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 {
@Description("Error given if login fails for some reason")
String GalleryLoginError();
@DefaultMessage("Projects with extensions cannot be published to the gallery.")
@Description("Error given if project contains extensions")
String HasExtensionError();
@DefaultMessage("Show Warnings")
@Description("Text on Toggle Warning Button")
String showWarnings();
......
......@@ -32,6 +32,10 @@ public class SendToGalleryAction implements Command {
ErrorReporter.reportInfo(MESSAGES.selectOnlyOneProject());
} else {
if (!lockPublishButton) {
if (Ode.getInstance().getCurrentYoungAndroidProjectRootNode().hasExtensions()) {
ErrorReporter.reportError(MESSAGES.HasExtensionError());
return;
}
lockPublishButton = true;
Project project = selectedProjects.get(0);
Ode.getInstance().getProjectService().sendToGallery(project.getProjectId(),
......
......@@ -625,7 +625,7 @@ public final class YaProjectEditor extends ProjectEditor implements ProjectChang
* To remove Component Files from the Project!
* @param componentTypes
*/
public void removeComponent(Map<String, String> componentTypes) {
public void removeComponent(Map<String, String> componentTypes) {
final Ode ode = Ode.getInstance();
final YoungAndroidComponentsFolder componentsFolder = ((YoungAndroidProjectNode) project.getRootNode()).getComponentsFolder();
Set<String> externalCompFolders = new HashSet<String>();
......
......@@ -35,6 +35,10 @@ public class SendToGalleryAction implements Command {
+ "Ignoring SendToGalleryAction.execute().");
return;
}
if (Ode.getInstance().getCurrentYoungAndroidProjectRootNode().hasExtensions()) {
ErrorReporter.reportError(MESSAGES.HasExtensionError());
return;
}
boolean shouldRun;
try {
shouldRun = before.call();
......
......@@ -175,7 +175,7 @@ public abstract class ProjectNode implements Serializable, IsSerializable {
*
* @return iterable
*/
public Iterable<ProjectNode> getChildren() {
public List<ProjectNode> getChildren() {
List<ProjectNode> result = children;
if (result == null) {
result = Collections.emptyList();
......@@ -264,4 +264,13 @@ public abstract class ProjectNode implements Serializable, IsSerializable {
public void setName(String 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
// Should never happen!
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