1 package cz
.cvut
.promod
.services
.actionService
;
3 import cz
.cvut
.promod
.services
.Service
;
4 import cz
.cvut
.promod
.services
.actionService
.actionUtils
.ProModAction
;
7 * ProMod, master thesis project
8 * User: Petr Zverina, petr.zverina@gmail.com
9 * Date: 17:44:48, 10.10.2009
13 * ActionService interface is a base point for ProModAction handling. One is supposed to use methods defined in this
14 * interface for registering and obtaining actions.
16 * Using ModelerSession.getActionService() is possible to get proper implementation of this interface ready for use.
18 * All instances of ProModAction class (this class is defined as abstract, so all class that extend ProMod class and
19 * implement method actionPerformed(ActionEvent event)) are initially defined as disabled. This forces user to use this
20 * mechanism for action registration. But on the other hand, this is not very strong protection, so be careful with
21 * dealing with not registered actions.
23 public interface ActionService
extends Service
{
26 * Register a new ProModAction.
28 * @param notationIdentifier is a identifier of notation to that the action belongs
29 * @param moduleIdentifier is a identifier of module to that the action belongs
30 * @param actionIdentifier is the action identifier
31 * @param action is an instance of any class that extends ProModAction
33 * @return the reference to the action (so the same as in the action parameter), or a reference to the action
34 * that has the same actionIdentifier, notationIdentifier and moduleIdentifier and that has been registered before.
36 * One can use for example:
37 * MyProModAction myAction = new MyProModAction();
38 * ProModAction action = ModelerSession.getActionService().registerAction(...);
40 * if(myAction == action){ //my action has been registered }
41 * else {// my action was not registered because of action duplicity }
43 public ProModAction
registerAction(final String notationIdentifier
,
44 final String moduleIdentifier
,
45 final String actionIdentifier
,
46 final ProModAction action
51 * Register a new ProModAction. Just syntactical sugar supplement of the more complex method.
53 * @param notationIdentifier is a identifier of notation to that the action belongs
54 * @param actionIdentifier is the action identifier
55 * @param action is the action identifier
56 * @return the reference to the action (so the same as in the action parameter), or a reference to the action
57 * that has the same actionIdentifier, notationIdentifier and moduleIdentifier and that has been registered before.
59 public ProModAction
registerAction(final String notationIdentifier
,
60 final String actionIdentifier
,
61 final ProModAction action
66 * Finds a returns an instance of ProModAction that has been registered by the ActionService with
67 * the given notation identifier, given module identifier and given action identifier.
69 * @param notationIdentifier is the identifier of notation under that has been the action registered
70 * @param moduleIdentifier is the identifier of module under that has been the action registered
71 * @param actionIdentifier is the identifier of action
73 * @return the instance of action if such a action has been successfully registered, null otherwise
75 public ProModAction
getAction(final String notationIdentifier
,
76 final String moduleIdentifier
,
77 final String actionIdentifier
82 * Finds a returns an instance of ProModAction that has been registered by the ActionService with
83 * the given notation identifier and given action identifier.
85 * @param notationIdentifier is the identifier of notation under that has been the action registered
86 * @param actionIdentifier is the identifier of action
88 * @return the instance of action if such a action has been successfully registered, null otherwise
90 public ProModAction
getAction(final String notationIdentifier
,
91 final String actionIdentifier
95 * Checks whether the action given as a parameter is any already registered action by any plugin or
98 * @param action is the action to be checked
99 * @return true if the actions has already been registered, false otherwise
101 public boolean isRegisteredAction(final ProModAction action
);