Skip to content

Commit

Permalink
FORGE-1479: AddConstraint now calls setup before running
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed Feb 14, 2014
1 parent 9d54b0a commit 1a1013c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -398,10 +398,6 @@ public List<Class<? extends UICommand>> getSetupSteps(UIContext context)
{
setup.add(JPASetupWizard.class);
}
else if (project.getFacet(JPAFacet.class).getAllEntities().isEmpty())
{
setup.add(NewEntityCommand.class);
}
return setup;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@

import org.jboss.forge.addon.javaee.ui.AbstractJavaEECommand;
import org.jboss.forge.addon.javaee.validation.ValidationFacet;
import org.jboss.forge.addon.javaee.validation.ui.setup.ValidationProviderSetupCommand;
import org.jboss.forge.addon.parser.java.facets.JavaSourceFacet;
import org.jboss.forge.addon.parser.java.resources.JavaResource;
import org.jboss.forge.addon.parser.java.resources.JavaResourceVisitor;
import org.jboss.forge.addon.projects.Project;
import org.jboss.forge.addon.resource.FileResource;
import org.jboss.forge.addon.resource.visit.VisitContext;
import org.jboss.forge.addon.ui.command.UICommand;
import org.jboss.forge.addon.ui.context.UIBuilder;
import org.jboss.forge.addon.ui.context.UIContext;
import org.jboss.forge.addon.ui.context.UIExecutionContext;
Expand Down Expand Up @@ -115,15 +117,21 @@ public NavigationResult next(UINavigationContext context) throws Exception
}

@Override
public boolean isEnabled(UIContext context)
protected boolean isProjectRequired()
{
return super.isEnabled(context) && getSelectedProject(context).hasFacet(ValidationFacet.class);
return true;
}

@Override
protected boolean isProjectRequired()
public List<Class<? extends UICommand>> getSetupSteps(UIContext context)
{
return true;
List<Class<? extends UICommand>> setup = new ArrayList<>();
Project project = getSelectedProject(context);
if (!project.hasFacet(ValidationFacet.class))
{
setup.add(ValidationProviderSetupCommand.class);
}
return setup;
}

}

0 comments on commit 1a1013c

Please sign in to comment.