Revision 332

View differences:

branches/modelio3/src/main/java/com/modeliosoft/modelio/sysml/impl/SysMLModule.java.bak
1
package com.modeliosoft.modelio.sysml.impl;
2

  
3
import org.eclipse.swt.graphics.Image;
4
import org.eclipse.swt.widgets.Display;
5
import org.modelio.api.diagram.ContributorCategory;
6
import org.modelio.api.model.IMetamodelExtensions;
7
import org.modelio.api.model.IModelingSession;
8
import org.modelio.api.modelio.Modelio;
9
import org.modelio.api.module.AbstractJavaModule;
10
import org.modelio.api.module.IModuleAPIConfiguration;
11
import org.modelio.api.module.IModuleSession;
12
import org.modelio.api.module.IModuleUserConfiguration;
13
import org.modelio.api.module.IParameterEditionModel;
14
import org.modelio.api.module.commands.ActionLocation;
15
import org.modelio.api.module.commands.DefaultModuleAction;
16
import org.modelio.api.module.commands.IModuleAction;
17
import org.modelio.api.module.commands.IModuleContextualCommand;
18
import org.modelio.api.module.paramEdition.ParametersEditionModel;
19
import org.modelio.gproject.ramc.core.model.IModelComponent;
20
import org.modelio.gproject.ramc.core.packaging.IModelComponentContributor;
21
import org.modelio.metamodel.Metamodel;
22
import org.modelio.metamodel.diagrams.ActivityDiagram;
23
import org.modelio.metamodel.diagrams.SequenceDiagram;
24
import org.modelio.metamodel.diagrams.StateMachineDiagram;
25
import org.modelio.metamodel.diagrams.StaticDiagram;
26
import org.modelio.metamodel.diagrams.UseCaseDiagram;
27
import org.modelio.metamodel.mda.ModuleComponent;
28
import org.modelio.metamodel.uml.behavior.activityModel.Activity;
29
import org.modelio.metamodel.uml.behavior.activityModel.ActivityParameterNode;
30
import org.modelio.metamodel.uml.behavior.activityModel.ControlFlow;
31
import org.modelio.metamodel.uml.behavior.commonBehaviors.Signal;
32
import org.modelio.metamodel.uml.informationFlow.InformationFlow;
33
import org.modelio.metamodel.uml.infrastructure.Dependency;
34
import org.modelio.metamodel.uml.infrastructure.Note;
35
import org.modelio.metamodel.uml.statik.Artifact;
36
import org.modelio.metamodel.uml.statik.Association;
37
import org.modelio.metamodel.uml.statik.AssociationEnd;
38
import org.modelio.metamodel.uml.statik.Attribute;
39
import org.modelio.metamodel.uml.statik.BindableInstance;
40
import org.modelio.metamodel.uml.statik.Class;
41
import org.modelio.metamodel.uml.statik.Classifier;
42
import org.modelio.metamodel.uml.statik.Component;
43
import org.modelio.metamodel.uml.statik.Connector;
44
import org.modelio.metamodel.uml.statik.ConnectorEnd;
45
import org.modelio.metamodel.uml.statik.DataType;
46
import org.modelio.metamodel.uml.statik.Enumeration;
47
import org.modelio.metamodel.uml.statik.Generalization;
48
import org.modelio.metamodel.uml.statik.Instance;
49
import org.modelio.metamodel.uml.statik.Interface;
50
import org.modelio.metamodel.uml.statik.NameSpace;
51
import org.modelio.metamodel.uml.statik.Node;
52
import org.modelio.metamodel.uml.statik.Operation;
53
import org.modelio.metamodel.uml.statik.Package;
54
import org.modelio.metamodel.uml.statik.Port;
55

  
56
import com.modeliosoft.modelio.sysml.api.SysMLStereotypes;
57
import com.modeliosoft.modelio.sysml.commands.diagram.AllocateDependencyDiagramCommand;
58
import com.modeliosoft.modelio.sysml.commands.diagram.BindingConnectorDiagramCommand;
59
import com.modeliosoft.modelio.sysml.commands.diagram.BlockDiagramCommand;
60
import com.modeliosoft.modelio.sysml.commands.diagram.ConformDependencyDiagramCommand;
61
import com.modeliosoft.modelio.sysml.commands.diagram.ConnectorPropertyDiagramCommand;
62
import com.modeliosoft.modelio.sysml.commands.diagram.ConstraintBlockDiagramCommand;
63
import com.modeliosoft.modelio.sysml.commands.diagram.ConstraintPropertyDiagramCommand;
64
import com.modeliosoft.modelio.sysml.commands.diagram.ContinuousEdgeDiagramCommand;
65
import com.modeliosoft.modelio.sysml.commands.diagram.ContinuousParameterDiagramCommand;
66
import com.modeliosoft.modelio.sysml.commands.diagram.CopyDependencyDiagramCommand;
67
import com.modeliosoft.modelio.sysml.commands.diagram.DiscreteEdgeDiagramCommand;
68
import com.modeliosoft.modelio.sysml.commands.diagram.DiscreteParameterDiagramCommand;
69
import com.modeliosoft.modelio.sysml.commands.diagram.DistributedPropertyDiagramCommand;
70
import com.modeliosoft.modelio.sysml.commands.diagram.FlowPortDiagramCommand;
71
import com.modeliosoft.modelio.sysml.commands.diagram.FlowPropertyDiagramCommand;
72
import com.modeliosoft.modelio.sysml.commands.diagram.FlowSpecificationDiagramCommand;
73
import com.modeliosoft.modelio.sysml.commands.diagram.ItemFlowDiagramCommand;
74
import com.modeliosoft.modelio.sysml.commands.diagram.OptionalDiagramCommand;
75
import com.modeliosoft.modelio.sysml.commands.diagram.PartDependencyDiagramCommand;
76
import com.modeliosoft.modelio.sysml.commands.diagram.ParticipantPropertyDiagramCommand;
77
import com.modeliosoft.modelio.sysml.commands.diagram.ProbabilityDiagramCommand;
78
import com.modeliosoft.modelio.sysml.commands.diagram.ProblemNoteDiagramCommand;
79
import com.modeliosoft.modelio.sysml.commands.diagram.QuantityKindDiagramCommand;
80
import com.modeliosoft.modelio.sysml.commands.diagram.RateEdgeDiagramCommand;
81
import com.modeliosoft.modelio.sysml.commands.diagram.RateParameterDiagramCommand;
82
import com.modeliosoft.modelio.sysml.commands.diagram.RationaleNoteDiagramCommand;
83
import com.modeliosoft.modelio.sysml.commands.diagram.ReferenceDiagramCommand;
84
import com.modeliosoft.modelio.sysml.commands.diagram.RefineDependencyDiagramCommand;
85
import com.modeliosoft.modelio.sysml.commands.diagram.SatisfyDependencyDiagramCommand;
86
import com.modeliosoft.modelio.sysml.commands.diagram.TraceDependencyDiagramCommand;
87
import com.modeliosoft.modelio.sysml.commands.diagram.UMLAggregationDiagramCommand;
88
import com.modeliosoft.modelio.sysml.commands.diagram.UMLAssociationDiagramCommand;
89
import com.modeliosoft.modelio.sysml.commands.diagram.UMLCompositionDiagramCommand;
90
import com.modeliosoft.modelio.sysml.commands.diagram.UMLGeneralizationDiagramCommand;
91
import com.modeliosoft.modelio.sysml.commands.diagram.UMLGeneralizationInterfaceRealizationDiagramCommand;
92
import com.modeliosoft.modelio.sysml.commands.diagram.UMLOperationDiagramCommand;
93
import com.modeliosoft.modelio.sysml.commands.diagram.UnitDiagramCommand;
94
import com.modeliosoft.modelio.sysml.commands.diagram.ValueTypeDiagramCommand;
95
import com.modeliosoft.modelio.sysml.commands.diagram.VerifyDependencyDiagramCommand;
96
import com.modeliosoft.modelio.sysml.commands.diagram.ViewDiagramCommand;
97
import com.modeliosoft.modelio.sysml.commands.diagram.ViewpointDiagramCommand;
98
import com.modeliosoft.modelio.sysml.commands.explorer.ActivityExplorerCommand;
99
import com.modeliosoft.modelio.sysml.commands.explorer.ActorExplorerCommand;
100
import com.modeliosoft.modelio.sysml.commands.explorer.BlockExplorerCommand;
101
import com.modeliosoft.modelio.sysml.commands.explorer.ConnectorPropertyExplorerCommand;
102
import com.modeliosoft.modelio.sysml.commands.explorer.ConstraintBlockExplorerCommand;
103
import com.modeliosoft.modelio.sysml.commands.explorer.ConstraintPropertyExplorerCommand;
104
import com.modeliosoft.modelio.sysml.commands.explorer.ContinuousExplorerCommand;
105
import com.modeliosoft.modelio.sysml.commands.explorer.DiscreteExplorerCommand;
106
import com.modeliosoft.modelio.sysml.commands.explorer.DistributedPropertyExplorerCommand;
107
import com.modeliosoft.modelio.sysml.commands.explorer.EnumerationExplorerCommand;
108
import com.modeliosoft.modelio.sysml.commands.explorer.EnumerationLiteralExplorerCommand;
109
import com.modeliosoft.modelio.sysml.commands.explorer.FlowPortExplorerCommand;
110
import com.modeliosoft.modelio.sysml.commands.explorer.FlowPropertyExplorerCommand;
111
import com.modeliosoft.modelio.sysml.commands.explorer.FlowSpecificationExplorerCommand;
112
import com.modeliosoft.modelio.sysml.commands.explorer.InteractionExplorerCommand;
113
import com.modeliosoft.modelio.sysml.commands.explorer.OperationExplorerCommand;
114
import com.modeliosoft.modelio.sysml.commands.explorer.OptionalExplorerCommand;
115
import com.modeliosoft.modelio.sysml.commands.explorer.ParameterExplorerCommand;
116
import com.modeliosoft.modelio.sysml.commands.explorer.PartExplorerCommand;
117
import com.modeliosoft.modelio.sysml.commands.explorer.ParticipantPropertyExplorerCommand;
118
import com.modeliosoft.modelio.sysml.commands.explorer.PortExplorerCommand;
119
import com.modeliosoft.modelio.sysml.commands.explorer.QuantityKindExplorerCommand;
120
import com.modeliosoft.modelio.sysml.commands.explorer.RateExplorerCommand;
121
import com.modeliosoft.modelio.sysml.commands.explorer.ReferenceExplorerCommand;
122
import com.modeliosoft.modelio.sysml.commands.explorer.ReturnParameterExplorerCommand;
123
import com.modeliosoft.modelio.sysml.commands.explorer.StateMachineExplorerCommand;
124
import com.modeliosoft.modelio.sysml.commands.explorer.UnitExplorerCommand;
125
import com.modeliosoft.modelio.sysml.commands.explorer.UseCaseExplorerCommand;
126
import com.modeliosoft.modelio.sysml.commands.explorer.ValueTypeExplorerCommand;
127
import com.modeliosoft.modelio.sysml.commands.explorer.ViewExplorerCommand;
128
import com.modeliosoft.modelio.sysml.commands.explorer.ViewpointExplorerCommand;
129
import com.modeliosoft.modelio.sysml.commands.explorer.diagram.command.BlockDiagramContributor;
130
import com.modeliosoft.modelio.sysml.commands.explorer.diagram.command.InternalBlockDiagramContributor;
131
import com.modeliosoft.modelio.sysml.commands.explorer.diagram.command.PackageDiagramContributor;
132
import com.modeliosoft.modelio.sysml.commands.explorer.diagram.command.ParametricDiagramContributor;
133
import com.modeliosoft.modelio.sysml.commands.explorer.diagram.command.SysMLActivityDiagramContributor;
134
import com.modeliosoft.modelio.sysml.commands.explorer.diagram.command.SysMLRequirementDiagramContributor;
135
import com.modeliosoft.modelio.sysml.commands.explorer.diagram.command.SysMLSequenceDiagramContributor;
136
import com.modeliosoft.modelio.sysml.commands.explorer.diagram.command.SysMLStateMachineDiagramContributor;
137
import com.modeliosoft.modelio.sysml.commands.explorer.diagram.command.SysMLUseCaseDiagramContributor;
138
import com.modeliosoft.modelio.sysml.commands.explorer.diagram.support.DiagramContributions;
139
import com.modeliosoft.modelio.sysml.customizer.BlockDiagramCustomizer;
140
import com.modeliosoft.modelio.sysml.customizer.InternalBlockDiagramCustomizer;
141
import com.modeliosoft.modelio.sysml.customizer.PackageDiagramCustomizer;
142
import com.modeliosoft.modelio.sysml.customizer.ParametricDiagramCustomizer;
143
import com.modeliosoft.modelio.sysml.customizer.SysMLActivityDiagramCustomizer;
144
import com.modeliosoft.modelio.sysml.customizer.SysMLRequirementDiagramCustomizer;
145
import com.modeliosoft.modelio.sysml.customizer.SysMLSequenceDiagramCustomizer;
146
import com.modeliosoft.modelio.sysml.customizer.SysMLStateMachineDiagramCustomizer;
147
import com.modeliosoft.modelio.sysml.customizer.SysMLUseCaseDiagramCustomizer;
148
import com.modeliosoft.modelio.sysml.i18n.I18nMessageService;
149
import com.modeliosoft.modelio.sysml.utils.ISysMLCustomizerPredefinedField;
150
import com.modeliosoft.modelio.sysml.utils.SysMLResourcesManager;
151

  
152
/**
153
 * This is the main class of the SysML module
154
 * 
155
 * @author ebrosse
156
 * 
157
 */
158
public class SysMLModule extends AbstractJavaModule {
159

  
160
    public static final String MODULE_NAME = "SysMLArchitect";
161

  
162
    private SysMLPeerModule peerMdac = null;
163

  
164
    private SysMLSession session = null;
165

  
166
    public static SysMLLogService logService;
167

  
168
    private DiagramContributions contributions;
169

  
170
    /**
171
     * Builds a new module. This constructor must not be called by the user. It is automatically invoked by Modelio when the module
172
     * is installed, selected or started.
173
     * 
174
     * @param modelingSession
175
     *            : the current modeling session
176
     * @param module
177
     *            : the SysML module
178
     * @param configuration
179
     *            : the SysML configuration
180
     */
181

  
182
    public SysMLModule(IModelingSession modelingSession, ModuleComponent moduleComponent,
183
            IModuleUserConfiguration mdacConfiguration, IModuleAPIConfiguration peerConfiguration) {
184
        super(modelingSession, moduleComponent, mdacConfiguration);
185
        this.session = new SysMLSession(this);
186
        this.peerMdac = new SysMLPeerModule(this, peerConfiguration);
187
        SysMLModule.logService = new SysMLLogService(Modelio.getInstance().getLogService(), this);
188
        this.peerMdac.init();
189

  
190
    }
191

  
192
    @Override
193
    public SysMLPeerModule getPeerModule() {
194
        return this.peerMdac;
195
    }
196

  
197
    @Override
198
    public IModuleSession getSession() {
199
        return this.session;
200
    }
201

  
202
    /**
203
     * Method automatically called just after the creation of the module. The module is automatically instanciated at the beginning
204
     * of the MDA lifecycle and constructor implementation is not accessible to the module developer. The <code>init</code> method
205
     * allows the developer to execute the desired initialization.
206
     */
207
    @Override
208
    public void init() {
209
        // Add the module initialization code
210
        logService.info(I18nMessageService.getString("Mdac.Gui.Init"));
211

  
212
        SysMLResourcesManager.getInstance().setJMDAC(this);
213

  
214
        IMetamodelExtensions extensions = Modelio.getInstance().getModelingSession().getMetamodelExtensions();
215

  
216
        // Define diagram tools
217
        SysMLResourcesManager.getInstance().setJMDAC(this);
218
        registerCustomizedTool(ISysMLCustomizerPredefinedField.Allocate, Dependency.class, null, null,
219
                new AllocateDependencyDiagramCommand());
220
        registerCustomizedTool(ISysMLCustomizerPredefinedField.Block, Class.class, null, null, new BlockDiagramCommand());
221
        registerCustomizedTool(ISysMLCustomizerPredefinedField.BindingConnector, ConnectorEnd.class, null, null,
222
                new BindingConnectorDiagramCommand());
223
        registerCustomizedTool(ISysMLCustomizerPredefinedField.Conform, Dependency.class, null, null,
224
                new ConformDependencyDiagramCommand());
225
        registerCustomizedTool(ISysMLCustomizerPredefinedField.ConnectorProperty, BindableInstance.class, null, null,
226
                new ConnectorPropertyDiagramCommand());
227
        registerCustomizedTool(ISysMLCustomizerPredefinedField.ConstraintBlock, Class.class, null, null,
228
                new ConstraintBlockDiagramCommand());
229
        registerCustomizedTool(ISysMLCustomizerPredefinedField.ConstraintProperty, BindableInstance.class, null, null,
230
                new ConstraintPropertyDiagramCommand());
231
        registerCustomizedTool(ISysMLCustomizerPredefinedField.ContinuousActivityEdge, ControlFlow.class, null, null,
232
                new ContinuousEdgeDiagramCommand());
233
        registerCustomizedTool(ISysMLCustomizerPredefinedField.ContinuousParameter, ActivityParameterNode.class, null, "OwnedNode",
234
                new ContinuousParameterDiagramCommand());
235
        registerCustomizedTool(ISysMLCustomizerPredefinedField.Copy, Dependency.class, null, null,
236
                new CopyDependencyDiagramCommand());
237
        registerCustomizedTool(ISysMLCustomizerPredefinedField.DiscreteActivityEdge, ControlFlow.class, null, null,
238
                new DiscreteEdgeDiagramCommand());
239
        registerCustomizedTool(ISysMLCustomizerPredefinedField.DiscreteParameter, ActivityParameterNode.class, null, "OwnedNode",
240
                new DiscreteParameterDiagramCommand());
241
        registerCustomizedTool(ISysMLCustomizerPredefinedField.DistributedProperty, Attribute.class, null, null,
242
                new DistributedPropertyDiagramCommand());
243
        registerCustomizedTool(ISysMLCustomizerPredefinedField.FlowPort, Port.class, null, null, new FlowPortDiagramCommand());
244
        registerCustomizedTool(ISysMLCustomizerPredefinedField.FlowProperty, Attribute.class, null, null,
245
                new FlowPropertyDiagramCommand());
246
        registerCustomizedTool(ISysMLCustomizerPredefinedField.FlowSpecification, Interface.class, null, null,
247
                new FlowSpecificationDiagramCommand());
248
        registerCustomizedTool(ISysMLCustomizerPredefinedField.ItemFlow, InformationFlow.class, null, null,
249
                new ItemFlowDiagramCommand());
250
        registerCustomizedTool(ISysMLCustomizerPredefinedField.Optional, ActivityParameterNode.class, null, "OwnedNode",
251
                new OptionalDiagramCommand());
252
        registerCustomizedTool(ISysMLCustomizerPredefinedField.Part, Dependency.class, null, null,
253
                new PartDependencyDiagramCommand());
254
        registerCustomizedTool(ISysMLCustomizerPredefinedField.ParticipantPropertyBindableInstance, BindableInstance.class, null,
255
                null, new ParticipantPropertyDiagramCommand());
256
        registerCustomizedTool(ISysMLCustomizerPredefinedField.Probability, ControlFlow.class, null, null,
257
                new ProbabilityDiagramCommand());
258
        registerCustomizedTool(ISysMLCustomizerPredefinedField.Problem, Note.class, null, null, new ProblemNoteDiagramCommand());
259
        registerCustomizedTool(ISysMLCustomizerPredefinedField.QuantityKind, Instance.class, null, null,
260
                new QuantityKindDiagramCommand());
261
        registerCustomizedTool(ISysMLCustomizerPredefinedField.RateActivityEdge, ControlFlow.class, null, null,
262
                new RateEdgeDiagramCommand());
263
        registerCustomizedTool(ISysMLCustomizerPredefinedField.RateParameter, ActivityParameterNode.class, null, "OwnedNode",
264
                new RateParameterDiagramCommand());
265
        registerCustomizedTool(ISysMLCustomizerPredefinedField.Rationale, Note.class, null, null, new RationaleNoteDiagramCommand());
266
        registerCustomizedTool(ISysMLCustomizerPredefinedField.Refine, Dependency.class, null, null,
267
                new RefineDependencyDiagramCommand());
268
        registerCustomizedTool(ISysMLCustomizerPredefinedField.Satisfy, Dependency.class, null, null,
269
                new SatisfyDependencyDiagramCommand());
270
        registerCustomizedTool(ISysMLCustomizerPredefinedField.Trace, Dependency.class, null, null,
271
                new TraceDependencyDiagramCommand());
272
        registerCustomizedTool(ISysMLCustomizerPredefinedField.Unit, Instance.class, null, null, new UnitDiagramCommand());
273
        registerCustomizedTool(ISysMLCustomizerPredefinedField.ValueType, DataType.class, null, null, new ValueTypeDiagramCommand());
274
        registerCustomizedTool(ISysMLCustomizerPredefinedField.Verify, Dependency.class, null, null,
275
                new VerifyDependencyDiagramCommand());
276
        registerCustomizedTool(ISysMLCustomizerPredefinedField.View, Package.class, null, null, new ViewDiagramCommand());
277
        registerCustomizedTool(ISysMLCustomizerPredefinedField.ViewPoint, Class.class, null, null, new ViewpointDiagramCommand());
278
        registerCustomizedTool(ISysMLCustomizerPredefinedField.UMLAggregation, AssociationEnd.class, null, null,
279
                new UMLAggregationDiagramCommand());
280
        registerCustomizedTool(ISysMLCustomizerPredefinedField.UMLAssociation, AssociationEnd.class, null, null,
281
                new UMLAssociationDiagramCommand());
282
        registerCustomizedTool(ISysMLCustomizerPredefinedField.UMLAttribute, Attribute.class, null, null,
283
                new ReferenceDiagramCommand());
284
        registerCustomizedTool(ISysMLCustomizerPredefinedField.UMLComposition, AssociationEnd.class, null, null,
285
                new UMLCompositionDiagramCommand());
286
        registerCustomizedTool(ISysMLCustomizerPredefinedField.UMLGeneralization, Generalization.class, null, null,
287
                new UMLGeneralizationDiagramCommand());
288
        registerCustomizedTool(ISysMLCustomizerPredefinedField.UMLOperation, Operation.class, null, null,
289
                new UMLOperationDiagramCommand());
290
        registerCustomizedTool(ISysMLCustomizerPredefinedField.UMLSmartGeneralization, Dependency.class, null, null,
291
                new UMLGeneralizationInterfaceRealizationDiagramCommand());
292

  
293
        // Define diagram customizations
294

  
295
        registerDiagramCustomization(
296
                extensions.getStereotype(MODULE_NAME, SysMLStereotypes.BLOCKDIAGRAM, Metamodel.getMClass(StaticDiagram.class)),
297
                StaticDiagram.class, new BlockDiagramCustomizer());
298
        registerDiagramCustomization(
299
                extensions.getStereotype(MODULE_NAME, SysMLStereotypes.INTERNALBLOCKDIAGRAM,
300
                        Metamodel.getMClass(StaticDiagram.class)), StaticDiagram.class, new InternalBlockDiagramCustomizer());
301
        registerDiagramCustomization(
302
                extensions.getStereotype(MODULE_NAME, SysMLStereotypes.PARAMETRICDIAGRAM, Metamodel.getMClass(StaticDiagram.class)),
303
                StaticDiagram.class, new ParametricDiagramCustomizer());
304
        registerDiagramCustomization(
305
                extensions.getStereotype(MODULE_NAME, SysMLStereotypes.SYSMLACTIVITYDIAGRAM,
306
                        Metamodel.getMClass(ActivityDiagram.class)), ActivityDiagram.class, new SysMLActivityDiagramCustomizer());
307
        registerDiagramCustomization(
308
                extensions.getStereotype(MODULE_NAME, SysMLStereotypes.SYSMLREQUIREMENTDIAGRAM,
309
                        Metamodel.getMClass(StaticDiagram.class)), StaticDiagram.class, new SysMLRequirementDiagramCustomizer());
310
        registerDiagramCustomization(
311
                extensions.getStereotype(MODULE_NAME, SysMLStereotypes.PACKAGEDIAGRAM, Metamodel.getMClass(StaticDiagram.class)),
312
                StaticDiagram.class, new PackageDiagramCustomizer());
313
        registerDiagramCustomization(
314
                extensions.getStereotype(MODULE_NAME, SysMLStereotypes.SYSMLSTATEMACHINEDIAGRAM,
315
                        Metamodel.getMClass(StateMachineDiagram.class)), StateMachineDiagram.class,
316
                new SysMLStateMachineDiagramCustomizer());
317
        registerDiagramCustomization(
318
                extensions.getStereotype(MODULE_NAME, SysMLStereotypes.SYSMLUSECASEDIAGRAM,
319
                        Metamodel.getMClass(UseCaseDiagram.class)), UseCaseDiagram.class, new SysMLUseCaseDiagramCustomizer());
320
        registerDiagramCustomization(
321
                extensions.getStereotype(MODULE_NAME, SysMLStereotypes.SYSMLSEQUENCEDIAGRAM,
322
                        Metamodel.getMClass(SequenceDiagram.class)), SequenceDiagram.class, new SysMLSequenceDiagramCustomizer());
323

  
324
        // Define the explorer commands
325
       
326
        IModuleContextualCommand commandExplorer = null;
327
        IModuleAction actionExplorer = null;
328

  
329
        
330
        String icons =  this.getPeerModule().getConfiguration().getModuleResourcesPath() + "/res/icons/";
331

  
332
        commandExplorer = new BlockExplorerCommand();
333
        actionExplorer = new DefaultModuleAction(this, "BlockExplorerCommand",
334
                I18nMessageService.getString("Ui.Command.BlockExplorerCommand.Label"),
335
                I18nMessageService.getString("Ui.Command.BlockExplorerCommand.Tooltip"), icons + "block.png", "", "", true, true,
336
                commandExplorer);
337
        actionExplorer.addAllowedMetaclass(Package.class);
338
        this.registerAction(ActionLocation.contextualpopup, actionExplorer);
339

  
340
        commandExplorer = new ConnectorPropertyExplorerCommand();
341
        actionExplorer = new DefaultModuleAction(this, "ConnectorPropertyExplorerCommand",
342
                I18nMessageService.getString("Ui.Command.ConnectorPropertyExplorerCommand.Label"),
343
                I18nMessageService.getString("Ui.Command.ConnectorPropertyExplorerCommand.Tooltip"),
344
                icons + "connectorProperty.png", "Parts", "", true, true, commandExplorer);
345
        actionExplorer.addAllowedMetaclass(Class.class);
346
        actionExplorer.addAllowedStereotype(extensions.getStereotype(MODULE_NAME, SysMLStereotypes.BLOCK,
347
                Metamodel.getMClass(Class.class)));
348
        this.registerAction(ActionLocation.contextualpopup, actionExplorer);
349

  
350
        commandExplorer = new ConstraintBlockExplorerCommand();
351
        actionExplorer = new DefaultModuleAction(this, "ConstraintBlockExplorerCommand",
352
                I18nMessageService.getString("Ui.Command.ConstraintBlockExplorerCommand.Label"),
353
                I18nMessageService.getString("Ui.Command.ConstraintBlockExplorerCommand.Tooltip"), icons + "constraintblock.png",
354
                "", "", true, true, commandExplorer);
355
        actionExplorer.addAllowedMetaclass(Package.class);
356
        this.registerAction(ActionLocation.contextualpopup, actionExplorer);
357

  
358
        commandExplorer = new ConstraintPropertyExplorerCommand();
359
        actionExplorer = new DefaultModuleAction(this, "ConstraintPropertyExplorerCommand",
360
                I18nMessageService.getString("Ui.Command.ConstraintPropertyExplorerCommand.Label"),
361
                I18nMessageService.getString("Ui.Command.ConstraintPropertyExplorerCommand.Tooltip"),
362
                icons + "constraintproperty.png", "Parts", "", true, true, commandExplorer);
363
        actionExplorer.addAllowedMetaclass(Class.class);
364
        actionExplorer.addAllowedStereotype(extensions.getStereotype(MODULE_NAME, SysMLStereotypes.CONSTRAINTBLOCK,
365
                Metamodel.getMClass(Class.class)));
366
        this.registerAction(ActionLocation.contextualpopup, actionExplorer);
367

  
368
        commandExplorer = new DistributedPropertyExplorerCommand();
369
        actionExplorer = new DefaultModuleAction(this, "DistributedPropertyExplorerCommand",
370
                I18nMessageService.getString("Ui.Command.DistributedPropertyExplorerCommand.Label"),
371
                I18nMessageService.getString("Ui.Command.DistributedPropertyExplorerCommand.Tooltip"),
372
                icons + "distributedProperty.png", "References", "", true, true, commandExplorer);
373
        actionExplorer.addAllowedMetaclass(Class.class);
374
        actionExplorer.addAllowedStereotype(extensions.getStereotype(MODULE_NAME, SysMLStereotypes.BLOCK,
375
                Metamodel.getMClass(Class.class)));
376
        this.registerAction(ActionLocation.contextualpopup, actionExplorer);
377

  
378
        commandExplorer = new FlowSpecificationExplorerCommand();
379
        actionExplorer = new DefaultModuleAction(this, "FlowSpecificationExplorerCommand",
380
                I18nMessageService.getString("Ui.Command.FlowSpecificationExplorerCommand.Label"),
381
                I18nMessageService.getString("Ui.Command.FlowSpecificationExplorerCommand.Tooltip"),
382
                icons + "flowspecification.png", "", "", true, true, commandExplorer);
383
        actionExplorer.addAllowedMetaclass(Package.class);
384
        this.registerAction(ActionLocation.contextualpopup, actionExplorer);
385

  
386
        commandExplorer = new FlowPortExplorerCommand();
387
        actionExplorer = new DefaultModuleAction(this, "FlowPortExplorerCommand",
388
                I18nMessageService.getString("Ui.Command.FlowPortExplorerCommand.Label"),
389
                I18nMessageService.getString("Ui.Command.FlowPortExplorerCommand.Tooltip"), icons + "flowport_inout.png", "Ports",
390
                "", true, true, commandExplorer);
391
        actionExplorer.addAllowedMetaclass(Class.class);
392
        actionExplorer.addAllowedMetaclass(Instance.class);
393
        actionExplorer.addAllowedMetaclass(BindableInstance.class);
394
        actionExplorer.addAllowedMetaclass(Component.class);
395
        actionExplorer.addAllowedMetaclass(Artifact.class);
396
        actionExplorer.addAllowedMetaclass(Node.class);
397
        actionExplorer.addAllowedMetaclass(Signal.class);
398
        this.registerAction(ActionLocation.contextualpopup, actionExplorer);
399

  
400
        commandExplorer = new PortExplorerCommand();
401
        actionExplorer = new DefaultModuleAction(this, "PortExplorerCommand",
402
                I18nMessageService.getString("Ui.Command.PortExplorerCommand.Label"),
403
                I18nMessageService.getString("Ui.Command.PortExplorerCommand.Tooltip"), icons + "port.png", "Ports", "", true,
404
                true, commandExplorer);
405
        actionExplorer.addAllowedMetaclass(Class.class);
406
        actionExplorer.addAllowedMetaclass(Instance.class);
407
        actionExplorer.addAllowedMetaclass(BindableInstance.class);
408
        actionExplorer.addAllowedMetaclass(Component.class);
409
        actionExplorer.addAllowedMetaclass(Artifact.class);
410
        actionExplorer.addAllowedMetaclass(Node.class);
411
        actionExplorer.addAllowedMetaclass(Signal.class);
412
        this.registerAction(ActionLocation.contextualpopup, actionExplorer);
413

  
414
        commandExplorer = new FlowPropertyExplorerCommand();
415
        actionExplorer = new DefaultModuleAction(this, "FlowPropertyExplorerCommand",
416
                I18nMessageService.getString("Ui.Command.FlowPropertyExplorerCommand.Label"),
417
                I18nMessageService.getString("Ui.Command.FlowPropertyExplorerCommand.Tooltip"), icons + "flowproperty.png", "", "",
418
                true, true, commandExplorer);
419
        actionExplorer.addAllowedMetaclass(Interface.class);
420
        actionExplorer.addAllowedStereotype(extensions.getStereotype(MODULE_NAME, SysMLStereotypes.FLOWSPECIFICATION,
421
                Metamodel.getMClass(Interface.class)));
422
        this.registerAction(ActionLocation.contextualpopup, actionExplorer);
423

  
424
        commandExplorer = new PartExplorerCommand();
425
        actionExplorer = new DefaultModuleAction(this, "PartExplorerCommand",
426
                I18nMessageService.getString("Ui.Command.PartExplorerCommand.Label"),
427
                I18nMessageService.getString("Ui.Command.PartExplorerCommand.Tooltip"), icons + "bindableinstance.png", "Parts",
428
                "", true, true, commandExplorer);
429
        actionExplorer.addAllowedMetaclass(Class.class);
430
        actionExplorer.addAllowedStereotype(extensions.getStereotype(MODULE_NAME, SysMLStereotypes.BLOCK,
431
                Metamodel.getMClass(Class.class)));
432
        this.registerAction(ActionLocation.contextualpopup, actionExplorer);
433

  
434
        commandExplorer = new ParticipantPropertyExplorerCommand();
435
        actionExplorer = new DefaultModuleAction(this, "ParticipantPropertyExplorerCommand",
436
                I18nMessageService.getString("Ui.Command.ParticipantPropertyExplorerCommand.Label"),
437
                I18nMessageService.getString("Ui.Command.ParticipantPropertyExplorerCommand.Tooltip"),
438
                icons + "participantproperty.png", "Parts", "", true, true, commandExplorer);
439
        actionExplorer.addAllowedMetaclass(Class.class);
440
        actionExplorer.addAllowedStereotype(extensions.getStereotype(MODULE_NAME, SysMLStereotypes.BLOCK,
441
                Metamodel.getMClass(Class.class)));
442
        this.registerAction(ActionLocation.contextualpopup, actionExplorer);
443

  
444
        commandExplorer = new QuantityKindExplorerCommand();
445
        actionExplorer = new DefaultModuleAction(this, "QuantityKindExplorerCommand",
446
                I18nMessageService.getString("Ui.Command.QuantityKindExplorerCommand.Label"),
447
                I18nMessageService.getString("Ui.Command.QuantityKindExplorerCommand.Tooltip"), icons + "quantitykind.png", "", "",
448
                true, true, commandExplorer);
449
        actionExplorer.addAllowedMetaclass(Package.class);
450
        this.registerAction(ActionLocation.contextualpopup, actionExplorer);
451

  
452
        commandExplorer = new ReferenceExplorerCommand();
453
        actionExplorer = new DefaultModuleAction(this, "ReferenceExplorerCommand",
454
                I18nMessageService.getString("Ui.Command.ReferenceExplorerCommand.Label"),
455
                I18nMessageService.getString("Ui.Command.ReferenceExplorerCommand.Tooltip"), icons + "reference.png", "References",
456
                "", true, true, commandExplorer);
457
        actionExplorer.addAllowedMetaclass(Class.class);
458
        actionExplorer.addAllowedStereotype(extensions.getStereotype(MODULE_NAME, SysMLStereotypes.BLOCK,
459
                Metamodel.getMClass(Class.class)));
460
        this.registerAction(ActionLocation.contextualpopup, actionExplorer);
461

  
462
        commandExplorer = new UnitExplorerCommand();
463
        actionExplorer = new DefaultModuleAction(this, "UnitExplorerCommand",
464
                I18nMessageService.getString("Ui.Command.UnitExplorerCommand.Label"),
465
                I18nMessageService.getString("Ui.Command.UnitExplorerCommand.Tooltip"), icons + "unit.png", "", "", true, true,
466
                commandExplorer);
467
        actionExplorer.addAllowedMetaclass(Package.class);
468
        this.registerAction(ActionLocation.contextualpopup, actionExplorer);
469

  
470
        commandExplorer = new ValueTypeExplorerCommand();
471
        actionExplorer = new DefaultModuleAction(this, "ValueTypeExplorerCommand",
472
                I18nMessageService.getString("Ui.Command.ValueTypeExplorerCommand.Label"),
473
                I18nMessageService.getString("Ui.Command.ValueTypeExplorerCommand.Tooltip"), icons + "valuetype.png", "", "", true,
474
                true, commandExplorer);
475
        actionExplorer.addAllowedMetaclass(Package.class);
476
        this.registerAction(ActionLocation.contextualpopup, actionExplorer);
477

  
478
        commandExplorer = new ViewExplorerCommand();
479
        actionExplorer = new DefaultModuleAction(this, "ViewExplorerCommand",
480
                I18nMessageService.getString("Ui.Command.ViewExplorerCommand.Label"),
481
                I18nMessageService.getString("Ui.Command.ViewExplorerCommand.Tooltip"), icons + "view.png", "", "", true, true,
482
                commandExplorer);
483
        actionExplorer.addAllowedMetaclass(Package.class);
484
        this.registerAction(ActionLocation.contextualpopup, actionExplorer);
485

  
486
        commandExplorer = new ViewpointExplorerCommand();
487
        actionExplorer = new DefaultModuleAction(this, "ViewpointExplorerCommand",
488
                I18nMessageService.getString("Ui.Command.ViewpointExplorerCommand.Label"),
489
                I18nMessageService.getString("Ui.Command.ViewpointExplorerCommand.Tooltip"), icons + "viewpoint.png", "", "", true,
490
                true, commandExplorer);
491
        actionExplorer.addAllowedMetaclass(Package.class);
492
        this.registerAction(ActionLocation.contextualpopup, actionExplorer);
493

  
494
        commandExplorer = new ContinuousExplorerCommand();
495
        actionExplorer = new DefaultModuleAction(this, "ContinuousExplorerCommand",
496
                I18nMessageService.getString("Ui.Command.ContinuousExplorerCommand.Label"),
497
                I18nMessageService.getString("Ui.Command.ContinuousExplorerCommand.Tooltip"), icons + "continuousparameter.png",
498
                "", "", true, true, commandExplorer);
499
        actionExplorer.addAllowedMetaclass(Activity.class);
500
        actionExplorer.addAllowedMetaclass(Operation.class);
501
        this.registerAction(ActionLocation.contextualpopup, actionExplorer);
502

  
503
        commandExplorer = new OptionalExplorerCommand();
504
        actionExplorer = new DefaultModuleAction(this, "OptionalExplorerCommand",
505
                I18nMessageService.getString("Ui.Command.OptionalExplorerCommand.Label"),
506
                I18nMessageService.getString("Ui.Command.OptionalExplorerCommand.Tooltip"), icons + "optional.png", "", "", true,
507
                true, commandExplorer);
508
        actionExplorer.addAllowedMetaclass(Activity.class);
509
        actionExplorer.addAllowedMetaclass(Operation.class);
510
        this.registerAction(ActionLocation.contextualpopup, actionExplorer);
511

  
512
        commandExplorer = new RateExplorerCommand();
513
        actionExplorer = new DefaultModuleAction(this, "RateExplorerCommand",
514
                I18nMessageService.getString("Ui.Command.RateExplorerCommand.Label"),
515
                I18nMessageService.getString("Ui.Command.RateExplorerCommand.Tooltip"), icons + "rateparameter.png", "", "", true,
516
                true, commandExplorer);
517
        actionExplorer.addAllowedMetaclass(Activity.class);
518
        actionExplorer.addAllowedMetaclass(Operation.class);
519
        this.registerAction(ActionLocation.contextualpopup, actionExplorer);
520

  
521
        commandExplorer = new DiscreteExplorerCommand();
522
        actionExplorer = new DefaultModuleAction(this, "DiscreteExplorerCommand",
523
                I18nMessageService.getString("Ui.Command.DiscreteExplorerCommand.Label"),
524
                I18nMessageService.getString("Ui.Command.DiscreteExplorerCommand.Tooltip"), icons + "discreteparameter.png", "",
525
                "", true, true, commandExplorer);
526
        actionExplorer.addAllowedMetaclass(Activity.class);
527
        actionExplorer.addAllowedMetaclass(Operation.class);
528
        this.registerAction(ActionLocation.contextualpopup, actionExplorer);
529

  
530
        // UML elements
531

  
532
        commandExplorer = new ActivityExplorerCommand();
533
        actionExplorer = new DefaultModuleAction(this, "ActivityExplorerCommand",
534
                I18nMessageService.getString("Ui.Command.ActivityExplorerCommand.Label"),
535
                I18nMessageService.getString("Ui.Command.ActivityExplorerCommand.Tooltip"), icons + "activity.png", "", "", true,
536
                true, commandExplorer);
537
        actionExplorer.addAllowedMetaclass(NameSpace.class);
538
        this.registerAction(ActionLocation.contextualpopup, actionExplorer);
539

  
540
        commandExplorer = new ActorExplorerCommand();
541
        actionExplorer = new DefaultModuleAction(this, "ActorExplorerCommand",
542
                I18nMessageService.getString("Ui.Command.ActorExplorerCommand.Label"),
543
                I18nMessageService.getString("Ui.Command.ActorExplorerCommand.Tooltip"), icons + "actor.png", "", "", true, true,
544
                commandExplorer);
545
        actionExplorer.addAllowedMetaclass(Package.class);
546
        this.registerAction(ActionLocation.contextualpopup, actionExplorer);
547

  
548
        commandExplorer = new EnumerationExplorerCommand();
549
        actionExplorer = new DefaultModuleAction(this, "EnumerationExplorerCommand",
550
                I18nMessageService.getString("Ui.Command.EnumerationExplorerCommand.Label"),
551
                I18nMessageService.getString("Ui.Command.EnumerationExplorerCommand.Tooltip"), icons + "enumeration.png", "", "",
552
                true, true, commandExplorer);
553
        actionExplorer.addAllowedMetaclass(Package.class);
554
        this.registerAction(ActionLocation.contextualpopup, actionExplorer);
555

  
556
        commandExplorer = new EnumerationLiteralExplorerCommand();
557
        actionExplorer = new DefaultModuleAction(this, "EnumerationLiteralExplorerCommand",
558
                I18nMessageService.getString("Ui.Command.EnumerationLiteralExplorerCommand.Label"),
559
                I18nMessageService.getString("Ui.Command.EnumerationLiteralExplorerCommand.Tooltip"),
560
                icons + "enumerationliteral.png", "", "", true, true, commandExplorer);
561
        actionExplorer.addAllowedMetaclass(Enumeration.class);
562
        this.registerAction(ActionLocation.contextualpopup, actionExplorer);
563

  
564
        commandExplorer = new OperationExplorerCommand();
565
        actionExplorer = new DefaultModuleAction(this, "OperationExplorerCommand",
566
                I18nMessageService.getString("Ui.Command.OperationExplorerCommand.Label"),
567
                I18nMessageService.getString("Ui.Command.OperationExplorerCommand.Tooltip"), icons + "operation.png", "", "", true,
568
                true, commandExplorer);
569
        actionExplorer.addAllowedMetaclass(Classifier.class);
570
        this.registerAction(ActionLocation.contextualpopup, actionExplorer);
571

  
572
        commandExplorer = new ParameterExplorerCommand();
573
        actionExplorer = new DefaultModuleAction(this, "ParameterExplorerCommand",
574
                I18nMessageService.getString("Ui.Command.ParameterExplorerCommand.Label"),
575
                I18nMessageService.getString("Ui.Command.ParameterExplorerCommand.Tooltip"), icons + "parameter.png", "", "", true,
576
                true, commandExplorer);
577
        actionExplorer.addAllowedMetaclass(Operation.class);
578
        this.registerAction(ActionLocation.contextualpopup, actionExplorer);
579

  
580
        commandExplorer = new ReturnParameterExplorerCommand();
581
        actionExplorer = new DefaultModuleAction(this, "ReturnParameterExplorerCommand",
582
                I18nMessageService.getString("Ui.Command.ReturnParameterExplorerCommand.Label"),
583
                I18nMessageService.getString("Ui.Command.ReturnParameterExplorerCommand.Tooltip"), icons + "parameterreturn.png",
584
                "", "", true, true, commandExplorer);
585
        actionExplorer.addAllowedMetaclass(Operation.class);
586
        this.registerAction(ActionLocation.contextualpopup, actionExplorer);
587

  
588
        commandExplorer = new UseCaseExplorerCommand();
589
        actionExplorer = new DefaultModuleAction(this, "UseCaseExplorerCommand",
590
                I18nMessageService.getString("Ui.Command.UseCaseExplorerCommand.Label"),
591
                I18nMessageService.getString("Ui.Command.UseCaseExplorerCommand.Tooltip"), icons + "usecase.png", "", "", true,
592
                true, commandExplorer);
593
        actionExplorer.addAllowedMetaclass(Package.class);
594
        this.registerAction(ActionLocation.contextualpopup, actionExplorer);
595

  
596
        commandExplorer = new InteractionExplorerCommand();
597
        actionExplorer = new DefaultModuleAction(this, "InteractionExplorerCommand",
598
                I18nMessageService.getString("Ui.Command.InteractionExplorerCommand.Label"),
599
                I18nMessageService.getString("Ui.Command.InteractionExplorerCommand.Tooltip"), icons + "interaction.png", "", "",
600
                true, true, commandExplorer);
601
        actionExplorer.addAllowedMetaclass(Package.class);
602
        this.registerAction(ActionLocation.contextualpopup, actionExplorer);
603

  
604
        commandExplorer = new StateMachineExplorerCommand();
605
        actionExplorer = new DefaultModuleAction(this, "StateMachineExplorerCommand",
606
                I18nMessageService.getString("Ui.Command.StateMachineExplorerCommand.Label"),
607
                I18nMessageService.getString("Ui.Command.StateMachineExplorerCommand.Tooltip"), icons + "statemachine.png", "", "",
608
                true, true, commandExplorer);
609
        actionExplorer.addAllowedMetaclass(Package.class);
610
        this.registerAction(ActionLocation.contextualpopup, actionExplorer);
611
    
612

  
613
        // Diagram Contribution
614

  
615
        this.contributions = new DiagramContributions(this);
616
        this.contributions.addContributors(new BlockDiagramContributor());
617
        this.contributions.addContributors(new InternalBlockDiagramContributor());
618
        this.contributions.addContributors(new PackageDiagramContributor());
619
        this.contributions.addContributors(new ParametricDiagramContributor());
620
        this.contributions.addContributors(new SysMLActivityDiagramContributor());
621
        this.contributions.addContributors(new SysMLRequirementDiagramContributor());
622
        this.contributions.addContributors(new SysMLSequenceDiagramContributor());
623
        this.contributions.addContributors(new SysMLStateMachineDiagramContributor());
624
        this.contributions.addContributors(new SysMLUseCaseDiagramContributor());
625
        this.contributions.registerDiagramCommand();
626

  
627
        super.init();
628
    }
629

  
630
    @Override
631
    public IParameterEditionModel getParametersEditionModel() {
632
        if (this.parameterEditionModel == null) {
633
            ParametersEditionModel parameters = new ParametersEditionModel(this);
634
            this.parameterEditionModel = parameters;
635
        }
636
        return this.parameterEditionModel;
637
    }
638

  
639
    @Override
640
    public String getModuleImagePath() {
641
        return "/res/icons/sysml.png";
642
    }
643

  
644
    @Override
645
    public IModelComponentContributor getModelComponentContributor(IModelComponent mc) {
646
        return new SysMLModelComponentContributor(this);
647
    }
648

  
649
    public DiagramContributions getDiagramContributions() {
650
        return this.contributions;
651
    }
652
}

Also available in: Unified diff