@FacetConstraints(value=@FacetConstraint(value=JavaSourceFacet.class,type=REQUIRED)) public abstract class AbstractJavaSourceCommand<SOURCETYPE extends org.jboss.forge.roaster.model.source.JavaSource<?>> extends AbstractProjectCommand
| Constructor and Description |
|---|
AbstractJavaSourceCommand() |
| Modifier and Type | Method and Description |
|---|---|
protected String |
calculateDefaultPackage(UIContext context) |
SOURCETYPE |
decorateSource(UIExecutionContext context,
Project project,
SOURCETYPE source)
Override this method to do any necessary work to customize the generated
JavaResource. |
Result |
execute(UIExecutionContext context)
Called when the
UICommand should be executed. |
UICommandMetadata |
getMetadata(UIContext context) |
protected UIInput<String> |
getNamed() |
protected UIInput<Boolean> |
getOverwrite() |
protected ProjectFactory |
getProjectFactory()
Returns a reference to the
ProjectFactory. |
protected abstract Class<SOURCETYPE> |
getSourceType()
Get the
JavaSource type for which this command should create a new source file. |
protected UIInput<String> |
getTargetPackage() |
protected abstract String |
getType()
Get the type for which this command should create a new source file.
|
void |
initializeUI(UIBuilder builder)
Called before rendering the UI.
|
protected boolean |
isProjectRequired()
Implementations should return
true if a Project is required in order for this command to
execute. |
void |
validate(UIValidationContext validator)
Validate the current
UICommand. |
containsProject, getSelectedProject, getSelectedProject, isEnabledpublic void initializeUI(UIBuilder builder) throws Exception
UICommandInputComponent objects to be displayed in the provided
UIBuilderbuilder - The builder on which the UI should be built upon. Never nullException - if anything wrong happenspublic UICommandMetadata getMetadata(UIContext context)
getMetadata in interface UICommandgetMetadata in class AbstractUICommandcontext - the UIContext provided by the UI implementation, never nullprotected abstract String getType()
protected abstract Class<SOURCETYPE> getSourceType()
JavaSource type for which this command should create a new source file.public void validate(UIValidationContext validator)
UICommandUICommand.validate in interface UICommandvalidate in class AbstractUICommandpublic Result execute(UIExecutionContext context) throws Exception
UICommandUICommand should be executed.
This method should NEVER execute if UICommand.isEnabled(UIContext) returns false and
UICommand.validate(UIValidationContext) contains validation errorspublic SOURCETYPE decorateSource(UIExecutionContext context, Project project, SOURCETYPE source) throws Exception
JavaResource.Exceptionprotected boolean isProjectRequired()
AbstractProjectCommandtrue if a Project is required in order for this command to
execute. If false, this command will run without a Project selected in the current
UIContext. Returning true also enables the use of FacetConstraints on the
implementation Class declaration.isProjectRequired in class AbstractProjectCommandprotected ProjectFactory getProjectFactory()
AbstractProjectCommandProjectFactory.getProjectFactory in class AbstractProjectCommandCopyright © 2015 JBoss by Red Hat. All rights reserved.