Skip to content

Commit

Permalink
FORGE-2562: Introduced changes in ProjectType
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed Dec 17, 2015
1 parent 7137bb3 commit 7a235b3
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package org.jboss.forge.addon.projects;

import org.jboss.forge.addon.ui.context.UIContext;
import org.jboss.forge.addon.ui.context.UINavigationContext;
import org.jboss.forge.addon.ui.result.NavigationResult;
import org.jboss.forge.addon.ui.result.Results;
import org.jboss.forge.addon.ui.wizard.UIWizardStep;

/**
Expand All @@ -17,10 +20,32 @@ public interface ProjectType
String getType();

/**
* Return the {@link UIWizardStep} {@link Class} that begins {@link Project} configuration of this
* Return the {@link UIWizardStep} {@link Class} that begins the {@link Project} configuration of this
* {@link ProjectType}.
*
*
* The default implementation returns <code>null</code>. Implementations are encouraged to override the
* {@link #getSetupFlow()} method instead.
*
*/
Class<? extends UIWizardStep> getSetupFlow();
default Class<? extends UIWizardStep> getSetupFlow()
{
return null;
}

/**
* Return the {@link NavigationResult} that begins {@link Project} configuration of this {@link ProjectType}.
*
* The default implementation calls <code>Results.navigateTo(getSetupFlow())</code>
*
* @param context the current {@link UINavigationContext}
*
* @return a {@link NavigationResult} with the next steps to follow
*/
default NavigationResult next(UINavigationContext context)
{
return Results.navigateTo(getSetupFlow());
}

/**
* Return all {@link ProjectFacet} {@link Class} types required by a {@link Project} of this {@link ProjectType}.
Expand All @@ -31,9 +56,12 @@ public interface ProjectType
* Defines the priority of this {@link ProjectType}. Lower values receive a higher priority.
*/
int priority();

/**
* Returns if this {@link ProjectType} is enabled in the current {@link UIContext}
* Returns if this {@link ProjectType} is enabled in the current {@link UIContext}
*/
boolean isEnabled(UIContext context);
default boolean isEnabled(UIContext context)
{
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ public NavigationResult next(UINavigationContext context) throws Exception
{
if (type.getValue() != null)
{
return Results.navigateTo(type.getValue().getSetupFlow());
return type.getValue().next(context);
}
else
{
Expand Down

0 comments on commit 7a235b3

Please sign in to comment.