public abstract class DefaultModuleCommandHandler extends java.lang.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(java.util.List<MObject> selectedElements,
IModule module)
The handler accepts elements matching at least one scope
|
Stereotype |
findStereotypeFromSpec(IModule module,
MClass metaclass,
java.lang.String stereotypeSpec)
Find the stereotype from a stereotype specification.
|
java.lang.String |
getParameter(java.lang.String key)
get a parameter value.
|
java.util.Map<java.lang.String,java.lang.String> |
getParameters() |
java.util.List<ElementScope> |
getScopes() |
void |
initialize(java.util.List<ElementScope> scopes,
java.util.Map<java.lang.String,java.lang.String> hParameters)
This method is called right after the constructor to initialize scopes and parameters for the handler.
|
boolean |
isActiveFor(java.util.List<MObject> selectedElements,
IModule module)
The handler is active by default.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
actionPerformed
public boolean accept(java.util.List<MObject> selectedElements, IModule module)
accept
in interface IModuleCommandHandler
selectedElements
- Current selectionmodule
- Owner of the commandpublic boolean isActiveFor(java.util.List<MObject> selectedElements, IModule module)
isActiveFor
in interface IModuleCommandHandler
selectedElements
- Current selectionmodule
- Owner of the commandpublic void initialize(java.util.List<ElementScope> scopes, java.util.Map<java.lang.String,java.lang.String> hParameters)
IModuleCommandHandler
initialize
in interface IModuleCommandHandler
public java.lang.String getParameter(java.lang.String key)
key
- a parameter keypublic final Stereotype findStereotypeFromSpec(IModule module, MClass metaclass, java.lang.String stereotypeSpec)
The stereotype specification may have one of the following formats:
module
- the modulemetaclass
- the metaclass to look fromstereotypeSpec
- the stereotype specificationpublic java.util.Map<java.lang.String,java.lang.String> getParameters()
getParameters
in interface IModuleCommandHandler
public java.util.List<ElementScope> getScopes()
getScopes
in interface IModuleCommandHandler