Skip to content

Commit 57a829a

Browse files
committed
ST6RI-682 Registered sysmlx in Eclipse environment
1 parent b762971 commit 57a829a

8 files changed

Lines changed: 197 additions & 3 deletions

File tree

org.omg.sysml.editor/META-INF/MANIFEST.MF

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ Require-Bundle: org.eclipse.core.runtime,
1515
org.omg.sysml.edit;visibility:=reexport,
1616
org.eclipse.emf.ecore.xmi;visibility:=reexport,
1717
org.eclipse.emf.edit.ui;visibility:=reexport,
18-
org.eclipse.ui.ide;visibility:=reexport
18+
org.eclipse.ui.ide;visibility:=reexport,
19+
org.eclipse.emf.ecore.editor
1920
Bundle-ActivationPolicy: lazy

org.omg.sysml.editor/plugin.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,16 @@
3333
contributorClass="org.omg.sysml.lang.sysml.presentation.SysMLActionBarContributor">
3434
</editor>
3535
</extension>
36+
<extension
37+
point="org.eclipse.ui.editors">
38+
<editor
39+
class="org.eclipse.emf.ecore.presentation.EcoreEditor"
40+
contributorClass="org.eclipse.emf.ecore.presentation.EcoreActionBarContributor"
41+
default="false"
42+
extensions="sysmlx"
43+
id="org.omg.sysml.lang.sysml.presentation.SysMLxEditorID"
44+
name="SysMLx Model Editor">
45+
</editor>
46+
</extension>
3647

3748
</plugin>

org.omg.sysml.xtext.ui/META-INF/MANIFEST.MF

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ Require-Bundle: org.omg.sysml;bundle-version="0.2.0",
2222
org.omg.kerml.expressions.xtext,
2323
org.omg.kerml.expressions.xtext.ide,
2424
org.omg.kerml.expressions.xtext.ui,
25-
com.google.gson
25+
com.google.gson,
26+
org.eclipse.emf.ecore.editor
2627
Import-Package: org.apache.log4j
2728
Export-Package: org.omg.sysml.xtext.ui,
2829
org.omg.sysml.xtext.ui.internal
29-
Bundle-Activator: org.omg.sysml.xtext.ui.internal.XtextActivator
30+
Bundle-Activator: org.omg.sysml.xtext.ui.SysMLActivator
3031
Bundle-Vendor: SysML v2 Submission Team

