Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/infra/gmfdiag')
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/META-INF/MANIFEST.MF5
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/plugin.properties2
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/plugin.xml21
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/pom.xml2
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/schema/DirectEditor.exsd24
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/AbstractBasicDirectEditorConfiguration.java53
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/DefaultDirectEditorConfiguration.java163
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IAdvancedEditorConfiguration.java21
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/ICustomDirectEditorConfiguration.java21
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IDirectEditorConfiguration.java144
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IDirectEditorConstraint.java26
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IModelGenerator.java28
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IPopupEditorConfiguration.java18
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/definition/DirectEditorExtensionPoint.java501
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/definition/DirectEditorRegistry.java127
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/definition/IDirectEditorConfigurationIds.java61
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/definition/IDirectEditorExtensionPoint.java86
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/preferences/PapyrusEmbeddedEditorsPreferencePage.java545
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/preferences/PriorityEditorEditingSupport.java82
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/DirectEditExecutableExtension.java22
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/DirectEditorsContributionItem.java289
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/EmbeddedEditorReconcilingStrategy.java9
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/ErrorAnnotation.java102
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/ExtendedDirectEditionDialog.java166
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/GMFEmbeddedEditorActionDelegate.java128
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/ILabelEditorDialog.java10
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/IPopupEditorHelper.java12
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/LabelEditorDialog.java177
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/MultiReconciler.java96
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/OpenEmbeddedTextEditorObjectActionDelegate.java192
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/utils/DirectEditorsUtil.java189
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/utils/IDirectEditorsIds.java20
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/.classpath7
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/.project52
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/.settings/org.eclipse.core.runtime.prefs2
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/.settings/org.eclipse.jdt.core.prefs297
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/.settings/org.eclipse.jdt.ui.prefs127
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/.settings/org.eclipse.pde.api.tools.prefs104
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/EmbedddedEditor.usecases53
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/META-INF/MANIFEST.MF22
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/about.html28
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/build.properties12
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/icons/error.gifbin0 -> 609 bytes
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/plugin.properties14
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/plugin.xml53
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/pom.xml13
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/schema/DirectEditor.exsd263
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/Activator.java160
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/configuration/AbstractBasicDirectEditorConfiguration.java64
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/configuration/DefaultDirectEditorConfiguration.java180
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/configuration/IAdvancedEditorConfiguration.java33
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/configuration/ICustomDirectEditorConfiguration.java37
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/configuration/IDirectEditorConfiguration.java160
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/configuration/IDirectEditorConstraint.java43
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/configuration/IModelGenerator.java44
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/configuration/IPopupEditorConfiguration.java31
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/definition/DirectEditorExtensionPoint.java526
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/definition/DirectEditorRegistry.java144
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/definition/IDirectEditorConfigurationIds.java78
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/definition/IDirectEditorExtensionPoint.java106
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/preferences/PapyrusEmbeddedEditorsPreferencePage.java569
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/preferences/PriorityEditorEditingSupport.java106
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/preferences/provider/DirectEditorContentProvider.java (renamed from plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/preferences/provider/DirectEditorContentProvider.java)2
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/preferences/provider/DirectEditorLabelProvider.java (renamed from plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/preferences/provider/DirectEditorLabelProvider.java)4
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/preferences/provider/DirectEditorTreeItem.java (renamed from plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/preferences/provider/DirectEditorTreeItem.java)6
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/DirectEditExecutableExtension.java31
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/DirectEditorsContributionItem.java311
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/EmbeddedEditorReconcilingStrategy.java40
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/ErrorAnnotation.java116
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/ExtendedDirectEditionDialog.java190
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/GMFEmbeddedEditorActionDelegate.java143
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/ILabelEditorDialog.java24
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/IPopupEditorHelper.java25
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/LabelEditorDialog.java211
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/MultiReconciler.java126
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/OpenEmbeddedTextEditorObjectActionDelegate.java206
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/images/error.gifbin0 -> 609 bytes
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/utils/DirectEditorsUtil.java203
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/utils/IDirectEditorsIds.java36
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/plugin.xml2
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/directeditor/DiagramDirectEditorConfiguration.java2
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/preferences/DiagramDirectEditorPreferenceInitializer.java2
-rw-r--r--plugins/infra/gmfdiag/pom.xml4
84 files changed, 5226 insertions, 3130 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/META-INF/MANIFEST.MF
index 0805152a45a..6b19610900c 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/META-INF/MANIFEST.MF
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/META-INF/MANIFEST.MF
@@ -2,7 +2,8 @@ Manifest-Version: 1.0
Require-Bundle: org.eclipse.gmf.runtime.diagram.ui;bundle-version="[1.8.0,2.0.0)";visibility:=reexport,
org.eclipse.papyrus.infra.emf;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.infra.constraints;bundle-version="[2.0.0,3.0.0)";visibility:=reexport,
- org.eclipse.papyrus.infra.ui;bundle-version="[2.0.0,3.0.0)"
+ org.eclipse.papyrus.infra.ui;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors;bundle-version="[1.0.0,2.0.0)"
Export-Package: org.eclipse.papyrus.extensionpoints.editors,
org.eclipse.papyrus.extensionpoints.editors.configuration,
org.eclipse.papyrus.extensionpoints.editors.definition,
@@ -12,7 +13,7 @@ Export-Package: org.eclipse.papyrus.extensionpoints.editors,
org.eclipse.papyrus.extensionpoints.editors.utils
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
-Bundle-Version: 3.0.0.qualifier
+Bundle-Version: 3.1.0.qualifier
Bundle-Name: %pluginName
Bundle-Localization: plugin
Bundle-Activator: org.eclipse.papyrus.extensionpoints.editors.Activator
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/plugin.properties b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/plugin.properties
index ac68b824c1b..87458790c32 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/plugin.properties
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/plugin.properties
@@ -10,5 +10,5 @@
# Contributors:
# Remi Schnekenburger (CEA LIST) Remi.Schnekenburger@cea.fr - Initial API and implementation
##################################################################################
-pluginName=Papyrus Embedded Editors extensions point
+pluginName=Papyrus Embedded Editors extensions point (Deprecated)
providerName=Eclipse Modeling Project
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/plugin.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/plugin.xml
index f0a8ae4bc60..600a446610c 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/plugin.xml
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/plugin.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
- <extension-point id="DirectEditor" name="Define a new Direct editor for Papyrus" schema="schema/DirectEditor.exsd"/>
+ <extension-point id="DirectEditor" name="Define a new Direct editor for Papyrus (Deprecated)" schema="schema/DirectEditor.exsd"/>
<!--
<extension
point="org.eclipse.ui.popupMenus">
@@ -29,25 +29,6 @@
</objectContribution>
</extension>
-->
- <extension
- point="org.eclipse.ui.menus">
- <menuContribution
- locationURI="popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContextMenu">
- <dynamic
- class="org.eclipse.papyrus.extensionpoints.editors.ui.DirectEditorsContributionItem"
- id="org.eclipse.papyrus.extensionpoints.editors.DynamicMenu">
- </dynamic>
- </menuContribution>
- </extension>
- <extension
- point="org.eclipse.ui.preferencePages">
- <page
- category="org.eclipse.papyrus.infra.core.sasheditor.preferences.generalcategory"
- class="org.eclipse.papyrus.extensionpoints.editors.preferences.PapyrusEmbeddedEditorsPreferencePage"
- id="org.eclipse.papyrus.embeddededitors"
- name="Embedded Editors">
- </page>
- </extension>
</plugin>
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/pom.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/pom.xml
index ee9f67d6511..83b7712cac3 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/pom.xml
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/pom.xml
@@ -7,6 +7,6 @@
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.papyrus.extensionpoints.editors</artifactId>
- <version>3.0.0-SNAPSHOT</version>
+ <version>3.1.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project> \ No newline at end of file
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/schema/DirectEditor.exsd b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/schema/DirectEditor.exsd
index c1aea4f39c6..1886352746e 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/schema/DirectEditor.exsd
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/schema/DirectEditor.exsd
@@ -13,7 +13,7 @@
<element name="extension">
<annotation>
<appInfo>
- <meta.element />
+ <meta.element deprecated="true" />
</appInfo>
</annotation>
<complexType>
@@ -50,7 +50,7 @@
<element name="DirectEditor">
<annotation>
<appInfo>
- <meta.element labelAttribute="objectToEdit"/>
+ <meta.element labelAttribute="objectToEdit" deprecated="true"/>
</appInfo>
<documentation>
Extension points for direct editors in Papyrus UML2.
@@ -120,6 +120,11 @@
</element>
<element name="simpleeditor">
+ <annotation>
+ <appInfo>
+ <meta.element deprecated="true"/>
+ </appInfo>
+ </annotation>
<complexType>
<attribute name="editorConfiguration" type="string" use="required">
<annotation>
@@ -135,6 +140,11 @@
</element>
<element name="advancededitor">
+ <annotation>
+ <appInfo>
+ <meta.element deprecated="true"/>
+ </appInfo>
+ </annotation>
<complexType>
<attribute name="editorConfiguration" type="string" use="required">
<annotation>
@@ -151,6 +161,9 @@
<element name="popupeditor">
<annotation>
+ <appInfo>
+ <meta.element deprecated="true"/>
+ </appInfo>
<documentation>
This extension point can be used to register a popup editor
</documentation>
@@ -171,6 +184,9 @@
<element name="Priority">
<annotation>
+ <appInfo>
+ <meta.element deprecated="true"/>
+ </appInfo>
<documentation>
The description for the priority of the editpart provider
</documentation>
@@ -238,9 +254,9 @@
</annotation>
<annotation>
- <appinfo>
+ <appInfo>
<meta.section type="copyright"/>
- </appinfo>
+ </appInfo>
<documentation>
/*****************************************************************************
* Copyright (c) 2008 CEA LIST.
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/AbstractBasicDirectEditorConfiguration.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/AbstractBasicDirectEditorConfiguration.java
index 81d3c1c310b..96e5a62ed50 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/AbstractBasicDirectEditorConfiguration.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/AbstractBasicDirectEditorConfiguration.java
@@ -1,6 +1,6 @@
/*****************************************************************************
- * Copyright (c) 2016 CEA LIST and others.
- *
+ * Copyright (c) 2016, 2018 CEA LIST and others.
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -10,55 +10,18 @@
*
* Contributors:
* Fanch BONNABESSE (ALL4TEC) fanch.bonnabesse@all4tec.net - Initial API and implementation
- *
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 533667
+ *
*****************************************************************************/
package org.eclipse.papyrus.extensionpoints.editors.configuration;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.TextCellEditor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-
/**
* Basic Direct Editor configuration to rename elements.
+ *
+ * @deprecated since 3.1. Use {@link org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.AbstractBasicDirectEditorConfiguration} instead.
*/
-public abstract class AbstractBasicDirectEditorConfiguration extends DefaultDirectEditorConfiguration implements ICustomDirectEditorConfiguration {
-
- /**
- * {@inheritDoc}
- */
- public DirectEditManager createDirectEditManager(final ITextAwareEditPart host) {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public IParser createParser(final EObject host) {
- if (null == objectToEdit) {
- objectToEdit = host;
- }
- return createDirectEditorParser();
- }
-
- /**
- * {@inheritDoc}
- */
- public CellEditor createCellEditor(final Composite parent, final EObject object) {
- TextCellEditor cellEditor = new TextCellEditor(parent, SWT.BORDER);
- return cellEditor;
- }
-
- /**
- * Creation of the parser used to renamed the element.
- *
- * @return The IParser.
- */
- public abstract IParser createDirectEditorParser();
+@Deprecated
+public abstract class AbstractBasicDirectEditorConfiguration extends org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.AbstractBasicDirectEditorConfiguration {
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/DefaultDirectEditorConfiguration.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/DefaultDirectEditorConfiguration.java
index a4e1737c502..1799461489c 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/DefaultDirectEditorConfiguration.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/DefaultDirectEditorConfiguration.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2008 CEA LIST.
+ * Copyright (c) 2008, 2018 CEA LIST.
*
*
* All rights reserved. This program and the accompanying materials
@@ -12,169 +12,18 @@
* Contributors:
* Remi Schnekenburger (CEA LIST) Remi.Schnekenburger@cea.fr - Initial API and implementation
* Fanch BONNABESSE (ALL4TEC) fanch.bonnabesse@all4tec.net - Bug 497289
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 533667
*
*****************************************************************************/
package org.eclipse.papyrus.extensionpoints.editors.configuration;
-import org.eclipse.jface.dialogs.IInputValidator;
-import org.eclipse.jface.text.source.SourceViewerConfiguration;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Composite;
-
/**
* Default implementation for the {@link IDirectEditorConfiguration} interface.
+ *
+ * @deprecated since 3.1. Use {@link org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.DefaultDirectEditorConfiguration} instead.
*/
-public class DefaultDirectEditorConfiguration implements IDirectEditorConfiguration {
-
- /** Default sourceViewer configuration */
- protected SourceViewerConfiguration sourceViewerConfiguration;
-
- /** language of the edited body */
- protected String language;
-
- /** To check if the configuration is available for each type. */
- protected boolean superType;
-
- /** objectToEdit */
- protected Object objectToEdit;
-
- /** input validator */
- protected IInputValidator validator;
-
- /**
- * Returns the language of the edited body
- *
- * @return the language of the edited body
- */
- public String getLanguage() {
- return language;
- }
-
- /**
- * Sets the language of the edited body
- *
- * @param language
- * the language of the edited body
- */
- public void setLanguage(String language) {
- this.language = language;
- }
-
- /**
- * {@inheritDoc}
- */
- public Point getPreferedSize() {
- return new Point(SWT.DEFAULT, SWT.DEFAULT);
- }
-
- /**
- * {@inheritDoc}
- */
- public SourceViewerConfiguration getSourceViewerConfiguration() {
- if (sourceViewerConfiguration == null) {
- sourceViewerConfiguration = new SourceViewerConfiguration();
- }
- return sourceViewerConfiguration;
- }
-
- /**
- * {@inheritDoc}
- */
- public int getStyle() {
- return SWT.BORDER | SWT.SINGLE;
- }
-
- /**
- * {@inheritDoc}
- */
- public String getTextToEdit(Object objectToEdit) {
- return ""; //$NON-NLS-1$
- }
-
- /**
- * {@inheritDoc}
- */
- public Object postEditAction(Object objectToEdit, String newText) {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public Object preEditAction(Object objectToEdit) {
- setObjectToEdit(objectToEdit);
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public Composite createExtendedDialogArea(Composite parent) {
- return null;
- }
-
- /**
- * Returns the object to edit
- *
- * @return the object to edit
- */
- public Object getObjectToEdit() {
- return objectToEdit;
- }
-
- /**
- * Sets the object to edit
- *
- * @param objectToEdit
- * the object to edit
- */
- public void setObjectToEdit(Object objectToEdit) {
- this.objectToEdit = objectToEdit;
- }
-
- /**
- * {@inheritDoc}
- */
- public IInputValidator getInputValidator() {
- if (validator == null) {
- validator = new IInputValidator() {
-
- public String isValid(String newText) {
- // always valid
- return null;
- }
- };
- }
- return validator;
- }
-
- /**
- * {@inheritDoc}
- */
- public void setInputValidator(IInputValidator validator) {
- this.validator = validator;
- }
-
- /**
- * {@inheritDoc}
- */
- public Selection getTextSelection(String value, Object editedObject) {
- return new Selection(0, value.length());
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isSuperType() {
- return superType;
- }
+@Deprecated
+public class DefaultDirectEditorConfiguration extends org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.DefaultDirectEditorConfiguration {
- /**
- * {@inheritDoc}
- */
- public void setSuperType(boolean superType) {
- this.superType = superType;
- }
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IAdvancedEditorConfiguration.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IAdvancedEditorConfiguration.java
index d857eede3cc..cadcf66a2b5 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IAdvancedEditorConfiguration.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IAdvancedEditorConfiguration.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010, 2018 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -10,24 +10,17 @@
*
* Contributors:
* Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 533667
+ *
*****************************************************************************/
package org.eclipse.papyrus.extensionpoints.editors.configuration;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.swt.widgets.Shell;
-
-
/**
* Interface that should be implemented by advanced direct editors for Papyrus.
+ *
+ * @deprecated since 3.1. Use {@link org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration} instead.
*/
-public interface IAdvancedEditorConfiguration extends IDirectEditorConfiguration {
-
- /**
- * Creates the dialog for this direct editor
- *
- * @return the dialog created
- */
- public Dialog createDialog(Shell shell, EObject objectToEdit, String textToEdit);
+@Deprecated
+public interface IAdvancedEditorConfiguration extends org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration {
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/ICustomDirectEditorConfiguration.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/ICustomDirectEditorConfiguration.java
index fb367d5bcc3..889a44b7972 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/ICustomDirectEditorConfiguration.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/ICustomDirectEditorConfiguration.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010, 2018 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -10,28 +10,19 @@
*
* Contributors:
* CEA LIST - initial API and implementation
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 533667
+ *
*****************************************************************************/
package org.eclipse.papyrus.extensionpoints.editors.configuration;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.swt.widgets.Composite;
-
/**
*
* @author andreas muelder
*
+ * @deprecated since 3.1. Use {@link org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration} instead.
*/
-public interface ICustomDirectEditorConfiguration extends IDirectEditorConfiguration {
-
- public DirectEditManager createDirectEditManager(ITextAwareEditPart host);
-
- public IParser createParser(EObject host);
-
- public CellEditor createCellEditor(Composite parent, EObject object);
+@Deprecated
+public interface ICustomDirectEditorConfiguration extends org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration {
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IDirectEditorConfiguration.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IDirectEditorConfiguration.java
index 127fd19c0fd..58876556ff5 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IDirectEditorConfiguration.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IDirectEditorConfiguration.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2008 CEA LIST.
+ * Copyright (c) 2008, 2018 CEA LIST.
*
*
* All rights reserved. This program and the accompanying materials
@@ -12,149 +12,17 @@
* Contributors:
* Remi Schnekenburger (CEA LIST) Remi.Schnekenburger@cea.fr - Initial API and implementation
* Fanch BONNABESSE (ALL4TEC) fanch.bonnabesse@all4tec.net - Bug 497289
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 533667
*
*****************************************************************************/
package org.eclipse.papyrus.extensionpoints.editors.configuration;
-import org.eclipse.jface.dialogs.IInputValidator;
-import org.eclipse.jface.text.source.SourceViewerConfiguration;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Composite;
-
/**
* Interface that should be implemented by direct editors for Papyrus.
+ *
+ * @deprecated since 3.1. Use {@link org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration} instead.
*/
-public interface IDirectEditorConfiguration {
-
- /**
- * Returns the style for the source viewer widget
- *
- * @return the style for the source viewer widget
- * @see SWT
- */
- // @unused
- public int getStyle();
-
- /**
- * Returns the preferred size for the dialog window
- *
- * @return the preferred size for the dialog window
- */
- // @unused
- public Point getPreferedSize();
-
- /**
- * Returns the source viewer configuration for the editor
- *
- * @return the source viewer configuration for the editor
- */
- public SourceViewerConfiguration getSourceViewerConfiguration();
-
- /**
- * Returns the text to edit
- *
- * @return the text to edit
- */
- public String getTextToEdit(Object editedObject);
-
- /**
- * Action executed before opening editor dialog window
- *
- * @return the result of this action
- */
- public Object preEditAction(Object editedObject);
-
- /**
- * Action executed before closing editor dialog window
- *
- * @param newText
- * the text to save
- * @return the result of this action
- */
- public Object postEditAction(Object editedObject, String newText);
-
- /**
- * Returns the extended Area for the dialog window
- *
- * @param parent
- * the parent of the returned composite
- * @return the extended Area for the dialog window or <code>null</code> if no extension is
- * required
- */
- public Composite createExtendedDialogArea(Composite parent);
-
- /**
- * Returns the language of the edited body
- *
- * @return the language of the edited body
- */
- public String getLanguage();
-
- /**
- * Sets the language of the edited body
- *
- * @param language
- * the language of the edited body
- */
- public void setLanguage(String language);
-
- /**
- * Returns the input validator, ie indicates if the text is correct
- */
- public IInputValidator getInputValidator();
-
- /**
- * Sets the input validator, ie the element that indicates if the text is correct
- */
- // @unused
- public void setInputValidator(IInputValidator validator);
-
- /**
- * Get the text selection for the viewer
- *
- * @param value
- *
- * @return a selection
- */
- public Selection getTextSelection(String value, Object editedObject);
-
- /**
- * Class that represents an area for text selection
- */
- public static class Selection {
-
- private final int lentgh;
-
- private final int start;
-
- public Selection(int start, int lentgh) {
- this.start = start;
- this.lentgh = lentgh;
- }
-
- public int getLentgh() {
- return lentgh;
- }
-
- public int getStart() {
- return start;
- }
-
- }
-
- /**
- * Get the superType attribute value.
- *
- * @return The value of superType.
- */
- public boolean isSuperType();
+@Deprecated
+public interface IDirectEditorConfiguration extends org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration {
- /**
- * Set the superType attribute value.
- *
- * @param superType
- * the value to set.
- */
- public void setSuperType(boolean superType);
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IDirectEditorConstraint.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IDirectEditorConstraint.java
index 66bd8cfb392..b17b86bcc2e 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IDirectEditorConstraint.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IDirectEditorConstraint.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
+ * Copyright (c) 2014, 2018 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -11,33 +11,19 @@
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
* Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Bug 441962
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 533667
*
*****************************************************************************/
package org.eclipse.papyrus.extensionpoints.editors.configuration;
/**
* Constraint for a Direct Editor.
- *
+ *
* @author Camille Letavernier
*
+ * @deprecated since 3.1. Use {@link org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConstraint} instead.
*/
-public interface IDirectEditorConstraint {
-
- /**
- * Label which define the constrained. This label is displayed in preference page
- * and it is used to persist the preferences.
- *
- * @return the label
- */
- public String getLabel();
-
- /**
- * Check if the input object (current selection) corresponds to the defined constraint.
- *
- * @param selection
- * the current selection
- * @return <code>true</code> if selection matches the constraint, otherwise <code>false</code>
- */
- public boolean appliesTo(Object selection);
+@Deprecated
+public interface IDirectEditorConstraint extends org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConstraint {
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IModelGenerator.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IModelGenerator.java
index c1d481c0f19..71152798e46 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IModelGenerator.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IModelGenerator.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2008 CEA LIST.
+ * Copyright (c) 2008, 2018 CEA LIST.
*
*
* All rights reserved. This program and the accompanying materials
@@ -11,34 +11,18 @@
*
* Contributors:
* Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 533667
*
*****************************************************************************/
package org.eclipse.papyrus.extensionpoints.editors.configuration;
-import org.eclipse.core.runtime.IStatus;
-
/**
* Standard interface for classes in charge of model validation and modification from a text
* representation of a UML element
+ *
+ * @deprecated since 3.1. Use {@link org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IModelGenerator} instead.
*/
-public interface IModelGenerator {
-
- /**
- * validates the element, given its textual representation
- *
- * @param label
- * the label to validate
- * @return the {@link IStatus} corresponding to the validation
- */
- public IStatus validate(String label);
+@Deprecated
+public interface IModelGenerator extends org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IModelGenerator {
- /**
- * modifies the element, given its textual representation
- *
- * @param label
- * the label to validate
- * @return the {@link IStatus} corresponding to the validation
- */
- // @unused
- public IStatus modify(String label);
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IPopupEditorConfiguration.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IPopupEditorConfiguration.java
index 4946810cb3f..10014a8bc2e 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IPopupEditorConfiguration.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IPopupEditorConfiguration.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010, 2018 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -10,22 +10,18 @@
*
* Contributors:
* CEA LIST - initial API and implementation
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 533667
+ *
*****************************************************************************/
package org.eclipse.papyrus.extensionpoints.editors.configuration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-
/**
* This interface can be used to create an IPopupEditorHelper, that can then be used to show the editor
+ *
+ * @deprecated since 3.1. Use {@link org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration} instead.
*/
-public interface IPopupEditorConfiguration extends IDirectEditorConfiguration {
-
- /**
- * Should create an IPopupEditorHelper, that can then be used to show the editor
- *
- * It is expected that the type of the param editPart:Object is instanceof IGraphicalEditPart
- */
- IPopupEditorHelper createPopupEditorHelper(Object editPart);
+@Deprecated
+public interface IPopupEditorConfiguration extends org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration {
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/definition/DirectEditorExtensionPoint.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/definition/DirectEditorExtensionPoint.java
index c5afd0196c8..1b8fc67e1ce 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/definition/DirectEditorExtensionPoint.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/definition/DirectEditorExtensionPoint.java
@@ -11,177 +11,20 @@
* CEA LIST - initial API and implementation
* Fanch BONNABESSE (ALL4TEC) fanch.bonnabesse@all4tec.net - Bug 497289
* Ansgar Radermacher (CEA LIST) ansgar.radermacher@cea.fr - Bug 528199
- *
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 533667
+ *
*******************************************************************************/
package org.eclipse.papyrus.extensionpoints.editors.definition;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.DefaultDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConstraint;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.infra.constraints.constraints.JavaQuery;
-import org.eclipse.swt.graphics.Image;
/**
* Represented class for Extension point of Direct Editor.
+ *
+ * @deprecated since 3.1. Use {@link org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.definition.DirectEditorExtensionPoint} instead.
*/
-public class DirectEditorExtensionPoint implements IDirectEditorExtensionPoint {
-
- private static volatile DirectEditorExtensionPoint instance = null;
-
- /** Array that stores registered transformations */
- private static IDirectEditorExtensionPoint[] configurations;
-
- private static DirectEditorRegistry directEditorProvider;
-
- /** value of the language attribute */
- private String language;
-
- /** value of the superType attribute */
- private boolean superType;
-
- /** value of the editor configuration attribute */
- private IDirectEditorConfiguration directEditorConfiguration;
-
- private Class<? extends EObject> objectClassToEdit;
-
- /** the current priority of the direct editor, can be null **/
- private Integer extensionPriority;
-
- /** an optional additional constraint to filter the supported elements (In addition to the Metaclass) */
- private IDirectEditorConstraint constraint;
-
- private DirectEditorExtensionPoint() {
- super();
- init();
- }
-
- /**
- * @since 2.0
- */
- protected void init() {
- // It was not already computed,
- // returns the new Collection of DirectEditorExtensionPoint
- List<DirectEditorExtensionPoint> directEditorExtensionPoints = new ArrayList<DirectEditorExtensionPoint>();
-
- // Reading data from plug-ins
- IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor(IDirectEditorConfigurationIds.DIRECT_EDITOR_CONFIGURATION_EXTENSION_ID);
-
- // Read configuration elements for the current extension
- for (IConfigurationElement configElement : configElements) {
- try {
- DirectEditorExtensionPoint proxy = parseDirectEditorConfiguration(configElement);
-
- if (proxy != null) {
- directEditorExtensionPoints.add(proxy);
- }
- } catch (Throwable ex) {
- Activator.log.error(ex);
- continue;
- }
- } // end of configElements loop
-
- configurations = directEditorExtensionPoints.toArray(new DirectEditorExtensionPoint[directEditorExtensionPoints.size()]);
- directEditorProvider = new DirectEditorRegistry();
- directEditorProvider.init(configurations);
- }
-
- /**
- * @since 2.0
- */
- public final synchronized static DirectEditorExtensionPoint getInstance() {
- if (DirectEditorExtensionPoint.instance == null) {
- DirectEditorExtensionPoint.instance = new DirectEditorExtensionPoint();
- }
- return DirectEditorExtensionPoint.instance;
- }
-
- /**
- * Returns the set of transformations registered in the platform
- *
- * @return the set of transformations registered in the platform
- */
- public IDirectEditorExtensionPoint[] getDirectEditorConfigurations() {
- return configurations;
- }
-
- public DirectEditorRegistry getDirectEditorProvider() {
- return directEditorProvider;
- }
-
- /**
- * Retrieves the preferred editor configuration for the specified type
- *
- * @param class_
- * the type of element to edit
- * @return the preferred editor configuration for the specified type or <code>null</code>
- * @deprecated Use {@link DirectEditorsUtil#getDefaultDirectEditorExtension(Object, Object)} instead
- */
- @Deprecated
- public DirectEditorExtensionPoint getDefautDirectEditorConfiguration(EObject semanticObjectToEdit, Object selectedObject) {
- return (DirectEditorExtensionPoint) DirectEditorsUtil.getDefaultDirectEditorExtension(semanticObjectToEdit, selectedObject);
-
- }
-
- /**
- * Returns the set of transformations registered in the platform for the specified kind of
- * element
- *
- * @param the
- * type of element to be edited
- * @return the set of transformations registered in the platform for the specified kind of
- * element
- * @deprecated Use {@link DirectEditorsUtil#getDirectEditorExtensions(Object, Object)} instead
- */
- @Deprecated
- public Collection<DirectEditorExtensionPoint> getDirectEditorConfigurations(EObject semanticObjectToEdit, Object selectedObject) {
- Collection<IDirectEditorExtensionPoint> directEditorConfigurations = DirectEditorsUtil.getDirectEditorExtensions(semanticObjectToEdit, selectedObject);
-
- List<DirectEditorExtensionPoint> returnList = new ArrayList<DirectEditorExtensionPoint>();
- for (IDirectEditorExtensionPoint extension : directEditorConfigurations) {
- if (extension instanceof DirectEditorExtensionPoint) {
- returnList.add((DirectEditorExtensionPoint) extension);
- }
- }
- return returnList;
- }
-
- /**
- * Returns a configuration, given elements from the ConfigurationElement
- *
- * @param configElt
- * the element that declares the extension
- * @return a new configuration, given the information of the specified configElt
- */
- public DirectEditorExtensionPoint parseDirectEditorConfiguration(IConfigurationElement configElt) {
-
- // check that the ConfigElement is a transformation
- if (!IDirectEditorConfigurationIds.TAG_DIRECT_EDITOR_CONFIGURATION.equals(configElt.getName())) {
- return null;
- }
- // this is a transformation, tries to parse extension, and create the
- // java corresponding
- // class
- try {
- return new DirectEditorExtensionPoint(configElt);
- } catch (Exception e) {
- Activator.log(e);
- return null;
- }
- }
+@Deprecated
+public class DirectEditorExtensionPoint extends org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.definition.DirectEditorExtensionPoint {
/**
* Creates a new DirectEditorExtensionPoint, according to the ConfigurationElement
@@ -190,337 +33,7 @@ public class DirectEditorExtensionPoint implements IDirectEditorExtensionPoint {
* the configuration element corresponding to the configuration
*/
public DirectEditorExtensionPoint(IConfigurationElement configElt) {
- String attribute = getAttribute(configElt, IDirectEditorConfigurationIds.ATT_SUPER_TYPE, "false", false); //$NON-NLS-1$
- superType = attribute.equals("true"); //$NON-NLS-1$
-
- language = getAttribute(configElt, IDirectEditorConfigurationIds.ATT_LANGUAGE, "undefined", true); // should
- // already
- // be
- // a
- // string
- String objectToEdit = getAttribute(configElt, IDirectEditorConfigurationIds.ATT_OBJECT_TO_EDIT, EObject.class.getCanonicalName(), true);
-
- directEditorConfiguration = getDirectEditorConfigurationClass(configElt);
- // the constraint maybe null!
-
- extensionPriority = getPriority(configElt);
- if (directEditorConfiguration == null) {
- directEditorConfiguration = getAdvancedDirectEditorConfigurationClass(configElt);
- }
- // Block added for the case of popup editors
- if (directEditorConfiguration == null) {
- directEditorConfiguration = getPopupDirectEditorConfigurationClass(configElt);
- }
- directEditorConfiguration.setLanguage(language);
- directEditorConfiguration.setSuperType(superType);
-
- // retrieve the bundle loader of the plugin that declares the extension
- try {
- String pluginID = configElt.getContributor().getName();
- objectClassToEdit = Platform.getBundle(pluginID).loadClass(objectToEdit).asSubclass(EObject.class);
- } catch (ClassNotFoundException e) {
- Activator.log.error(e);
- } catch (ClassCastException e) {
- Activator.log.error(e);
- }
-
- if (configElt.getAttribute(IDirectEditorConfigurationIds.ATT_ADDITIONAL_CONSTRAINT) != null) {
- try {
- constraint = (IDirectEditorConstraint) configElt.createExecutableExtension(IDirectEditorConfigurationIds.ATT_ADDITIONAL_CONSTRAINT);
-
- } catch (CoreException ex) {
- Activator.log.error(ex);
- } catch (ClassCastException ex) {
- Activator.log.error(ex);
- }
- }
-
- }
-
- protected static IDirectEditorConfiguration getDirectEditorConfigurationClass(IConfigurationElement configElement) {
- IDirectEditorConfiguration configuration = null;
- try {
- if (configElement.getChildren(IDirectEditorConfigurationIds.TAG_SIMPLE_EDITOR).length > 0) {
- Object config = configElement.getChildren(IDirectEditorConfigurationIds.TAG_SIMPLE_EDITOR)[0].createExecutableExtension(IDirectEditorConfigurationIds.ATT_EDITOR_CONFIGURATION);
- if (config instanceof IDirectEditorConfiguration) {
- configuration = (IDirectEditorConfiguration) config;
- }
- }
- } catch (CoreException e) {
- Activator.log(e);
- configuration = new DefaultDirectEditorConfiguration();
- }
- return configuration;
- }
-
-
-
- /**
- * Try to load a javaQuery defined in the extension point
- *
- * @param configElement
- * the config element see {@link IConfigurationElement}
- * @return the java query class see {@link JavaQuery}, can return null because this attribute is optional
- */
- protected static JavaQuery getJavaQueryClass(IConfigurationElement configElement) {
- JavaQuery javaQuery = null;
- try {
- if (configElement.getAttribute(IDirectEditorConfigurationIds.ATT_CONSTRAINT) == null) {
- return null;
- }
- Object config = configElement.createExecutableExtension(IDirectEditorConfigurationIds.ATT_CONSTRAINT);
- if (config instanceof JavaQuery) {
- javaQuery = (JavaQuery) config;
- }
- } catch (CoreException e) {
- Activator.log(e);
- }
- return javaQuery;
- }
-
- /**
- * This priority policy has been defined so that:
- * - an external contribution is NOT the default editor with the classic configuration (LOW)
- * - an external contribution can be set to default editor(use High or Highest)
- *
- * To achieve that:
- * - the default priority is set to low
- * - Papyrus editors priority is set to medium
- * - Papyrus editors, defined to be the default ones, their priority is set at medium
- */
- protected static Integer getPriority(IConfigurationElement configElement) {
- try {
- for (IConfigurationElement childConfigElement : configElement.getChildren(IDirectEditorConfigurationIds.ATT_PRIORITY)) {
-
- String config = getAttribute(childConfigElement, IDirectEditorConfigurationIds.ATT_PRIORITY_NAME, null, true);
- if (config.equals(IDirectEditorConfigurationIds.PRIORITY_HIGHEST)) {
- return new Integer(0);
- }
- if (config.equals(IDirectEditorConfigurationIds.PRIORITY_HIGH)) {
- return new Integer(1);
- }
- if (config.equals(IDirectEditorConfigurationIds.PRIORITY_MEDIUM)) {
- return new Integer(2);
- }
- if (config.equals(IDirectEditorConfigurationIds.PRIORITY_LOW)) {
- return new Integer(3);
- }
- if (config.equals(IDirectEditorConfigurationIds.PRIORITY_LOWEST)) {
- return new Integer(4);
- }
- }
- } catch (Exception e) {
- Activator.log.error(e);
- }
- return new Integer(3); // PRIORITY_LOW
- }
-
-
- protected static IAdvancedEditorConfiguration getAdvancedDirectEditorConfigurationClass(IConfigurationElement configElement) {
- IAdvancedEditorConfiguration configuration = null;
- try {
- for (IConfigurationElement childConfigElement : configElement.getChildren(IDirectEditorConfigurationIds.TAG_ADVANCED_EDITOR)) {
- for (String attname : childConfigElement.getAttributeNames()) {
- Activator.log.debug(attname);
- }
-
- Object config = childConfigElement.createExecutableExtension(IDirectEditorConfigurationIds.ATT_EDITOR_CONFIGURATION);
- if (config instanceof IAdvancedEditorConfiguration) {
- configuration = (IAdvancedEditorConfiguration) config;
- }
- }
-
- } catch (CoreException e) {
- Activator.log.error(e);
- configuration = null;
- }
- return configuration;
- }
-
- // /////////////////////////////// TODO:(done) Method added for the case of popup editors
- protected static IDirectEditorConfiguration getPopupDirectEditorConfigurationClass(IConfigurationElement configElement) {
- IDirectEditorConfiguration configuration = null;
- try {
- for (IConfigurationElement childConfigElement : configElement.getChildren(IDirectEditorConfigurationIds.TAG_POPUP_EDITOR)) {
- for (String attname : childConfigElement.getAttributeNames()) {
- Activator.log.debug(attname);
- }
-
- Object config = childConfigElement.createExecutableExtension(IDirectEditorConfigurationIds.ATT_EDITOR_CONFIGURATION);
- if (config instanceof IDirectEditorConfiguration) {
- configuration = (IDirectEditorConfiguration) config;
- }
- }
-
- } catch (CoreException e) {
- Activator.log(e);
- configuration = null;
- }
- return configuration;
- }
-
- // ///////////////////////////////////
-
- /**
- * Returns the value of the attribute that has the given name, for the given configuration
- * element.
- * <p>
- * if the attribute has no value, and if default value is not <code>null</code>, it returns defaultValue.
- * <p>
- * if it has no value, no default value, and if the attribute is required, it throws an exception.
- *
- * @param defaultValue
- * the default value (if exists) of the attribute
- * @param isRequired
- * boolean that indicates if this attribute is required
- * @param configElt
- * configuration element that reflects the content of the extension
- * @param name
- * the name of the attribute to read
- * @return the attribute value
- */
- protected static String getAttribute(IConfigurationElement configElt, String name, String defaultValue, boolean isRequired) {
- String value = configElt.getAttribute(name);
-
- if (value != null) {
- return value;
- } else if (defaultValue != null) {
- return defaultValue;
- }
-
- if (isRequired) {
- throw new IllegalArgumentException("Missing " + name + " attribute"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- return null;
- }
-
- /**
- * Icon getter
- *
- * @return the icon which path is in extension
- */
- // @unused
- protected Image getImage(String iconPath, IConfigurationElement configElement) {
-
- // no image associated to this plug-in
- if (iconPath == null) {
- return null;
- }
- IExtension extension = configElement.getDeclaringExtension();
- String extensionPluginId = extension.getContributor().getName();
-
- return Activator.getImage(extensionPluginId, iconPath);
- }
-
- /**
- * @see org.eclipse.papyrus.extensionpoints.editors.definition.IDirectEditorExtensionPoint#getLanguage()
- *
- * @return
- */
- public String getLanguage() {
- return language;
- }
-
-
- /**
- * @see org.eclipse.papyrus.extensionpoints.editors.definition.IDirectEditorExtensionPoint#getObjectToEdit()
- *
- * @return
- */
- public String getObjectToEdit() {
- return objectClassToEdit.getCanonicalName();
- }
-
- /**
- * @see org.eclipse.papyrus.extensionpoints.editors.definition.IDirectEditorExtensionPoint#getObjectClassToEdit()
- *
- * @return
- */
- public Class<? extends EObject> getObjectClassToEdit() {
- return objectClassToEdit;
- }
-
-
- /**
- * @see org.eclipse.papyrus.extensionpoints.editors.definition.IDirectEditorExtensionPoint#getDirectEditorConfiguration()
- *
- * @return
- */
- public IDirectEditorConfiguration getDirectEditorConfiguration() {
- return directEditorConfiguration;
- }
-
-
- /**
- * @see org.eclipse.papyrus.extensionpoints.editors.definition.IDirectEditorExtensionPoint#setDirectEditorConfiguration(org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration)
- *
- * @param directEditorConfiguration
- */
- public void setDirectEditorConfiguration(IDirectEditorConfiguration directEditorConfiguration) {
- this.directEditorConfiguration = directEditorConfiguration;
- }
-
-
- /**
- * @see org.eclipse.papyrus.extensionpoints.editors.definition.IDirectEditorExtensionPoint#getPriority()
- *
- * @return
- */
- public Integer getPriority() {
- int preferencePriority = getPreferencePriority();
- return preferencePriority != -1 ? preferencePriority : extensionPriority;
- }
-
-
- /**
- * Gets the preference priority.
- *
- * @return the preference priority
- */
- private int getPreferencePriority() {
- int preferencePriority = -1;
- int preference = Activator.getDefault().getPreferenceStore().getInt(IDirectEditorsIds.EDITOR_FOR_ELEMENT + getObjectToEdit() + '.' + language);
- if (IPreferenceStore.INT_DEFAULT_DEFAULT != preference) {
- preferencePriority = preference;
- }
- return preferencePriority;
+ super(configElt);
}
-
- /**
- * @see org.eclipse.papyrus.extensionpoints.editors.definition.IDirectEditorExtensionPoint#setPriority(java.lang.Integer)
- *
- * @param priority
- */
- public void setPriority(Integer priority) {
- this.extensionPriority = priority;
- }
-
- /**
- * Gets the additional constraint.
- *
- * @return the additional constraint
- */
- public IDirectEditorConstraint getAdditionalConstraint() {
- return constraint;
- }
-
- /**
- * @see org.eclipse.papyrus.extensionpoints.editors.definition.IDirectEditorExtensionPoint#getIcon()
- *
- * @return
- */
- public Image getIcon() {
- return null;
- }
-
- /**
- * @see org.eclipse.papyrus.extensionpoints.editors.definition.IDirectEditorExtensionPoint#isSuperType()
- *
- * @return
- */
- public boolean isSuperType() {
- return superType;
- }
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/definition/DirectEditorRegistry.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/definition/DirectEditorRegistry.java
index 503daff4ca2..3dfa76887c8 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/definition/DirectEditorRegistry.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/definition/DirectEditorRegistry.java
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2012 CEA LIST.
+ * Copyright (c) 2012, 2018 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -10,135 +10,18 @@
*
* Contributors:
* Patrick Tessier (CEA LIST) - Initial API and implementation
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 533667
*
*****************************************************************************/
package org.eclipse.papyrus.extensionpoints.editors.definition;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.TreeMap;
-
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-
/**
* the goal of this class is to store all direct editors and to provides them by taking account
* object to edit, constraint, and priority
*
+ * @deprecated since 3.1. Use {@link org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.definition.DirectEditorRegistry} instead.
*/
-public class DirectEditorRegistry {
-
- // map of direct editor indexed by priorities
- protected TreeMap<Integer, List<IDirectEditorExtensionPoint>> editorMap = new TreeMap<Integer, List<IDirectEditorExtensionPoint>>();
- // list of objects that can be edited
- protected ArrayList<String> objectToEdits = new ArrayList<String>();
-
- /**
- * add a direct editor
- * if this direct editor is already used as default in preferences, its priority becomes 0
- *
- * @param directEditor
- * a direct editor, cannot be null
- */
- public void add(IDirectEditorExtensionPoint directEditor) {
- assert (directEditor != null);
- objectToEdits.add(directEditor.getObjectToEdit());
- Integer priority = directEditor.getPriority();
-
- // take in account priority of preferences
- String preferedLanguage = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + directEditor.getObjectToEdit());
-
- // if the language equals is store in preferences this is the default direct editor
- if (preferedLanguage.equals(directEditor.getLanguage())) {
- priority = new Integer(0);
- }
- List<IDirectEditorExtensionPoint> currentValue = editorMap.get(priority);
- if (currentValue == null) {
- currentValue = new ArrayList<IDirectEditorExtensionPoint>();
- }
-
- currentValue.add(directEditor);
- editorMap.put(priority, currentValue);
- }
-
- /**
- * put in preferences the editor with the more important priority
- */
- protected void adaptPreferences() {
- Iterator<String> iter = objectToEdits.iterator();
- IDirectEditorExtensionPoint defaultDirectEditor = null;
- while (iter.hasNext()) {
- String objectToEdit = iter.next();
- defaultDirectEditor = getDefaultDirectEditor(objectToEdit);
-
- String id = IDirectEditorsIds.EDITOR_FOR_ELEMENT + defaultDirectEditor.getObjectToEdit();
- String language = defaultDirectEditor.getLanguage();
- // if preference set direct editor as default, do nothing
- if (!Activator.getDefault().getPreferenceStore().getString(id).equals(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR)) {
- Activator.getDefault().getPreferenceStore().setValue(id, language);
- }
- }
- }
-
- @Override
- public String toString() {
- String out = "";
- Iterator<Integer> keyIterator = editorMap.keySet().iterator();
-
- while (keyIterator.hasNext()) {
- Integer index = keyIterator.next();
- out = out + "\n[" + index + "]" + "=[" + editorMap.get(index) + "]";
-
- }
- return out;
- }
-
- /**
- * used to fill the registry with an array of direct editors
- *
- * @param directEditors
- * cannot be null
- */
- public void init(IDirectEditorExtensionPoint[] directEditors) {
- editorMap = new TreeMap<Integer, List<IDirectEditorExtensionPoint>>();
- objectToEdits = new ArrayList<String>();
- for (int i = 0; i < directEditors.length; i++) {
- add(directEditors[i]);
-
- }
- adaptPreferences();
-
- }
-
- /**
- * get the direct editor with the higher priority for a given object to edit.
- *
- * @param ObjectToEdit
- * the string that represents the element to edit
- * @return a direct editor, it can be null
- */
- public IDirectEditorExtensionPoint getDefaultDirectEditor(String ObjectToEdit) {
- Iterator<Integer> keyIterator = editorMap.keySet().iterator();
- TreeMap<Integer, IDirectEditorExtensionPoint> directEditorExtensionPoints = new TreeMap<Integer, IDirectEditorExtensionPoint>();
- while (keyIterator.hasNext()) {
- Integer index = keyIterator.next();
- Iterator<IDirectEditorExtensionPoint> iter = editorMap.get(index).iterator();
- while (iter.hasNext()) {
- IDirectEditorExtensionPoint directEditorExtensionPoint = iter.next();
- if (directEditorExtensionPoint.getObjectToEdit().equals(ObjectToEdit)) {
- directEditorExtensionPoints.put(directEditorExtensionPoint.getPriority(), directEditorExtensionPoint);
- }
-
- }
- // if the user add a direct editor with highest priority, do not return the default direct editor but the direct editor with highest priority
- // this will set the highest priority direct editor to the default one
- if (!directEditorExtensionPoints.isEmpty()) {
- return directEditorExtensionPoints.firstEntry().getValue();
- }
- }
- return null;
- }
-
+@Deprecated
+public class DirectEditorRegistry extends org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.definition.DirectEditorRegistry {
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/definition/IDirectEditorConfigurationIds.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/definition/IDirectEditorConfigurationIds.java
index ad1a97bb54e..a2977c2eb79 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/definition/IDirectEditorConfigurationIds.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/definition/IDirectEditorConfigurationIds.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010, 2018 CEA LIST.
*
*
* All rights reserved. This program and the accompanying materials
@@ -12,6 +12,7 @@
* Contributors:
* CEA LIST - initial API and implementation
* Fanch BONNABESSE (ALL4TEC) fanch.bonnabesse@all4tec.net - Bug 497289
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 533667
*
*****************************************************************************/
@@ -19,60 +20,10 @@ package org.eclipse.papyrus.extensionpoints.editors.definition;
/**
* Constant for the direct editor extension point
+ *
+ * @deprecated since 3.1. Use {@link org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.definition.IDirectEditorConfigurationIds} instead.
*/
-public interface IDirectEditorConfigurationIds {
-
- /** id of the direct editor configuration extension point */
- public static final String DIRECT_EDITOR_CONFIGURATION_EXTENSION_ID = org.eclipse.papyrus.extensionpoints.editors.Activator.PLUGIN_ID + ".DirectEditor";
-
- /** id of the direct editor configuration element */
- public static final String TAG_DIRECT_EDITOR_CONFIGURATION = "DirectEditor";
-
- /** id of the language attribute */
- public static final String ATT_LANGUAGE = "language";
-
- /** id of the object to edit attribute */
- public static final String ATT_OBJECT_TO_EDIT = "objectToEdit";
-
- /** id of the direct editor configuration attribute */
- public static final String ATT_EDITOR_CONFIGURATION = "editorConfiguration";
-
- /** id of the direct editor "additional constraint" attribute */
- public static final String ATT_ADDITIONAL_CONSTRAINT = "additionalConstraint"; //$NON-NLS-1$
-
- /** id of the direct editor simple configuration tag */
- public static final String TAG_SIMPLE_EDITOR = "simpleeditor";
-
- /** id of the direct editor advanced configuration tag */
- public static final String TAG_ADVANCED_EDITOR = "advancededitor";
-
- /** id of the direct editor popup configuration tag */
- public static final String TAG_POPUP_EDITOR = "popupeditor";
-
- /** id of the constraint associated to a directEditor */
- public static final String ATT_CONSTRAINT = "constraint";
-
- /** id of the priority associated to a directEditor */
- public static final String ATT_PRIORITY = "Priority";
-
- /** id of the priority name associated to a directEditor */
- public static final String ATT_PRIORITY_NAME = "name";
-
- /** string that represents the lowest priority **/
- public static final String PRIORITY_LOWEST = "Lowest";
-
- /** string that represents a Low priority **/
- public static final String PRIORITY_LOW = "Low";
-
- /** string that represents a Medium priority **/
- public static final String PRIORITY_MEDIUM = "Medium";
-
- /** string that represents a High priority **/
- public static final String PRIORITY_HIGH = "High";
-
- /** string that represents the Highest priority **/
- public static final String PRIORITY_HIGHEST = "Highest";
+@Deprecated
+public interface IDirectEditorConfigurationIds extends org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.definition.IDirectEditorConfigurationIds {
- /** string that represents the superType attribute **/
- public static final String ATT_SUPER_TYPE = "superType";
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/definition/IDirectEditorExtensionPoint.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/definition/IDirectEditorExtensionPoint.java
index dd4d6acb997..be1291e863d 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/definition/IDirectEditorExtensionPoint.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/definition/IDirectEditorExtensionPoint.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2015 CEA LIST and others.
+ * Copyright (c) 2015, 2018 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -11,96 +11,20 @@
* Contributors:
* Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Initial API and implementation
* Fanch BONNABESSE (ALL4TEC) fanch.bonnabesse@all4tec.net - Bug 497289
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 533667
*
*****************************************************************************/
package org.eclipse.papyrus.extensionpoints.editors.definition;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConstraint;
-import org.eclipse.swt.graphics.Image;
-
/**
* Interface to manipulate extension point of Direct Editor.
*
* @author Gabriel Pascual
*
+ * @deprecated since 3.1. Use {@link org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.definition.IDirectEditorExtensionPoint} instead.
*/
-public interface IDirectEditorExtensionPoint {
-
- /**
- * Returns the language edited by this direct editor
- *
- * @return the language edited by this direct editor
- */
- public String getLanguage();
-
- /**
- * Returns the type of object to edit
- *
- * @return the type of object to edit
- */
- public String getObjectToEdit();
-
- /**
- * Returns the class of object to edit
- *
- * @return the class of object to edit
- */
- public Class<? extends EObject> getObjectClassToEdit();
-
- /**
- * Gets the icon.
- *
- * @return the icon
- */
- public Image getIcon();
-
- /**
- * Returns the configuration for the dialog window
- *
- * @return the configuration for the dialog window
- */
- public IDirectEditorConfiguration getDirectEditorConfiguration();
-
- /**
- * Sets the configuration for the dialog window
- *
- * @param directEditorConfiguration
- * the configuration for the dialog window
- */
- // @unused
- public void setDirectEditorConfiguration(IDirectEditorConfiguration directEditorConfiguration);
-
- /**
- * Gets the priority.
- *
- * @return the priority
- */
- public Integer getPriority();
-
-
- /**
- * Sets the priority.
- *
- * @param priority
- * the new priority
- */
- public void setPriority(Integer priority);
-
- /**
- * Gets the additional constraint.
- *
- * @return the additional constraint
- */
- public IDirectEditorConstraint getAdditionalConstraint();
-
- /**
- * Return the "superType" attribute*.
- *
- * @return The attribute.
- */
- public boolean isSuperType();
+@Deprecated
+public interface IDirectEditorExtensionPoint extends org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.definition.IDirectEditorExtensionPoint {
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/preferences/PapyrusEmbeddedEditorsPreferencePage.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/preferences/PapyrusEmbeddedEditorsPreferencePage.java
index 42a42bda44d..2618fbf76ae 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/preferences/PapyrusEmbeddedEditorsPreferencePage.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/preferences/PapyrusEmbeddedEditorsPreferencePage.java
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2008 CEA LIST.
+ * Copyright (c) 2008, 2018 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -12,51 +12,11 @@
* Remi Schnekenburger (CEA LIST) - Initial API and implementation
* Gabriel Pascual (ALL4TEC) gabriel.pascual - Bug 441962
* Fanch BONNABESSE (ALL4TEC) fanch.bonnabesse@all4tec.net - Bug 497289
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 533667
*
*****************************************************************************/
package org.eclipse.papyrus.extensionpoints.editors.preferences;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.ColumnLabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TableViewerColumn;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConstraint;
-import org.eclipse.papyrus.extensionpoints.editors.definition.DirectEditorExtensionPoint;
-import org.eclipse.papyrus.extensionpoints.editors.definition.IDirectEditorConfigurationIds;
-import org.eclipse.papyrus.extensionpoints.editors.definition.IDirectEditorExtensionPoint;
-import org.eclipse.papyrus.extensionpoints.editors.preferences.provider.DirectEditorContentProvider;
-import org.eclipse.papyrus.extensionpoints.editors.preferences.provider.DirectEditorLabelProvider;
-import org.eclipse.papyrus.extensionpoints.editors.preferences.provider.DirectEditorTreeItem;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-
/**
* The file editors page presents the collection of file names and extensions for which the user has
* registered editors. It also lets the user add new internal or external (program) editors for a
@@ -67,503 +27,10 @@ import org.eclipse.ui.IWorkbenchPreferencePage;
*
* The set of registered editors is tracked by the EditorRegistery available from the workbench
* plugin.
+ *
+ * @deprecated since 3.1. Use {@link org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.preferences.PapyrusEmbeddedEditorsPreferencePage} instead.
*/
-public class PapyrusEmbeddedEditorsPreferencePage extends PreferencePage implements IWorkbenchPreferencePage, Listener {
-
- /**
- *
- */
- private static final String PRIORITY_COLUMN_TITLE = "Priority";
-
- /** The Constant ELEMENTS_TO_EDIT_VIEWER_LABEL. */
- private static final String ELEMENTS_TO_EDIT_VIEWER_LABEL = "Elements to edit";
-
- /** The Constant DEFAULT_BUTTON_LABEL. */
- private static final String DEFAULT_BUTTON_LABEL = "Default";
-
- /** The Constant DIRECT_EDITOR_PART_LABEL. */
- private static final String DIRECT_EDITOR_PART_LABEL = "Associated editor";
-
- /** The Constant PREFERENCE_KEY_SEPARATOR. */
- private static final String PREFERENCE_KEY_SEPARATOR = "."; //$NON-NLS-1$
-
- /** The Constant DEFAULT_EDITOR_LABEL. */
- protected static final String DEFAULT_EDITOR_LABEL = " (Default Editor)"; //$NON-NLS-1$
-
- protected TableViewer editorTable;
-
- protected Button defaultEditorButton;
-
- protected Label editorLabel;
-
- protected IWorkbench workbench;
-
- private TreeViewer elementTypeViewer;
-
- /**
- * Creates the page's UI content.
- */
- @Override
- protected Control createContents(Composite parent) {
-
-
- // define container & its layout
- Composite pageComponent = createMainComposite(parent);
-
- // layout the top table & its buttons
- createElementTypePart(pageComponent);
-
-
- // layout the bottom table & its buttons
- createDirectEditorPart(pageComponent);
-
- createButtonsPanel(pageComponent);
-
-
- fillEditorTree();
-
- fillEditorTable();
- updateEnabledState();
-
- applyDialogFont(pageComponent);
-
- return pageComponent;
- }
-
- /**
- * Creates the buttons panel.
- *
- * @param parent
- * the parent
- */
- private void createButtonsPanel(Composite parent) {
- Composite groupComponent;
- GridLayout groupLayout;
- GridData data;
- groupComponent = new Composite(parent, SWT.NULL);
- groupLayout = new GridLayout();
- groupLayout.marginWidth = 0;
- groupLayout.marginHeight = 0;
- groupComponent.setLayout(groupLayout);
- data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- groupComponent.setLayoutData(data);
-
- defaultEditorButton = new Button(groupComponent, SWT.PUSH);
- defaultEditorButton.setText(DEFAULT_BUTTON_LABEL);
- defaultEditorButton.addListener(SWT.Selection, this);
- setButtonLayoutData(defaultEditorButton);
- }
-
- /**
- * Creates the direct editor part.
- *
- * @param pageComponent
- * the page component
- */
- private void createDirectEditorPart(Composite pageComponent) {
-
- editorLabel = new Label(pageComponent, SWT.LEFT);
- editorLabel.setText(DIRECT_EDITOR_PART_LABEL);
-
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.horizontalSpan = 2;
- editorLabel.setLayoutData(data);
-
- editorTable = new TableViewer(pageComponent, SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER);
- editorTable.getTable().addListener(SWT.Selection, this);
- editorTable.getTable().addListener(SWT.DefaultSelection, this);
- editorTable.getTable().setLinesVisible(true);
- editorTable.getTable().setHeaderVisible(true);
- editorTable.setContentProvider(ArrayContentProvider.getInstance());
-
- createEditorNameColumn();
- createEditorPriorityColumn();
-
-
- data = new GridData(GridData.FILL_BOTH);
- data.heightHint = editorTable.getTable().getItemHeight() * 7;
- editorTable.getTable().setLayoutData(data);
- }
-
- /**
- * Creates the editor priority column.
- */
- private void createEditorPriorityColumn() {
- TableViewerColumn editorPriorityColumn = new TableViewerColumn(editorTable, SWT.NONE);
- editorPriorityColumn.getColumn().setWidth(200);
- editorPriorityColumn.getColumn().setText(PRIORITY_COLUMN_TITLE);
- editorPriorityColumn.setLabelProvider(new ColumnLabelProvider() {
- /**
- * @see org.eclipse.jface.viewers.ColumnLabelProvider#getText(java.lang.Object)
- *
- * @param element
- * @return
- */
- @Override
- public String getText(Object element) {
- String priorityLabel = "<Unknown>";
- if (element instanceof IDirectEditorExtensionPoint) {
- switch (((IDirectEditorExtensionPoint) element).getPriority()) {
- case 0:
- priorityLabel = IDirectEditorConfigurationIds.PRIORITY_HIGHEST;
- break;
- case 1:
- priorityLabel = IDirectEditorConfigurationIds.PRIORITY_HIGH;
- break;
- case 2:
- priorityLabel = IDirectEditorConfigurationIds.PRIORITY_MEDIUM;
- break;
- case 3:
- priorityLabel = IDirectEditorConfigurationIds.PRIORITY_LOW;
- break;
- case 4:
- priorityLabel = IDirectEditorConfigurationIds.PRIORITY_LOWEST;
- break;
-
- default:
- break;
- }
- ;
- }
- return priorityLabel;
- }
- });
-
- PriorityEditorEditingSupport editingSupport = new PriorityEditorEditingSupport(editorTable);
- editorPriorityColumn.setEditingSupport(editingSupport);
- }
-
- /**
- * Creates the editor name column.
- */
- private void createEditorNameColumn() {
- TableViewerColumn editorNameColumn = new TableViewerColumn(editorTable, SWT.NONE);
- editorNameColumn.getColumn().setWidth(200);
- editorNameColumn.getColumn().setText("Name");
- editorNameColumn.setLabelProvider(new ColumnLabelProvider() {
- /**
- * @see org.eclipse.jface.viewers.ColumnLabelProvider#getText(java.lang.Object)
- *
- * @param element
- * @return
- */
- @Override
- public String getText(Object element) {
- String label = "<Unknown>";
- if (element instanceof IDirectEditorExtensionPoint) {
- String elementType = getSelectedElementType();
- String preferedLanguage = getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + elementType);
- // retrieves if this editor is the default one or not.
- label = ((IDirectEditorExtensionPoint) element).getLanguage();
- if (preferedLanguage.equals(((IDirectEditorExtensionPoint) element).getLanguage())) {
- label += DEFAULT_EDITOR_LABEL;
- }
- }
- return label;
- }
-
- });
- }
-
- /**
- * Creates the element type part.
- *
- * @param pageComponent
- * the page component
- */
- private void createElementTypePart(Composite pageComponent) {
- Label label = new Label(pageComponent, SWT.LEFT);
- label.setText(ELEMENTS_TO_EDIT_VIEWER_LABEL);
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.horizontalSpan = 2;
- label.setLayoutData(data);
-
- elementTypeViewer = new TreeViewer(pageComponent);
- elementTypeViewer.setContentProvider(new DirectEditorContentProvider());
- elementTypeViewer.setLabelProvider(new DirectEditorLabelProvider());
- elementTypeViewer.getTree().addListener(SWT.Selection, this);
- elementTypeViewer.getTree().addListener(SWT.DefaultSelection, this);
-
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalAlignment = GridData.FILL;
- data.heightHint = elementTypeViewer.getTree().getItemHeight() * 10; // ten lines
- // shown
- elementTypeViewer.getTree().setLayoutData(data);
-
- }
-
- /**
- * Creates the main composite.
- *
- * @param parent
- * the parent
- * @return the composite
- */
- private Composite createMainComposite(Composite parent) {
- Composite pageComponent = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- pageComponent.setLayout(layout);
- GridData data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- pageComponent.setLayoutData(data);
- return pageComponent;
- }
-
-
-
- /**
- * Hook method to get a page specific preference store. Reimplement this method if a page don't
- * want to use its parent's preference store.
- */
- @Override
- protected IPreferenceStore doGetPreferenceStore() {
- return Activator.getDefault().getPreferenceStore();
- }
-
- /**
- * Fill editor table.
- */
- protected void fillEditorTable() {
- editorTable.getTable().removeAll();
-
- List<IDirectEditorExtensionPoint> editors = getAssociatedEditors();
- editors.add(SimpleDirectEditorExtension.getInstance());
- editorTable.setInput(editors.toArray());
-
- }
-
- /**
- * Fill editor tree.
- */
- private void fillEditorTree() {
- Map<String, List<IDirectEditorExtensionPoint>> elements = new HashMap<String, List<IDirectEditorExtensionPoint>>();
-
- // Populate the table with the items
- IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations();
- List<IDirectEditorExtensionPoint> configurations;
- for (IDirectEditorExtensionPoint extensionPoint : extensionPoints) {
- if (!elements.containsKey(extensionPoint.getObjectToEdit())) {
- // no configuration yet for this element.
- configurations = new ArrayList<IDirectEditorExtensionPoint>();
- } else {
- configurations = elements.get(extensionPoint.getObjectToEdit());
- }
- configurations.add(extensionPoint);
- // replace configuration list
- elements.put(extensionPoint.getObjectToEdit(), configurations);
- }
-
- // Build the input to display
- Set<String> keys = elements.keySet();
- List<DirectEditorTreeItem> preferencesItemsList = new ArrayList<DirectEditorTreeItem>(keys.size());
-
- for (String key : keys) {
- preferencesItemsList.add(new DirectEditorTreeItem(elements.get(key)));
- }
- elementTypeViewer.setInput(preferencesItemsList);
-
- // Set selection
- elementTypeViewer.setSelection(new StructuredSelection(preferencesItemsList.get(0)));
- }
-
-
- /**
- * Gets the selected element type.
- *
- * @return the selected element type
- */
- protected String getSelectedElementType() {
- String selectedElementType = null;
- ISelection selection = elementTypeViewer.getSelection();
- if (!selection.isEmpty()) {
- if (selection instanceof IStructuredSelection) {
- // Tree is single select
- Object selectedElement = ((IStructuredSelection) selection).getFirstElement();
- if (selectedElement instanceof DirectEditorTreeItem) {
-
- // Preference key is the qualified name of edited Meta Class
- selectedElementType = ((DirectEditorTreeItem) selectedElement).getMetaClassToEdit();
- } else if (selectedElement instanceof IDirectEditorConstraint) {
- Object parentElement = getParentTreeItem();
- if (parentElement instanceof DirectEditorTreeItem) {
-
- // Preference key is the qualified name of edited Meta Class with Constraint name
- selectedElementType = ((DirectEditorTreeItem) parentElement).getMetaClassToEdit() + PREFERENCE_KEY_SEPARATOR + ((IDirectEditorConstraint) selectedElement).getLabel();
- }
- }
-
- }
- }
- return selectedElementType;
- }
-
- /**
- * Gets the parent tree item.
- *
- * @return the parent tree item
- */
- private Object getParentTreeItem() {
- // Tree is single select
- TreeItem parentItem = elementTypeViewer.getTree().getSelection()[0].getParentItem();
- Object parentElement = parentItem.getData();
- return parentElement;
- }
-
- /**
- * Returns all {@link DirectEditorExtensionPoint} for the current selected element type
- *
- * @return all {@link DirectEditorExtensionPoint} for the current selected element type or <code>null</code.
- */
- protected List<IDirectEditorExtensionPoint> getAssociatedEditors() {
- List<IDirectEditorExtensionPoint> associatedEditors = new ArrayList<IDirectEditorExtensionPoint>();
-
- if (getSelectedElementType() != null) {
-
- ISelection selection = elementTypeViewer.getSelection();
-
- // Handle the selection
- if (selection instanceof IStructuredSelection) {
- Object selectedElement = ((IStructuredSelection) selection).getFirstElement();
- if (selectedElement instanceof IDirectEditorConstraint) {
-
- Object parentElement = getParentTreeItem();
- if (parentElement instanceof DirectEditorTreeItem) {
- associatedEditors.addAll(((DirectEditorTreeItem) parentElement).getConstrainedEditor((IDirectEditorConstraint) selectedElement));
- }
-
- } else {
- DirectEditorTreeItem treeItem = (DirectEditorTreeItem) selectedElement;
- associatedEditors.addAll(treeItem.getConfigurations());
- }
- }
- }
- return associatedEditors;
- }
-
- public void handleEvent(Event event) {
- /*
- * if (event.widget == upEditorButton) { promptForEditor(); } else if (event.widget ==
- * downEditorButton) { removeSelectedEditor(); } else
- */if (event.widget == defaultEditorButton) {
- setSelectedEditorAsDefault();
- } else if (event.widget == elementTypeViewer.getTree()) {
- fillEditorTable();
- }
-
- updateEnabledState();
-
- }
-
- /**
- * @see IWorkbenchPreferencePage
- */
- public void init(IWorkbench aWorkbench) {
- this.workbench = aWorkbench;
- noDefaultAndApplyButton();
- }
-
- /**
- * Add the selected editor to the default list.
- */
- public void setSelectedEditorAsDefault() {
-
- ISelection selection = editorTable.getSelection();
- IDirectEditorExtensionPoint extensionPoint = null;
- if (!selection.isEmpty()) {
- // First change the label of the old default
- // Now set the new default
- if (selection instanceof IStructuredSelection) {
- Object selectedElement = ((IStructuredSelection) selection).getFirstElement();
- if (selectedElement instanceof IDirectEditorExtensionPoint) {
- extensionPoint = (IDirectEditorExtensionPoint) selectedElement;
- }
- }
- // retrieve current object to edit name
- getPreferenceStore().setValue(IDirectEditorsIds.EDITOR_FOR_ELEMENT + getSelectedElementType(), (extensionPoint != null) ? extensionPoint.getLanguage() : IDirectEditorsIds.SIMPLE_DIRECT_EDITOR);
- editorTable.refresh();
-
-
- }
- }
-
- /**
- * Update the enabled state.
- */
- public void updateEnabledState() {
- // Update enabled state
- boolean resourceTypeSelected = elementTypeViewer.getTree().getSelection() != null;
- boolean editorSelected = editorTable.getTable().getSelectionIndex() != -1;
-
- editorLabel.setEnabled(resourceTypeSelected);
- defaultEditorButton.setEnabled(editorSelected);
- }
-
- /**
- * Extension point for Simple Editor.
- */
- private static class SimpleDirectEditorExtension implements IDirectEditorExtensionPoint {
-
- public static IDirectEditorExtensionPoint getInstance() {
- return new SimpleDirectEditorExtension();
- }
-
- /**
- * Constructor.
- *
- */
- private SimpleDirectEditorExtension() {
- priority = 3;
- }
-
- private Integer priority;
-
- public void setPriority(Integer priority) {
- this.priority = priority;
- }
-
- public void setDirectEditorConfiguration(IDirectEditorConfiguration directEditorConfiguration) {
-
- }
-
- public Integer getPriority() {
- return priority;
- }
-
- public String getObjectToEdit() {
- return null;
- }
-
- public Class<? extends EObject> getObjectClassToEdit() {
- return null;
- }
-
- public String getLanguage() {
- return IDirectEditorsIds.SIMPLE_DIRECT_EDITOR;
- }
-
- public Image getIcon() {
- return null;
- }
-
- public IDirectEditorConfiguration getDirectEditorConfiguration() {
- return null;
- }
-
- public IDirectEditorConstraint getAdditionalConstraint() {
- return null;
- }
-
- public boolean isSuperType() {
- return false;
- }
- };
+@Deprecated
+public class PapyrusEmbeddedEditorsPreferencePage extends org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.preferences.PapyrusEmbeddedEditorsPreferencePage {
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/preferences/PriorityEditorEditingSupport.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/preferences/PriorityEditorEditingSupport.java
index 0bca49b3326..8b9fde6609f 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/preferences/PriorityEditorEditingSupport.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/preferences/PriorityEditorEditingSupport.java
@@ -1,6 +1,6 @@
/*****************************************************************************
- * Copyright (c) 2015 CEA LIST and others.
- *
+ * Copyright (c) 2015, 2018 CEA LIST and others.
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -10,33 +10,23 @@
*
* Contributors:
* Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Initial API and implementation
- *
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 533667
+ *
*****************************************************************************/
package org.eclipse.papyrus.extensionpoints.editors.preferences;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.ComboBoxCellEditor;
-import org.eclipse.jface.viewers.EditingSupport;
import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.papyrus.extensionpoints.editors.definition.IDirectEditorConfigurationIds;
-import org.eclipse.papyrus.extensionpoints.editors.definition.IDirectEditorExtensionPoint;
/**
* Editing Support for cell of Priority editor.
- *
+ *
* @author Gabriel Pascual
*
+ * @deprecated since 3.1. Use {@link org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.preferences.PriorityEditorEditingSupport} instead.
*/
-public class PriorityEditorEditingSupport extends EditingSupport {
-
- /** The Constant priorityItems. */
- private static final String[] priorityItems = new String[] { IDirectEditorConfigurationIds.PRIORITY_HIGHEST,
- IDirectEditorConfigurationIds.PRIORITY_HIGH, IDirectEditorConfigurationIds.PRIORITY_MEDIUM,
- IDirectEditorConfigurationIds.PRIORITY_LOW, IDirectEditorConfigurationIds.PRIORITY_LOWEST };
-
- /** The cell editor. */
- private CellEditor cellEditor;
+@Deprecated
+public class PriorityEditorEditingSupport extends org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.preferences.PriorityEditorEditingSupport {
/**
* Constructor.
@@ -46,61 +36,5 @@ public class PriorityEditorEditingSupport extends EditingSupport {
*/
public PriorityEditorEditingSupport(TableViewer viewer) {
super(viewer);
-
- cellEditor = new ComboBoxCellEditor(viewer.getTable(), priorityItems);
}
-
- /**
- * @see org.eclipse.jface.viewers.EditingSupport#setValue(java.lang.Object, java.lang.Object)
- *
- * @param element
- * @param value
- */
- @Override
- protected void setValue(Object element, Object value) {
- if (element instanceof IDirectEditorExtensionPoint) {
- ((IDirectEditorExtensionPoint) element).setPriority((Integer) value);
- getViewer().refresh();
- }
- }
-
- /**
- * @see org.eclipse.jface.viewers.EditingSupport#getValue(java.lang.Object)
- *
- * @param element
- * @return
- */
- @Override
- protected Object getValue(Object element) {
- Object value = 0;
- if (element instanceof IDirectEditorExtensionPoint) {
- value = ((IDirectEditorExtensionPoint) element).getPriority();
- }
- return value;
- }
-
- /**
- * @see org.eclipse.jface.viewers.EditingSupport#getCellEditor(java.lang.Object)
- *
- * @param element
- * @return
- */
- @Override
- protected CellEditor getCellEditor(Object element) {
- return cellEditor;
- }
-
- /**
- * @see org.eclipse.jface.viewers.EditingSupport#canEdit(java.lang.Object)
- *
- * @param element
- * @return
- */
- @Override
- protected boolean canEdit(Object element) {
- return element instanceof IDirectEditorExtensionPoint;
-
- }
-
-
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/DirectEditExecutableExtension.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/DirectEditExecutableExtension.java
index 727330569b1..1b600faf341 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/DirectEditExecutableExtension.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/DirectEditExecutableExtension.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2008 CEA LIST.
+ * Copyright (c) 2008, 2018 CEA LIST.
*
*
* All rights reserved. This program and the accompanying materials
@@ -11,21 +11,17 @@
*
* Contributors:
* Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 533667
*
*****************************************************************************/
package org.eclipse.papyrus.extensionpoints.editors.ui;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExecutableExtension;
-
-//@unused
-public class DirectEditExecutableExtension implements IExecutableExtension {
-
- public DirectEditExecutableExtension() {
- }
-
- public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
- }
+/**
+ *
+ * @deprecated since 3.1. Use {@link org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.DirectEditExecutableExtension} instead.
+ */
+@Deprecated
+// @unused
+public class DirectEditExecutableExtension extends org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.DirectEditExecutableExtension {
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/DirectEditorsContributionItem.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/DirectEditorsContributionItem.java
index e79c8d6af33..23a460f6479 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/DirectEditorsContributionItem.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/DirectEditorsContributionItem.java
@@ -1,6 +1,6 @@
/*****************************************************************************
- * Copyright (c) 2015 CEA LIST.
- *
+ * Copyright (c) 2015, 2018 CEA LIST.
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -11,49 +11,24 @@
* Contributors:
* CEA LIST - Initial API and implementation
* Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Bug 441962
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 533667
+ *
*****************************************************************************/
package org.eclipse.papyrus.extensionpoints.editors.ui;
-import java.util.Collection;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.action.ContributionItem;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.extensionpoints.editors.definition.IDirectEditorExtensionPoint;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
-import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.CoolBar;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.ui.ISelectionService;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.menus.IWorkbenchContribution;
-import org.eclipse.ui.services.IServiceLocator;
-
/**
* Contribution to contextual menu for Direct Editor extension.
+ *
+ * @deprecated since 3.1. Use {@link org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.MultiReconciler} instead.
*/
-public class DirectEditorsContributionItem extends ContributionItem implements IWorkbenchContribution {
-
- /**
- * Service locator given to this contribution item using the {@link IWorkbenchContribution} interface.
- */
- private IServiceLocator serviceLocator;
-
- private MenuItem subMenuItem;
+@Deprecated
+public class DirectEditorsContributionItem extends org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.DirectEditorsContributionItem {
/**
*
*/
public DirectEditorsContributionItem() {
- setId("org.eclipse.papyrus.editors.menuitem"); //$NON-NLS-1$
+ super();
}
/**
@@ -62,250 +37,4 @@ public class DirectEditorsContributionItem extends ContributionItem implements I
public DirectEditorsContributionItem(String id) {
super(id);
}
-
- /**
- * The default implementation of this <code>IContributionItem</code> method does nothing.
- * Subclasses may override.
- */
- @Override
- public void dispose() {
- if (subMenuItem != null && !subMenuItem.isDisposed()) {
- subMenuItem.dispose();
- }
- }
-
- /**
- * The default implementation of this <code>IContributionItem</code> method does nothing.
- * Subclasses may override.
- */
- @Override
- public void fill(Composite parent) {
- }
-
- /**
- * The default implementation of this <code>IContributionItem</code> method does nothing.
- * Subclasses may override.
- */
- @Override
- public void fill(Menu menu, int index) {
- // retrieves current selection
- final Object selectedElement = getSelectedElement();
-
- // first case: this class was not able to retrieve the selection service
- // or does not understand the current selection.
- // does not build any sub-menu and returns.
- if (selectedElement == null) {
- return;
- }
-
- // get the UML object type of this element, using the business resolver
- final EObject businessObject = EMFHelper.getEObject(selectedElement);
-
- // no object found: exit
- if (businessObject == null) {
- return;
- }
-
- // retrieves all editor configurations for this kind of element
- final Collection<IDirectEditorExtensionPoint> configurations = DirectEditorsUtil.getDirectEditorExtensions(businessObject, selectedElement);
-
- // if configurations is not empty, a submenu should open to select which
- // editor to use...
-
- if (configurations.isEmpty()) {
- return;
- }
-
- createSubMenu(menu, index, selectedElement, businessObject, configurations);
- }
-
- // creates the submenu "open editors" > "edit with UML", "edit with AL", etc
- protected void createSubMenu(Menu menu, int index, Object selectedElement, EObject businessObject, Collection<IDirectEditorExtensionPoint> configurations) {
- // create direct item, and then create sub-items
- subMenuItem = new MenuItem(menu, SWT.CASCADE);
- String type = ((businessObject instanceof EObject) ?
- businessObject.eClass().getName() : ""); //$NON-NLS-1$
-
- subMenuItem.setText("Edit " + type); //$NON-NLS-1$
-
- // submenu
- Menu subMenu = new Menu(menu);
- subMenuItem.setMenu(subMenu);
-
- // items on the submenu
- // there are as many items as configurations
- final IDirectEditorExtensionPoint defaultConfig = DirectEditorsUtil.getDefaultDirectEditorExtension(businessObject, selectedElement);
-
- for (final IDirectEditorExtensionPoint configuration : configurations) {
- MenuItem item = new MenuItem(subMenu, SWT.NONE);
- StringBuffer buffer = new StringBuffer();
- buffer.append("Using "); //$NON-NLS-1$
- buffer.append(configuration.getLanguage());
- if (configuration.equals(defaultConfig)) {
- buffer.append(" (Default via F2)"); //$NON-NLS-1$
- }
- item.setText(buffer.toString());
- item.addSelectionListener(new SelectionListener() {
-
- /**
- * {@inheritDoc}
- */
- public void widgetDefaultSelected(SelectionEvent e) {
-
- }
-
- /**
- * {@inheritDoc}
- */
- public void widgetSelected(SelectionEvent e) {
- // launch editor
- GMFEmbeddedEditorActionDelegate actionDelegate = new GMFEmbeddedEditorActionDelegate();
- actionDelegate.setActivePart(null, ((IMultiDiagramEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor()).getActiveEditor());
- actionDelegate.selectionChanged(null, getSelection());
- actionDelegate.setExtensionPointConfiguration(configuration);
- actionDelegate.run(null);
- }
- });
- }
- }
-
- /**
- * Retrieves and return the current selected element
- *
- * @return the current selected element
- */
- protected Object getSelectedElement() {
- ISelection selection = getSelection();
- // this checks if it is the good instance AND if it is not null
- if (selection instanceof IStructuredSelection) {
- return ((IStructuredSelection) selection).getFirstElement();
- }
- return null;
- }
-
- /**
- * Retrieves and return the current selection
- *
- * @return the current selection
- */
- protected ISelection getSelection() {
- ISelectionService selectionService = getSelectionService();
- if (selectionService != null) {
- return selectionService.getSelection();
- }
- return null;
- }
-
- /**
- * Returns the selection service for the current workbench
- *
- * @return the selection service for the current workbench or <code>null</code> if no selection
- * service was found.
- */
- protected ISelectionService getSelectionService() {
- ISelectionService selectionService = serviceLocator.getService(ISelectionService.class);
- return selectionService;
- }
-
- /**
- * The default implementation of this <code>IContributionItem</code> method does nothing.
- * Subclasses may override.
- */
- @Override
- public void fill(ToolBar parent, int index) {
- }
-
- /**
- * The default implementation of this <code>IContributionItem</code> method does nothing.
- * Subclasses may override.
- *
- * @since 3.0
- */
- @Override
- public void fill(CoolBar parent, int index) {
- }
-
- /**
- * The default implementation of this <code>IContributionItem</code> method does nothing.
- * Subclasses may override.
- *
- * @since 3.0
- */
- @Override
- public void saveWidgetState() {
- }
-
- /**
- * The default implementation of this <code>IContributionItem</code> method returns <code>false</code>. Subclasses may override.
- */
- @Override
- public boolean isDirty() {
- // @issue should this be false instead of calling isDynamic()?
- return true;
- }
-
- /**
- * The default implementation of this <code>IContributionItem</code> method returns <code>true</code>. Subclasses may override.
- */
- @Override
- public boolean isEnabled() {
- return true;
- }
-
- /**
- * The default implementation of this <code>IContributionItem</code> method returns <code>false</code>. Subclasses may override.
- */
- @Override
- public boolean isDynamic() {
- return true;
- }
-
- /**
- * The default implementation of this <code>IContributionItem</code> method returns <code>false</code>. Subclasses may override.
- */
- @Override
- public boolean isGroupMarker() {
- return false;
- }
-
- /**
- * The default implementation of this <code>IContributionItem</code> method returns <code>false</code>. Subclasses may override.
- */
- @Override
- public boolean isSeparator() {
- return false;
- }
-
- /**
- * Returns a string representation of this contribution item suitable only for debugging.
- */
- @Override
- public String toString() {
- return getClass().getName() + "(id=" + getId() + ")";//$NON-NLS-2$//$NON-NLS-1$
- }
-
- /**
- * The default implementation of this <code>IContributionItem</code> method does nothing.
- * Subclasses may override.
- */
- @Override
- public void update() {
- }
-
- /**
- * The <code>ContributionItem</code> implementation of this method declared on <code>IContributionItem</code> does nothing. Subclasses should
- * override to update their
- * state.
- */
- @Override
- public void update(String id) {
- }
-
- /**
- * {@inheritDoc}
- */
- public void initialize(IServiceLocator serviceLocator) {
- assert (serviceLocator != null);
- this.serviceLocator = serviceLocator;
- }
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/EmbeddedEditorReconcilingStrategy.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/EmbeddedEditorReconcilingStrategy.java
index 1d61fa9526f..5d4867f5d52 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/EmbeddedEditorReconcilingStrategy.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/EmbeddedEditorReconcilingStrategy.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2008 CEA LIST.
+ * Copyright (c) 2008, 2018 CEA LIST.
*
*
* All rights reserved. This program and the accompanying materials
@@ -11,19 +11,22 @@
*
* Contributors:
* Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 533667
*
*****************************************************************************/
package org.eclipse.papyrus.extensionpoints.editors.ui;
import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.ui.texteditor.spelling.SpellingReconcileStrategy;
import org.eclipse.ui.texteditor.spelling.SpellingService;
/**
* Reconcile strategy used for spell checking and semantic verification
+ *
+ * @deprecated since 3.1. Use {@link org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.EmbeddedEditorReconcilingStrategy} instead.
*/
+@Deprecated
// @unused
-public class EmbeddedEditorReconcilingStrategy extends SpellingReconcileStrategy {
+public class EmbeddedEditorReconcilingStrategy extends org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.EmbeddedEditorReconcilingStrategy {
/**
* Creates a new EmbeddedEditorReconcilingStrategy.
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/ErrorAnnotation.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/ErrorAnnotation.java
index fdc7f43094b..3aee9038ae4 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/ErrorAnnotation.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/ErrorAnnotation.java
@@ -1,37 +1,39 @@
-/**
+/*****************************************************************************
+ * Copyright (c) 2008, 2018 CEA LIST.
*
- */
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 533667
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.extensionpoints.editors.ui;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.text.source.Annotation;
-import org.eclipse.jface.text.source.IAnnotationAccessExtension;
-import org.eclipse.jface.text.source.IAnnotationPresentation;
-import org.eclipse.jface.text.source.ImageUtilities;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Display;
-
/**
* Extended annotation class for error annotation in embedded editors
+ *
+ * @deprecated since 3.1. Use {@link org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ErrorAnnotation} instead.
*/
-public class ErrorAnnotation extends Annotation implements IAnnotationPresentation {
+@Deprecated
+public class ErrorAnnotation extends org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ErrorAnnotation {
/**
* Creates a new annotation with the given properties.
*
- * @param type
- * the unique name of this annotation type
* @param isPersistent
* <code>true</code> if this annotation is persistent, <code>false</code> otherwise
* @param text
* the text associated with this annotation
*/
public ErrorAnnotation(boolean isPersistent, String text) {
- super(TYPE, isPersistent, text);
+ super(isPersistent, text);
}
/**
@@ -42,68 +44,6 @@ public class ErrorAnnotation extends Annotation implements IAnnotationPresentati
*/
// @unused
public ErrorAnnotation(boolean isPersistent) {
- this(isPersistent, "no text");
- }
-
- /**
- * The type of projection annotations.
- */
- public static final String TYPE = "org.eclipse.ui.workbench.texteditor.error"; //$NON-NLS-1$
-
- /** error image */
- private static Image fgErrorImage;
-
- /**
- * Class that disposes image on demand
- */
- private static class DisplayDisposeRunnable implements Runnable {
-
- public void run() {
- if (fgErrorImage != null) {
- fgErrorImage.dispose();
- fgErrorImage = null;
- }
- }
+ super(isPersistent);
}
-
- /**
- * {@inheritDoc}
- */
- public int getLayer() {
- return IAnnotationAccessExtension.DEFAULT_LAYER;
- }
-
- /*
- * @see org.eclipse.jface.text.source.IAnnotationPresentation#paint(org.eclipse
- * .swt.graphics.GC, org.eclipse.swt.widgets.Canvas, org.eclipse.swt.graphics.Rectangle)
- */
- public void paint(GC gc, Canvas canvas, Rectangle rectangle) {
- Image image = getImage(canvas.getDisplay());
- if (image != null) {
- ImageUtilities.drawImage(image, gc, canvas, rectangle, SWT.CENTER, SWT.TOP);
- }
- }
-
- /**
- * Returns the image to be drawn
- *
- * @param display
- * the current display
- * @return the image to be drawn
- */
- protected Image getImage(Display display) {
- initializeImages(display);
- return fgErrorImage;
- }
-
- private void initializeImages(Display display) {
- if (fgErrorImage == null) {
-
- ImageDescriptor descriptor = ImageDescriptor.createFromFile(ErrorAnnotation.class, "images/error.gif"); //$NON-NLS-1$
- fgErrorImage = descriptor.createImage(display);
-
- display.disposeExec(new DisplayDisposeRunnable());
- }
- }
-
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/ExtendedDirectEditionDialog.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/ExtendedDirectEditionDialog.java
index a79a2156bda..69a9da87549 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/ExtendedDirectEditionDialog.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/ExtendedDirectEditionDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006 CEA List.
+ * Copyright (c) 2006, 2018 CEA List.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -9,45 +9,21 @@
*
* Contributors:
* CEA List - initial API and implementation
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 533667
+ *
*******************************************************************************/
package org.eclipse.papyrus.extensionpoints.editors.ui;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.DocumentEvent;
-import org.eclipse.jface.text.IDocumentListener;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.jface.text.source.SourceViewer;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration.Selection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.custom.VerifyKeyListener;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
import org.eclipse.swt.widgets.Shell;
/**
* Dialog used in for direct edition, when an extension is provided
+ *
+ * @deprecated since 3.1. Use {@link org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog} instead.
*/
-public class ExtendedDirectEditionDialog extends LabelEditorDialog {
-
- /** Title of the Dialog */
- final private static String TITLE = "Edit Label";
-
- /** Edited object */
- protected Object editedObject;
-
- /** Document used by the dialog */
- protected Document document;
-
- /** extension configuration */
- protected IDirectEditorConfiguration configuration;
+@Deprecated
+public class ExtendedDirectEditionDialog extends org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog {
/**
* Creates a new ExtendedDirectEditionDialog
@@ -61,130 +37,6 @@ public class ExtendedDirectEditionDialog extends LabelEditorDialog {
*/
public ExtendedDirectEditionDialog(Shell parentShell, Object object, String initialValue,
IDirectEditorConfiguration configuration) {
- super(parentShell, TITLE, initialValue, configuration.getInputValidator());
- this.editedObject = object;
- this.value = initialValue;
- this.configuration = configuration;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Control createDialogArea(Composite parent) {
- Group composite = new Group(parent, SWT.RESIZE);
- composite.setText("Specification");
- GridLayout layout = new GridLayout();
- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- Composite viewerGroup = new Composite(composite, SWT.RESIZE);
- FillLayout viewerLayout = new FillLayout();
- viewerGroup.setLayout(viewerLayout);
- GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL
- | GridData.VERTICAL_ALIGN_CENTER);
- data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
- viewerGroup.setLayoutData(data);
- viewer = new SourceViewer(viewerGroup, null, SWT.BORDER | SWT.FILL_EVEN_ODD);
-
- // configure source viewer
- document = new Document();
- document.set(value);
-
- // add completion processor key listener (ctrl+space keys)
- viewer.appendVerifyKeyListener(new LabelKeyListener(viewer));
-
- document.addDocumentListener(new DocumentListener());
- viewer.configure(configuration.getSourceViewerConfiguration());
- viewer.setDocument(document);
-
- Selection selection = configuration.getTextSelection(value, editedObject);
- viewer.setSelectedRange(selection.getStart(), selection.getLentgh());
-
- Composite extendedArea = configuration.createExtendedDialogArea(viewerGroup);
- if (extendedArea != null) {
- extendedArea.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
- }
-
- errorMessageText = new CLabel(composite, SWT.READ_ONLY | SWT.SHADOW_NONE);
- errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
- errorMessageText.setBackground(errorMessageText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
- // Set the error message text
- // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=66292
- setErrorMessage(errorMessage);
-
- applyDialogFont(composite);
- return composite;
+ super(parentShell, object, initialValue, configuration);
}
-
- /**
- *
- */
- private class LabelKeyListener implements VerifyKeyListener {
-
- /**
- *
- */
- SourceViewer viewer;
-
- /**
- * Default constructor.
- *
- * @param viewer
- */
- public LabelKeyListener(SourceViewer viewer) {
- this.viewer = viewer;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.swt.custom.VerifyKeyListener#verifyKey(org.eclipse.swt.events.VerifyEvent)
- */
- /**
- *
- *
- * @param event
- */
- public void verifyKey(VerifyEvent event) {
- if ((event.stateMask == SWT.CTRL) && (event.character == ' ')) {
- if (viewer.canDoOperation(ISourceViewer.CONTENTASSIST_PROPOSALS)) {
- viewer.doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS);
- }
- event.doit = false;
- } else if (event.character == SWT.CR) {
- event.doit = false;
- }
- }
- }
-
- /**
- *
- */
- private class DocumentListener implements IDocumentListener {
-
- /**
- *
- *
- * @param event
- */
- public void documentAboutToBeChanged(DocumentEvent event) {
- }
-
- /**
- *
- *
- * @param event
- */
- public void documentChanged(DocumentEvent event) {
- validateInput();
- }
-
- }
-
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/GMFEmbeddedEditorActionDelegate.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/GMFEmbeddedEditorActionDelegate.java
index f66e8a88cae..1c7094b7531 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/GMFEmbeddedEditorActionDelegate.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/GMFEmbeddedEditorActionDelegate.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2008 CEA LIST.
+ * Copyright (c) 2008, 2018 CEA LIST.
*
*
* All rights reserved. This program and the accompanying materials
@@ -11,133 +11,17 @@
*
* Contributors:
* Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 533667
*
*****************************************************************************/
package org.eclipse.papyrus.extensionpoints.editors.ui;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramGraphicalViewer;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
/**
* Action delegate for direct editors embedded in GMF editors
+ *
+ * @deprecated since 3.1. Use {@link org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.GMFEmbeddedEditorActionDelegate} instead.
*/
-public class GMFEmbeddedEditorActionDelegate extends OpenEmbeddedTextEditorObjectActionDelegate {
-
- /** selected element in the diagram */
- protected IGraphicalEditPart selectedElement;
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Control getControl() {
- IDiagramGraphicalViewer viewer = null;
- if (part instanceof IDiagramGraphicalViewer) {
- viewer = (IDiagramGraphicalViewer) part;
- } else if (part instanceof IAdaptable) {
- viewer = (IDiagramGraphicalViewer) ((IAdaptable) part).getAdapter(IDiagramGraphicalViewer.class);
- }
-
- if (viewer != null) {
- return viewer.getControl();
- }
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected EObject getEditedObject() {
- // should never happened, but...
- if (selectedElement == null) {
- throw new RuntimeException("Impossible to get an element from no selection.");
- }
-
- // retrieves the current model element associated to the graphical selected edit part
- Object model = selectedElement.getModel();
- if (model instanceof View) {
- return ((View) model).getElement();
- }
-
- // nothing was found. throw an exception
- throw new RuntimeException("Impossible to get an element from selected Element " + selectedElement);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Point getPosition() {
- // calculate position in 2 steps:
- // 1. position of the element from the top left corner of he gmf viewer
- // 2. position of the viewer from the top left corner of the screen
- Rectangle rect = selectedElement.getFigure().getBounds().getCopy();
- selectedElement.getFigure().translateToAbsolute(rect);
-
- Point viewerPosition = getViewerPosition();
- return new Point(rect.x + viewerPosition.x, rect.y + viewerPosition.y);
- }
-
- /**
- * Returns the viewer position
- *
- * @return the GMF viewer position
- */
- protected Point getViewerPosition() {
- Control viewerControl = selectedElement.getViewer().getControl();
-
- // get the position of this control in its parent
- Composite parent = viewerControl.getParent();
- Point selectionPoint = new Point(0, 0);
- while (parent.getParent() != null) {
- selectionPoint.x += parent.getLocation().x;
- selectionPoint.y += parent.getLocation().y;
- parent = parent.getParent();
- if (parent.getParent() == null) {
- // this is the display
- selectionPoint.x += parent.getDisplay().getActiveShell().getLocation().x;
- selectionPoint.y += parent.getDisplay().getActiveShell().getLocation().y;
- }
- }
- return selectionPoint;
- }
-
- /**
- * {@inheritDoc}
- */
- public void selectionChanged(IAction action, ISelection selection) {
- if (selection instanceof IStructuredSelection) {
- Object o = ((IStructuredSelection) selection).getFirstElement();
- if (o instanceof IGraphicalEditPart) {
- selectedElement = ((IGraphicalEditPart) o);
- }
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Composite getParentComposite() {
- Composite parentComposite = (Composite) selectedElement.getViewer().getControl();
- return new Composite(parentComposite, SWT.BORDER);
- }
-
- @Override
- protected org.eclipse.gef.GraphicalEditPart getSelectedElement() {
- return selectedElement;
- }
+@Deprecated
+public class GMFEmbeddedEditorActionDelegate extends org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.GMFEmbeddedEditorActionDelegate {
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/ILabelEditorDialog.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/ILabelEditorDialog.java
index 96df4e81c63..408a030c9e4 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/ILabelEditorDialog.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/ILabelEditorDialog.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010, 2018 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -10,15 +10,17 @@
*
* Contributors:
* Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 533667
+ *
*****************************************************************************/
package org.eclipse.papyrus.extensionpoints.editors.ui;
/**
*
+ * @deprecated since 3.1. Use {@link org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog} instead.
*/
-public interface ILabelEditorDialog {
+@Deprecated
+public interface ILabelEditorDialog extends org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog {
- /** gets the value returned by the dialog */
- public String getValue();
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/IPopupEditorHelper.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/IPopupEditorHelper.java
index 323b530c450..3359fb4a536 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/IPopupEditorHelper.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/IPopupEditorHelper.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010, 2018 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -10,16 +10,18 @@
*
* Contributors:
* CEA LIST - initial API and implementation
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 533667
+ *
*****************************************************************************/
package org.eclipse.papyrus.extensionpoints.editors.ui;
/**
* This interface provides a method for displaying a popupeditor
+ *
+ * @deprecated since 3.1. Use {@link org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper} instead.
*/
-public interface IPopupEditorHelper {
-
- /** Displays the editor encapsulated by the IPopupEditorHelper */
- void showEditor();
+@Deprecated
+public interface IPopupEditorHelper extends org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper {
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/LabelEditorDialog.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/LabelEditorDialog.java
index 8cd7c8ef0be..4635a432328 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/LabelEditorDialog.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/LabelEditorDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006 CEA List.
+ * Copyright (c) 2006, 2018 CEA List.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -9,60 +9,21 @@
*
* Contributors:
* CEA List - initial API and implementation
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 533667
+ *
*******************************************************************************/
package org.eclipse.papyrus.extensionpoints.editors.ui;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IInputValidator;
-import org.eclipse.jface.text.source.SourceViewer;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
// equivalent au inputDialog (code recopie) mais donne un sourceviewer a la place du label
/**
*
+ * @deprecated since 3.1. Use {@link org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.LabelEditorDialog} instead.
*/
-public class LabelEditorDialog extends Dialog implements ILabelEditorDialog {
-
- /**
- * The title of the dialog.
- */
- protected String title;
-
- /**
- * The input value; the empty string by default.
- */
- protected String value = "";//$NON-NLS-1$
-
- /**
- * The input validator, or <code>null</code> if none.
- */
- protected IInputValidator validator;
-
- /**
- * Ok button widget.
- */
- protected Button okButton;
-
- /**
- * Error message label widget.
- */
- protected CLabel errorMessageText;
-
- /**
- * Error message string.
- */
- protected String errorMessage;
-
- /**
- * SourceViewer : area that displays text.
- */
- protected SourceViewer viewer;
+@Deprecated
+public class LabelEditorDialog extends org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.LabelEditorDialog {
/**
* Creates a dialog with OK and Cancel buttons. Note that the dialog will have no visual
@@ -82,130 +43,6 @@ public class LabelEditorDialog extends Dialog implements ILabelEditorDialog {
* string)
*/
public LabelEditorDialog(Shell parentShell, String dialogTitle, String initialValue, IInputValidator validator) {
- super(parentShell);
- this.title = dialogTitle;
- if (initialValue == null) {
- value = "";//$NON-NLS-1$
- } else {
- value = initialValue;
- }
- this.validator = validator;
- }
-
- /*
- * (non-Javadoc) Method declared on Dialog.
- */
- /**
- *
- *
- * @param buttonId
- */
- @Override
- protected void buttonPressed(int buttonId) {
- if (buttonId == IDialogConstants.OK_ID) {
- value = viewer.getDocument().get();
- } else {
- value = null;
- }
- super.buttonPressed(buttonId);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets .Shell)
- */
- /**
- *
- *
- * @param shell
- */
- @Override
- protected void configureShell(Shell shell) {
- super.configureShell(shell);
- if (title != null) {
- shell.setText(title);
- }
- }
-
- /**
- * Returns the ok button.
- *
- * @return the ok button
- */
- // @unused
- protected Button getOkButton() {
- return okButton;
- }
-
- /**
- * Returns the text area.
- *
- * @return the text area
- */
- // @unused
- protected SourceViewer getSourceViewer() {
- return viewer;
- }
-
- /**
- * Returns the validator.
- *
- * @return the validator
- */
- // @unused
- protected IInputValidator getValidator() {
- return validator;
- }
-
- /**
- * Returns the string typed into this input dialog.
- *
- * @return the input string
- */
- public String getValue() {
- return value;
- }
-
- /**
- * Validates the input.
- * <p>
- * The default implementation of this framework method delegates the request to the supplied input validator object; if it finds the input invalid, the error message is displayed in the dialog's message line. This hook method is called whenever the text
- * changes in the input field.
- * </p>
- */
- protected void validateInput() {
- String errorMessage = null;
- if (validator != null) {
- errorMessage = validator.isValid(viewer.getDocument().get());
- }
- // Bug 16256: important not to treat "" (blank error) the same as null
- // (no error)
- setErrorMessage(errorMessage);
- }
-
- /**
- * Sets or clears the error message. If not <code>null</code>, the OK button is disabled.
- *
- * @param errorMessage
- * the error message, or <code>null</code> to clear
- *
- * @since 3.0
- */
- public void setErrorMessage(String errorMessage) {
- this.errorMessage = errorMessage;
- if ((errorMessageText != null) && !errorMessageText.isDisposed()) {
- Image errorImage = Activator.getImage("icons/error.gif");
- errorMessageText.setImage(errorMessage == null ? null : errorImage);
- errorMessageText.setText(errorMessage == null ? "" : errorMessage); //$NON-NLS-1$
- errorMessageText.getParent().update();
- // Access the ok button by id, in case clients have overridden
- // button creation.
- // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=113643
- Control button = getButton(IDialogConstants.OK_ID);
- if (button != null) {
- button.setEnabled(errorMessage == null);
- }
- }
+ super(parentShell, dialogTitle, initialValue, validator);
}
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/MultiReconciler.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/MultiReconciler.java
index 023e47d124e..8f72d3ec126 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/MultiReconciler.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/MultiReconciler.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2008 CEA LIST.
+ * Copyright (c) 2008, 2018 CEA LIST.
*
*
* All rights reserved. This program and the accompanying materials
@@ -11,28 +11,22 @@
*
* Contributors:
* Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 533667
*
*****************************************************************************/
package org.eclipse.papyrus.extensionpoints.editors.ui;
import java.util.List;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.reconciler.AbstractReconciler;
-import org.eclipse.jface.text.reconciler.DirtyRegion;
import org.eclipse.jface.text.reconciler.IReconcilingStrategy;
-import org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension;
/**
* Reconciler that uses several independent strategies.
+ *
+ * @deprecated since 3.1. Use {@link org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.MultiReconciler} instead.
*/
-public class MultiReconciler extends AbstractReconciler {
-
- /** The reconciling strategy. */
- private final List<IReconcilingStrategy> fStrategies;
+@Deprecated
+public class MultiReconciler extends org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.MultiReconciler {
/**
* Creates a new reconciler that uses several reconciling strategies to reconcile its document
@@ -45,82 +39,6 @@ public class MultiReconciler extends AbstractReconciler {
*/
// @unused
public MultiReconciler(List<IReconcilingStrategy> strategies, boolean isIncremental) {
- Assert.isNotNull(strategies);
- fStrategies = strategies;
- for (IReconcilingStrategy strategy : fStrategies) {
- if (strategy instanceof IReconcilingStrategyExtension) {
- IReconcilingStrategyExtension extension = (IReconcilingStrategyExtension) strategy;
- extension.setProgressMonitor(getProgressMonitor());
- }
- }
-
- setIsIncrementalReconciler(isIncremental);
- }
-
- /*
- * @see IReconciler#getReconcilingStrategy(String)
- */
- public IReconcilingStrategy getReconcilingStrategy(String contentType) {
- Assert.isNotNull(contentType);
- return fStrategies.get(0);
+ super(strategies, isIncremental);
}
-
- /*
- * @see AbstractReconciler#process(DirtyRegion)
- */
- @Override
- protected void process(DirtyRegion dirtyRegion) {
-
- for (IReconcilingStrategy strategy : fStrategies) {
- if (dirtyRegion != null) {
- strategy.reconcile(dirtyRegion, dirtyRegion);
- } else {
- IDocument document = getDocument();
- if (document != null) {
- strategy.reconcile(new Region(0, document.getLength()));
- }
- }
- }
- }
-
- /*
- * @see AbstractReconciler#reconcilerDocumentChanged(IDocument)
- */
- @Override
- protected void reconcilerDocumentChanged(IDocument document) {
- for (IReconcilingStrategy strategy : fStrategies) {
- strategy.setDocument(document);
- }
- }
-
- /*
- * @see AbstractReconciler#setProgressMonitor(IProgressMonitor)
- */
- @Override
- public void setProgressMonitor(IProgressMonitor monitor) {
- super.setProgressMonitor(monitor);
-
- for (IReconcilingStrategy strategy : fStrategies) {
- if (strategy instanceof IReconcilingStrategyExtension) {
- IReconcilingStrategyExtension extension = (IReconcilingStrategyExtension) strategy;
- extension.setProgressMonitor(monitor);
- }
- }
-
- }
-
- /*
- * @see AbstractReconciler#initialProcess()
- */
- @Override
- protected void initialProcess() {
-
- for (IReconcilingStrategy strategy : fStrategies) {
- if (strategy instanceof IReconcilingStrategyExtension) {
- IReconcilingStrategyExtension extension = (IReconcilingStrategyExtension) strategy;
- extension.initialReconcile();
- }
- }
- }
-
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/OpenEmbeddedTextEditorObjectActionDelegate.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/OpenEmbeddedTextEditorObjectActionDelegate.java
index dc3fbaa315f..760370ccc18 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/OpenEmbeddedTextEditorObjectActionDelegate.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/OpenEmbeddedTextEditorObjectActionDelegate.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 CEA LIST.
+ * Copyright (c) 2008, 2018 CEA LIST.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -9,198 +9,20 @@
*
* Contributors:
* CEA LIST - initial API and implementation
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 533667
+ *
*******************************************************************************/
package org.eclipse.papyrus.extensionpoints.editors.ui;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.definition.IDirectEditorExtensionPoint;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PlatformUI;
-
/**
* This action implementation is an abstract implementation of an object contribution action that
* opens a TEF editor window within a host editor. Inheriting concrete implementations have to
* provide the EMF object to be edited, the position of the editor window, access to the hosting GUI
* control and edit part.
+ *
+ * @deprecated since 3.1. Use {@link org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.OpenEmbeddedTextEditorObjectActionDelegate} instead.
*/
-public abstract class OpenEmbeddedTextEditorObjectActionDelegate implements IObjectActionDelegate {
-
- /** part in which the editor is embedded */
- protected IWorkbenchPart part = null;
-
- /** the configuration for the embedded editor */
- private IDirectEditorExtensionPoint directEditorExtensionPoint;
-
- /**
- * Returns the edited EObject
- *
- * @return the EObject edited in the editor. It should never be <code>null</code>.
- */
- protected abstract EObject getEditedObject();
-
- /**
- * Returns the selected graphical edit part
- *
- * @return the GraphicalEditPart selected in the editor. It should never be <code>null</code>.
- */
- protected abstract GraphicalEditPart getSelectedElement();
-
- /**
- * Retrieves the position where the editor should be opened.
- *
- * @return the position of the shell containing the editor
- */
- // @unused
- protected abstract Point getPosition();
-
- /**
- * Retrieves the editor context
- *
- * @return the context for the current editor
- */
- // protected abstract IEditorContext getEditorContext();
-
- /**
- * Returns the editor's main control
- *
- * @return the editor's main control
- */
- // @unused
- protected abstract Control getControl();
-
- /**
- * {@inheritDoc}
- */
- public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- part = targetPart;
- }
-
- /**
- * {@inheritDoc}
- */
- public void run(IAction action) {
- // retrieves graphical context (in which shell it should open for example
-
- final IDirectEditorConfiguration configuration = directEditorExtensionPoint.getDirectEditorConfiguration();
- configuration.preEditAction(getEditedObject());
-
- Dialog dialog = null;
- if (configuration instanceof ICustomDirectEditorConfiguration) {
- GraphicalEditPart selectedElement = getSelectedElement();
- if (selectedElement != null) {
- Request request = new Request(RequestConstants.REQ_DIRECT_EDIT);
- selectedElement.performRequest(request);
- }
- return;
- } else if (configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorConfiguration popupEditor = (IPopupEditorConfiguration) configuration;
- popupEditor.createPopupEditorHelper(getSelectedElement()).showEditor();
- return;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), getEditedObject(), configuration.getTextToEdit(getEditedObject()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), getEditedObject(), configuration.getTextToEdit(getEditedObject()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = ((DiagramEditor) part).getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") { //$NON-NLS-1$
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(getEditedObject(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
-
- /*
- * protected void setManager(DirectEditManager manager) {
- * this.manager = manager;
- * }
- *
- * public void setParser(IParser parser) {
- * this.parser = parser;
- * }
- *
- * protected void initializeDirectEditManager(final Request request) {
- * // initialize the direct edit manager
- * try {
- * getEditingDomain().runExclusive(new Runnable() {
- * public void run() {
- * if (isActive() && isEditable()) {
- * if (request
- * .getExtendedData()
- * .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- * Character initialChar = (Character) request
- * .getExtendedData()
- * .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- * performDirectEdit(initialChar.charValue());
- * } else if ((request instanceof DirectEditRequest)
- * && (getEditText().equals(getLabelText()))) {
- * DirectEditRequest editRequest = (DirectEditRequest) request;
- * performDirectEdit(editRequest.getLocation());
- * } else {
- * performDirectEdit();
- * }
- * }
- * }
- * });
- * } catch (InterruptedException e) {
- * e.printStackTrace();
- * }
- * }
- */
-
- /**
- * Sets the configuration for the editor
- *
- * @param configuration
- * the configuration for the specified editor
- */
- public void setExtensionPointConfiguration(IDirectEditorExtensionPoint directEditorExtensionPoint) {
- this.directEditorExtensionPoint = directEditorExtensionPoint;
- }
-
- /**
- * Returns the parent composite for the new embedded editor
- *
- * @return the parent composite for the new embedded editor
- */
- protected abstract Composite getParentComposite();
-
- /**
- * Returns whether the widget is <code>null</code> or disposed or active.
- *
- * @param widget
- * the widget to check
- * @return <code>true</code> if the widget can be used
- */
- public static boolean isValid(Widget widget) {
- return (widget != null && !widget.isDisposed());
- }
+@Deprecated
+public abstract class OpenEmbeddedTextEditorObjectActionDelegate extends org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.OpenEmbeddedTextEditorObjectActionDelegate {
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/utils/DirectEditorsUtil.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/utils/DirectEditorsUtil.java
index 2e6e035b942..c983e3186a6 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/utils/DirectEditorsUtil.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/utils/DirectEditorsUtil.java
@@ -12,192 +12,17 @@
* Contributors:
* Remi Schnekenburger (CEA LIST) Remi.Schnekenburger@cea.fr - Initial API and implementation
* Ansgar Radermacher (CEA LIST) ansgar.radermacher@cea.fr - Bug 528199
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 533667
*
*****************************************************************************/
package org.eclipse.papyrus.extensionpoints.editors.utils;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.DefaultDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConstraint;
-import org.eclipse.papyrus.extensionpoints.editors.definition.DirectEditorExtensionPoint;
-import org.eclipse.papyrus.extensionpoints.editors.definition.IDirectEditorExtensionPoint;
-
-public class DirectEditorsUtil {
-
- /** The Constant UNKNOWN_PRIORITY. */
- private static final int UNKNOWN_PRIORITY = 100;
-
- /**
- * Find an editor configuration for specific language and object to edit
- *
- * @param language
- * the language to edit
- * @param semanticObjectToEdit
- * the semantic object to edit
- * @return the editor configuration
- * @since 3.0
- */
- public static IDirectEditorConfiguration findEditorConfiguration(String language, EObject objectToEdit) {
- return findEditorConfiguration(language, objectToEdit, objectToEdit);
- }
-
- /**
- * Find an editor configuration for specific language and object to edit
- *
- * @param language
- * the language to edit
- * @param semanticObjectToEdit
- * the semantic object to edit
- * @param selectedElement
- * The real selected element (e.g. widget, edit part, ...)
- * @return the editor configuration
- */
- public static IDirectEditorConfiguration findEditorConfiguration(String language, Object semanticObjectToEdit, Object selectedElement) {
- IDirectEditorExtensionPoint extension = findEditorExtension(language, semanticObjectToEdit, selectedElement);
- if (extension != null) {
- return extension.getDirectEditorConfiguration();
- }
- // none found, return default
- return new DefaultDirectEditorConfiguration();
- }
-
- /**
- * Find an editor extension for a specific language and object to edit
- *
- * @param language
- * the language to edit, if null accept all languages
- * @param semanticObjectToEdit
- * the semantic object to edit
- * @param selectedElement
- * The real selected element (e.g. widget, edit part, ...)
- * @return the extension point that manages this kind of editor
- * @since 3.0
- */
- public static IDirectEditorExtensionPoint findEditorExtension(String language, Object semanticObjectToEdit, Object selectedElement) {
- Collection<IDirectEditorExtensionPoint> configs = getDirectEditorExtensions(semanticObjectToEdit, selectedElement);
-
- IDirectEditorExtensionPoint currentExtension = null;
- int currentPriority = UNKNOWN_PRIORITY;
- for (IDirectEditorExtensionPoint extensionPoint : configs) {
- if ((language == null || language.equals(extensionPoint.getLanguage())) && extensionPoint.getPriority() < currentPriority) {
- currentExtension = extensionPoint;
- currentPriority = extensionPoint.getPriority();
- }
- }
-
- if (currentExtension == null && language != null) {
- // no extension found, retry without specific language filter. This is useful, since the default editor
- // might not match, e.g. if you edit an opaque expression with a non-OCL body, the OCL editor should not
- // be used, see bug 528199
- return findEditorExtension(null, semanticObjectToEdit, selectedElement);
- }
- return currentExtension;
- }
-
- /**
- * finds if an editor for specific language and object is available to edit type
- *
- * @param language
- * the language to edit
- * @param semanticObjectToEdit
- * the semantic object to edit
- * @param selectedElement
- * The real selected element (e.g. widget, edit part, ...)
- * @return <code>true</code> if an editor exists
- */
- public static boolean hasSpecificEditorConfiguration(String language, Object semanticObjectToEdit, Object selectedElement) {
- return findEditorExtension(language, semanticObjectToEdit, selectedElement) != null;
- }
-
- /**
- * finds whether an editor for specific object is available to edit
- *
- * @param objectToEdit
- * @return <code>true</code> if an editor exists
- * @since 3.0
- */
- public static boolean hasSpecificEditorConfiguration(EObject objectToEdit) {
- return hasSpecificEditorConfiguration(objectToEdit, objectToEdit);
- }
-
- /**
- * finds whether an editor for a specific object is available to edit
- *
- * @param language
- * the language to edit
- * @param semanticObjectToEdit
- * the semantic object to edit
- * @param selectedElement
- * The real selected element (e.g. widget, edit part, ...)
- * @return <code>true</code> if an editor exists
- */
- public static boolean hasSpecificEditorConfiguration(Object semanticObjectToEdit, Object selectedElement) {
- return getDirectEditorExtensions(semanticObjectToEdit, selectedElement).size() > 0;
- }
-
- /**
- * Retrieves the preferred editor extension for the specified type
- *
- * @param class_
- * the type of element to edit
- * @return the preferred editor extension for the specified or <code>null</code>
- * @since 3.0
- */
- public static IDirectEditorExtensionPoint getDefaultDirectEditorExtension(Object semanticObjectToEdit) {
- return getDefaultDirectEditorExtension(semanticObjectToEdit, semanticObjectToEdit);
- }
-
- /**
- * Retrieves the preferred editor extension for the specified type
- *
- * @param semanticObjectToEdit
- * the object that should be edited
- * @param selectedObject
- * the currently selected object
- * @return the default editor extension for the passed elements or <code>null</code>
- * @since 3.0
- */
- public static IDirectEditorExtensionPoint getDefaultDirectEditorExtension(Object semanticObjectToEdit, Object selectedObject) {
- // retrieves preference for this element
- String language = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + semanticObjectToEdit.getClass().asSubclass(EObject.class));
- if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(language)) {
- return null;
- }
- return findEditorExtension(language, semanticObjectToEdit, selectedObject);
- }
-
- /**
- * Return the set of editor extensions registered in the platform for the specified kind of element
- *
- * @param semanticObjectToEdit
- * the object that should be edited
- * @param selectedObject
- * the currently selected object
- * @return the set of editor extension registered in the platform for the specified elements
- * @since 3.0
- */
- public static Collection<IDirectEditorExtensionPoint> getDirectEditorExtensions(Object semanticObjectToEdit, Object selectedObject) {
- // list of extension points to be returned.
- final List<IDirectEditorExtensionPoint> editorExtensionPoints = new ArrayList<IDirectEditorExtensionPoint>();
+/**
+ *
+ * @deprecated since 3.1. Use {@link org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil} instead.
+ */
+@Deprecated
+public class DirectEditorsUtil extends org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil {
- // check each configuration and select those satisfying the constraints
- for (IDirectEditorExtensionPoint configuration : DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations()) {
- // both class are compatibles ?
- if (configuration.getObjectClassToEdit() != null) {
- if (configuration.getObjectClassToEdit().isInstance(semanticObjectToEdit)) {
- IDirectEditorConstraint constraint = configuration.getAdditionalConstraint();
- if (constraint == null || constraint.appliesTo(selectedObject))
- editorExtensionPoints.add(configuration);
- }
- }
- }
- return editorExtensionPoints;
- }
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/utils/IDirectEditorsIds.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/utils/IDirectEditorsIds.java
index b0efb02e65e..2421d527e1d 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/utils/IDirectEditorsIds.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/utils/IDirectEditorsIds.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2008 CEA LIST.
+ * Copyright (c) 2008, 2018 CEA LIST.
*
*
* All rights reserved. This program and the accompanying materials
@@ -11,6 +11,7 @@
*
* Contributors:
* Remi Schnekenburger (CEA LIST) Remi.Schnekenburger@cea.fr - Initial API and implementation
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 533667
*
*****************************************************************************/
@@ -18,19 +19,10 @@ package org.eclipse.papyrus.extensionpoints.editors.utils;
/**
* Ids and constants for the editors extension point plugin
+ *
+ * @deprecated since 3.1. Use {@link org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds} instead.
*/
-public interface IDirectEditorsIds {
-
- /** Constant for the UML language */
- public final String UML_LANGUAGE = "Papyrus UML";
-
- /** Constant for the SysML language */
- public final String SYSML_LANGUAGE = "Papyrus SysML";
-
- /** Constant for the direct editors */
- public static final String SIMPLE_DIRECT_EDITOR = "Simple Direct Editor"; //$NON-NLS-1$
-
- /** constant for preferences */
- public static final String EDITOR_FOR_ELEMENT = "papyrus.directeditor.";
+@Deprecated
+public interface IDirectEditorsIds extends org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds {
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/.classpath b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/.classpath
new file mode 100644
index 00000000000..64c5e31b7a2
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/.project b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/.project
new file mode 100644
index 00000000000..fc5a2085267
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/.project
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.oomph.version.VersionBuilder</name>
+ <arguments>
+ <dictionary>
+ <key>check.maven.pom</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>ignore.lower.bound.dependency.ranges</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>release.path</key>
+ <value>/org.eclipse.papyrus.releng.main.release/release.xml</value>
+ </dictionary>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.oomph.version.VersionNature</nature>
+ <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/.settings/org.eclipse.core.resources.prefs b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 00000000000..896a9a53a53
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8 \ No newline at end of file
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/.settings/org.eclipse.core.runtime.prefs b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/.settings/org.eclipse.core.runtime.prefs
new file mode 100644
index 00000000000..5a0ad22d2a7
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/.settings/org.eclipse.core.runtime.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/.settings/org.eclipse.jdt.core.prefs b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..15d5f917b9c
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,297 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.release=disabled
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
+org.eclipse.jdt.core.formatter.comment.line_length=260
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=false
+org.eclipse.jdt.core.formatter.join_wrapped_lines=false
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=260
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=5
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/.settings/org.eclipse.jdt.ui.prefs b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 00000000000..ba7542ef658
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,127 @@
+cleanup.add_default_serial_version_id=true
+cleanup.add_generated_serial_version_id=false
+cleanup.add_missing_annotations=true
+cleanup.add_missing_deprecated_annotations=true
+cleanup.add_missing_methods=false
+cleanup.add_missing_nls_tags=false
+cleanup.add_missing_override_annotations=true
+cleanup.add_missing_override_annotations_interface_methods=true
+cleanup.add_serial_version_id=false
+cleanup.always_use_blocks=true
+cleanup.always_use_parentheses_in_expressions=false
+cleanup.always_use_this_for_non_static_field_access=false
+cleanup.always_use_this_for_non_static_method_access=false
+cleanup.convert_functional_interfaces=false
+cleanup.convert_to_enhanced_for_loop=false
+cleanup.correct_indentation=false
+cleanup.format_source_code=false
+cleanup.format_source_code_changes_only=false
+cleanup.insert_inferred_type_arguments=false
+cleanup.make_local_variable_final=true
+cleanup.make_parameters_final=false
+cleanup.make_private_fields_final=true
+cleanup.make_type_abstract_if_missing_method=false
+cleanup.make_variable_declarations_final=false
+cleanup.never_use_blocks=false
+cleanup.never_use_parentheses_in_expressions=true
+cleanup.organize_imports=false
+cleanup.qualify_static_field_accesses_with_declaring_class=false
+cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+cleanup.qualify_static_member_accesses_with_declaring_class=true
+cleanup.qualify_static_method_accesses_with_declaring_class=false
+cleanup.remove_private_constructors=true
+cleanup.remove_redundant_type_arguments=true
+cleanup.remove_trailing_whitespaces=true
+cleanup.remove_trailing_whitespaces_all=true
+cleanup.remove_trailing_whitespaces_ignore_empty=false
+cleanup.remove_unnecessary_casts=true
+cleanup.remove_unnecessary_nls_tags=true
+cleanup.remove_unused_imports=true
+cleanup.remove_unused_local_variables=false
+cleanup.remove_unused_private_fields=true
+cleanup.remove_unused_private_members=false
+cleanup.remove_unused_private_methods=true
+cleanup.remove_unused_private_types=true
+cleanup.sort_members=false
+cleanup.sort_members_all=false
+cleanup.use_anonymous_class_creation=false
+cleanup.use_blocks=true
+cleanup.use_blocks_only_for_return_and_throw=false
+cleanup.use_lambda=true
+cleanup.use_parentheses_in_expressions=false
+cleanup.use_this_for_non_static_field_access=false
+cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+cleanup.use_this_for_non_static_method_access=false
+cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+cleanup.use_type_arguments=false
+cleanup_profile=_Papyrus
+cleanup_settings_version=2
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_Papyrus
+formatter_settings_version=12
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=java;javax;org;com;
+org.eclipse.jdt.ui.javadoc=true
+org.eclipse.jdt.ui.ondemandthreshold=99
+org.eclipse.jdt.ui.staticondemandthreshold=99
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="false" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * Constructor.\n *\n * ${tags}\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*****************************************************************************\n * Copyright (c) ${year} CEA LIST and others.\n * \n * All rights reserved. This program and the accompanying materials\n * are made available under the terms of the Eclipse Public License 2.0\n * which accompanies this distribution, and is available at\n * http\://www.eclipse.org/legal/epl-2.0/\n *\n * SPDX-License-Identifier: EPL-2.0\n *\n * Contributors\:\n * CEA LIST - Initial API and implementation\n * \n *****************************************************************************/\n</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/**\n * ${see_to_overridden}\n *\n * ${tags}\n */</template><template autoinsert\="false" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${see_to_target}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_functional_interfaces=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.insert_inferred_type_arguments=false
+sp_cleanup.make_local_variable_final=true
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_redundant_modifiers=false
+sp_cleanup.remove_redundant_type_arguments=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=true
+sp_cleanup.remove_unused_imports=true
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_anonymous_class_creation=false
+sp_cleanup.use_blocks=true
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_lambda=true
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/.settings/org.eclipse.pde.api.tools.prefs b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/.settings/org.eclipse.pde.api.tools.prefs
new file mode 100644
index 00000000000..b2260f87129
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/.settings/org.eclipse.pde.api.tools.prefs
@@ -0,0 +1,104 @@
+ANNOTATION_ELEMENT_TYPE_ADDED_FIELD=Error
+ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error
+ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Warning
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Warning
+API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error
+API_USE_SCAN_FIELD_SEVERITY=Error
+API_USE_SCAN_METHOD_SEVERITY=Error
+API_USE_SCAN_TYPE_SEVERITY=Error
+CLASS_ELEMENT_TYPE_ADDED_FIELD=Warning
+CLASS_ELEMENT_TYPE_ADDED_METHOD=Error
+CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error
+CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error
+CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error
+CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error
+ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error
+ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error
+ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+FIELD_ELEMENT_TYPE_ADDED_VALUE=Warning
+FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error
+FIELD_ELEMENT_TYPE_CHANGED_VALUE=Warning
+FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error
+FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error
+ILLEGAL_EXTEND=Warning
+ILLEGAL_IMPLEMENT=Warning
+ILLEGAL_INSTANTIATE=Warning
+ILLEGAL_OVERRIDE=Warning
+ILLEGAL_REFERENCE=Warning
+INTERFACE_ELEMENT_TYPE_ADDED_DEFAULT_METHOD=Warning
+INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Ignore
+INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+INVALID_ANNOTATION=Ignore
+INVALID_JAVADOC_TAG=Ignore
+INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Ignore
+LEAK_EXTEND=Warning
+LEAK_FIELD_DECL=Warning
+LEAK_IMPLEMENT=Warning
+LEAK_METHOD_PARAM=Warning
+LEAK_METHOD_RETURN_TYPE=Warning
+METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error
+METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+MISSING_EE_DESCRIPTIONS=Error
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
+UNUSED_PROBLEM_FILTERS=Warning
+automatically_removed_unused_problem_filters=Enabled
+changed_execution_env=Warning
+eclipse.preferences.version=1
+incompatible_api_component_version=Warning
+incompatible_api_component_version_include_major_without_breaking_change=Disabled
+incompatible_api_component_version_include_minor_without_api_change=Disabled
+incompatible_api_component_version_report_major_without_breaking_change=Error
+incompatible_api_component_version_report_minor_without_api_change=Error
+invalid_since_tag_version=Error
+malformed_since_tag=Error
+missing_since_tag=Error
+report_api_breakage_when_major_version_incremented=Disabled
+report_resolution_errors_api_component=Warning
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/EmbedddedEditor.usecases b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/EmbedddedEditor.usecases
new file mode 100644
index 00000000000..26cea759b66
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/EmbedddedEditor.usecases
@@ -0,0 +1,53 @@
+Embedded editor use cases
+
+It is sometimes more efficient to use a textual editor to modify a model element, For instance,
+an operation with parameter definitions has a compact textual representation, but it is
+quite time consuming to create all parameters and provide a type when manipulating it on
+the model level. Other elements have an inherent textual representation, notably opaque expressions
+and behaviors. Therefore, Papyrus offers textual editors for these elements.
+
+Use case 1:
+Edit an OCL expression in an opaque expression.
+This can be done by pressing "F2" after selecting either the constraint owning the expression
+or the expression itself. The editor should support completion and syntax highlighting
+to enable the efficient specification.
+Note that the user wants to open an OCL editor on an existing
+expression with OCL content, even if a different editor has been configured as default
+editor for constraints/expressions. Of course, the default editor is chosen on an empty
+opaque expression.
+
+Use case 2:
+The user edits an attribute declaration with a textual editor. The editor allows to set
+name, type, multiplicities and uniqueness. Compared to the first use case, the textual
+representation is a combination of several model elements. The modification might result
+in a non-valid representation, i.e. a text that cannot be represented in the model, for
+instance an unknown type or a non-parseable multiplicity specification. Since this might
+be caused by a single typo, the edited content of an invalid text should not get lost,
+when the user quits the editor. Papyrus manages this situation with a specific stereotype
+storing the text (automatically managed by the editor). Once the specification is corrected
+in the editor, this additional text storage gets removed automatically.
+
+Requirements
+
+* A UML object of a certain kind (i.e. instance of a meta-model element, such
+ as State or Class) has an associated default edtior. This is configurable
+ in the Papyrus preferences ("Embedded Editors"). Technically, the editor
+ is identified using its name as "language".
+
+* Each editor can have additional constraints denoting whether it is eligible
+ to edit a certain element. For instance, it can check whether a certain stereotype
+ is applied. Another typical use case is to check whether opaque expressions
+ or opaque behaviors are either empty or have a body with the "right" language
+ tag.
+
+* Each editor has a priority that is configurable in the Papyrus preferences
+ ("Embedded Editors"). Five different levels are supported:
+ lowest, low, medium, high, highest
+
+* If the user opens a textual editor for a certain UML element, the tool should
+ check first, whether the default is applicable (check eligibility constraints)
+ to the given element. If this is the case, this editor should be opened. If
+ not, it should check whether other editors are eligible and choose the one with
+ the highest priority. If multiple editors with the same priority exist, the
+ first eligitible editor is chosen. This situation should be avoided by
+ choosing the priorities in a suitable way.
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..ca15a0af856
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/META-INF/MANIFEST.MF
@@ -0,0 +1,22 @@
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.gmf.runtime.diagram.ui;bundle-version="[1.8.0,2.0.0)";visibility:=reexport,
+ org.eclipse.papyrus.infra.emf;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.constraints;bundle-version="[2.0.0,3.0.0)";visibility:=reexport,
+ org.eclipse.papyrus.infra.ui;bundle-version="[2.0.0,3.0.0)"
+Export-Package: org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors,
+ org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration,
+ org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.definition,
+ org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.preferences,
+ org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui,
+ org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.images,
+ org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils
+Bundle-Vendor: %providerName
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 1.0.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-Activator: org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors;singleton:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Automatic-Module-Name: org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/about.html b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/about.html
new file mode 100644
index 00000000000..3e183aa78df
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>November 30, 2017</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 2.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="https://www.eclipse.org/legal/epl-2.0/">https://www.eclipse.org/legal/epl-2.0/</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/build.properties b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/build.properties
new file mode 100644
index 00000000000..75c8e9319c7
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/build.properties
@@ -0,0 +1,12 @@
+#
+#Mon Sep 12 09:29:52 CEST 2011
+bin.includes = META-INF/,\
+ .,\
+ schema/,\
+ plugin.xml,\
+ plugin.properties,\
+ icons/,\
+ about.html
+output.. = bin/
+src.includes = about.html
+source.. = src/
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/icons/error.gif b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/icons/error.gif
new file mode 100644
index 00000000000..a3b621b5709
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/icons/error.gif
Binary files differ
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/plugin.properties b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/plugin.properties
new file mode 100644
index 00000000000..ac68b824c1b
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/plugin.properties
@@ -0,0 +1,14 @@
+#################################################################################
+# Copyright (c) 2008 CEA LIST.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License 2.0
+# which accompanies this distribution, and is available at
+# https://www.eclipse.org/legal/epl-2.0/
+#
+# SPDX-License-Identifier: EPL-2.0
+#
+# Contributors:
+# Remi Schnekenburger (CEA LIST) Remi.Schnekenburger@cea.fr - Initial API and implementation
+##################################################################################
+pluginName=Papyrus Embedded Editors extensions point
+providerName=Eclipse Modeling Project
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/plugin.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/plugin.xml
new file mode 100644
index 00000000000..9d51e93b073
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/plugin.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension-point id="DirectEditor" name="Define a new Direct editor for Papyrus" schema="schema/DirectEditor.exsd"/>
+ <!--
+ <extension
+ point="org.eclipse.ui.popupMenus">
+ <objectContribution
+ adaptable="true"
+ id="org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.GMFDirectEditors"
+ objectClass="org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart">
+ <menu
+ id="papyrus.DirectEdit"
+ label="Direct Edit"
+ path="additions">
+ </menu>
+ <action
+ class="org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.GMFEmbeddedEditorActionDelegate"
+ icon="icons/Papyrus.gif"
+ id="org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.editelement"
+ label="Edit Element"
+ menubarPath="additions/papyrus.DirectEdit">
+ </action>
+ <menu
+ id="org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.menu2"
+ label="DD"
+ path="additions/papyrus.DirectEdit">
+ </menu>
+ </objectContribution>
+ </extension>
+ -->
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ locationURI="popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContextMenu">
+ <dynamic
+ class="org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.DirectEditorsContributionItem"
+ id="org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.DynamicMenu">
+ </dynamic>
+ </menuContribution>
+ </extension>
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ category="org.eclipse.papyrus.infra.core.sasheditor.preferences.generalcategory"
+ class="org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.preferences.PapyrusEmbeddedEditorsPreferencePage"
+ id="org.eclipse.papyrus.embeddededitors"
+ name="Embedded Editors">
+ </page>
+ </extension>
+
+
+</plugin>
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/pom.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/pom.xml
new file mode 100644
index 00000000000..e1b3e042d4c
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/pom.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.papyrus</groupId>
+ <artifactId>org.eclipse.papyrus.infra-gmfdiag</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project> \ No newline at end of file
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/schema/DirectEditor.exsd b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/schema/DirectEditor.exsd
new file mode 100644
index 00000000000..7f5fd5767c7
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/schema/DirectEditor.exsd
@@ -0,0 +1,263 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors" id="DirectEditor" name="Extension Poin that defines new editors for specific objects and specific language in Papyrus"/>
+ </appInfo>
+ <documentation>
+ This extension point is used to registered new editors into Papyrus modeling tool to edit objects using a given language.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="DirectEditor"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="DirectEditor">
+ <annotation>
+ <appInfo>
+ <meta.element labelAttribute="objectToEdit"/>
+ </appInfo>
+ <documentation>
+ Extension points for direct editors in Papyrus UML2.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <choice>
+ <element ref="advancededitor"/>
+ <element ref="simpleeditor"/>
+ <element ref="popupeditor"/>
+ </choice>
+ <element ref="Priority" minOccurs="0" maxOccurs="1"/>
+ </sequence>
+ <attribute name="language" type="string" use="required">
+ <annotation>
+ <documentation>
+ language used to edit the specified object
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="objectToEdit" type="string" use="required">
+ <annotation>
+ <documentation>
+ The type of object to edit (for example, &quot;org.eclipse.emf.ecore.EObject&quot;)
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.emf.ecore.EObject"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="icon" type="string">
+ <annotation>
+ <documentation>
+ Icon used in menus for this editor
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="resource"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="contributor" type="string">
+ <annotation>
+ <documentation>
+ Name of the contributor for this extension point
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="additionalConstraint" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConstraint"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="superType" type="boolean">
+ <annotation>
+ <documentation>
+ To indicate if the editor configuration is available for each type depending of the language.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="simpleeditor">
+ <complexType>
+ <attribute name="editorConfiguration" type="string" use="required">
+ <annotation>
+ <documentation>
+ The class that configure the direct editor
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="advancededitor">
+ <complexType>
+ <attribute name="editorConfiguration" type="string" use="required">
+ <annotation>
+ <documentation>
+ The class that configure the direct editor
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.jface.dialogs.Dialog:"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="popupeditor">
+ <annotation>
+ <documentation>
+ This extension point can be used to register a popup editor
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="editorConfiguration" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="Priority">
+ <annotation>
+ <documentation>
+ The description for the priority of the editpart provider
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="name" use="default" value="Low">
+ <annotation>
+ <documentation>
+ The priority of the provider. It can be one of the following values:
+&lt;Lowest, Low, Medium, High, Highest&gt;. Consideration of dependencies has to be done when choosing the priority. A provider at a higher priority will take a chance first at deciding provision.
+ </documentation>
+ </annotation>
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="Lowest">
+ </enumeration>
+ <enumeration value="Low">
+ </enumeration>
+ <enumeration value="Medium">
+ </enumeration>
+ <enumeration value="High">
+ </enumeration>
+ <enumeration value="Highest">
+ </enumeration>
+ </restriction>
+ </simpleType>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ Since 1.9.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ /*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/Activator.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/Activator.java
new file mode 100644
index 00000000000..a8bb4564cc4
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/Activator.java
@@ -0,0 +1,160 @@
+/*******************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.papyrus.infra.core.log.LogHelper;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /** Logging helper */
+ public static LogHelper log;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ // register the login helper
+ log = new LogHelper(plugin);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ log = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns an <code>org.eclipse.swt.graphics.Image</code> identified by its key.<BR>
+ * By default, it returns a default image. This image is the image placed in the directory <em>resources/icons/default.gif</em>
+ *
+ * @param key
+ * the key of the image
+ * @return the Image
+ */
+ public static Image getImage(String key) {
+ ImageRegistry registry = getDefault().getImageRegistry();
+ Image image = registry.get(key);
+ if (image == null) {
+ ImageDescriptor desc = AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, key);
+ registry.put(key, desc);
+ image = registry.get(key);
+ }
+ return image;
+ }
+
+ /**
+ * Returns an <code>org.eclipse.swt.graphics.Image</code> identified by its key and its owning
+ * plugin.<BR>
+ *
+ * @param pluginID
+ * the plugin id where to retrieve the image
+ * @param key
+ * the key of the image
+ * @return the Image
+ */
+ public static Image getImage(String pluginID, String key) {
+ ImageRegistry registry = getDefault().getImageRegistry();
+ Image image = registry.get(key);
+ if (image == null) {
+ ImageDescriptor desc = AbstractUIPlugin.imageDescriptorFromPlugin(pluginID, key);
+ registry.put(key, desc);
+ image = registry.get(key);
+ }
+ return image;
+ }
+
+ /**
+ * Log a message and an exception in the plugin's log.
+ *
+ * @param message
+ * the message to log
+ * @param e
+ * the exception to log
+ */
+ public static void log(String message, Exception e) {
+ getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.OK, message, e));
+ }
+
+ /**
+ * Log a message in the plugin's log.
+ *
+ * @param message
+ * the message to log
+ */
+ public static void log(String message) {
+ getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.OK, message, null));
+ }
+
+ /**
+ * Log a message in the plugin's log.
+ *
+ * @param message
+ * the message to log
+ */
+ public static void log(Exception e) {
+ getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.OK, e.getLocalizedMessage(), e));
+ }
+
+ /**
+ * Log a message in the plugin's log.
+ *
+ * @param message
+ * the message to log
+ */
+ public static void debug(String message) {
+ getDefault().getLog().log(new Status(IStatus.INFO, Activator.PLUGIN_ID, IStatus.OK, message, null));
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/configuration/AbstractBasicDirectEditorConfiguration.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/configuration/AbstractBasicDirectEditorConfiguration.java
new file mode 100644
index 00000000000..f405e27e232
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/configuration/AbstractBasicDirectEditorConfiguration.java
@@ -0,0 +1,64 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Fanch BONNABESSE (ALL4TEC) fanch.bonnabesse@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Basic Direct Editor configuration to rename elements.
+ */
+public abstract class AbstractBasicDirectEditorConfiguration extends DefaultDirectEditorConfiguration implements ICustomDirectEditorConfiguration {
+
+ /**
+ * {@inheritDoc}
+ */
+ public DirectEditManager createDirectEditManager(final ITextAwareEditPart host) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IParser createParser(final EObject host) {
+ if (null == objectToEdit) {
+ objectToEdit = host;
+ }
+ return createDirectEditorParser();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public CellEditor createCellEditor(final Composite parent, final EObject object) {
+ TextCellEditor cellEditor = new TextCellEditor(parent, SWT.BORDER);
+ return cellEditor;
+ }
+
+ /**
+ * Creation of the parser used to renamed the element.
+ *
+ * @return The IParser.
+ */
+ public abstract IParser createDirectEditorParser();
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/configuration/DefaultDirectEditorConfiguration.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/configuration/DefaultDirectEditorConfiguration.java
new file mode 100644
index 00000000000..813de53976c
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/configuration/DefaultDirectEditorConfiguration.java
@@ -0,0 +1,180 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Remi Schnekenburger (CEA LIST) Remi.Schnekenburger@cea.fr - Initial API and implementation
+ * Fanch BONNABESSE (ALL4TEC) fanch.bonnabesse@all4tec.net - Bug 497289
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration;
+
+import org.eclipse.jface.dialogs.IInputValidator;
+import org.eclipse.jface.text.source.SourceViewerConfiguration;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Default implementation for the {@link IDirectEditorConfiguration} interface.
+ */
+public class DefaultDirectEditorConfiguration implements IDirectEditorConfiguration {
+
+ /** Default sourceViewer configuration */
+ protected SourceViewerConfiguration sourceViewerConfiguration;
+
+ /** language of the edited body */
+ protected String language;
+
+ /** To check if the configuration is available for each type. */
+ protected boolean superType;
+
+ /** objectToEdit */
+ protected Object objectToEdit;
+
+ /** input validator */
+ protected IInputValidator validator;
+
+ /**
+ * Returns the language of the edited body
+ *
+ * @return the language of the edited body
+ */
+ public String getLanguage() {
+ return language;
+ }
+
+ /**
+ * Sets the language of the edited body
+ *
+ * @param language
+ * the language of the edited body
+ */
+ public void setLanguage(String language) {
+ this.language = language;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Point getPreferedSize() {
+ return new Point(SWT.DEFAULT, SWT.DEFAULT);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public SourceViewerConfiguration getSourceViewerConfiguration() {
+ if (sourceViewerConfiguration == null) {
+ sourceViewerConfiguration = new SourceViewerConfiguration();
+ }
+ return sourceViewerConfiguration;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getStyle() {
+ return SWT.BORDER | SWT.SINGLE;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getTextToEdit(Object objectToEdit) {
+ return ""; //$NON-NLS-1$
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object postEditAction(Object objectToEdit, String newText) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object preEditAction(Object objectToEdit) {
+ setObjectToEdit(objectToEdit);
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Composite createExtendedDialogArea(Composite parent) {
+ return null;
+ }
+
+ /**
+ * Returns the object to edit
+ *
+ * @return the object to edit
+ */
+ public Object getObjectToEdit() {
+ return objectToEdit;
+ }
+
+ /**
+ * Sets the object to edit
+ *
+ * @param objectToEdit
+ * the object to edit
+ */
+ public void setObjectToEdit(Object objectToEdit) {
+ this.objectToEdit = objectToEdit;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IInputValidator getInputValidator() {
+ if (validator == null) {
+ validator = new IInputValidator() {
+
+ public String isValid(String newText) {
+ // always valid
+ return null;
+ }
+ };
+ }
+ return validator;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setInputValidator(IInputValidator validator) {
+ this.validator = validator;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Selection getTextSelection(String value, Object editedObject) {
+ return new Selection(0, value.length());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isSuperType() {
+ return superType;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setSuperType(boolean superType) {
+ this.superType = superType;
+ }
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/configuration/IAdvancedEditorConfiguration.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/configuration/IAdvancedEditorConfiguration.java
new file mode 100644
index 00000000000..25f1f708e05
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/configuration/IAdvancedEditorConfiguration.java
@@ -0,0 +1,33 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * Interface that should be implemented by advanced direct editors for Papyrus.
+ */
+public interface IAdvancedEditorConfiguration extends IDirectEditorConfiguration {
+
+ /**
+ * Creates the dialog for this direct editor
+ *
+ * @return the dialog created
+ */
+ public Dialog createDialog(Shell shell, EObject objectToEdit, String textToEdit);
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/configuration/ICustomDirectEditorConfiguration.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/configuration/ICustomDirectEditorConfiguration.java
new file mode 100644
index 00000000000..01e2018af2a
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/configuration/ICustomDirectEditorConfiguration.java
@@ -0,0 +1,37 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - initial API and implementation
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ *
+ * @author andreas muelder
+ *
+ */
+public interface ICustomDirectEditorConfiguration extends IDirectEditorConfiguration {
+
+ public DirectEditManager createDirectEditManager(ITextAwareEditPart host);
+
+ public IParser createParser(EObject host);
+
+ public CellEditor createCellEditor(Composite parent, EObject object);
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/configuration/IDirectEditorConfiguration.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/configuration/IDirectEditorConfiguration.java
new file mode 100644
index 00000000000..eb14bed0467
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/configuration/IDirectEditorConfiguration.java
@@ -0,0 +1,160 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Remi Schnekenburger (CEA LIST) Remi.Schnekenburger@cea.fr - Initial API and implementation
+ * Fanch BONNABESSE (ALL4TEC) fanch.bonnabesse@all4tec.net - Bug 497289
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration;
+
+import org.eclipse.jface.dialogs.IInputValidator;
+import org.eclipse.jface.text.source.SourceViewerConfiguration;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Interface that should be implemented by direct editors for Papyrus.
+ */
+public interface IDirectEditorConfiguration {
+
+ /**
+ * Returns the style for the source viewer widget
+ *
+ * @return the style for the source viewer widget
+ * @see SWT
+ */
+ // @unused
+ public int getStyle();
+
+ /**
+ * Returns the preferred size for the dialog window
+ *
+ * @return the preferred size for the dialog window
+ */
+ // @unused
+ public Point getPreferedSize();
+
+ /**
+ * Returns the source viewer configuration for the editor
+ *
+ * @return the source viewer configuration for the editor
+ */
+ public SourceViewerConfiguration getSourceViewerConfiguration();
+
+ /**
+ * Returns the text to edit
+ *
+ * @return the text to edit
+ */
+ public String getTextToEdit(Object editedObject);
+
+ /**
+ * Action executed before opening editor dialog window
+ *
+ * @return the result of this action
+ */
+ public Object preEditAction(Object editedObject);
+
+ /**
+ * Action executed before closing editor dialog window
+ *
+ * @param newText
+ * the text to save
+ * @return the result of this action
+ */
+ public Object postEditAction(Object editedObject, String newText);
+
+ /**
+ * Returns the extended Area for the dialog window
+ *
+ * @param parent
+ * the parent of the returned composite
+ * @return the extended Area for the dialog window or <code>null</code> if no extension is
+ * required
+ */
+ public Composite createExtendedDialogArea(Composite parent);
+
+ /**
+ * Returns the language of the edited body
+ *
+ * @return the language of the edited body
+ */
+ public String getLanguage();
+
+ /**
+ * Sets the language of the edited body
+ *
+ * @param language
+ * the language of the edited body
+ */
+ public void setLanguage(String language);
+
+ /**
+ * Returns the input validator, ie indicates if the text is correct
+ */
+ public IInputValidator getInputValidator();
+
+ /**
+ * Sets the input validator, ie the element that indicates if the text is correct
+ */
+ // @unused
+ public void setInputValidator(IInputValidator validator);
+
+ /**
+ * Get the text selection for the viewer
+ *
+ * @param value
+ *
+ * @return a selection
+ */
+ public Selection getTextSelection(String value, Object editedObject);
+
+ /**
+ * Class that represents an area for text selection
+ */
+ public static class Selection {
+
+ private final int lentgh;
+
+ private final int start;
+
+ public Selection(int start, int lentgh) {
+ this.start = start;
+ this.lentgh = lentgh;
+ }
+
+ public int getLentgh() {
+ return lentgh;
+ }
+
+ public int getStart() {
+ return start;
+ }
+
+ }
+
+ /**
+ * Get the superType attribute value.
+ *
+ * @return The value of superType.
+ */
+ public boolean isSuperType();
+
+ /**
+ * Set the superType attribute value.
+ *
+ * @param superType
+ * the value to set.
+ */
+ public void setSuperType(boolean superType);
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/configuration/IDirectEditorConstraint.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/configuration/IDirectEditorConstraint.java
new file mode 100644
index 00000000000..a88dc26ba39
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/configuration/IDirectEditorConstraint.java
@@ -0,0 +1,43 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Bug 441962
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration;
+
+/**
+ * Constraint for a Direct Editor.
+ *
+ * @author Camille Letavernier
+ *
+ */
+public interface IDirectEditorConstraint {
+
+ /**
+ * Label which define the constrained. This label is displayed in preference page
+ * and it is used to persist the preferences.
+ *
+ * @return the label
+ */
+ public String getLabel();
+
+ /**
+ * Check if the input object (current selection) corresponds to the defined constraint.
+ *
+ * @param selection
+ * the current selection
+ * @return <code>true</code> if selection matches the constraint, otherwise <code>false</code>
+ */
+ public boolean appliesTo(Object selection);
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/configuration/IModelGenerator.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/configuration/IModelGenerator.java
new file mode 100644
index 00000000000..16d4c08100e
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/configuration/IModelGenerator.java
@@ -0,0 +1,44 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration;
+
+import org.eclipse.core.runtime.IStatus;
+
+/**
+ * Standard interface for classes in charge of model validation and modification from a text
+ * representation of a UML element
+ */
+public interface IModelGenerator {
+
+ /**
+ * validates the element, given its textual representation
+ *
+ * @param label
+ * the label to validate
+ * @return the {@link IStatus} corresponding to the validation
+ */
+ public IStatus validate(String label);
+
+ /**
+ * modifies the element, given its textual representation
+ *
+ * @param label
+ * the label to validate
+ * @return the {@link IStatus} corresponding to the validation
+ */
+ // @unused
+ public IStatus modify(String label);
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/configuration/IPopupEditorConfiguration.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/configuration/IPopupEditorConfiguration.java
new file mode 100644
index 00000000000..2177640d1f4
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/configuration/IPopupEditorConfiguration.java
@@ -0,0 +1,31 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - initial API and implementation
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration;
+
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
+
+/**
+ * This interface can be used to create an IPopupEditorHelper, that can then be used to show the editor
+ */
+public interface IPopupEditorConfiguration extends IDirectEditorConfiguration {
+
+ /**
+ * Should create an IPopupEditorHelper, that can then be used to show the editor
+ *
+ * It is expected that the type of the param editPart:Object is instanceof IGraphicalEditPart
+ */
+ IPopupEditorHelper createPopupEditorHelper(Object editPart);
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/definition/DirectEditorExtensionPoint.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/definition/DirectEditorExtensionPoint.java
new file mode 100644
index 00000000000..ae993c67d20
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/definition/DirectEditorExtensionPoint.java
@@ -0,0 +1,526 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2018 CEA LIST.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - initial API and implementation
+ * Fanch BONNABESSE (ALL4TEC) fanch.bonnabesse@all4tec.net - Bug 497289
+ * Ansgar Radermacher (CEA LIST) ansgar.radermacher@cea.fr - Bug 528199
+ *
+ *******************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.definition;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.DefaultDirectEditorConfiguration;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConstraint;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.constraints.constraints.JavaQuery;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * Represented class for Extension point of Direct Editor.
+ */
+public class DirectEditorExtensionPoint implements IDirectEditorExtensionPoint {
+
+ private static volatile DirectEditorExtensionPoint instance = null;
+
+ /** Array that stores registered transformations */
+ private static IDirectEditorExtensionPoint[] configurations;
+
+ private static DirectEditorRegistry directEditorProvider;
+
+ /** value of the language attribute */
+ private String language;
+
+ /** value of the superType attribute */
+ private boolean superType;
+
+ /** value of the editor configuration attribute */
+ private IDirectEditorConfiguration directEditorConfiguration;
+
+ private Class<? extends EObject> objectClassToEdit;
+
+ /** the current priority of the direct editor, can be null **/
+ private Integer extensionPriority;
+
+ /** an optional additional constraint to filter the supported elements (In addition to the Metaclass) */
+ private IDirectEditorConstraint constraint;
+
+ private DirectEditorExtensionPoint() {
+ super();
+ init();
+ }
+
+ /**
+ * @since 2.0
+ */
+ protected void init() {
+ // It was not already computed,
+ // returns the new Collection of DirectEditorExtensionPoint
+ List<DirectEditorExtensionPoint> directEditorExtensionPoints = new ArrayList<DirectEditorExtensionPoint>();
+
+ // Reading data from plug-ins
+ IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor(IDirectEditorConfigurationIds.DIRECT_EDITOR_CONFIGURATION_EXTENSION_ID);
+
+ // Read configuration elements for the current extension
+ for (IConfigurationElement configElement : configElements) {
+ try {
+ DirectEditorExtensionPoint proxy = parseDirectEditorConfiguration(configElement);
+
+ if (proxy != null) {
+ directEditorExtensionPoints.add(proxy);
+ }
+ } catch (Throwable ex) {
+ Activator.log.error(ex);
+ continue;
+ }
+ } // end of configElements loop
+
+ configurations = directEditorExtensionPoints.toArray(new DirectEditorExtensionPoint[directEditorExtensionPoints.size()]);
+ directEditorProvider = new DirectEditorRegistry();
+ directEditorProvider.init(configurations);
+ }
+
+ /**
+ * @since 2.0
+ */
+ public final synchronized static DirectEditorExtensionPoint getInstance() {
+ if (DirectEditorExtensionPoint.instance == null) {
+ DirectEditorExtensionPoint.instance = new DirectEditorExtensionPoint();
+ }
+ return DirectEditorExtensionPoint.instance;
+ }
+
+ /**
+ * Returns the set of transformations registered in the platform
+ *
+ * @return the set of transformations registered in the platform
+ */
+ public IDirectEditorExtensionPoint[] getDirectEditorConfigurations() {
+ return configurations;
+ }
+
+ public DirectEditorRegistry getDirectEditorProvider() {
+ return directEditorProvider;
+ }
+
+ /**
+ * Retrieves the preferred editor configuration for the specified type
+ *
+ * @param class_
+ * the type of element to edit
+ * @return the preferred editor configuration for the specified type or <code>null</code>
+ * @deprecated Use {@link DirectEditorsUtil#getDefaultDirectEditorExtension(Object, Object)} instead
+ */
+ @Deprecated
+ public DirectEditorExtensionPoint getDefautDirectEditorConfiguration(EObject semanticObjectToEdit, Object selectedObject) {
+ return (DirectEditorExtensionPoint) DirectEditorsUtil.getDefaultDirectEditorExtension(semanticObjectToEdit, selectedObject);
+
+ }
+
+ /**
+ * Returns the set of transformations registered in the platform for the specified kind of
+ * element
+ *
+ * @param the
+ * type of element to be edited
+ * @return the set of transformations registered in the platform for the specified kind of
+ * element
+ * @deprecated Use {@link DirectEditorsUtil#getDirectEditorExtensions(Object, Object)} instead
+ */
+ @Deprecated
+ public Collection<DirectEditorExtensionPoint> getDirectEditorConfigurations(EObject semanticObjectToEdit, Object selectedObject) {
+ Collection<IDirectEditorExtensionPoint> directEditorConfigurations = DirectEditorsUtil.getDirectEditorExtensions(semanticObjectToEdit, selectedObject);
+
+ List<DirectEditorExtensionPoint> returnList = new ArrayList<DirectEditorExtensionPoint>();
+ for (IDirectEditorExtensionPoint extension : directEditorConfigurations) {
+ if (extension instanceof DirectEditorExtensionPoint) {
+ returnList.add((DirectEditorExtensionPoint) extension);
+ }
+ }
+ return returnList;
+ }
+
+ /**
+ * Returns a configuration, given elements from the ConfigurationElement
+ *
+ * @param configElt
+ * the element that declares the extension
+ * @return a new configuration, given the information of the specified configElt
+ */
+ public DirectEditorExtensionPoint parseDirectEditorConfiguration(IConfigurationElement configElt) {
+
+ // check that the ConfigElement is a transformation
+ if (!IDirectEditorConfigurationIds.TAG_DIRECT_EDITOR_CONFIGURATION.equals(configElt.getName())) {
+ return null;
+ }
+ // this is a transformation, tries to parse extension, and create the
+ // java corresponding
+ // class
+ try {
+ return new DirectEditorExtensionPoint(configElt);
+ } catch (Exception e) {
+ Activator.log(e);
+ return null;
+ }
+ }
+
+ /**
+ * Creates a new DirectEditorExtensionPoint, according to the ConfigurationElement
+ *
+ * @param configElt
+ * the configuration element corresponding to the configuration
+ */
+ public DirectEditorExtensionPoint(IConfigurationElement configElt) {
+ String attribute = getAttribute(configElt, IDirectEditorConfigurationIds.ATT_SUPER_TYPE, "false", false); //$NON-NLS-1$
+ superType = attribute.equals("true"); //$NON-NLS-1$
+
+ language = getAttribute(configElt, IDirectEditorConfigurationIds.ATT_LANGUAGE, "undefined", true); // should
+ // already
+ // be
+ // a
+ // string
+ String objectToEdit = getAttribute(configElt, IDirectEditorConfigurationIds.ATT_OBJECT_TO_EDIT, EObject.class.getCanonicalName(), true);
+
+ directEditorConfiguration = getDirectEditorConfigurationClass(configElt);
+ // the constraint maybe null!
+
+ extensionPriority = getPriority(configElt);
+ if (directEditorConfiguration == null) {
+ directEditorConfiguration = getAdvancedDirectEditorConfigurationClass(configElt);
+ }
+ // Block added for the case of popup editors
+ if (directEditorConfiguration == null) {
+ directEditorConfiguration = getPopupDirectEditorConfigurationClass(configElt);
+ }
+ directEditorConfiguration.setLanguage(language);
+ directEditorConfiguration.setSuperType(superType);
+
+ // retrieve the bundle loader of the plugin that declares the extension
+ try {
+ String pluginID = configElt.getContributor().getName();
+ objectClassToEdit = Platform.getBundle(pluginID).loadClass(objectToEdit).asSubclass(EObject.class);
+ } catch (ClassNotFoundException e) {
+ Activator.log.error(e);
+ } catch (ClassCastException e) {
+ Activator.log.error(e);
+ }
+
+ if (configElt.getAttribute(IDirectEditorConfigurationIds.ATT_ADDITIONAL_CONSTRAINT) != null) {
+ try {
+ constraint = (IDirectEditorConstraint) configElt.createExecutableExtension(IDirectEditorConfigurationIds.ATT_ADDITIONAL_CONSTRAINT);
+
+ } catch (CoreException ex) {
+ Activator.log.error(ex);
+ } catch (ClassCastException ex) {
+ Activator.log.error(ex);
+ }
+ }
+
+ }
+
+ protected static IDirectEditorConfiguration getDirectEditorConfigurationClass(IConfigurationElement configElement) {
+ IDirectEditorConfiguration configuration = null;
+ try {
+ if (configElement.getChildren(IDirectEditorConfigurationIds.TAG_SIMPLE_EDITOR).length > 0) {
+ Object config = configElement.getChildren(IDirectEditorConfigurationIds.TAG_SIMPLE_EDITOR)[0].createExecutableExtension(IDirectEditorConfigurationIds.ATT_EDITOR_CONFIGURATION);
+ if (config instanceof IDirectEditorConfiguration) {
+ configuration = (IDirectEditorConfiguration) config;
+ }
+ }
+ } catch (CoreException e) {
+ Activator.log(e);
+ configuration = new DefaultDirectEditorConfiguration();
+ }
+ return configuration;
+ }
+
+
+
+ /**
+ * Try to load a javaQuery defined in the extension point
+ *
+ * @param configElement
+ * the config element see {@link IConfigurationElement}
+ * @return the java query class see {@link JavaQuery}, can return null because this attribute is optional
+ */
+ protected static JavaQuery getJavaQueryClass(IConfigurationElement configElement) {
+ JavaQuery javaQuery = null;
+ try {
+ if (configElement.getAttribute(IDirectEditorConfigurationIds.ATT_CONSTRAINT) == null) {
+ return null;
+ }
+ Object config = configElement.createExecutableExtension(IDirectEditorConfigurationIds.ATT_CONSTRAINT);
+ if (config instanceof JavaQuery) {
+ javaQuery = (JavaQuery) config;
+ }
+ } catch (CoreException e) {
+ Activator.log(e);
+ }
+ return javaQuery;
+ }
+
+ /**
+ * This priority policy has been defined so that:
+ * - an external contribution is NOT the default editor with the classic configuration (LOW)
+ * - an external contribution can be set to default editor(use High or Highest)
+ *
+ * To achieve that:
+ * - the default priority is set to low
+ * - Papyrus editors priority is set to medium
+ * - Papyrus editors, defined to be the default ones, their priority is set at medium
+ */
+ protected static Integer getPriority(IConfigurationElement configElement) {
+ try {
+ for (IConfigurationElement childConfigElement : configElement.getChildren(IDirectEditorConfigurationIds.ATT_PRIORITY)) {
+
+ String config = getAttribute(childConfigElement, IDirectEditorConfigurationIds.ATT_PRIORITY_NAME, null, true);
+ if (config.equals(IDirectEditorConfigurationIds.PRIORITY_HIGHEST)) {
+ return new Integer(0);
+ }
+ if (config.equals(IDirectEditorConfigurationIds.PRIORITY_HIGH)) {
+ return new Integer(1);
+ }
+ if (config.equals(IDirectEditorConfigurationIds.PRIORITY_MEDIUM)) {
+ return new Integer(2);
+ }
+ if (config.equals(IDirectEditorConfigurationIds.PRIORITY_LOW)) {
+ return new Integer(3);
+ }
+ if (config.equals(IDirectEditorConfigurationIds.PRIORITY_LOWEST)) {
+ return new Integer(4);
+ }
+ }
+ } catch (Exception e) {
+ Activator.log.error(e);
+ }
+ return new Integer(3); // PRIORITY_LOW
+ }
+
+
+ protected static IAdvancedEditorConfiguration getAdvancedDirectEditorConfigurationClass(IConfigurationElement configElement) {
+ IAdvancedEditorConfiguration configuration = null;
+ try {
+ for (IConfigurationElement childConfigElement : configElement.getChildren(IDirectEditorConfigurationIds.TAG_ADVANCED_EDITOR)) {
+ for (String attname : childConfigElement.getAttributeNames()) {
+ Activator.log.debug(attname);
+ }
+
+ Object config = childConfigElement.createExecutableExtension(IDirectEditorConfigurationIds.ATT_EDITOR_CONFIGURATION);
+ if (config instanceof IAdvancedEditorConfiguration) {
+ configuration = (IAdvancedEditorConfiguration) config;
+ }
+ }
+
+ } catch (CoreException e) {
+ Activator.log.error(e);
+ configuration = null;
+ }
+ return configuration;
+ }
+
+ // /////////////////////////////// TODO:(done) Method added for the case of popup editors
+ protected static IDirectEditorConfiguration getPopupDirectEditorConfigurationClass(IConfigurationElement configElement) {
+ IDirectEditorConfiguration configuration = null;
+ try {
+ for (IConfigurationElement childConfigElement : configElement.getChildren(IDirectEditorConfigurationIds.TAG_POPUP_EDITOR)) {
+ for (String attname : childConfigElement.getAttributeNames()) {
+ Activator.log.debug(attname);
+ }
+
+ Object config = childConfigElement.createExecutableExtension(IDirectEditorConfigurationIds.ATT_EDITOR_CONFIGURATION);
+ if (config instanceof IDirectEditorConfiguration) {
+ configuration = (IDirectEditorConfiguration) config;
+ }
+ }
+
+ } catch (CoreException e) {
+ Activator.log(e);
+ configuration = null;
+ }
+ return configuration;
+ }
+
+ // ///////////////////////////////////
+
+ /**
+ * Returns the value of the attribute that has the given name, for the given configuration
+ * element.
+ * <p>
+ * if the attribute has no value, and if default value is not <code>null</code>, it returns defaultValue.
+ * <p>
+ * if it has no value, no default value, and if the attribute is required, it throws an exception.
+ *
+ * @param defaultValue
+ * the default value (if exists) of the attribute
+ * @param isRequired
+ * boolean that indicates if this attribute is required
+ * @param configElt
+ * configuration element that reflects the content of the extension
+ * @param name
+ * the name of the attribute to read
+ * @return the attribute value
+ */
+ protected static String getAttribute(IConfigurationElement configElt, String name, String defaultValue, boolean isRequired) {
+ String value = configElt.getAttribute(name);
+
+ if (value != null) {
+ return value;
+ } else if (defaultValue != null) {
+ return defaultValue;
+ }
+
+ if (isRequired) {
+ throw new IllegalArgumentException("Missing " + name + " attribute"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ return null;
+ }
+
+ /**
+ * Icon getter
+ *
+ * @return the icon which path is in extension
+ */
+ // @unused
+ protected Image getImage(String iconPath, IConfigurationElement configElement) {
+
+ // no image associated to this plug-in
+ if (iconPath == null) {
+ return null;
+ }
+ IExtension extension = configElement.getDeclaringExtension();
+ String extensionPluginId = extension.getContributor().getName();
+
+ return Activator.getImage(extensionPluginId, iconPath);
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.definition.IDirectEditorExtensionPoint#getLanguage()
+ *
+ * @return
+ */
+ public String getLanguage() {
+ return language;
+ }
+
+
+ /**
+ * @see org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.definition.IDirectEditorExtensionPoint#getObjectToEdit()
+ *
+ * @return
+ */
+ public String getObjectToEdit() {
+ return objectClassToEdit.getCanonicalName();
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.definition.IDirectEditorExtensionPoint#getObjectClassToEdit()
+ *
+ * @return
+ */
+ public Class<? extends EObject> getObjectClassToEdit() {
+ return objectClassToEdit;
+ }
+
+
+ /**
+ * @see org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.definition.IDirectEditorExtensionPoint#getDirectEditorConfiguration()
+ *
+ * @return
+ */
+ public IDirectEditorConfiguration getDirectEditorConfiguration() {
+ return directEditorConfiguration;
+ }
+
+
+ /**
+ * @see org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.definition.IDirectEditorExtensionPoint#setDirectEditorConfiguration(org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration)
+ *
+ * @param directEditorConfiguration
+ */
+ public void setDirectEditorConfiguration(IDirectEditorConfiguration directEditorConfiguration) {
+ this.directEditorConfiguration = directEditorConfiguration;
+ }
+
+
+ /**
+ * @see org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.definition.IDirectEditorExtensionPoint#getPriority()
+ *
+ * @return
+ */
+ public Integer getPriority() {
+ int preferencePriority = getPreferencePriority();
+ return preferencePriority != -1 ? preferencePriority : extensionPriority;
+ }
+
+
+ /**
+ * Gets the preference priority.
+ *
+ * @return the preference priority
+ */
+ private int getPreferencePriority() {
+ int preferencePriority = -1;
+ int preference = Activator.getDefault().getPreferenceStore().getInt(IDirectEditorsIds.EDITOR_FOR_ELEMENT + getObjectToEdit() + '.' + language);
+ if (IPreferenceStore.INT_DEFAULT_DEFAULT != preference) {
+ preferencePriority = preference;
+ }
+ return preferencePriority;
+ }
+
+
+ /**
+ * @see org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.definition.IDirectEditorExtensionPoint#setPriority(java.lang.Integer)
+ *
+ * @param priority
+ */
+ public void setPriority(Integer priority) {
+ this.extensionPriority = priority;
+ }
+
+ /**
+ * Gets the additional constraint.
+ *
+ * @return the additional constraint
+ */
+ public IDirectEditorConstraint getAdditionalConstraint() {
+ return constraint;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.definition.IDirectEditorExtensionPoint#getIcon()
+ *
+ * @return
+ */
+ public Image getIcon() {
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.definition.IDirectEditorExtensionPoint#isSuperType()
+ *
+ * @return
+ */
+ public boolean isSuperType() {
+ return superType;
+ }
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/definition/DirectEditorRegistry.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/definition/DirectEditorRegistry.java
new file mode 100644
index 00000000000..3ad9a3af95d
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/definition/DirectEditorRegistry.java
@@ -0,0 +1,144 @@
+/****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.definition;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.TreeMap;
+
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
+
+/**
+ * the goal of this class is to store all direct editors and to provides them by taking account
+ * object to edit, constraint, and priority
+ *
+ */
+public class DirectEditorRegistry {
+
+ // map of direct editor indexed by priorities
+ protected TreeMap<Integer, List<IDirectEditorExtensionPoint>> editorMap = new TreeMap<Integer, List<IDirectEditorExtensionPoint>>();
+ // list of objects that can be edited
+ protected ArrayList<String> objectToEdits = new ArrayList<String>();
+
+ /**
+ * add a direct editor
+ * if this direct editor is already used as default in preferences, its priority becomes 0
+ *
+ * @param directEditor
+ * a direct editor, cannot be null
+ */
+ public void add(IDirectEditorExtensionPoint directEditor) {
+ assert (directEditor != null);
+ objectToEdits.add(directEditor.getObjectToEdit());
+ Integer priority = directEditor.getPriority();
+
+ // take in account priority of preferences
+ String preferedLanguage = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + directEditor.getObjectToEdit());
+
+ // if the language equals is store in preferences this is the default direct editor
+ if (preferedLanguage.equals(directEditor.getLanguage())) {
+ priority = new Integer(0);
+ }
+ List<IDirectEditorExtensionPoint> currentValue = editorMap.get(priority);
+ if (currentValue == null) {
+ currentValue = new ArrayList<IDirectEditorExtensionPoint>();
+ }
+
+ currentValue.add(directEditor);
+ editorMap.put(priority, currentValue);
+ }
+
+ /**
+ * put in preferences the editor with the more important priority
+ */
+ protected void adaptPreferences() {
+ Iterator<String> iter = objectToEdits.iterator();
+ IDirectEditorExtensionPoint defaultDirectEditor = null;
+ while (iter.hasNext()) {
+ String objectToEdit = iter.next();
+ defaultDirectEditor = getDefaultDirectEditor(objectToEdit);
+
+ String id = IDirectEditorsIds.EDITOR_FOR_ELEMENT + defaultDirectEditor.getObjectToEdit();
+ String language = defaultDirectEditor.getLanguage();
+ // if preference set direct editor as default, do nothing
+ if (!Activator.getDefault().getPreferenceStore().getString(id).equals(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR)) {
+ Activator.getDefault().getPreferenceStore().setValue(id, language);
+ }
+ }
+ }
+
+ @Override
+ public String toString() {
+ String out = "";
+ Iterator<Integer> keyIterator = editorMap.keySet().iterator();
+
+ while (keyIterator.hasNext()) {
+ Integer index = keyIterator.next();
+ out = out + "\n[" + index + "]" + "=[" + editorMap.get(index) + "]";
+
+ }
+ return out;
+ }
+
+ /**
+ * used to fill the registry with an array of direct editors
+ *
+ * @param directEditors
+ * cannot be null
+ */
+ public void init(IDirectEditorExtensionPoint[] directEditors) {
+ editorMap = new TreeMap<Integer, List<IDirectEditorExtensionPoint>>();
+ objectToEdits = new ArrayList<String>();
+ for (int i = 0; i < directEditors.length; i++) {
+ add(directEditors[i]);
+
+ }
+ adaptPreferences();
+
+ }
+
+ /**
+ * get the direct editor with the higher priority for a given object to edit.
+ *
+ * @param ObjectToEdit
+ * the string that represents the element to edit
+ * @return a direct editor, it can be null
+ */
+ public IDirectEditorExtensionPoint getDefaultDirectEditor(String ObjectToEdit) {
+ Iterator<Integer> keyIterator = editorMap.keySet().iterator();
+ TreeMap<Integer, IDirectEditorExtensionPoint> directEditorExtensionPoints = new TreeMap<Integer, IDirectEditorExtensionPoint>();
+ while (keyIterator.hasNext()) {
+ Integer index = keyIterator.next();
+ Iterator<IDirectEditorExtensionPoint> iter = editorMap.get(index).iterator();
+ while (iter.hasNext()) {
+ IDirectEditorExtensionPoint directEditorExtensionPoint = iter.next();
+ if (directEditorExtensionPoint.getObjectToEdit().equals(ObjectToEdit)) {
+ directEditorExtensionPoints.put(directEditorExtensionPoint.getPriority(), directEditorExtensionPoint);
+ }
+
+ }
+ // if the user add a direct editor with highest priority, do not return the default direct editor but the direct editor with highest priority
+ // this will set the highest priority direct editor to the default one
+ if (!directEditorExtensionPoints.isEmpty()) {
+ return directEditorExtensionPoints.firstEntry().getValue();
+ }
+ }
+ return null;
+ }
+
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/definition/IDirectEditorConfigurationIds.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/definition/IDirectEditorConfigurationIds.java
new file mode 100644
index 00000000000..f9ff792783d
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/definition/IDirectEditorConfigurationIds.java
@@ -0,0 +1,78 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - initial API and implementation
+ * Fanch BONNABESSE (ALL4TEC) fanch.bonnabesse@all4tec.net - Bug 497289
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.definition;
+
+/**
+ * Constant for the direct editor extension point
+ */
+public interface IDirectEditorConfigurationIds {
+
+ /** id of the direct editor configuration extension point */
+ public static final String DIRECT_EDITOR_CONFIGURATION_EXTENSION_ID = org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator.PLUGIN_ID + ".DirectEditor";
+
+ /** id of the direct editor configuration element */
+ public static final String TAG_DIRECT_EDITOR_CONFIGURATION = "DirectEditor";
+
+ /** id of the language attribute */
+ public static final String ATT_LANGUAGE = "language";
+
+ /** id of the object to edit attribute */
+ public static final String ATT_OBJECT_TO_EDIT = "objectToEdit";
+
+ /** id of the direct editor configuration attribute */
+ public static final String ATT_EDITOR_CONFIGURATION = "editorConfiguration";
+
+ /** id of the direct editor "additional constraint" attribute */
+ public static final String ATT_ADDITIONAL_CONSTRAINT = "additionalConstraint"; //$NON-NLS-1$
+
+ /** id of the direct editor simple configuration tag */
+ public static final String TAG_SIMPLE_EDITOR = "simpleeditor";
+
+ /** id of the direct editor advanced configuration tag */
+ public static final String TAG_ADVANCED_EDITOR = "advancededitor";
+
+ /** id of the direct editor popup configuration tag */
+ public static final String TAG_POPUP_EDITOR = "popupeditor";
+
+ /** id of the constraint associated to a directEditor */
+ public static final String ATT_CONSTRAINT = "constraint";
+
+ /** id of the priority associated to a directEditor */
+ public static final String ATT_PRIORITY = "Priority";
+
+ /** id of the priority name associated to a directEditor */
+ public static final String ATT_PRIORITY_NAME = "name";
+
+ /** string that represents the lowest priority **/
+ public static final String PRIORITY_LOWEST = "Lowest";
+
+ /** string that represents a Low priority **/
+ public static final String PRIORITY_LOW = "Low";
+
+ /** string that represents a Medium priority **/
+ public static final String PRIORITY_MEDIUM = "Medium";
+
+ /** string that represents a High priority **/
+ public static final String PRIORITY_HIGH = "High";
+
+ /** string that represents the Highest priority **/
+ public static final String PRIORITY_HIGHEST = "Highest";
+
+ /** string that represents the superType attribute **/
+ public static final String ATT_SUPER_TYPE = "superType";
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/definition/IDirectEditorExtensionPoint.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/definition/IDirectEditorExtensionPoint.java
new file mode 100644
index 00000000000..2fed09b6464
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/definition/IDirectEditorExtensionPoint.java
@@ -0,0 +1,106 @@
+/*****************************************************************************
+ * Copyright (c) 2015 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Initial API and implementation
+ * Fanch BONNABESSE (ALL4TEC) fanch.bonnabesse@all4tec.net - Bug 497289
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.definition;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConstraint;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * Interface to manipulate extension point of Direct Editor.
+ *
+ * @author Gabriel Pascual
+ *
+ */
+public interface IDirectEditorExtensionPoint {
+
+ /**
+ * Returns the language edited by this direct editor
+ *
+ * @return the language edited by this direct editor
+ */
+ public String getLanguage();
+
+ /**
+ * Returns the type of object to edit
+ *
+ * @return the type of object to edit
+ */
+ public String getObjectToEdit();
+
+ /**
+ * Returns the class of object to edit
+ *
+ * @return the class of object to edit
+ */
+ public Class<? extends EObject> getObjectClassToEdit();
+
+ /**
+ * Gets the icon.
+ *
+ * @return the icon
+ */
+ public Image getIcon();
+
+ /**
+ * Returns the configuration for the dialog window
+ *
+ * @return the configuration for the dialog window
+ */
+ public IDirectEditorConfiguration getDirectEditorConfiguration();
+
+ /**
+ * Sets the configuration for the dialog window
+ *
+ * @param directEditorConfiguration
+ * the configuration for the dialog window
+ */
+ // @unused
+ public void setDirectEditorConfiguration(IDirectEditorConfiguration directEditorConfiguration);
+
+ /**
+ * Gets the priority.
+ *
+ * @return the priority
+ */
+ public Integer getPriority();
+
+
+ /**
+ * Sets the priority.
+ *
+ * @param priority
+ * the new priority
+ */
+ public void setPriority(Integer priority);
+
+ /**
+ * Gets the additional constraint.
+ *
+ * @return the additional constraint
+ */
+ public IDirectEditorConstraint getAdditionalConstraint();
+
+ /**
+ * Return the "superType" attribute*.
+ *
+ * @return The attribute.
+ */
+ public boolean isSuperType();
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/preferences/PapyrusEmbeddedEditorsPreferencePage.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/preferences/PapyrusEmbeddedEditorsPreferencePage.java
new file mode 100644
index 00000000000..f6b4acdd941
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/preferences/PapyrusEmbeddedEditorsPreferencePage.java
@@ -0,0 +1,569 @@
+/****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Remi Schnekenburger (CEA LIST) - Initial API and implementation
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual - Bug 441962
+ * Fanch BONNABESSE (ALL4TEC) fanch.bonnabesse@all4tec.net - Bug 497289
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.preferences;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConstraint;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.definition.DirectEditorExtensionPoint;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.definition.IDirectEditorConfigurationIds;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.definition.IDirectEditorExtensionPoint;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.preferences.provider.DirectEditorContentProvider;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.preferences.provider.DirectEditorLabelProvider;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.preferences.provider.DirectEditorTreeItem;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+/**
+ * The file editors page presents the collection of file names and extensions for which the user has
+ * registered editors. It also lets the user add new internal or external (program) editors for a
+ * given file name and extension.
+ *
+ * The user can add an editor for either a specific file name and extension (e.g. report.doc), or
+ * for all file names of a given extension (e.g. *.doc)
+ *
+ * The set of registered editors is tracked by the EditorRegistery available from the workbench
+ * plugin.
+ */
+public class PapyrusEmbeddedEditorsPreferencePage extends PreferencePage implements IWorkbenchPreferencePage, Listener {
+
+ /**
+ *
+ */
+ private static final String PRIORITY_COLUMN_TITLE = "Priority";
+
+ /** The Constant ELEMENTS_TO_EDIT_VIEWER_LABEL. */
+ private static final String ELEMENTS_TO_EDIT_VIEWER_LABEL = "Elements to edit";
+
+ /** The Constant DEFAULT_BUTTON_LABEL. */
+ private static final String DEFAULT_BUTTON_LABEL = "Default";
+
+ /** The Constant DIRECT_EDITOR_PART_LABEL. */
+ private static final String DIRECT_EDITOR_PART_LABEL = "Associated editor";
+
+ /** The Constant PREFERENCE_KEY_SEPARATOR. */
+ private static final String PREFERENCE_KEY_SEPARATOR = "."; //$NON-NLS-1$
+
+ /** The Constant DEFAULT_EDITOR_LABEL. */
+ protected static final String DEFAULT_EDITOR_LABEL = " (Default Editor)"; //$NON-NLS-1$
+
+ protected TableViewer editorTable;
+
+ protected Button defaultEditorButton;
+
+ protected Label editorLabel;
+
+ protected IWorkbench workbench;
+
+ private TreeViewer elementTypeViewer;
+
+ /**
+ * Creates the page's UI content.
+ */
+ @Override
+ protected Control createContents(Composite parent) {
+
+
+ // define container & its layout
+ Composite pageComponent = createMainComposite(parent);
+
+ // layout the top table & its buttons
+ createElementTypePart(pageComponent);
+
+
+ // layout the bottom table & its buttons
+ createDirectEditorPart(pageComponent);
+
+ createButtonsPanel(pageComponent);
+
+
+ fillEditorTree();
+
+ fillEditorTable();
+ updateEnabledState();
+
+ applyDialogFont(pageComponent);
+
+ return pageComponent;
+ }
+
+ /**
+ * Creates the buttons panel.
+ *
+ * @param parent
+ * the parent
+ */
+ private void createButtonsPanel(Composite parent) {
+ Composite groupComponent;
+ GridLayout groupLayout;
+ GridData data;
+ groupComponent = new Composite(parent, SWT.NULL);
+ groupLayout = new GridLayout();
+ groupLayout.marginWidth = 0;
+ groupLayout.marginHeight = 0;
+ groupComponent.setLayout(groupLayout);
+ data = new GridData();
+ data.verticalAlignment = GridData.FILL;
+ data.horizontalAlignment = GridData.FILL;
+ groupComponent.setLayoutData(data);
+
+ defaultEditorButton = new Button(groupComponent, SWT.PUSH);
+ defaultEditorButton.setText(DEFAULT_BUTTON_LABEL);
+ defaultEditorButton.addListener(SWT.Selection, this);
+ setButtonLayoutData(defaultEditorButton);
+ }
+
+ /**
+ * Creates the direct editor part.
+ *
+ * @param pageComponent
+ * the page component
+ */
+ private void createDirectEditorPart(Composite pageComponent) {
+
+ editorLabel = new Label(pageComponent, SWT.LEFT);
+ editorLabel.setText(DIRECT_EDITOR_PART_LABEL);
+
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ data.horizontalSpan = 2;
+ editorLabel.setLayoutData(data);
+
+ editorTable = new TableViewer(pageComponent, SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER);
+ editorTable.getTable().addListener(SWT.Selection, this);
+ editorTable.getTable().addListener(SWT.DefaultSelection, this);
+ editorTable.getTable().setLinesVisible(true);
+ editorTable.getTable().setHeaderVisible(true);
+ editorTable.setContentProvider(ArrayContentProvider.getInstance());
+
+ createEditorNameColumn();
+ createEditorPriorityColumn();
+
+
+ data = new GridData(GridData.FILL_BOTH);
+ data.heightHint = editorTable.getTable().getItemHeight() * 7;
+ editorTable.getTable().setLayoutData(data);
+ }
+
+ /**
+ * Creates the editor priority column.
+ */
+ private void createEditorPriorityColumn() {
+ TableViewerColumn editorPriorityColumn = new TableViewerColumn(editorTable, SWT.NONE);
+ editorPriorityColumn.getColumn().setWidth(200);
+ editorPriorityColumn.getColumn().setText(PRIORITY_COLUMN_TITLE);
+ editorPriorityColumn.setLabelProvider(new ColumnLabelProvider() {
+ /**
+ * @see org.eclipse.jface.viewers.ColumnLabelProvider#getText(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
+ @Override
+ public String getText(Object element) {
+ String priorityLabel = "<Unknown>";
+ if (element instanceof IDirectEditorExtensionPoint) {
+ switch (((IDirectEditorExtensionPoint) element).getPriority()) {
+ case 0:
+ priorityLabel = IDirectEditorConfigurationIds.PRIORITY_HIGHEST;
+ break;
+ case 1:
+ priorityLabel = IDirectEditorConfigurationIds.PRIORITY_HIGH;
+ break;
+ case 2:
+ priorityLabel = IDirectEditorConfigurationIds.PRIORITY_MEDIUM;
+ break;
+ case 3:
+ priorityLabel = IDirectEditorConfigurationIds.PRIORITY_LOW;
+ break;
+ case 4:
+ priorityLabel = IDirectEditorConfigurationIds.PRIORITY_LOWEST;
+ break;
+
+ default:
+ break;
+ }
+ ;
+ }
+ return priorityLabel;
+ }
+ });
+
+ PriorityEditorEditingSupport editingSupport = new PriorityEditorEditingSupport(editorTable);
+ editorPriorityColumn.setEditingSupport(editingSupport);
+ }
+
+ /**
+ * Creates the editor name column.
+ */
+ private void createEditorNameColumn() {
+ TableViewerColumn editorNameColumn = new TableViewerColumn(editorTable, SWT.NONE);
+ editorNameColumn.getColumn().setWidth(200);
+ editorNameColumn.getColumn().setText("Name");
+ editorNameColumn.setLabelProvider(new ColumnLabelProvider() {
+ /**
+ * @see org.eclipse.jface.viewers.ColumnLabelProvider#getText(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
+ @Override
+ public String getText(Object element) {
+ String label = "<Unknown>";
+ if (element instanceof IDirectEditorExtensionPoint) {
+ String elementType = getSelectedElementType();
+ String preferedLanguage = getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + elementType);
+ // retrieves if this editor is the default one or not.
+ label = ((IDirectEditorExtensionPoint) element).getLanguage();
+ if (preferedLanguage.equals(((IDirectEditorExtensionPoint) element).getLanguage())) {
+ label += DEFAULT_EDITOR_LABEL;
+ }
+ }
+ return label;
+ }
+
+ });
+ }
+
+ /**
+ * Creates the element type part.
+ *
+ * @param pageComponent
+ * the page component
+ */
+ private void createElementTypePart(Composite pageComponent) {
+ Label label = new Label(pageComponent, SWT.LEFT);
+ label.setText(ELEMENTS_TO_EDIT_VIEWER_LABEL);
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ data.horizontalSpan = 2;
+ label.setLayoutData(data);
+
+ elementTypeViewer = new TreeViewer(pageComponent);
+ elementTypeViewer.setContentProvider(new DirectEditorContentProvider());
+ elementTypeViewer.setLabelProvider(new DirectEditorLabelProvider());
+ elementTypeViewer.getTree().addListener(SWT.Selection, this);
+ elementTypeViewer.getTree().addListener(SWT.DefaultSelection, this);
+
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalAlignment = GridData.FILL;
+ data.heightHint = elementTypeViewer.getTree().getItemHeight() * 10; // ten lines
+ // shown
+ elementTypeViewer.getTree().setLayoutData(data);
+
+ }
+
+ /**
+ * Creates the main composite.
+ *
+ * @param parent
+ * the parent
+ * @return the composite
+ */
+ private Composite createMainComposite(Composite parent) {
+ Composite pageComponent = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ pageComponent.setLayout(layout);
+ GridData data = new GridData();
+ data.verticalAlignment = GridData.FILL;
+ data.horizontalAlignment = GridData.FILL;
+ pageComponent.setLayoutData(data);
+ return pageComponent;
+ }
+
+
+
+ /**
+ * Hook method to get a page specific preference store. Reimplement this method if a page don't
+ * want to use its parent's preference store.
+ */
+ @Override
+ protected IPreferenceStore doGetPreferenceStore() {
+ return Activator.getDefault().getPreferenceStore();
+ }
+
+ /**
+ * Fill editor table.
+ */
+ protected void fillEditorTable() {
+ editorTable.getTable().removeAll();
+
+ List<IDirectEditorExtensionPoint> editors = getAssociatedEditors();
+ editors.add(SimpleDirectEditorExtension.getInstance());
+ editorTable.setInput(editors.toArray());
+
+ }
+
+ /**
+ * Fill editor tree.
+ */
+ private void fillEditorTree() {
+ Map<String, List<IDirectEditorExtensionPoint>> elements = new HashMap<String, List<IDirectEditorExtensionPoint>>();
+
+ // Populate the table with the items
+ IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations();
+ List<IDirectEditorExtensionPoint> configurations;
+ for (IDirectEditorExtensionPoint extensionPoint : extensionPoints) {
+ if (!elements.containsKey(extensionPoint.getObjectToEdit())) {
+ // no configuration yet for this element.
+ configurations = new ArrayList<IDirectEditorExtensionPoint>();
+ } else {
+ configurations = elements.get(extensionPoint.getObjectToEdit());
+ }
+ configurations.add(extensionPoint);
+ // replace configuration list
+ elements.put(extensionPoint.getObjectToEdit(), configurations);
+ }
+
+ // Build the input to display
+ Set<String> keys = elements.keySet();
+ List<DirectEditorTreeItem> preferencesItemsList = new ArrayList<DirectEditorTreeItem>(keys.size());
+
+ for (String key : keys) {
+ preferencesItemsList.add(new DirectEditorTreeItem(elements.get(key)));
+ }
+ elementTypeViewer.setInput(preferencesItemsList);
+
+ // Set selection
+ elementTypeViewer.setSelection(new StructuredSelection(preferencesItemsList.get(0)));
+ }
+
+
+ /**
+ * Gets the selected element type.
+ *
+ * @return the selected element type
+ */
+ protected String getSelectedElementType() {
+ String selectedElementType = null;
+ ISelection selection = elementTypeViewer.getSelection();
+ if (!selection.isEmpty()) {
+ if (selection instanceof IStructuredSelection) {
+ // Tree is single select
+ Object selectedElement = ((IStructuredSelection) selection).getFirstElement();
+ if (selectedElement instanceof DirectEditorTreeItem) {
+
+ // Preference key is the qualified name of edited Meta Class
+ selectedElementType = ((DirectEditorTreeItem) selectedElement).getMetaClassToEdit();
+ } else if (selectedElement instanceof IDirectEditorConstraint) {
+ Object parentElement = getParentTreeItem();
+ if (parentElement instanceof DirectEditorTreeItem) {
+
+ // Preference key is the qualified name of edited Meta Class with Constraint name
+ selectedElementType = ((DirectEditorTreeItem) parentElement).getMetaClassToEdit() + PREFERENCE_KEY_SEPARATOR + ((IDirectEditorConstraint) selectedElement).getLabel();
+ }
+ }
+
+ }
+ }
+ return selectedElementType;
+ }
+
+ /**
+ * Gets the parent tree item.
+ *
+ * @return the parent tree item
+ */
+ private Object getParentTreeItem() {
+ // Tree is single select
+ TreeItem parentItem = elementTypeViewer.getTree().getSelection()[0].getParentItem();
+ Object parentElement = parentItem.getData();
+ return parentElement;
+ }
+
+ /**
+ * Returns all {@link DirectEditorExtensionPoint} for the current selected element type
+ *
+ * @return all {@link DirectEditorExtensionPoint} for the current selected element type or <code>null</code.
+ */
+ protected List<IDirectEditorExtensionPoint> getAssociatedEditors() {
+ List<IDirectEditorExtensionPoint> associatedEditors = new ArrayList<IDirectEditorExtensionPoint>();
+
+ if (getSelectedElementType() != null) {
+
+ ISelection selection = elementTypeViewer.getSelection();
+
+ // Handle the selection
+ if (selection instanceof IStructuredSelection) {
+ Object selectedElement = ((IStructuredSelection) selection).getFirstElement();
+ if (selectedElement instanceof IDirectEditorConstraint) {
+
+ Object parentElement = getParentTreeItem();
+ if (parentElement instanceof DirectEditorTreeItem) {
+ associatedEditors.addAll(((DirectEditorTreeItem) parentElement).getConstrainedEditor((IDirectEditorConstraint) selectedElement));
+ }
+
+ } else {
+ DirectEditorTreeItem treeItem = (DirectEditorTreeItem) selectedElement;
+ associatedEditors.addAll(treeItem.getConfigurations());
+ }
+ }
+ }
+ return associatedEditors;
+ }
+
+ public void handleEvent(Event event) {
+ /*
+ * if (event.widget == upEditorButton) { promptForEditor(); } else if (event.widget ==
+ * downEditorButton) { removeSelectedEditor(); } else
+ */if (event.widget == defaultEditorButton) {
+ setSelectedEditorAsDefault();
+ } else if (event.widget == elementTypeViewer.getTree()) {
+ fillEditorTable();
+ }
+
+ updateEnabledState();
+
+ }
+
+ /**
+ * @see IWorkbenchPreferencePage
+ */
+ public void init(IWorkbench aWorkbench) {
+ this.workbench = aWorkbench;
+ noDefaultAndApplyButton();
+ }
+
+ /**
+ * Add the selected editor to the default list.
+ */
+ public void setSelectedEditorAsDefault() {
+
+ ISelection selection = editorTable.getSelection();
+ IDirectEditorExtensionPoint extensionPoint = null;
+ if (!selection.isEmpty()) {
+ // First change the label of the old default
+ // Now set the new default
+ if (selection instanceof IStructuredSelection) {
+ Object selectedElement = ((IStructuredSelection) selection).getFirstElement();
+ if (selectedElement instanceof IDirectEditorExtensionPoint) {
+ extensionPoint = (IDirectEditorExtensionPoint) selectedElement;
+ }
+ }
+ // retrieve current object to edit name
+ getPreferenceStore().setValue(IDirectEditorsIds.EDITOR_FOR_ELEMENT + getSelectedElementType(), (extensionPoint != null) ? extensionPoint.getLanguage() : IDirectEditorsIds.SIMPLE_DIRECT_EDITOR);
+ editorTable.refresh();
+
+
+ }
+ }
+
+ /**
+ * Update the enabled state.
+ */
+ public void updateEnabledState() {
+ // Update enabled state
+ boolean resourceTypeSelected = elementTypeViewer.getTree().getSelection() != null;
+ boolean editorSelected = editorTable.getTable().getSelectionIndex() != -1;
+
+ editorLabel.setEnabled(resourceTypeSelected);
+ defaultEditorButton.setEnabled(editorSelected);
+ }
+
+ /**
+ * Extension point for Simple Editor.
+ */
+ private static class SimpleDirectEditorExtension implements IDirectEditorExtensionPoint {
+
+ public static IDirectEditorExtensionPoint getInstance() {
+ return new SimpleDirectEditorExtension();
+ }
+
+ /**
+ * Constructor.
+ *
+ */
+ private SimpleDirectEditorExtension() {
+ priority = 3;
+ }
+
+ private Integer priority;
+
+ public void setPriority(Integer priority) {
+ this.priority = priority;
+ }
+
+ public void setDirectEditorConfiguration(IDirectEditorConfiguration directEditorConfiguration) {
+
+ }
+
+ public Integer getPriority() {
+ return priority;
+ }
+
+ public String getObjectToEdit() {
+ return null;
+ }
+
+ public Class<? extends EObject> getObjectClassToEdit() {
+ return null;
+ }
+
+ public String getLanguage() {
+ return IDirectEditorsIds.SIMPLE_DIRECT_EDITOR;
+ }
+
+ public Image getIcon() {
+ return null;
+ }
+
+ public IDirectEditorConfiguration getDirectEditorConfiguration() {
+ return null;
+ }
+
+ public IDirectEditorConstraint getAdditionalConstraint() {
+ return null;
+ }
+
+ public boolean isSuperType() {
+ return false;
+ }
+ };
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/preferences/PriorityEditorEditingSupport.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/preferences/PriorityEditorEditingSupport.java
new file mode 100644
index 00000000000..8fb15c5911c
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/preferences/PriorityEditorEditingSupport.java
@@ -0,0 +1,106 @@
+/*****************************************************************************
+ * Copyright (c) 2015 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.preferences;
+
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ComboBoxCellEditor;
+import org.eclipse.jface.viewers.EditingSupport;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.definition.IDirectEditorConfigurationIds;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.definition.IDirectEditorExtensionPoint;
+
+/**
+ * Editing Support for cell of Priority editor.
+ *
+ * @author Gabriel Pascual
+ *
+ */
+public class PriorityEditorEditingSupport extends EditingSupport {
+
+ /** The Constant priorityItems. */
+ private static final String[] priorityItems = new String[] { IDirectEditorConfigurationIds.PRIORITY_HIGHEST,
+ IDirectEditorConfigurationIds.PRIORITY_HIGH, IDirectEditorConfigurationIds.PRIORITY_MEDIUM,
+ IDirectEditorConfigurationIds.PRIORITY_LOW, IDirectEditorConfigurationIds.PRIORITY_LOWEST };
+
+ /** The cell editor. */
+ private CellEditor cellEditor;
+
+ /**
+ * Constructor.
+ *
+ * @param viewer
+ * the viewer
+ */
+ public PriorityEditorEditingSupport(TableViewer viewer) {
+ super(viewer);
+
+ cellEditor = new ComboBoxCellEditor(viewer.getTable(), priorityItems);
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.EditingSupport#setValue(java.lang.Object, java.lang.Object)
+ *
+ * @param element
+ * @param value
+ */
+ @Override
+ protected void setValue(Object element, Object value) {
+ if (element instanceof IDirectEditorExtensionPoint) {
+ ((IDirectEditorExtensionPoint) element).setPriority((Integer) value);
+ getViewer().refresh();
+ }
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.EditingSupport#getValue(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
+ @Override
+ protected Object getValue(Object element) {
+ Object value = 0;
+ if (element instanceof IDirectEditorExtensionPoint) {
+ value = ((IDirectEditorExtensionPoint) element).getPriority();
+ }
+ return value;
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.EditingSupport#getCellEditor(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
+ @Override
+ protected CellEditor getCellEditor(Object element) {
+ return cellEditor;
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.EditingSupport#canEdit(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
+ @Override
+ protected boolean canEdit(Object element) {
+ return element instanceof IDirectEditorExtensionPoint;
+
+ }
+
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/preferences/provider/DirectEditorContentProvider.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/preferences/provider/DirectEditorContentProvider.java
index ca476964932..8591190e03b 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/preferences/provider/DirectEditorContentProvider.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/preferences/provider/DirectEditorContentProvider.java
@@ -13,7 +13,7 @@
*
*****************************************************************************/
-package org.eclipse.papyrus.extensionpoints.editors.preferences.provider;
+package org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.preferences.provider;
import java.util.List;
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/preferences/provider/DirectEditorLabelProvider.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/preferences/provider/DirectEditorLabelProvider.java
index 5b85a120d77..9f04a3dab6c 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/preferences/provider/DirectEditorLabelProvider.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/preferences/provider/DirectEditorLabelProvider.java
@@ -13,11 +13,11 @@
*
*****************************************************************************/
-package org.eclipse.papyrus.extensionpoints.editors.preferences.provider;
+package org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.preferences.provider;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConstraint;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConstraint;
import org.eclipse.swt.graphics.Image;
/**
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/preferences/provider/DirectEditorTreeItem.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/preferences/provider/DirectEditorTreeItem.java
index 40f3a854191..c777e237830 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/preferences/provider/DirectEditorTreeItem.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/preferences/provider/DirectEditorTreeItem.java
@@ -13,13 +13,13 @@
*
*****************************************************************************/
-package org.eclipse.papyrus.extensionpoints.editors.preferences.provider;
+package org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.preferences.provider;
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConstraint;
-import org.eclipse.papyrus.extensionpoints.editors.definition.IDirectEditorExtensionPoint;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConstraint;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.definition.IDirectEditorExtensionPoint;
/**
*
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/DirectEditExecutableExtension.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/DirectEditExecutableExtension.java
new file mode 100644
index 00000000000..f11a126b927
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/DirectEditExecutableExtension.java
@@ -0,0 +1,31 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExecutableExtension;
+
+//@unused
+public class DirectEditExecutableExtension implements IExecutableExtension {
+
+ public DirectEditExecutableExtension() {
+ }
+
+ public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/DirectEditorsContributionItem.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/DirectEditorsContributionItem.java
new file mode 100644
index 00000000000..78e6527aa1b
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/DirectEditorsContributionItem.java
@@ -0,0 +1,311 @@
+/*****************************************************************************
+ * Copyright (c) 2015 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Bug 441962
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui;
+
+import java.util.Collection;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.action.ContributionItem;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.definition.IDirectEditorExtensionPoint;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.CoolBar;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.ui.ISelectionService;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.menus.IWorkbenchContribution;
+import org.eclipse.ui.services.IServiceLocator;
+
+/**
+ * Contribution to contextual menu for Direct Editor extension.
+ */
+public class DirectEditorsContributionItem extends ContributionItem implements IWorkbenchContribution {
+
+ /**
+ * Service locator given to this contribution item using the {@link IWorkbenchContribution} interface.
+ */
+ private IServiceLocator serviceLocator;
+
+ private MenuItem subMenuItem;
+
+ /**
+ *
+ */
+ public DirectEditorsContributionItem() {
+ setId("org.eclipse.papyrus.editors.menuitem"); //$NON-NLS-1$
+ }
+
+ /**
+ * @param id
+ */
+ public DirectEditorsContributionItem(String id) {
+ super(id);
+ }
+
+ /**
+ * The default implementation of this <code>IContributionItem</code> method does nothing.
+ * Subclasses may override.
+ */
+ @Override
+ public void dispose() {
+ if (subMenuItem != null && !subMenuItem.isDisposed()) {
+ subMenuItem.dispose();
+ }
+ }
+
+ /**
+ * The default implementation of this <code>IContributionItem</code> method does nothing.
+ * Subclasses may override.
+ */
+ @Override
+ public void fill(Composite parent) {
+ }
+
+ /**
+ * The default implementation of this <code>IContributionItem</code> method does nothing.
+ * Subclasses may override.
+ */
+ @Override
+ public void fill(Menu menu, int index) {
+ // retrieves current selection
+ final Object selectedElement = getSelectedElement();
+
+ // first case: this class was not able to retrieve the selection service
+ // or does not understand the current selection.
+ // does not build any sub-menu and returns.
+ if (selectedElement == null) {
+ return;
+ }
+
+ // get the UML object type of this element, using the business resolver
+ final EObject businessObject = EMFHelper.getEObject(selectedElement);
+
+ // no object found: exit
+ if (businessObject == null) {
+ return;
+ }
+
+ // retrieves all editor configurations for this kind of element
+ final Collection<IDirectEditorExtensionPoint> configurations = DirectEditorsUtil.getDirectEditorExtensions(businessObject, selectedElement);
+
+ // if configurations is not empty, a submenu should open to select which
+ // editor to use...
+
+ if (configurations.isEmpty()) {
+ return;
+ }
+
+ createSubMenu(menu, index, selectedElement, businessObject, configurations);
+ }
+
+ // creates the submenu "open editors" > "edit with UML", "edit with AL", etc
+ protected void createSubMenu(Menu menu, int index, Object selectedElement, EObject businessObject, Collection<IDirectEditorExtensionPoint> configurations) {
+ // create direct item, and then create sub-items
+ subMenuItem = new MenuItem(menu, SWT.CASCADE);
+ String type = ((businessObject instanceof EObject) ?
+ businessObject.eClass().getName() : ""); //$NON-NLS-1$
+
+ subMenuItem.setText("Edit " + type); //$NON-NLS-1$
+
+ // submenu
+ Menu subMenu = new Menu(menu);
+ subMenuItem.setMenu(subMenu);
+
+ // items on the submenu
+ // there are as many items as configurations
+ final IDirectEditorExtensionPoint defaultConfig = DirectEditorsUtil.getDefaultDirectEditorExtension(businessObject, selectedElement);
+
+ for (final IDirectEditorExtensionPoint configuration : configurations) {
+ MenuItem item = new MenuItem(subMenu, SWT.NONE);
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("Using "); //$NON-NLS-1$
+ buffer.append(configuration.getLanguage());
+ if (configuration.equals(defaultConfig)) {
+ buffer.append(" (Default via F2)"); //$NON-NLS-1$
+ }
+ item.setText(buffer.toString());
+ item.addSelectionListener(new SelectionListener() {
+
+ /**
+ * {@inheritDoc}
+ */
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void widgetSelected(SelectionEvent e) {
+ // launch editor
+ GMFEmbeddedEditorActionDelegate actionDelegate = new GMFEmbeddedEditorActionDelegate();
+ actionDelegate.setActivePart(null, ((IMultiDiagramEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor()).getActiveEditor());
+ actionDelegate.selectionChanged(null, getSelection());
+ actionDelegate.setExtensionPointConfiguration(configuration);
+ actionDelegate.run(null);
+ }
+ });
+ }
+ }
+
+ /**
+ * Retrieves and return the current selected element
+ *
+ * @return the current selected element
+ */
+ protected Object getSelectedElement() {
+ ISelection selection = getSelection();
+ // this checks if it is the good instance AND if it is not null
+ if (selection instanceof IStructuredSelection) {
+ return ((IStructuredSelection) selection).getFirstElement();
+ }
+ return null;
+ }
+
+ /**
+ * Retrieves and return the current selection
+ *
+ * @return the current selection
+ */
+ protected ISelection getSelection() {
+ ISelectionService selectionService = getSelectionService();
+ if (selectionService != null) {
+ return selectionService.getSelection();
+ }
+ return null;
+ }
+
+ /**
+ * Returns the selection service for the current workbench
+ *
+ * @return the selection service for the current workbench or <code>null</code> if no selection
+ * service was found.
+ */
+ protected ISelectionService getSelectionService() {
+ ISelectionService selectionService = serviceLocator.getService(ISelectionService.class);
+ return selectionService;
+ }
+
+ /**
+ * The default implementation of this <code>IContributionItem</code> method does nothing.
+ * Subclasses may override.
+ */
+ @Override
+ public void fill(ToolBar parent, int index) {
+ }
+
+ /**
+ * The default implementation of this <code>IContributionItem</code> method does nothing.
+ * Subclasses may override.
+ *
+ * @since 3.0
+ */
+ @Override
+ public void fill(CoolBar parent, int index) {
+ }
+
+ /**
+ * The default implementation of this <code>IContributionItem</code> method does nothing.
+ * Subclasses may override.
+ *
+ * @since 3.0
+ */
+ @Override
+ public void saveWidgetState() {
+ }
+
+ /**
+ * The default implementation of this <code>IContributionItem</code> method returns <code>false</code>. Subclasses may override.
+ */
+ @Override
+ public boolean isDirty() {
+ // @issue should this be false instead of calling isDynamic()?
+ return true;
+ }
+
+ /**
+ * The default implementation of this <code>IContributionItem</code> method returns <code>true</code>. Subclasses may override.
+ */
+ @Override
+ public boolean isEnabled() {
+ return true;
+ }
+
+ /**
+ * The default implementation of this <code>IContributionItem</code> method returns <code>false</code>. Subclasses may override.
+ */
+ @Override
+ public boolean isDynamic() {
+ return true;
+ }
+
+ /**
+ * The default implementation of this <code>IContributionItem</code> method returns <code>false</code>. Subclasses may override.
+ */
+ @Override
+ public boolean isGroupMarker() {
+ return false;
+ }
+
+ /**
+ * The default implementation of this <code>IContributionItem</code> method returns <code>false</code>. Subclasses may override.
+ */
+ @Override
+ public boolean isSeparator() {
+ return false;
+ }
+
+ /**
+ * Returns a string representation of this contribution item suitable only for debugging.
+ */
+ @Override
+ public String toString() {
+ return getClass().getName() + "(id=" + getId() + ")";//$NON-NLS-2$//$NON-NLS-1$
+ }
+
+ /**
+ * The default implementation of this <code>IContributionItem</code> method does nothing.
+ * Subclasses may override.
+ */
+ @Override
+ public void update() {
+ }
+
+ /**
+ * The <code>ContributionItem</code> implementation of this method declared on <code>IContributionItem</code> does nothing. Subclasses should
+ * override to update their
+ * state.
+ */
+ @Override
+ public void update(String id) {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void initialize(IServiceLocator serviceLocator) {
+ assert (serviceLocator != null);
+ this.serviceLocator = serviceLocator;
+ }
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/EmbeddedEditorReconcilingStrategy.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/EmbeddedEditorReconcilingStrategy.java
new file mode 100644
index 00000000000..a89d735475f
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/EmbeddedEditorReconcilingStrategy.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui;
+
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.ui.texteditor.spelling.SpellingReconcileStrategy;
+import org.eclipse.ui.texteditor.spelling.SpellingService;
+
+/**
+ * Reconcile strategy used for spell checking and semantic verification
+ */
+// @unused
+public class EmbeddedEditorReconcilingStrategy extends SpellingReconcileStrategy {
+
+ /**
+ * Creates a new EmbeddedEditorReconcilingStrategy.
+ *
+ * @param viewer
+ * the source viewer containing the text to reconcile
+ * @param spellingService
+ * the service in charge of the spelling verification
+ */
+ public EmbeddedEditorReconcilingStrategy(ISourceViewer viewer, SpellingService spellingService) {
+ super(viewer, spellingService);
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/ErrorAnnotation.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/ErrorAnnotation.java
new file mode 100644
index 00000000000..03e0b40a34e
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/ErrorAnnotation.java
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * Copyright (c) 2008 CEA List.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA List - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.text.source.Annotation;
+import org.eclipse.jface.text.source.IAnnotationAccessExtension;
+import org.eclipse.jface.text.source.IAnnotationPresentation;
+import org.eclipse.jface.text.source.ImageUtilities;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Extended annotation class for error annotation in embedded editors
+ */
+public class ErrorAnnotation extends Annotation implements IAnnotationPresentation {
+
+ /**
+ * Creates a new annotation with the given properties.
+ *
+ * @param isPersistent
+ * <code>true</code> if this annotation is persistent, <code>false</code> otherwise
+ * @param text
+ * the text associated with this annotation
+ */
+ public ErrorAnnotation(boolean isPersistent, String text) {
+ super(TYPE, isPersistent, text);
+ }
+
+ /**
+ * Creates a new annotation with the given persistence state.
+ *
+ * @param isPersistent
+ * <code>true</code> if persistent, <code>false</code> otherwise
+ */
+ // @unused
+ public ErrorAnnotation(boolean isPersistent) {
+ this(isPersistent, "no text");
+ }
+
+ /**
+ * The type of projection annotations.
+ */
+ public static final String TYPE = "org.eclipse.ui.workbench.texteditor.error"; //$NON-NLS-1$
+
+ /** error image */
+ private static Image fgErrorImage;
+
+ /**
+ * Class that disposes image on demand
+ */
+ private static class DisplayDisposeRunnable implements Runnable {
+
+ public void run() {
+ if (fgErrorImage != null) {
+ fgErrorImage.dispose();
+ fgErrorImage = null;
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getLayer() {
+ return IAnnotationAccessExtension.DEFAULT_LAYER;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.IAnnotationPresentation#paint(org.eclipse
+ * .swt.graphics.GC, org.eclipse.swt.widgets.Canvas, org.eclipse.swt.graphics.Rectangle)
+ */
+ public void paint(GC gc, Canvas canvas, Rectangle rectangle) {
+ Image image = getImage(canvas.getDisplay());
+ if (image != null) {
+ ImageUtilities.drawImage(image, gc, canvas, rectangle, SWT.CENTER, SWT.TOP);
+ }
+ }
+
+ /**
+ * Returns the image to be drawn
+ *
+ * @param display
+ * the current display
+ * @return the image to be drawn
+ */
+ protected Image getImage(Display display) {
+ initializeImages(display);
+ return fgErrorImage;
+ }
+
+ private void initializeImages(Display display) {
+ if (fgErrorImage == null) {
+
+ ImageDescriptor descriptor = ImageDescriptor.createFromFile(ErrorAnnotation.class, "images/error.gif"); //$NON-NLS-1$
+ fgErrorImage = descriptor.createImage(display);
+
+ display.disposeExec(new DisplayDisposeRunnable());
+ }
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/ExtendedDirectEditionDialog.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/ExtendedDirectEditionDialog.java
new file mode 100644
index 00000000000..5742f5406dd
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/ExtendedDirectEditionDialog.java
@@ -0,0 +1,190 @@
+/*******************************************************************************
+ * Copyright (c) 2006 CEA List.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA List - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.DocumentEvent;
+import org.eclipse.jface.text.IDocumentListener;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jface.text.source.SourceViewer;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration.Selection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.custom.VerifyKeyListener;
+import org.eclipse.swt.events.VerifyEvent;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Dialog used in for direct edition, when an extension is provided
+ */
+public class ExtendedDirectEditionDialog extends LabelEditorDialog {
+
+ /** Title of the Dialog */
+ final private static String TITLE = "Edit Label";
+
+ /** Edited object */
+ protected Object editedObject;
+
+ /** Document used by the dialog */
+ protected Document document;
+
+ /** extension configuration */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * Creates a new ExtendedDirectEditionDialog
+ *
+ * @param parentShell
+ * the parent shell
+ * @param parameter
+ * the editedObject
+ * @param initialValue
+ * the initial text value
+ */
+ public ExtendedDirectEditionDialog(Shell parentShell, Object object, String initialValue,
+ IDirectEditorConfiguration configuration) {
+ super(parentShell, TITLE, initialValue, configuration.getInputValidator());
+ this.editedObject = object;
+ this.value = initialValue;
+ this.configuration = configuration;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Group composite = new Group(parent, SWT.RESIZE);
+ composite.setText("Specification");
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
+ layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
+ layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
+ layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ Composite viewerGroup = new Composite(composite, SWT.RESIZE);
+ FillLayout viewerLayout = new FillLayout();
+ viewerGroup.setLayout(viewerLayout);
+ GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.VERTICAL_ALIGN_CENTER);
+ data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
+ viewerGroup.setLayoutData(data);
+ viewer = new SourceViewer(viewerGroup, null, SWT.BORDER | SWT.FILL_EVEN_ODD);
+
+ // configure source viewer
+ document = new Document();
+ document.set(value);
+
+ // add completion processor key listener (ctrl+space keys)
+ viewer.appendVerifyKeyListener(new LabelKeyListener(viewer));
+
+ document.addDocumentListener(new DocumentListener());
+ viewer.configure(configuration.getSourceViewerConfiguration());
+ viewer.setDocument(document);
+
+ Selection selection = configuration.getTextSelection(value, editedObject);
+ viewer.setSelectedRange(selection.getStart(), selection.getLentgh());
+
+ Composite extendedArea = configuration.createExtendedDialogArea(viewerGroup);
+ if (extendedArea != null) {
+ extendedArea.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
+ }
+
+ errorMessageText = new CLabel(composite, SWT.READ_ONLY | SWT.SHADOW_NONE);
+ errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
+ errorMessageText.setBackground(errorMessageText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
+ // Set the error message text
+ // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=66292
+ setErrorMessage(errorMessage);
+
+ applyDialogFont(composite);
+ return composite;
+ }
+
+ /**
+ *
+ */
+ private class LabelKeyListener implements VerifyKeyListener {
+
+ /**
+ *
+ */
+ SourceViewer viewer;
+
+ /**
+ * Default constructor.
+ *
+ * @param viewer
+ */
+ public LabelKeyListener(SourceViewer viewer) {
+ this.viewer = viewer;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.swt.custom.VerifyKeyListener#verifyKey(org.eclipse.swt.events.VerifyEvent)
+ */
+ /**
+ *
+ *
+ * @param event
+ */
+ public void verifyKey(VerifyEvent event) {
+ if ((event.stateMask == SWT.CTRL) && (event.character == ' ')) {
+ if (viewer.canDoOperation(ISourceViewer.CONTENTASSIST_PROPOSALS)) {
+ viewer.doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS);
+ }
+ event.doit = false;
+ } else if (event.character == SWT.CR) {
+ event.doit = false;
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ private class DocumentListener implements IDocumentListener {
+
+ /**
+ *
+ *
+ * @param event
+ */
+ public void documentAboutToBeChanged(DocumentEvent event) {
+ }
+
+ /**
+ *
+ *
+ * @param event
+ */
+ public void documentChanged(DocumentEvent event) {
+ validateInput();
+ }
+
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/GMFEmbeddedEditorActionDelegate.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/GMFEmbeddedEditorActionDelegate.java
new file mode 100644
index 00000000000..689552e54c7
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/GMFEmbeddedEditorActionDelegate.java
@@ -0,0 +1,143 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramGraphicalViewer;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+/**
+ * Action delegate for direct editors embedded in GMF editors
+ */
+public class GMFEmbeddedEditorActionDelegate extends OpenEmbeddedTextEditorObjectActionDelegate {
+
+ /** selected element in the diagram */
+ protected IGraphicalEditPart selectedElement;
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Control getControl() {
+ IDiagramGraphicalViewer viewer = null;
+ if (part instanceof IDiagramGraphicalViewer) {
+ viewer = (IDiagramGraphicalViewer) part;
+ } else if (part instanceof IAdaptable) {
+ viewer = (IDiagramGraphicalViewer) ((IAdaptable) part).getAdapter(IDiagramGraphicalViewer.class);
+ }
+
+ if (viewer != null) {
+ return viewer.getControl();
+ }
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected EObject getEditedObject() {
+ // should never happened, but...
+ if (selectedElement == null) {
+ throw new RuntimeException("Impossible to get an element from no selection.");
+ }
+
+ // retrieves the current model element associated to the graphical selected edit part
+ Object model = selectedElement.getModel();
+ if (model instanceof View) {
+ return ((View) model).getElement();
+ }
+
+ // nothing was found. throw an exception
+ throw new RuntimeException("Impossible to get an element from selected Element " + selectedElement);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Point getPosition() {
+ // calculate position in 2 steps:
+ // 1. position of the element from the top left corner of he gmf viewer
+ // 2. position of the viewer from the top left corner of the screen
+ Rectangle rect = selectedElement.getFigure().getBounds().getCopy();
+ selectedElement.getFigure().translateToAbsolute(rect);
+
+ Point viewerPosition = getViewerPosition();
+ return new Point(rect.x + viewerPosition.x, rect.y + viewerPosition.y);
+ }
+
+ /**
+ * Returns the viewer position
+ *
+ * @return the GMF viewer position
+ */
+ protected Point getViewerPosition() {
+ Control viewerControl = selectedElement.getViewer().getControl();
+
+ // get the position of this control in its parent
+ Composite parent = viewerControl.getParent();
+ Point selectionPoint = new Point(0, 0);
+ while (parent.getParent() != null) {
+ selectionPoint.x += parent.getLocation().x;
+ selectionPoint.y += parent.getLocation().y;
+ parent = parent.getParent();
+ if (parent.getParent() == null) {
+ // this is the display
+ selectionPoint.x += parent.getDisplay().getActiveShell().getLocation().x;
+ selectionPoint.y += parent.getDisplay().getActiveShell().getLocation().y;
+ }
+ }
+ return selectionPoint;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ if (selection instanceof IStructuredSelection) {
+ Object o = ((IStructuredSelection) selection).getFirstElement();
+ if (o instanceof IGraphicalEditPart) {
+ selectedElement = ((IGraphicalEditPart) o);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Composite getParentComposite() {
+ Composite parentComposite = (Composite) selectedElement.getViewer().getControl();
+ return new Composite(parentComposite, SWT.BORDER);
+ }
+
+ @Override
+ protected org.eclipse.gef.GraphicalEditPart getSelectedElement() {
+ return selectedElement;
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/ILabelEditorDialog.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/ILabelEditorDialog.java
new file mode 100644
index 00000000000..991fda55642
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/ILabelEditorDialog.java
@@ -0,0 +1,24 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui;
+
+
+/**
+ *
+ */
+public interface ILabelEditorDialog {
+
+ /** gets the value returned by the dialog */
+ public String getValue();
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/IPopupEditorHelper.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/IPopupEditorHelper.java
new file mode 100644
index 00000000000..f433aae7bd2
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/IPopupEditorHelper.java
@@ -0,0 +1,25 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - initial API and implementation
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui;
+
+/**
+ * This interface provides a method for displaying a popupeditor
+ */
+public interface IPopupEditorHelper {
+
+ /** Displays the editor encapsulated by the IPopupEditorHelper */
+ void showEditor();
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/LabelEditorDialog.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/LabelEditorDialog.java
new file mode 100644
index 00000000000..a408b633972
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/LabelEditorDialog.java
@@ -0,0 +1,211 @@
+/*******************************************************************************
+ * Copyright (c) 2006 CEA List.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA List - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.IInputValidator;
+import org.eclipse.jface.text.source.SourceViewer;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+// equivalent au inputDialog (code recopie) mais donne un sourceviewer a la place du label
+/**
+ *
+ */
+public class LabelEditorDialog extends Dialog implements ILabelEditorDialog {
+
+ /**
+ * The title of the dialog.
+ */
+ protected String title;
+
+ /**
+ * The input value; the empty string by default.
+ */
+ protected String value = "";//$NON-NLS-1$
+
+ /**
+ * The input validator, or <code>null</code> if none.
+ */
+ protected IInputValidator validator;
+
+ /**
+ * Ok button widget.
+ */
+ protected Button okButton;
+
+ /**
+ * Error message label widget.
+ */
+ protected CLabel errorMessageText;
+
+ /**
+ * Error message string.
+ */
+ protected String errorMessage;
+
+ /**
+ * SourceViewer : area that displays text.
+ */
+ protected SourceViewer viewer;
+
+ /**
+ * Creates a dialog with OK and Cancel buttons. Note that the dialog will have no visual
+ * representation (no widgets) until it is told to open.
+ * <p>
+ * Note that the <code>open</code> method blocks for input dialogs.
+ * </p>
+ *
+ * @param dialogTitle
+ * the dialog title, or <code>null</code> if none
+ * @param validator
+ * an input validator, or <code>null</code> if none
+ * @param parentShell
+ * the parent shell, or <code>null</code> to create a top-level shell
+ * @param initialValue
+ * the initial input value, or <code>null</code> if none (equivalent to the empty
+ * string)
+ */
+ public LabelEditorDialog(Shell parentShell, String dialogTitle, String initialValue, IInputValidator validator) {
+ super(parentShell);
+ this.title = dialogTitle;
+ if (initialValue == null) {
+ value = "";//$NON-NLS-1$
+ } else {
+ value = initialValue;
+ }
+ this.validator = validator;
+ }
+
+ /*
+ * (non-Javadoc) Method declared on Dialog.
+ */
+ /**
+ *
+ *
+ * @param buttonId
+ */
+ @Override
+ protected void buttonPressed(int buttonId) {
+ if (buttonId == IDialogConstants.OK_ID) {
+ value = viewer.getDocument().get();
+ } else {
+ value = null;
+ }
+ super.buttonPressed(buttonId);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets .Shell)
+ */
+ /**
+ *
+ *
+ * @param shell
+ */
+ @Override
+ protected void configureShell(Shell shell) {
+ super.configureShell(shell);
+ if (title != null) {
+ shell.setText(title);
+ }
+ }
+
+ /**
+ * Returns the ok button.
+ *
+ * @return the ok button
+ */
+ // @unused
+ protected Button getOkButton() {
+ return okButton;
+ }
+
+ /**
+ * Returns the text area.
+ *
+ * @return the text area
+ */
+ // @unused
+ protected SourceViewer getSourceViewer() {
+ return viewer;
+ }
+
+ /**
+ * Returns the validator.
+ *
+ * @return the validator
+ */
+ // @unused
+ protected IInputValidator getValidator() {
+ return validator;
+ }
+
+ /**
+ * Returns the string typed into this input dialog.
+ *
+ * @return the input string
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * Validates the input.
+ * <p>
+ * The default implementation of this framework method delegates the request to the supplied input validator object; if it finds the input invalid, the error message is displayed in the dialog's message line. This hook method is called whenever the text
+ * changes in the input field.
+ * </p>
+ */
+ protected void validateInput() {
+ String errorMessage = null;
+ if (validator != null) {
+ errorMessage = validator.isValid(viewer.getDocument().get());
+ }
+ // Bug 16256: important not to treat "" (blank error) the same as null
+ // (no error)
+ setErrorMessage(errorMessage);
+ }
+
+ /**
+ * Sets or clears the error message. If not <code>null</code>, the OK button is disabled.
+ *
+ * @param errorMessage
+ * the error message, or <code>null</code> to clear
+ *
+ * @since 3.0
+ */
+ public void setErrorMessage(String errorMessage) {
+ this.errorMessage = errorMessage;
+ if ((errorMessageText != null) && !errorMessageText.isDisposed()) {
+ Image errorImage = Activator.getImage("icons/error.gif");
+ errorMessageText.setImage(errorMessage == null ? null : errorImage);
+ errorMessageText.setText(errorMessage == null ? "" : errorMessage); //$NON-NLS-1$
+ errorMessageText.getParent().update();
+ // Access the ok button by id, in case clients have overridden
+ // button creation.
+ // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=113643
+ Control button = getButton(IDialogConstants.OK_ID);
+ if (button != null) {
+ button.setEnabled(errorMessage == null);
+ }
+ }
+ }
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/MultiReconciler.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/MultiReconciler.java
new file mode 100644
index 00000000000..4c2e7abb037
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/MultiReconciler.java
@@ -0,0 +1,126 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.Region;
+import org.eclipse.jface.text.reconciler.AbstractReconciler;
+import org.eclipse.jface.text.reconciler.DirtyRegion;
+import org.eclipse.jface.text.reconciler.IReconcilingStrategy;
+import org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension;
+
+/**
+ * Reconciler that uses several independent strategies.
+ */
+public class MultiReconciler extends AbstractReconciler {
+
+ /** The reconciling strategy. */
+ private final List<IReconcilingStrategy> fStrategies;
+
+ /**
+ * Creates a new reconciler that uses several reconciling strategies to reconcile its document
+ * independent of the type of the document's contents.
+ *
+ * @param strategies
+ * the reconciling strategies to be used
+ * @param isIncremental
+ * the indication whether strategy is incremental or not
+ */
+ // @unused
+ public MultiReconciler(List<IReconcilingStrategy> strategies, boolean isIncremental) {
+ Assert.isNotNull(strategies);
+ fStrategies = strategies;
+ for (IReconcilingStrategy strategy : fStrategies) {
+ if (strategy instanceof IReconcilingStrategyExtension) {
+ IReconcilingStrategyExtension extension = (IReconcilingStrategyExtension) strategy;
+ extension.setProgressMonitor(getProgressMonitor());
+ }
+ }
+
+ setIsIncrementalReconciler(isIncremental);
+ }
+
+ /*
+ * @see IReconciler#getReconcilingStrategy(String)
+ */
+ public IReconcilingStrategy getReconcilingStrategy(String contentType) {
+ Assert.isNotNull(contentType);
+ return fStrategies.get(0);
+ }
+
+ /*
+ * @see AbstractReconciler#process(DirtyRegion)
+ */
+ @Override
+ protected void process(DirtyRegion dirtyRegion) {
+
+ for (IReconcilingStrategy strategy : fStrategies) {
+ if (dirtyRegion != null) {
+ strategy.reconcile(dirtyRegion, dirtyRegion);
+ } else {
+ IDocument document = getDocument();
+ if (document != null) {
+ strategy.reconcile(new Region(0, document.getLength()));
+ }
+ }
+ }
+ }
+
+ /*
+ * @see AbstractReconciler#reconcilerDocumentChanged(IDocument)
+ */
+ @Override
+ protected void reconcilerDocumentChanged(IDocument document) {
+ for (IReconcilingStrategy strategy : fStrategies) {
+ strategy.setDocument(document);
+ }
+ }
+
+ /*
+ * @see AbstractReconciler#setProgressMonitor(IProgressMonitor)
+ */
+ @Override
+ public void setProgressMonitor(IProgressMonitor monitor) {
+ super.setProgressMonitor(monitor);
+
+ for (IReconcilingStrategy strategy : fStrategies) {
+ if (strategy instanceof IReconcilingStrategyExtension) {
+ IReconcilingStrategyExtension extension = (IReconcilingStrategyExtension) strategy;
+ extension.setProgressMonitor(monitor);
+ }
+ }
+
+ }
+
+ /*
+ * @see AbstractReconciler#initialProcess()
+ */
+ @Override
+ protected void initialProcess() {
+
+ for (IReconcilingStrategy strategy : fStrategies) {
+ if (strategy instanceof IReconcilingStrategyExtension) {
+ IReconcilingStrategyExtension extension = (IReconcilingStrategyExtension) strategy;
+ extension.initialReconcile();
+ }
+ }
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/OpenEmbeddedTextEditorObjectActionDelegate.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/OpenEmbeddedTextEditorObjectActionDelegate.java
new file mode 100644
index 00000000000..085e657d954
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/OpenEmbeddedTextEditorObjectActionDelegate.java
@@ -0,0 +1,206 @@
+/*******************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.definition.IDirectEditorExtensionPoint;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * This action implementation is an abstract implementation of an object contribution action that
+ * opens a TEF editor window within a host editor. Inheriting concrete implementations have to
+ * provide the EMF object to be edited, the position of the editor window, access to the hosting GUI
+ * control and edit part.
+ */
+public abstract class OpenEmbeddedTextEditorObjectActionDelegate implements IObjectActionDelegate {
+
+ /** part in which the editor is embedded */
+ protected IWorkbenchPart part = null;
+
+ /** the configuration for the embedded editor */
+ private IDirectEditorExtensionPoint directEditorExtensionPoint;
+
+ /**
+ * Returns the edited EObject
+ *
+ * @return the EObject edited in the editor. It should never be <code>null</code>.
+ */
+ protected abstract EObject getEditedObject();
+
+ /**
+ * Returns the selected graphical edit part
+ *
+ * @return the GraphicalEditPart selected in the editor. It should never be <code>null</code>.
+ */
+ protected abstract GraphicalEditPart getSelectedElement();
+
+ /**
+ * Retrieves the position where the editor should be opened.
+ *
+ * @return the position of the shell containing the editor
+ */
+ // @unused
+ protected abstract Point getPosition();
+
+ /**
+ * Retrieves the editor context
+ *
+ * @return the context for the current editor
+ */
+ // protected abstract IEditorContext getEditorContext();
+
+ /**
+ * Returns the editor's main control
+ *
+ * @return the editor's main control
+ */
+ // @unused
+ protected abstract Control getControl();
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ part = targetPart;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void run(IAction action) {
+ // retrieves graphical context (in which shell it should open for example
+
+ final IDirectEditorConfiguration configuration = directEditorExtensionPoint.getDirectEditorConfiguration();
+ configuration.preEditAction(getEditedObject());
+
+ Dialog dialog = null;
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ GraphicalEditPart selectedElement = getSelectedElement();
+ if (selectedElement != null) {
+ Request request = new Request(RequestConstants.REQ_DIRECT_EDIT);
+ selectedElement.performRequest(request);
+ }
+ return;
+ } else if (configuration instanceof IPopupEditorConfiguration) {
+ IPopupEditorConfiguration popupEditor = (IPopupEditorConfiguration) configuration;
+ popupEditor.createPopupEditorHelper(getSelectedElement()).showEditor();
+ return;
+ } else if (configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), getEditedObject(), configuration.getTextToEdit(getEditedObject()));
+ } else if (configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), getEditedObject(), configuration.getTextToEdit(getEditedObject()), configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+
+ if (Window.OK == dialog.open()) {
+ TransactionalEditingDomain domain = ((DiagramEditor) part).getEditingDomain();
+ RecordingCommand command = new RecordingCommand(domain, "Edit Label") { //$NON-NLS-1$
+
+ @Override
+ protected void doExecute() {
+ configuration.postEditAction(getEditedObject(), ((ILabelEditorDialog) finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+
+ /*
+ * protected void setManager(DirectEditManager manager) {
+ * this.manager = manager;
+ * }
+ *
+ * public void setParser(IParser parser) {
+ * this.parser = parser;
+ * }
+ *
+ * protected void initializeDirectEditManager(final Request request) {
+ * // initialize the direct edit manager
+ * try {
+ * getEditingDomain().runExclusive(new Runnable() {
+ * public void run() {
+ * if (isActive() && isEditable()) {
+ * if (request
+ * .getExtendedData()
+ * .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ * Character initialChar = (Character) request
+ * .getExtendedData()
+ * .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ * performDirectEdit(initialChar.charValue());
+ * } else if ((request instanceof DirectEditRequest)
+ * && (getEditText().equals(getLabelText()))) {
+ * DirectEditRequest editRequest = (DirectEditRequest) request;
+ * performDirectEdit(editRequest.getLocation());
+ * } else {
+ * performDirectEdit();
+ * }
+ * }
+ * }
+ * });
+ * } catch (InterruptedException e) {
+ * e.printStackTrace();
+ * }
+ * }
+ */
+
+ /**
+ * Sets the configuration for the editor
+ *
+ * @param configuration
+ * the configuration for the specified editor
+ */
+ public void setExtensionPointConfiguration(IDirectEditorExtensionPoint directEditorExtensionPoint) {
+ this.directEditorExtensionPoint = directEditorExtensionPoint;
+ }
+
+ /**
+ * Returns the parent composite for the new embedded editor
+ *
+ * @return the parent composite for the new embedded editor
+ */
+ protected abstract Composite getParentComposite();
+
+ /**
+ * Returns whether the widget is <code>null</code> or disposed or active.
+ *
+ * @param widget
+ * the widget to check
+ * @return <code>true</code> if the widget can be used
+ */
+ public static boolean isValid(Widget widget) {
+ return (widget != null && !widget.isDisposed());
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/images/error.gif b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/images/error.gif
new file mode 100644
index 00000000000..a3b621b5709
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/ui/images/error.gif
Binary files differ
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/utils/DirectEditorsUtil.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/utils/DirectEditorsUtil.java
new file mode 100644
index 00000000000..c64021aa90a
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/utils/DirectEditorsUtil.java
@@ -0,0 +1,203 @@
+/*****************************************************************************
+ * Copyright (c) 2008, 2018 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Remi Schnekenburger (CEA LIST) Remi.Schnekenburger@cea.fr - Initial API and implementation
+ * Ansgar Radermacher (CEA LIST) ansgar.radermacher@cea.fr - Bug 528199
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.DefaultDirectEditorConfiguration;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConstraint;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.definition.DirectEditorExtensionPoint;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.definition.IDirectEditorExtensionPoint;
+
+public class DirectEditorsUtil {
+
+ /** The Constant UNKNOWN_PRIORITY. */
+ private static final int UNKNOWN_PRIORITY = 100;
+
+ /**
+ * Find an editor configuration for specific language and object to edit
+ *
+ * @param language
+ * the language to edit
+ * @param semanticObjectToEdit
+ * the semantic object to edit
+ * @return the editor configuration
+ * @since 3.0
+ */
+ public static IDirectEditorConfiguration findEditorConfiguration(String language, EObject objectToEdit) {
+ return findEditorConfiguration(language, objectToEdit, objectToEdit);
+ }
+
+ /**
+ * Find an editor configuration for specific language and object to edit
+ *
+ * @param language
+ * the language to edit
+ * @param semanticObjectToEdit
+ * the semantic object to edit
+ * @param selectedElement
+ * The real selected element (e.g. widget, edit part, ...)
+ * @return the editor configuration
+ */
+ public static IDirectEditorConfiguration findEditorConfiguration(String language, Object semanticObjectToEdit, Object selectedElement) {
+ IDirectEditorExtensionPoint extension = findEditorExtension(language, semanticObjectToEdit, selectedElement);
+ if (extension != null) {
+ return extension.getDirectEditorConfiguration();
+ }
+ // none found, return default
+ return new DefaultDirectEditorConfiguration();
+ }
+
+ /**
+ * Find an editor extension for a specific language and object to edit
+ *
+ * @param language
+ * the language to edit, if null accept all languages
+ * @param semanticObjectToEdit
+ * the semantic object to edit
+ * @param selectedElement
+ * The real selected element (e.g. widget, edit part, ...)
+ * @return the extension point that manages this kind of editor
+ * @since 3.0
+ */
+ public static IDirectEditorExtensionPoint findEditorExtension(String language, Object semanticObjectToEdit, Object selectedElement) {
+ Collection<IDirectEditorExtensionPoint> configs = getDirectEditorExtensions(semanticObjectToEdit, selectedElement);
+
+ IDirectEditorExtensionPoint currentExtension = null;
+ int currentPriority = UNKNOWN_PRIORITY;
+ for (IDirectEditorExtensionPoint extensionPoint : configs) {
+ if ((language == null || language.equals(extensionPoint.getLanguage())) && extensionPoint.getPriority() < currentPriority) {
+ currentExtension = extensionPoint;
+ currentPriority = extensionPoint.getPriority();
+ }
+ }
+
+ if (currentExtension == null && language != null) {
+ // no extension found, retry without specific language filter. This is useful, since the default editor
+ // might not match, e.g. if you edit an opaque expression with a non-OCL body, the OCL editor should not
+ // be used, see bug 528199
+ return findEditorExtension(null, semanticObjectToEdit, selectedElement);
+ }
+ return currentExtension;
+ }
+
+ /**
+ * finds if an editor for specific language and object is available to edit type
+ *
+ * @param language
+ * the language to edit
+ * @param semanticObjectToEdit
+ * the semantic object to edit
+ * @param selectedElement
+ * The real selected element (e.g. widget, edit part, ...)
+ * @return <code>true</code> if an editor exists
+ */
+ public static boolean hasSpecificEditorConfiguration(String language, Object semanticObjectToEdit, Object selectedElement) {
+ return findEditorExtension(language, semanticObjectToEdit, selectedElement) != null;
+ }
+
+ /**
+ * finds whether an editor for specific object is available to edit
+ *
+ * @param objectToEdit
+ * @return <code>true</code> if an editor exists
+ * @since 3.0
+ */
+ public static boolean hasSpecificEditorConfiguration(EObject objectToEdit) {
+ return hasSpecificEditorConfiguration(objectToEdit, objectToEdit);
+ }
+
+ /**
+ * finds whether an editor for a specific object is available to edit
+ *
+ * @param language
+ * the language to edit
+ * @param semanticObjectToEdit
+ * the semantic object to edit
+ * @param selectedElement
+ * The real selected element (e.g. widget, edit part, ...)
+ * @return <code>true</code> if an editor exists
+ */
+ public static boolean hasSpecificEditorConfiguration(Object semanticObjectToEdit, Object selectedElement) {
+ return getDirectEditorExtensions(semanticObjectToEdit, selectedElement).size() > 0;
+ }
+
+ /**
+ * Retrieves the preferred editor extension for the specified type
+ *
+ * @param class_
+ * the type of element to edit
+ * @return the preferred editor extension for the specified or <code>null</code>
+ * @since 3.0
+ */
+ public static IDirectEditorExtensionPoint getDefaultDirectEditorExtension(Object semanticObjectToEdit) {
+ return getDefaultDirectEditorExtension(semanticObjectToEdit, semanticObjectToEdit);
+ }
+
+ /**
+ * Retrieves the preferred editor extension for the specified type
+ *
+ * @param semanticObjectToEdit
+ * the object that should be edited
+ * @param selectedObject
+ * the currently selected object
+ * @return the default editor extension for the passed elements or <code>null</code>
+ * @since 3.0
+ */
+ public static IDirectEditorExtensionPoint getDefaultDirectEditorExtension(Object semanticObjectToEdit, Object selectedObject) {
+ // retrieves preference for this element
+ String language = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + semanticObjectToEdit.getClass().asSubclass(EObject.class));
+ if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(language)) {
+ return null;
+ }
+ return findEditorExtension(language, semanticObjectToEdit, selectedObject);
+ }
+
+ /**
+ * Return the set of editor extensions registered in the platform for the specified kind of element
+ *
+ * @param semanticObjectToEdit
+ * the object that should be edited
+ * @param selectedObject
+ * the currently selected object
+ * @return the set of editor extension registered in the platform for the specified elements
+ * @since 3.0
+ */
+ public static Collection<IDirectEditorExtensionPoint> getDirectEditorExtensions(Object semanticObjectToEdit, Object selectedObject) {
+ // list of extension points to be returned.
+ final List<IDirectEditorExtensionPoint> editorExtensionPoints = new ArrayList<IDirectEditorExtensionPoint>();
+
+ // check each configuration and select those satisfying the constraints
+ for (IDirectEditorExtensionPoint configuration : DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations()) {
+ // both class are compatibles ?
+ if (configuration.getObjectClassToEdit() != null) {
+ if (configuration.getObjectClassToEdit().isInstance(semanticObjectToEdit)) {
+ IDirectEditorConstraint constraint = configuration.getAdditionalConstraint();
+ if (constraint == null || constraint.appliesTo(selectedObject))
+ editorExtensionPoints.add(configuration);
+ }
+ }
+ }
+ return editorExtensionPoints;
+ }
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/utils/IDirectEditorsIds.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/utils/IDirectEditorsIds.java
new file mode 100644
index 00000000000..50ed1cbac64
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors/src/org/eclipse/papyrus/infra/gmfdiag/extensionpoints/editors/utils/IDirectEditorsIds.java
@@ -0,0 +1,36 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Remi Schnekenburger (CEA LIST) Remi.Schnekenburger@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils;
+
+/**
+ * Ids and constants for the editors extension point plugin
+ */
+public interface IDirectEditorsIds {
+
+ /** Constant for the UML language */
+ public final String UML_LANGUAGE = "Papyrus UML";
+
+ /** Constant for the SysML language */
+ public final String SYSML_LANGUAGE = "Papyrus SysML";
+
+ /** Constant for the direct editors */
+ public static final String SIMPLE_DIRECT_EDITOR = "Simple Direct Editor"; //$NON-NLS-1$
+
+ /** constant for preferences */
+ public static final String EDITOR_FOR_ELEMENT = "papyrus.directeditor.";
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/plugin.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/plugin.xml
index b6d6c4cc640..111c08d2d59 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/plugin.xml
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/plugin.xml
@@ -85,7 +85,7 @@
</propertyTester>
</extension>
<extension
- point="org.eclipse.papyrus.extensionpoints.editors.DirectEditor">
+ point="org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.DirectEditor">
<DirectEditor
contributor="CEA LIST"
language="Diagram Direct Editor"
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/directeditor/DiagramDirectEditorConfiguration.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/directeditor/DiagramDirectEditorConfiguration.java
index 9a7e0dd621d..bac708081d7 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/directeditor/DiagramDirectEditorConfiguration.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/directeditor/DiagramDirectEditorConfiguration.java
@@ -17,7 +17,7 @@ package org.eclipse.papyrus.infra.gmfdiag.modelexplorer.directeditor;
import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.AbstractBasicDirectEditorConfiguration;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.AbstractBasicDirectEditorConfiguration;
import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization;
import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalizationPreferencesUtils;
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/preferences/DiagramDirectEditorPreferenceInitializer.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/preferences/DiagramDirectEditorPreferenceInitializer.java
index d40dde9c96b..81ac200738e 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/preferences/DiagramDirectEditorPreferenceInitializer.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/preferences/DiagramDirectEditorPreferenceInitializer.java
@@ -18,7 +18,7 @@ package org.eclipse.papyrus.infra.gmfdiag.modelexplorer.preferences;
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
/**
*
diff --git a/plugins/infra/gmfdiag/pom.xml b/plugins/infra/gmfdiag/pom.xml
index 3fec852a238..5741a39472e 100644
--- a/plugins/infra/gmfdiag/pom.xml
+++ b/plugins/infra/gmfdiag/pom.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<project>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>org.eclipse.papyrus.infra-gmfdiag</artifactId>
<packaging>pom</packaging>
@@ -21,6 +22,7 @@
<module>org.eclipse.papyrus.infra.gmfdiag.css.model.edit</module>
<module>org.eclipse.papyrus.infra.gmfdiag.dnd</module>
<module>org.eclipse.papyrus.infra.gmfdiag.export</module>
+ <module>org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors</module>
<module>org.eclipse.papyrus.infra.gmfdiag.gef</module>
<module>org.eclipse.papyrus.infra.gmfdiag.gmfmenu.filter</module>
<module>org.eclipse.papyrus.infra.gmfdiag.hyperlink</module>

Back to the top