public class ApplyPatternStandardHandler extends DefaultModuleCommandHandler
Registered as default command handler for "PatternApply" module command verb.
The run pattern will have access to the following parameters:
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COMMANDPARAM_PATTERN_NAME
Command parameter containing the name of the pattern to run.
|
static java.lang.String |
COMMANDPARAM_PATTERN_PATH
Command parameter containing the path of the pattern to run.
|
protected static java.lang.String |
PATTERNPARAM_MODULE
Pattern parameter name containing the current module.
|
protected static java.lang.String |
PATTERNPARAM_SEL
Pattern parameter name containing the selected element on which the pattern is run.
|
protected static java.lang.String |
PATTERNPARAM_SEL_NAME
Pattern parameter name containing the selected element name.
|
Constructor and Description |
---|
ApplyPatternStandardHandler() |
Modifier and Type | Method and Description |
---|---|
boolean |
accept(java.util.List<MObject> selectedElements,
IModule module)
The handler accepts elements matching at least one scope
|
void |
actionPerformed(java.util.List<MObject> selectedElements,
IModule module)
Method invoked when the command is launched.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
configure(java.util.List<MObject> selectedElements,
IModule module)
Configure the command before being executed.
|
protected void |
postConfigure(java.util.List<MObject> selectedElements,
IModule module)
Hook called once the pattern is applied and before the transaction is committed.
|
findStereotypeFromSpec, getParameter, getParameters, getScopes, initialize, isActiveFor
public static final java.lang.String COMMANDPARAM_PATTERN_PATH
The path must be relative to the module resources path.
public static final java.lang.String COMMANDPARAM_PATTERN_NAME
protected static final java.lang.String PATTERNPARAM_MODULE
protected static final java.lang.String PATTERNPARAM_SEL_NAME
protected static final java.lang.String PATTERNPARAM_SEL
public void actionPerformed(java.util.List<MObject> selectedElements, IModule module)
IModuleCommandHandler
This command is launched by Modelio when the user clicks on the contextual menu command. The selected elements that corresponds to the current selection are given as parameter.
The module that is passed as parameter corresponds to the owner of the command.
selectedElements
- Current selectionmodule
- Owner of the commandprotected java.util.Map<java.lang.String,java.lang.Object> configure(java.util.List<MObject> selectedElements, IModule module)
This method is a hook called by actionPerformed(List, IModule)
.
It returns the parameters the pattern will use.
By default copy all the command handler parameters and add the following ones:
selectedElements
- the current selection in Modeliomodule
- the module owning the command handler.protected void postConfigure(java.util.List<MObject> selectedElements, IModule module)
Does nothing by default. Sub classes may redefine this method to make additional modifications.
selectedElements
- the current selection in Modeliomodule
- the module owning the command handler.public boolean accept(java.util.List<MObject> selectedElements, IModule module)
DefaultModuleCommandHandler
accept
in interface IModuleCommandHandler
accept
in class DefaultModuleCommandHandler
selectedElements
- Current selectionmodule
- Owner of the command