org.omg.sysml.xtext.ui/plugin.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,4 +397,11 @@
397397
type="text">
398398
</fileTypes>
399399
</extension>
400+
<extension
401+
point="org.eclipse.xtext.extension_resourceServiceProvider">
402+
<resourceServiceProvider
403+
class="org.omg.sysml.xtext.ui.xmi.SysMLXExecutableExtensionFactory:org.eclipse.xtext.ui.resource.generic.EmfResourceUIServiceProvider"
404+
uriExtension="sysmlx">
405+
</resourceServiceProvider>
406+
</extension>
400407
</plugin>
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/**
2+
* SysML 2 Pilot Implementation
3+
* Copyright (C) 2025 Model Driven Solutions, Inc.
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU Lesser General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU Lesser General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU Lesser General Public License
16+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
*
18+
* @license LGPL-3.0-or-later <http://spdx.org/licenses/LGPL-3.0-or-later>
19+
*
20+
* Contributors:
21+
* Laszlo Gati, MDS
22+
*/
23+
package org.omg.sysml.xtext.ui
24+
25+
import org.omg.sysml.xtext.SysMLRuntimeModule
26+
import org.omg.sysml.xtext.ui.internal.XtextActivator
27+
import org.omg.sysml.xmi.SysMLxRuntimeModule
28+
import org.omg.sysml.xtext.ui.xmi.SysMLxUIModule
29+
30+
class SysMLActivator extends XtextActivator {
31+
32+
override getRuntimeModule(String grammar) {
33+
return switch (grammar) {
34+
case ORG_OMG_SYSML_XTEXT_SYSML: new SysMLRuntimeModule
35+
case SysMLxRuntimeModule::SYSMLX_LANGUAGE_NAME: new SysMLxRuntimeModule
36+
default: throw new IllegalArgumentException(grammar)
37+
}
38+
}
39+
40+
override getUiModule(String grammar) {
41+
return switch (grammar) {
42+
case ORG_OMG_SYSML_XTEXT_SYSML: new SysMLUiModule(this)
43+
case SysMLxRuntimeModule::SYSMLX_LANGUAGE_NAME: new SysMLxUIModule(this)
44+
default: throw new IllegalArgumentException(grammar)
45+
}
46+
}
47+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/**
2+
* SysML 2 Pilot Implementation
3+
* Copyright (C) 2025 Model Driven Solutions, Inc.
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU Lesser General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU Lesser General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU Lesser General Public License
16+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
*
18+
* @license LGPL-3.0-or-later <http://spdx.org/licenses/LGPL-3.0-or-later>
19+
*
20+
* Contributors:
21+
* Laszlo Gati, MDS
22+
*/
23+
package org.omg.sysml.xtext.ui.xmi
24+
25+
import org.eclipse.xtext.ui.editor.LanguageSpecificURIEditorOpener
26+
import org.eclipse.ui.IEditorPart
27+
import org.eclipse.emf.common.util.URI
28+
import org.eclipse.emf.ecore.EReference
29+
import org.eclipse.emf.ecore.presentation.EcoreEditor
30+
31+
class EcoreEditorOpener extends LanguageSpecificURIEditorOpener {
32+
33+
34+
override protected selectAndReveal(IEditorPart openEditor, URI uri, EReference crossReference, int indexInList, boolean select) {
35+
if (uri.fragment !== null){
36+
val editor = openEditor.getAdapter(EcoreEditor)
37+
val eObject = editor.editingDomain.resourceSet.getEObject(uri, false)
38+
editor.selectionToViewer = #[eObject]
39+
}
40+
}
41+
42+
override protected getEditorId() {
43+
'org.omg.sysml.lang.sysml.presentation.SysMLxEditorID'
44+
}
45+
46+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/**
2+
* SysML 2 Pilot Implementation
3+
* Copyright (C) 2025 Model Driven Solutions, Inc.
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU Lesser General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU Lesser General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU Lesser General Public License
16+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
*
18+
* @license LGPL-3.0-or-later <http://spdx.org/licenses/LGPL-3.0-or-later>
19+
*
20+
* Contributors:
21+
* Laszlo Gati, MDS
22+
*/
23+
package org.omg.sysml.xtext.ui.xmi
24+
25+
import org.eclipse.xtext.ui.guice.AbstractGuiceAwareExecutableExtensionFactory
26+
import org.osgi.framework.FrameworkUtil
27+
import org.omg.sysml.xtext.ui.SysMLActivator
28+
import org.omg.sysml.xmi.SysMLxRuntimeModule
29+
30+
class SysMLxExecutableExtensionFactory extends AbstractGuiceAwareExecutableExtensionFactory {
31+
32+
override protected getBundle() {
33+
FrameworkUtil.getBundle(SysMLActivator)
34+
}
35+
36+
override protected getInjector() {
37+
val instance = SysMLActivator.instance
38+
return instance !== null? instance.getInjector(SysMLxRuntimeModule::SYSMLX_LANGUAGE_NAME) : null
39+
}
40+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/**
2+
* SysML 2 Pilot Implementation
3+
* Copyright (C) 2025 Model Driven Solutions, Inc.
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU Lesser General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU Lesser General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU Lesser General Public License
16+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
*
18+
* @license LGPL-3.0-or-later <http://spdx.org/licenses/LGPL-3.0-or-later>
19+
*
20+
* Contributors:
21+
* Laszlo Gati, MDS
22+
*/
23+
package org.omg.sysml.xtext.ui.xmi
24+
25+
import org.eclipse.ui.plugin.AbstractUIPlugin
26+
import org.eclipse.xtext.ui.resource.generic.EmfUiModule
27+
import com.google.inject.Binder
28+
import org.eclipse.xtext.ui.LanguageSpecific
29+
import org.eclipse.xtext.ui.editor.IURIEditorOpener
30+
31+
class SysMLxUIModule extends EmfUiModule {
32+
33+
new(AbstractUIPlugin plugin) {
34+
super(plugin)
35+
}
36+
37+
override configureLanguageSpecificURIEditorOpener(Binder binder) {
38+
binder.bind(IURIEditorOpener).annotatedWith(LanguageSpecific).to(EcoreEditorOpener)
39+
}
40+
41+
}

0 commit comments

Comments
 (0)