public abstract class DefaultModuleCommandHandler extends Object implements IModuleCommandHandler
IModuleCommandHandler
interface.
This default implementation may be inherited by the module developers in order to simplify the code writing of a contextual command.
Constructor and Description |
---|
DefaultModuleCommandHandler() |
Modifier and Type | Method and Description |
---|---|
boolean |
accept(List<MObject> selectedElements,
IModule module)
The handler accepts elements matching the scopes
|
Stereotype |
findStereotypeFromSpec(IModule module,
MClass metaclass,
String stereotypeSpec)
Find the stereotype from a stereotype specification.
|
String |
getParameter(String key)
get a parameter value.
|
Map<String,String> |
getParameters() |
List<ElementScope> |
getScopes() |
void |
initialize(List<ElementScope> scopes,
Map<String,String> hParameters)
This method is called right after the constructor to initialize scopes and parameters for the handler.
|
boolean |
isActiveFor(List<MObject> selectedElements,
IModule module)
The handler is active by default.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
actionPerformed
public Map<String,String> getParameters()
getParameters
in interface IModuleCommandHandler
public List<ElementScope> getScopes()
getScopes
in interface IModuleCommandHandler
public boolean accept(List<MObject> selectedElements, IModule module)
accept
in interface IModuleCommandHandler
selectedElements
- Current selectionmodule
- Owner of the commandpublic boolean isActiveFor(List<MObject> selectedElements, IModule module)
isActiveFor
in interface IModuleCommandHandler
selectedElements
- Current selectionmodule
- Owner of the commandpublic void initialize(List<ElementScope> scopes, Map<String,String> hParameters)
IModuleCommandHandler
initialize
in interface IModuleCommandHandler
public String getParameter(String key)
key
- a parameter keypublic final Stereotype findStereotypeFromSpec(IModule module, MClass metaclass, String stereotypeSpec)
The stereotype specification may have one of the following formats:
module
- the modulemetaclass
- the metaclass to look fromstereotypeSpec
- the stereotype specification