Unverified Commit 73d1e23e authored by Arya Anand's avatar Arya Anand Committed by GitHub

Provide error message regarding extensions for the gallery (#2864)

parent 001fa913
...@@ -97,6 +97,10 @@ public interface OdeMessages extends Messages, AutogeneratedOdeMessages { ...@@ -97,6 +97,10 @@ public interface OdeMessages extends Messages, AutogeneratedOdeMessages {
@Description("Error given if login fails for some reason") @Description("Error given if login fails for some reason")
String GalleryLoginError(); String GalleryLoginError();
@DefaultMessage("Projects with extensions cannot be published to the gallery.")
@Description("Error given if project contains extensions")
String HasExtensionError();
@DefaultMessage("Show Warnings") @DefaultMessage("Show Warnings")
@Description("Text on Toggle Warning Button") @Description("Text on Toggle Warning Button")
String showWarnings(); String showWarnings();
......
...@@ -32,6 +32,10 @@ public class SendToGalleryAction implements Command { ...@@ -32,6 +32,10 @@ public class SendToGalleryAction implements Command {
ErrorReporter.reportInfo(MESSAGES.selectOnlyOneProject()); ErrorReporter.reportInfo(MESSAGES.selectOnlyOneProject());
} else { } else {
if (!lockPublishButton) { if (!lockPublishButton) {
if (Ode.getInstance().getCurrentYoungAndroidProjectRootNode().hasExtensions()) {
ErrorReporter.reportError(MESSAGES.HasExtensionError());
return;
}
lockPublishButton = true; lockPublishButton = true;
Project project = selectedProjects.get(0); Project project = selectedProjects.get(0);
Ode.getInstance().getProjectService().sendToGallery(project.getProjectId(), Ode.getInstance().getProjectService().sendToGallery(project.getProjectId(),
......
...@@ -625,7 +625,7 @@ public final class YaProjectEditor extends ProjectEditor implements ProjectChang ...@@ -625,7 +625,7 @@ public final class YaProjectEditor extends ProjectEditor implements ProjectChang
* To remove Component Files from the Project! * To remove Component Files from the Project!
* @param componentTypes * @param componentTypes
*/ */
public void removeComponent(Map<String, String> componentTypes) { public void removeComponent(Map<String, String> componentTypes) {
final Ode ode = Ode.getInstance(); final Ode ode = Ode.getInstance();
final YoungAndroidComponentsFolder componentsFolder = ((YoungAndroidProjectNode) project.getRootNode()).getComponentsFolder(); final YoungAndroidComponentsFolder componentsFolder = ((YoungAndroidProjectNode) project.getRootNode()).getComponentsFolder();
Set<String> externalCompFolders = new HashSet<String>(); Set<String> externalCompFolders = new HashSet<String>();
......
...@@ -35,6 +35,10 @@ public class SendToGalleryAction implements Command { ...@@ -35,6 +35,10 @@ public class SendToGalleryAction implements Command {
+ "Ignoring SendToGalleryAction.execute()."); + "Ignoring SendToGalleryAction.execute().");
return; return;
} }
if (Ode.getInstance().getCurrentYoungAndroidProjectRootNode().hasExtensions()) {
ErrorReporter.reportError(MESSAGES.HasExtensionError());
return;
}
boolean shouldRun; boolean shouldRun;
try { try {
shouldRun = before.call(); shouldRun = before.call();
......
...@@ -175,7 +175,7 @@ public abstract class ProjectNode implements Serializable, IsSerializable { ...@@ -175,7 +175,7 @@ public abstract class ProjectNode implements Serializable, IsSerializable {
* *
* @return iterable * @return iterable
*/ */
public Iterable<ProjectNode> getChildren() { public List<ProjectNode> getChildren() {
List<ProjectNode> result = children; List<ProjectNode> result = children;
if (result == null) { if (result == null) {
result = Collections.emptyList(); result = Collections.emptyList();
...@@ -264,4 +264,13 @@ public abstract class ProjectNode implements Serializable, IsSerializable { ...@@ -264,4 +264,13 @@ public abstract class ProjectNode implements Serializable, IsSerializable {
public void setName(String newName) { public void setName(String newName) {
name = newName; name = newName;
} }
/**
* Checks if project has extension or not.
*
* @return boolean;
*/
public boolean hasExtensions() {
return false;
}
} }
...@@ -100,5 +100,12 @@ public final class YoungAndroidProjectNode extends ProjectRootNode ...@@ -100,5 +100,12 @@ public final class YoungAndroidProjectNode extends ProjectRootNode
// Should never happen! // Should never happen!
throw new IllegalStateException("Couldn't find component folder"); throw new IllegalStateException("Couldn't find component folder");
} }
@Override
public boolean hasExtensions() {
if (getComponentsFolder().getChildren().size() > 0) {
return true;
}
return false;
}
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment