4949
5050/**
5151 * This class represents the life of SysMl module
52- *
52+ *
5353 * @author ebrosse
5454 */
5555
5656public class SysMLSession extends DefaultModuleLifeCycleHandler {
57-
57+
5858 private SysMLModelChangeHandler modelChangeHandler = null ;
5959
6060 /**
6161 * Constructor
6262 * @author ebrosse
63- *
63+ *
6464 * @param module : the SysML Mdac
6565 */
66-
66+
6767 public SysMLSession (SysMLModule module ) {
6868 super (module );
6969 }
7070
71-
71+
7272 @ Override
7373 public boolean start () throws ModuleException {
7474 /*
@@ -80,29 +80,29 @@ public boolean start() throws ModuleException {
8080 // Display the copyright
8181 // SysMLInfo cannot be used in this operation, because there is a Java
8282 // error when the MDAC is deployed
83- SysMLModule .logService .info ("Modelio/" + this .module .getName () + " " + completeVersion + " - Copyright 2011-2015 Modeliosoft " );
84-
83+ SysMLModule .logService .info ("Modelio/" + this .module .getName () + " " + completeVersion + " - Copyright 2011-2023 Docaposte " );
84+
8585 IModelingSession session = this .module .getModuleContext ().getModelingSession ();
8686 this .modelChangeHandler = new SysMLModelChangeHandler ();
8787 session .addModelHandler (this .modelChangeHandler );
88-
88+
8989 installStyles ();
9090 installRamc ();
9191 return super .start ();
9292 }
9393
94-
94+
9595 @ Override
9696 public void stop () throws ModuleException {
9797 this .module .getModuleContext ().getModelingSession ().removeModelHandler (this .modelChangeHandler );
9898 this .modelChangeHandler = null ;
9999 super .stop ();
100100 }
101101
102-
102+
103103 private void installRamc () {
104104 Path mdaplugsPath = this .module .getModuleContext ().getConfiguration ().getModuleResourcesPath ();
105-
105+
106106 final IModelComponentService modelComponentService = SysMLModule .getInstance ().getModuleContext ().getModelioServices ().getModelComponentService ();
107107 for (IModelComponentDescriptor mc : modelComponentService .getModelComponents ()) {
108108 if (mc .getName ().equals ("SIDefinitions" )) {
@@ -114,29 +114,29 @@ private void installRamc() {
114114 }
115115 }
116116 }
117-
117+
118118 // No ramc found, deploy it
119119 modelComponentService .deployModelComponent (new File (mdaplugsPath .resolve ("res" + File .separator + "ramc" + File .separator + "SIDefinitions.ramc" ).toString ()), new NullProgressMonitor ());
120120 }
121121
122-
122+
123123 private void installStyles () {
124124 Path mdaplugsPath = this .module .getModuleContext ().getConfiguration ().getModuleResourcesPath ();
125-
125+
126126 SysMLModule .getInstance ().getModuleContext ().getModelioServices ().getDiagramService ().registerStyle ("sysml" , "default" , new File (mdaplugsPath .resolve ("res" + File .separator + "style" + File .separator + "sysml.style" ).toString ()));
127-
127+
128128 SysMLModule .getInstance ().getModuleContext ().getModelioServices ().getDiagramService ().registerStyle ("sysmlinternal" , "default" , new File (mdaplugsPath .resolve ("res" + File .separator + "style" + File .separator + "sysmlinternal.style" ).toString ()));
129-
129+
130130 SysMLModule .getInstance ().getModuleContext ().getModelioServices ().getDiagramService ().registerStyle ("sysmlpackage" , "default" , new File (mdaplugsPath .resolve ("res" + File .separator + "style" + File .separator + "sysmlpackage.style" ).toString ()));
131131 }
132132
133-
133+
134134 @ Override
135135 public boolean select () throws ModuleException {
136136 return super .select ();
137137 }
138138
139-
139+
140140 @ Override
141141 public void upgrade (Version oldVersion , Map <String , String > oldParameters ) {
142142 Version lastVersion = new Version ("2.1.10" );
@@ -146,30 +146,30 @@ public void upgrade(Version oldVersion, Map<String, String> oldParameters) {
146146 for (MObject existingPort : existingPorts ) {
147147 if (existingPort instanceof Port ) {
148148 Port currentPort = (Port ) existingPort ;
149-
149+
150150 Stereotype flowPortSter = session .getMetamodelExtensions ().getStereotype (ISysMLPeerModule .MODULE_NAME , SysMLStereotypes .FLOWPORT , SysMLModule .getInstance ().getModuleContext ().getModelioServices ().getMetamodelService ().getMetamodel ().getMClass (Port .class ));
151-
151+
152152 if (currentPort .isStereotyped (ISysMLPeerModule .MODULE_NAME , SysMLStereotypes .FLOWIN )) {
153-
153+
154154 Stereotype flowINSter = session .getMetamodelExtensions ().getStereotype (ISysMLPeerModule .MODULE_NAME , SysMLStereotypes .FLOWIN , SysMLModule .getInstance ().getModuleContext ().getModelioServices ().getMetamodelService ().getMetamodel ().getMClass (Port .class ));
155155 currentPort .setDirection (PortOrientation .IN );
156156 currentPort .getExtension ().remove (flowINSter );
157-
157+
158158 } else if (currentPort .isStereotyped (ISysMLPeerModule .MODULE_NAME , SysMLStereotypes .FLOWOUT )) {
159-
159+
160160 Stereotype flowOUTSter = session .getMetamodelExtensions ().getStereotype (ISysMLPeerModule .MODULE_NAME , SysMLStereotypes .FLOWOUT , SysMLModule .getInstance ().getModuleContext ().getModelioServices ().getMetamodelService ().getMetamodel ().getMClass (Port .class ));
161161 currentPort .setDirection (PortOrientation .OUT );
162162 currentPort .getExtension ().remove (flowOUTSter );
163-
163+
164164 } else if (currentPort .isStereotyped (ISysMLPeerModule .MODULE_NAME , SysMLStereotypes .FLOWINOUT )) {
165-
165+
166166 Stereotype flowINOUTSter = session .getMetamodelExtensions ().getStereotype (ISysMLPeerModule .MODULE_NAME , SysMLStereotypes .FLOWINOUT , SysMLModule .getInstance ().getModuleContext ().getModelioServices ().getMetamodelService ().getMetamodel ().getMClass (Port .class ));
167167 currentPort .setDirection (PortOrientation .INOUT );
168168 currentPort .getExtension ().remove (flowINOUTSter );
169169 }
170-
170+
171171 currentPort .getExtension ().add (flowPortSter );
172-
172+
173173 }
174174 }
175175 }
0 commit comments