Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvincent lorenzo2015-01-13 11:56:12 +0000
committerGerrit Code Review @ Eclipse.org2015-01-13 11:56:12 +0000
commit57097abb29f10f4953e442aab705304d67f35db6 (patch)
tree8a1594b997927dcfce995bbc865108b9f77d25b2 /examples
parent43f86f0912aeef28689ec3ff261543e77b755cdd (diff)
parent8341d4a2ce2981db609b180eaf6175d8accd7e91 (diff)
downloadorg.eclipse.papyrus-57097abb29f10f4953e442aab705304d67f35db6.tar.gz
org.eclipse.papyrus-57097abb29f10f4953e442aab705304d67f35db6.tar.xz
org.eclipse.papyrus-57097abb29f10f4953e442aab705304d67f35db6.zip
Merge "Bug 450549 - [Example] Many examples don't compile - patch compilation errors - move all version to 1.0.1 - create an example build with tycho (the build is not a module of the main pom, it should be launched each week to avoid performances issues)"
Diffstat (limited to 'examples')
-rw-r--r--examples/core/org.eclipse.papyrus.example.core.lifecycleevents/META-INF/MANIFEST.MF4
-rw-r--r--examples/core/org.eclipse.papyrus.example.core.lifecycleevents/pom.xml14
-rw-r--r--examples/core/org.eclipse.papyrus.example.core.lifecycleevents/src/org/eclipse/papyrus/example/core/lifecycleevents/LifeCycleEventsMonitorService.java294
-rw-r--r--examples/core/org.eclipse.papyrus.example.core.sashwindows.fulleditor/META-INF/MANIFEST.MF6
-rw-r--r--examples/core/org.eclipse.papyrus.example.core.sashwindows.fulleditor/pom.xml14
-rw-r--r--examples/core/org.eclipse.papyrus.example.core.sashwindows.fulleditor/src/org/eclipse/papyrus/example/core/sashwindows/fulleditor/msgpage/MessagePartModel.java164
-rw-r--r--examples/core/org.eclipse.papyrus.example.core.sashwindows.fulleditor/src/org/eclipse/papyrus/example/core/sashwindows/fulleditor/texteditor/TextEditorPartModel.java167
-rw-r--r--examples/core/org.eclipse.papyrus.example.core.sashwindows.simpleeditor/META-INF/MANIFEST.MF4
-rw-r--r--examples/core/org.eclipse.papyrus.example.core.sashwindows.simpleeditor/pom.xml14
-rw-r--r--examples/core/org.eclipse.papyrus.example.core.sashwindows.simpleeditor/src/org/eclipse/papyrus/example/core/sashwindows/simpleeditor/editors/SimpleTextMultiPageEditor.java15
-rw-r--r--examples/emf/org.eclipse.papyrus.outline.emftree/META-INF/MANIFEST.MF39
-rw-r--r--examples/emf/org.eclipse.papyrus.outline.emftree/pom.xml14
-rw-r--r--examples/emf/org.eclipse.papyrus.outline.emftree/src/org/eclipse/papyrus/outline/emftree/internal/OutlineDragAdapter.java3
-rw-r--r--examples/infra/org.eclipse.papyrus.example.infra.servicesregistry.retrieval/META-INF/MANIFEST.MF8
-rw-r--r--examples/infra/org.eclipse.papyrus.example.infra.servicesregistry.retrieval/pom.xml14
-rw-r--r--examples/infra/org.eclipse.papyrus.infra.gmfdiag.connectionpoint.preferences/META-INF/MANIFEST.MF6
-rw-r--r--examples/infra/org.eclipse.papyrus.infra.gmfdiag.connectionpoint.preferences/pom.xml14
-rw-r--r--examples/org.eclipse.papyrus.example.text.instance/META-INF/MANIFEST.MF34
-rw-r--r--examples/org.eclipse.papyrus.example.text.instance/pom.xml14
-rw-r--r--examples/org.eclipse.papyrus.example.uml.comment.editor.newresource/META-INF/MANIFEST.MF56
-rw-r--r--examples/org.eclipse.papyrus.example.uml.comment.editor.newresource/pom.xml14
-rw-r--r--examples/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/factory/CommentEditorFactory.java422
-rw-r--r--examples/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/META-INF/MANIFEST.MF56
-rw-r--r--examples/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/pom.xml14
-rw-r--r--examples/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/factory/CommentEditorFactory.java418
-rw-r--r--examples/org.eclipse.papyrus.examples.restrictedservicecreation/.classpath7
-rw-r--r--examples/org.eclipse.papyrus.examples.restrictedservicecreation/.project28
-rw-r--r--examples/org.eclipse.papyrus.examples.restrictedservicecreation/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--examples/org.eclipse.papyrus.examples.restrictedservicecreation/META-INF/MANIFEST.MF21
-rw-r--r--examples/org.eclipse.papyrus.examples.restrictedservicecreation/build.properties8
-rw-r--r--examples/org.eclipse.papyrus.examples.restrictedservicecreation/plugin.properties12
-rw-r--r--examples/org.eclipse.papyrus.examples.restrictedservicecreation/plugin.xml27
-rw-r--r--examples/org.eclipse.papyrus.examples.restrictedservicecreation/src/org/eclipse/papyrus/restrictedservicecreation/Activator.java68
-rw-r--r--examples/org.eclipse.papyrus.examples.restrictedservicecreation/src/org/eclipse/papyrus/restrictedservicecreation/FilterClassOnPackage.java73
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/.classpath16
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/.project56
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/META-INF/MANIFEST.MF103
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/build.properties13
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/custom-src/org/eclipse/papyrus/example/diagram/simplediagram/CreateDiagramCommand.java81
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/custom-src/org/eclipse/papyrus/example/diagram/simplediagram/DiagramEditorFactory.java46
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/custom-src/org/eclipse/papyrus/example/diagram/simplediagram/UmlDiagramForMultiEditor.java190
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/messages.properties3
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/model/newdiagram.gmfgen316
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/model/newdiagram.gmfgraph62
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/model/newdiagram.gmfmap74
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/model/newdiagram.gmftool60
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/model/newdiagram.trace24
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/plugin.properties68
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/plugin.xml585
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/pom.xml14
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/commands/ComponentCreateCommand.java205
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/helpers/ComponentEditHelper.java14
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/helpers/ModelEditHelper.java14
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/helpers/UMLBaseEditHelper.java98
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/parts/ComponentEditPart.java657
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/parts/ComponentNameEditPart.java1494
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/parts/ModelEditPart.java219
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/parts/UMLEditPartFactory.java257
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/ComponentItemSemanticEditPolicy.java100
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/ModelCanonicalEditPolicy.java360
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/ModelItemSemanticEditPolicy.java135
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/UMLBaseItemSemanticEditPolicy.java601
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/UMLTextNonResizableEditPolicy.java454
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/UMLTextSelectionEditPolicy.java422
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLAbstractNavigatorItem.java122
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLDomainNavigatorContentProvider.java459
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLDomainNavigatorItem.java234
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLDomainNavigatorLabelProvider.java196
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLNavigatorActionProvider.java352
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLNavigatorContentProvider.java734
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLNavigatorGroup.java194
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLNavigatorItem.java186
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLNavigatorLabelProvider.java464
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLNavigatorLinkHelper.java249
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLNavigatorSorter.java54
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/parsers/AbstractParser.java465
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/parsers/MessageFormatParser.java408
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/DeleteElementAction.java3
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/DiagramEditorContextMenuProvider.java98
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/LoadResourceAction.java49
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/Messages.java583
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/ModelElementSelectionPage.java177
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLCreationWizard.java346
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLCreationWizardPage.java174
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLDiagramActionBarContributor.java78
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLDiagramEditor.java830
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLDiagramEditorPlugin.java540
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLDiagramEditorUtil.java813
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLDiagramUpdateCommand.java170
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLDiagramUpdater.java276
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLDocumentProvider.java2248
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLInitDiagramFileAction.java190
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLLinkDescriptor.java120
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLMatchingStrategy.java72
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLNewDiagramFileWizard.java392
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLNodeDescriptor.java59
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLPaletteFactory.java117
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLUriEditorInputTester.java46
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLVisualIDRegistry.java499
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/preferences/ComponentPreferencePage.java53
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/preferences/DiagramAppearancePreferencePage.java37
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/preferences/DiagramConnectionsPreferencePage.java37
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/preferences/DiagramGeneralPreferencePage.java39
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/preferences/DiagramPreferenceInitializer.java59
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/preferences/DiagramPrintingPreferencePage.java37
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/preferences/DiagramRulersAndGridPreferencePage.java37
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/providers/ElementInitializers.java52
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/providers/UMLEditPartProvider.java163
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/providers/UMLElementTypes.java378
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/providers/UMLIconProvider.java50
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/providers/UMLModelingAssistantProvider.java171
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/providers/UMLParserProvider.java248
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/providers/UMLViewProvider.java695
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/sheet/UMLPropertySection.java139
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/sheet/UMLSheetLabelProvider.java160
-rw-r--r--examples/pom.xml28
-rw-r--r--examples/uml/org.eclipse.papyrus.thousandcreation/META-INF/MANIFEST.MF6
-rw-r--r--examples/uml/org.eclipse.papyrus.thousandcreation/pom.xml14
-rw-r--r--examples/uml/org.eclipse.papyrus.uml.diagram.example.programmaticcreation/build.properties3
-rw-r--r--examples/uml/org.eclipse.papyrus.uml.diagram.example.programmaticcreation/pom.xml14
120 files changed, 10553 insertions, 12679 deletions
diff --git a/examples/core/org.eclipse.papyrus.example.core.lifecycleevents/META-INF/MANIFEST.MF b/examples/core/org.eclipse.papyrus.example.core.lifecycleevents/META-INF/MANIFEST.MF
index 342682e67ab..381bb02ee10 100644
--- a/examples/core/org.eclipse.papyrus.example.core.lifecycleevents/META-INF/MANIFEST.MF
+++ b/examples/core/org.eclipse.papyrus.example.core.lifecycleevents/META-INF/MANIFEST.MF
@@ -2,11 +2,11 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.papyrus.example.core.lifecycleevents;singleton:=true
-Bundle-Version: 0.8.0.qualifier
+Bundle-Version: 1.0.1.qualifier
Bundle-Activator: org.eclipse.papyrus.example.core.lifecycleevents.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
- org.eclipse.papyrus.infra.core;bundle-version="0.7.0"
+ org.eclipse.papyrus.infra.core;bundle-version="1.0.1"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: %providerName
diff --git a/examples/core/org.eclipse.papyrus.example.core.lifecycleevents/pom.xml b/examples/core/org.eclipse.papyrus.example.core.lifecycleevents/pom.xml
new file mode 100644
index 00000000000..22b93621e82
--- /dev/null
+++ b/examples/core/org.eclipse.papyrus.example.core.lifecycleevents/pom.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>org.eclipse.papyrus.examples</artifactId>
+ <groupId>org.eclipse.papyrus</groupId>
+ <version>1.0.1-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>org.eclipse.papyrus.example.core.lifecycleevents</artifactId>
+ <groupId>org.eclipse.papyrus</groupId>
+ <version>1.0.1-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project> \ No newline at end of file
diff --git a/examples/core/org.eclipse.papyrus.example.core.lifecycleevents/src/org/eclipse/papyrus/example/core/lifecycleevents/LifeCycleEventsMonitorService.java b/examples/core/org.eclipse.papyrus.example.core.lifecycleevents/src/org/eclipse/papyrus/example/core/lifecycleevents/LifeCycleEventsMonitorService.java
index 7881c3935bd..7acf5db4f13 100644
--- a/examples/core/org.eclipse.papyrus.example.core.lifecycleevents/src/org/eclipse/papyrus/example/core/lifecycleevents/LifeCycleEventsMonitorService.java
+++ b/examples/core/org.eclipse.papyrus.example.core.lifecycleevents/src/org/eclipse/papyrus/example/core/lifecycleevents/LifeCycleEventsMonitorService.java
@@ -1,142 +1,152 @@
-/**
- *
- */
-package org.eclipse.papyrus.example.core.lifecycleevents;
-
-import org.eclipse.papyrus.infra.core.lifecycleevents.DoSaveEvent;
-import org.eclipse.papyrus.infra.core.lifecycleevents.ILifeCycleEventsProvider;
-import org.eclipse.papyrus.infra.core.lifecycleevents.ISaveEventListener;
-import org.eclipse.papyrus.infra.core.lifecycleevents.LifeCycleEventsProvider;
-import org.eclipse.papyrus.infra.core.services.IService;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-
-
-/**
- * A simple example of a class monitoring the life cycle events from the mlti editor.
- * This class is registered as a Papyrus service.
- * It then registered itself to the {@link LifeCycleEventsProvider}.
- *
- *
- * @author cedric dumoulin
- *
- */
-public class LifeCycleEventsMonitorService implements IService {
-
- protected ServicesRegistry servicesRegistry;
- /**
- * The object firing event about the Editor lifecycle.
- */
- protected ILifeCycleEventsProvider eventProvider;
-
- /**
- * Listener on aboutToSave events.
- */
- protected ISaveEventListener aboutToSaveListener = new ISaveEventListener() {
-
- public void doSaveAs(DoSaveEvent event) {
- System.out.println("event received: aboutToSaveAs");
- }
-
- public void doSave(DoSaveEvent event) {
- System.out.println("event received: aboutToSave");
- }
- };
-
- /**
- * Listener on doSave events.
- */
- protected ISaveEventListener saveListener= new ISaveEventListener() {
-
- public void doSaveAs(DoSaveEvent event) {
- System.out.println("event received: doSaveAs");
- }
-
- public void doSave(DoSaveEvent event) {
- System.out.println("event received: doSave");
- }
- };
-
- /**
- * Listener on postSave events.
- */
- protected ISaveEventListener postSaveListener= new ISaveEventListener() {
-
- public void doSaveAs(DoSaveEvent event) {
- System.out.println("event received: postSaveAs");
- }
-
- public void doSave(DoSaveEvent event) {
- System.out.println("event received: postSave");
- }
- };
-
- /**
- * Constructor.
- * This constructor is called by the ServiceRegistry when this service is created. The
- * parameter is provided by the ServiceRegistry itself.
- *
- * @param servicesRegistry
- */
- public LifeCycleEventsMonitorService() {
- System.out.println("LifeCycleEventsMonitorService created");
- }
-
- /**
- * @see org.eclipse.papyrus.infra.core.services.IService#disposeService()
- *
- */
- public void disposeService() {
- deactivate();
- System.out.println("LifeCycleEventsMonitorService disposed");
-
- }
-
- /**
- * Initialize the service.
- * @see org.eclipse.papyrus.infra.core.services.IService#init(org.eclipse.papyrus.infra.core.services.ServicesRegistry)
- *
- * @param servicesRegistry
- */
- public void init(ServicesRegistry servicesRegistry) {
- this.servicesRegistry = servicesRegistry;
- }
-
- /**
- * @see org.eclipse.papyrus.infra.core.services.IService#startService()
- *
- */
- public void startService() {
- System.out.println("LifeCycleEventsMonitorService started");
- activate();
- }
-
- /**
- * Activate listeners.
- */
- private void activate() {
- try {
- eventProvider = servicesRegistry.getService(ILifeCycleEventsProvider.class);
- eventProvider.addAboutToDoSaveListener(aboutToSaveListener);
- eventProvider.addDoSaveListener(saveListener);
- eventProvider.addPostDoSaveListener(postSaveListener);
- } catch (ServiceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
-
- }
-
- /**
- * Deactivate listeners
- */
- private void deactivate() {
- eventProvider.removeAboutToDoSaveListener(aboutToSaveListener);
- eventProvider.removeDoSaveListener(saveListener);
- eventProvider.removePostDoSaveListener(postSaveListener);
-
- }
-
-
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.example.core.lifecycleevents;
+
+import org.eclipse.papyrus.infra.core.lifecycleevents.DoSaveEvent;
+import org.eclipse.papyrus.infra.core.lifecycleevents.ILifeCycleEventsProvider;
+import org.eclipse.papyrus.infra.core.lifecycleevents.ISaveEventListener;
+import org.eclipse.papyrus.infra.core.lifecycleevents.LifeCycleEventsProvider;
+import org.eclipse.papyrus.infra.core.services.IService;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+
+
+/**
+ * A simple example of a class monitoring the life cycle events from the mlti editor.
+ * This class is registered as a Papyrus service.
+ * It then registered itself to the {@link LifeCycleEventsProvider}.
+ *
+ *
+ * @author cedric dumoulin
+ *
+ */
+public class LifeCycleEventsMonitorService implements IService {
+
+ protected ServicesRegistry servicesRegistry;
+ /**
+ * The object firing event about the Editor lifecycle.
+ */
+ protected ILifeCycleEventsProvider eventProvider;
+
+ /**
+ * Listener on aboutToSave events.
+ */
+ protected ISaveEventListener aboutToSaveListener = new ISaveEventListener() {
+
+ public void doSaveAs(DoSaveEvent event) {
+ System.out.println("event received: aboutToSaveAs");
+ }
+
+ public void doSave(DoSaveEvent event) {
+ System.out.println("event received: aboutToSave");
+ }
+ };
+
+ /**
+ * Listener on doSave events.
+ */
+ protected ISaveEventListener saveListener= new ISaveEventListener() {
+
+ public void doSaveAs(DoSaveEvent event) {
+ System.out.println("event received: doSaveAs");
+ }
+
+ public void doSave(DoSaveEvent event) {
+ System.out.println("event received: doSave");
+ }
+ };
+
+ /**
+ * Listener on postSave events.
+ */
+ protected ISaveEventListener postSaveListener= new ISaveEventListener() {
+
+ public void doSaveAs(DoSaveEvent event) {
+ System.out.println("event received: postSaveAs");
+ }
+
+ public void doSave(DoSaveEvent event) {
+ System.out.println("event received: postSave");
+ }
+ };
+
+ /**
+ * Constructor.
+ * This constructor is called by the ServiceRegistry when this service is created. The
+ * parameter is provided by the ServiceRegistry itself.
+ *
+ * @param servicesRegistry
+ */
+ public LifeCycleEventsMonitorService() {
+ System.out.println("LifeCycleEventsMonitorService created");
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.core.services.IService#disposeService()
+ *
+ */
+ public void disposeService() {
+ deactivate();
+ System.out.println("LifeCycleEventsMonitorService disposed");
+
+ }
+
+ /**
+ * Initialize the service.
+ * @see org.eclipse.papyrus.infra.core.services.IService#init(org.eclipse.papyrus.infra.core.services.ServicesRegistry)
+ *
+ * @param servicesRegistry
+ */
+ public void init(ServicesRegistry servicesRegistry) {
+ this.servicesRegistry = servicesRegistry;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.core.services.IService#startService()
+ *
+ */
+ public void startService() {
+ System.out.println("LifeCycleEventsMonitorService started");
+ activate();
+ }
+
+ /**
+ * Activate listeners.
+ */
+ private void activate() {
+ try {
+ eventProvider = servicesRegistry.getService(ILifeCycleEventsProvider.class);
+ eventProvider.addAboutToDoSaveListener(aboutToSaveListener);
+ eventProvider.addDoSaveListener(saveListener);
+ eventProvider.addPostDoSaveListener(postSaveListener);
+ } catch (ServiceException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+
+ }
+
+ /**
+ * Deactivate listeners
+ */
+ private void deactivate() {
+ eventProvider.removeAboutToDoSaveListener(aboutToSaveListener);
+ eventProvider.removeDoSaveListener(saveListener);
+ eventProvider.removePostDoSaveListener(postSaveListener);
+
+ }
+
+
+}
diff --git a/examples/core/org.eclipse.papyrus.example.core.sashwindows.fulleditor/META-INF/MANIFEST.MF b/examples/core/org.eclipse.papyrus.example.core.sashwindows.fulleditor/META-INF/MANIFEST.MF
index 1952c4864bb..81072139e10 100644
--- a/examples/core/org.eclipse.papyrus.example.core.sashwindows.fulleditor/META-INF/MANIFEST.MF
+++ b/examples/core/org.eclipse.papyrus.example.core.sashwindows.fulleditor/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.papyrus.example.core.sashwindows.fulleditor;singleton:=true
-Bundle-Version: 0.8.0.qualifier
+Bundle-Version: 1.0.1.qualifier
Bundle-Activator: org.eclipse.papyrus.example.core.sashwindows.fulleditor.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
@@ -10,9 +10,9 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.core.resources,
org.eclipse.ui.editors,
org.eclipse.ui.ide,
- org.eclipse.papyrus.infra.core.sasheditor;bundle-version="0.9.0",
+ org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.0.1",
org.eclipse.emf.ecore.xmi;bundle-version="2.5.0",
- org.eclipse.papyrus.infra.core.sasheditor.di;bundle-version="0.9.0"
+ org.eclipse.papyrus.infra.core.sasheditor.di;bundle-version="1.0.1"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Vendor: %providerName
diff --git a/examples/core/org.eclipse.papyrus.example.core.sashwindows.fulleditor/pom.xml b/examples/core/org.eclipse.papyrus.example.core.sashwindows.fulleditor/pom.xml
new file mode 100644
index 00000000000..6dfde3a6ca5
--- /dev/null
+++ b/examples/core/org.eclipse.papyrus.example.core.sashwindows.fulleditor/pom.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>org.eclipse.papyrus.examples</artifactId>
+ <groupId>org.eclipse.papyrus</groupId>
+ <version>1.0.1-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <groupId>org.eclipse.papyrus</groupId>
+ <artifactId>org.eclipse.papyrus.example.core.sashwindows.fulleditor</artifactId>
+ <version>1.0.1-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project> \ No newline at end of file
diff --git a/examples/core/org.eclipse.papyrus.example.core.sashwindows.fulleditor/src/org/eclipse/papyrus/example/core/sashwindows/fulleditor/msgpage/MessagePartModel.java b/examples/core/org.eclipse.papyrus.example.core.sashwindows.fulleditor/src/org/eclipse/papyrus/example/core/sashwindows/fulleditor/msgpage/MessagePartModel.java
index 578f4ed8c12..b3e21c904b1 100644
--- a/examples/core/org.eclipse.papyrus.example.core.sashwindows.fulleditor/src/org/eclipse/papyrus/example/core/sashwindows/fulleditor/msgpage/MessagePartModel.java
+++ b/examples/core/org.eclipse.papyrus.example.core.sashwindows.fulleditor/src/org/eclipse/papyrus/example/core/sashwindows/fulleditor/msgpage/MessagePartModel.java
@@ -1,73 +1,91 @@
-package org.eclipse.papyrus.example.core.sashwindows.fulleditor.msgpage;
-
-import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IComponentModel;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Description of the first page
- *
- * @author dumoulin
- */
-
-public class MessagePartModel implements IComponentModel {
-
- private String title;
-
- private String msg;
-
- static private int count = 0;
-
-
- /**
- *
- */
- public MessagePartModel(String msg) {
- title = "newMsg " + count++;
- this.msg = msg;
- }
-
- /**
- * @param title
- */
- public MessagePartModel(String title, String msg) {
- this.title = title;
- this.msg = msg;
- }
-
- /**
- * Return the control to be shown. {@inheritDoc}
- */
- public Composite createPartControl(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- FillLayout layout = new FillLayout();
- composite.setLayout(layout);
- StyledText text;
-
- text = new StyledText(composite, SWT.H_SCROLL | SWT.V_SCROLL);
- text.setEditable(false);
-
- text.setText(" " + msg + " - " + getTabTitle());
- return composite;
- }
-
- public Image getTabIcon() {
- return null;
- }
-
- public String getTabTitle() {
- return title;
- }
-
- /**
- * Return this. In this implementation, the rawModel and the IEditorModel are the same.
- *
- */
- public Object getRawModel() {
- return this;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.example.core.sashwindows.fulleditor.msgpage;
+
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IComponentModel;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Description of the first page
+ *
+ * @author dumoulin
+ */
+
+public class MessagePartModel implements IComponentModel {
+
+ private String title;
+
+ private String msg;
+
+ static private int count = 0;
+
+
+ /**
+ *
+ */
+ public MessagePartModel(String msg) {
+ title = "newMsg " + count++;
+ this.msg = msg;
+ }
+
+ /**
+ * @param title
+ */
+ public MessagePartModel(String title, String msg) {
+ this.title = title;
+ this.msg = msg;
+ }
+
+ /**
+ * Return the control to be shown. {@inheritDoc}
+ */
+ public Composite createPartControl(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ FillLayout layout = new FillLayout();
+ composite.setLayout(layout);
+ StyledText text;
+
+ text = new StyledText(composite, SWT.H_SCROLL | SWT.V_SCROLL);
+ text.setEditable(false);
+
+ text.setText(" " + msg + " - " + getTabTitle());
+ return composite;
+ }
+
+ public Image getTabIcon() {
+ return null;
+ }
+
+ public String getTabTitle() {
+ return title;
+ }
+
+ /**
+ * Return this. In this implementation, the rawModel and the IEditorModel are the same.
+ *
+ */
+ public Object getRawModel() {
+ return this;
+ }
+
+ @Override
+ public void dispose() {
+ // Pass
+ }
+
+}
diff --git a/examples/core/org.eclipse.papyrus.example.core.sashwindows.fulleditor/src/org/eclipse/papyrus/example/core/sashwindows/fulleditor/texteditor/TextEditorPartModel.java b/examples/core/org.eclipse.papyrus.example.core.sashwindows.fulleditor/src/org/eclipse/papyrus/example/core/sashwindows/fulleditor/texteditor/TextEditorPartModel.java
index b13f57246de..e8d81aa08b6 100644
--- a/examples/core/org.eclipse.papyrus.example.core.sashwindows.fulleditor/src/org/eclipse/papyrus/example/core/sashwindows/fulleditor/texteditor/TextEditorPartModel.java
+++ b/examples/core/org.eclipse.papyrus.example.core.sashwindows.fulleditor/src/org/eclipse/papyrus/example/core/sashwindows/fulleditor/texteditor/TextEditorPartModel.java
@@ -1,81 +1,86 @@
-/*****************************************************************************
- * Copyright (c) 2009 CEA LIST & LIFL
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.example.core.sashwindows.fulleditor.texteditor;
-
-import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.part.EditorActionBarContributor;
-
-/**
- * Description of the first page
- *
- * @author dumoulin
- */
-
-public class TextEditorPartModel implements IEditorModel {
-
- /** The text editor used in page 0. */
- private TabTextEditor editor;
-
- private String title;
-
- static private int count = 0;
-
- /**
- * @param title
- */
- public TextEditorPartModel(String title) {
- this.title = title;
- }
-
- /**
- *
- */
- public TextEditorPartModel() {
- title = "newText" + count++;
- }
-
- public IEditorPart createIEditorPart() throws PartInitException {
- editor = new TabTextEditor();
- if(title == null)
- title = "newText" + count++;
- return editor;
- }
-
- public Image getTabIcon() {
- return null;
- }
-
- public String getTabTitle() {
- return title;
- }
-
- /**
- * Return this. In this implementation, the rawModel and the IEditorModel are the same.
- *
- */
- public Object getRawModel() {
- return this;
- }
-
- /**
- * Return the ActionBarContributor dedicated to the created editor.
- * Can return null if no particular ActionBarContributor is required.;
- */
- public EditorActionBarContributor getActionBarContributor() {
- return null;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2009 CEA LIST & LIFL
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.example.core.sashwindows.fulleditor.texteditor;
+
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.part.EditorActionBarContributor;
+
+/**
+ * Description of the first page
+ *
+ * @author dumoulin
+ */
+
+public class TextEditorPartModel implements IEditorModel {
+
+ /** The text editor used in page 0. */
+ private TabTextEditor editor;
+
+ private String title;
+
+ static private int count = 0;
+
+ /**
+ * @param title
+ */
+ public TextEditorPartModel(String title) {
+ this.title = title;
+ }
+
+ /**
+ *
+ */
+ public TextEditorPartModel() {
+ title = "newText" + count++;
+ }
+
+ public IEditorPart createIEditorPart() throws PartInitException {
+ editor = new TabTextEditor();
+ if(title == null)
+ title = "newText" + count++;
+ return editor;
+ }
+
+ public Image getTabIcon() {
+ return null;
+ }
+
+ public String getTabTitle() {
+ return title;
+ }
+
+ /**
+ * Return this. In this implementation, the rawModel and the IEditorModel are the same.
+ *
+ */
+ public Object getRawModel() {
+ return this;
+ }
+
+ /**
+ * Return the ActionBarContributor dedicated to the created editor.
+ * Can return null if no particular ActionBarContributor is required.;
+ */
+ public EditorActionBarContributor getActionBarContributor() {
+ return null;
+ }
+
+ @Override
+ public void dispose() {
+ // Pass
+ }
+}
diff --git a/examples/core/org.eclipse.papyrus.example.core.sashwindows.simpleeditor/META-INF/MANIFEST.MF b/examples/core/org.eclipse.papyrus.example.core.sashwindows.simpleeditor/META-INF/MANIFEST.MF
index 07be6d0d174..1d0ad753814 100644
--- a/examples/core/org.eclipse.papyrus.example.core.sashwindows.simpleeditor/META-INF/MANIFEST.MF
+++ b/examples/core/org.eclipse.papyrus.example.core.sashwindows.simpleeditor/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.papyrus.example.core.sashwindows.simpleeditor;singleton:=true
-Bundle-Version: 0.8.0.qualifier
+Bundle-Version: 1.0.1.qualifier
Bundle-Activator: org.eclipse.papyrus.example.core.sashwindows.simpleeditor.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
@@ -10,7 +10,7 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.core.resources,
org.eclipse.ui.editors,
org.eclipse.ui.ide,
- org.eclipse.papyrus.infra.core.sasheditor;bundle-version="0.7.0"
+ org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.0.1"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Vendor: %providerName
diff --git a/examples/core/org.eclipse.papyrus.example.core.sashwindows.simpleeditor/pom.xml b/examples/core/org.eclipse.papyrus.example.core.sashwindows.simpleeditor/pom.xml
new file mode 100644
index 00000000000..f5aba1cb786
--- /dev/null
+++ b/examples/core/org.eclipse.papyrus.example.core.sashwindows.simpleeditor/pom.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>org.eclipse.papyrus.examples</artifactId>
+ <groupId>org.eclipse.papyrus</groupId>
+ <version>1.0.1-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>org.eclipse.papyrus.example.core.sashwindows.simpleeditor</artifactId>
+ <groupId>org.eclipse.papyrus</groupId>
+ <version>1.0.1-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project> \ No newline at end of file
diff --git a/examples/core/org.eclipse.papyrus.example.core.sashwindows.simpleeditor/src/org/eclipse/papyrus/example/core/sashwindows/simpleeditor/editors/SimpleTextMultiPageEditor.java b/examples/core/org.eclipse.papyrus.example.core.sashwindows.simpleeditor/src/org/eclipse/papyrus/example/core/sashwindows/simpleeditor/editors/SimpleTextMultiPageEditor.java
index f09ad953255..aa7fd182bd0 100644
--- a/examples/core/org.eclipse.papyrus.example.core.sashwindows.simpleeditor/src/org/eclipse/papyrus/example/core/sashwindows/simpleeditor/editors/SimpleTextMultiPageEditor.java
+++ b/examples/core/org.eclipse.papyrus.example.core.sashwindows.simpleeditor/src/org/eclipse/papyrus/example/core/sashwindows/simpleeditor/editors/SimpleTextMultiPageEditor.java
@@ -127,6 +127,11 @@ public class SimpleTextMultiPageEditor extends MultiPageEditor implements IResou
public EditorActionBarContributor getActionBarContributor() {
return null;
}
+
+ @Override
+ public void dispose() {
+ // Pass
+ }
}
/**
@@ -170,6 +175,11 @@ public class SimpleTextMultiPageEditor extends MultiPageEditor implements IResou
return this;
}
+ @Override
+ public void dispose() {
+ // Pass
+ }
+
}
public class Page2 implements IComponentModel {
@@ -196,6 +206,11 @@ public class SimpleTextMultiPageEditor extends MultiPageEditor implements IResou
return this;
}
+ @Override
+ public void dispose() {
+ // Pass
+ }
+
}
/**
diff --git a/examples/emf/org.eclipse.papyrus.outline.emftree/META-INF/MANIFEST.MF b/examples/emf/org.eclipse.papyrus.outline.emftree/META-INF/MANIFEST.MF
index aee69ecc46b..4b94fd4fccd 100644
--- a/examples/emf/org.eclipse.papyrus.outline.emftree/META-INF/MANIFEST.MF
+++ b/examples/emf/org.eclipse.papyrus.outline.emftree/META-INF/MANIFEST.MF
@@ -1,19 +1,20 @@
-Manifest-Version: 1.0
-Require-Bundle: org.eclipse.papyrus.infra.core;bundle-version="0.10.0",
- org.eclipse.emf.ecore.editor;bundle-version="2.5.0",
- org.eclipse.uml2.uml.edit;bundle-version="3.0.0",
- org.eclipse.core.runtime;bundle-version="3.7.0",
- org.eclipse.emf.transaction;bundle-version="1.4.0"
-Export-Package: org.eclipse.papyrus.outline.emftree,
- org.eclipse.papyrus.outline.emftree.internal;x-internal:=true
-Bundle-Vendor: %providerName
-Bundle-ActivationPolicy: lazy
-Bundle-Version: 0.10.0.qualifier
-Bundle-Localization: plugin
-Bundle-Name: %pluginName
-Bundle-ManifestVersion: 2
-Bundle-Activator: org.eclipse.papyrus.outline.emftree.Activator
-Bundle-SymbolicName: org.eclipse.papyrus.outline.emftree;singleton:=tr
- ue
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.papyrus.infra.core;bundle-version="1.0.1",
+ org.eclipse.emf.ecore.editor;bundle-version="2.5.0",
+ org.eclipse.uml2.uml.edit;bundle-version="3.0.0",
+ org.eclipse.core.runtime;bundle-version="3.7.0",
+ org.eclipse.emf.transaction;bundle-version="1.4.0"
+Export-Package: org.eclipse.papyrus.outline.emftree,
+ org.eclipse.papyrus.outline.emftree.internal;x-internal:=true
+Bundle-Vendor: %providerName
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 1.0.1.qualifier
+Bundle-Localization: plugin
+Bundle-Name: %pluginName
+Bundle-ManifestVersion: 2
+Bundle-Activator: org.eclipse.papyrus.outline.emftree.Activator
+Bundle-SymbolicName: org.eclipse.papyrus.outline.emftree;singleton:=tr
+ ue
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
+
diff --git a/examples/emf/org.eclipse.papyrus.outline.emftree/pom.xml b/examples/emf/org.eclipse.papyrus.outline.emftree/pom.xml
new file mode 100644
index 00000000000..34c091fb61e
--- /dev/null
+++ b/examples/emf/org.eclipse.papyrus.outline.emftree/pom.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>org.eclipse.papyrus.examples</artifactId>
+ <groupId>org.eclipse.papyrus</groupId>
+ <version>1.0.1-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>org.eclipse.papyrus.outline.emftree</artifactId>
+ <groupId>org.eclipse.papyrus</groupId>
+ <version>1.0.1-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project> \ No newline at end of file
diff --git a/examples/emf/org.eclipse.papyrus.outline.emftree/src/org/eclipse/papyrus/outline/emftree/internal/OutlineDragAdapter.java b/examples/emf/org.eclipse.papyrus.outline.emftree/src/org/eclipse/papyrus/outline/emftree/internal/OutlineDragAdapter.java
index bd3a2ee9c8d..7ae91a51c67 100644
--- a/examples/emf/org.eclipse.papyrus.outline.emftree/src/org/eclipse/papyrus/outline/emftree/internal/OutlineDragAdapter.java
+++ b/examples/emf/org.eclipse.papyrus.outline.emftree/src/org/eclipse/papyrus/outline/emftree/internal/OutlineDragAdapter.java
@@ -25,7 +25,6 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.papyrus.infra.core.utils.PapyrusTrace;
import org.eclipse.swt.dnd.DragSourceEvent;
import org.eclipse.swt.dnd.DragSourceListener;
import org.eclipse.swt.dnd.Transfer;
@@ -100,7 +99,7 @@ public class OutlineDragAdapter implements DragSourceListener {
}
} catch (RuntimeException e) {
- PapyrusTrace.log(e);
+ System.err.println(e);
}
}
diff --git a/examples/infra/org.eclipse.papyrus.example.infra.servicesregistry.retrieval/META-INF/MANIFEST.MF b/examples/infra/org.eclipse.papyrus.example.infra.servicesregistry.retrieval/META-INF/MANIFEST.MF
index 42b483ca6b9..0b37530c60a 100644
--- a/examples/infra/org.eclipse.papyrus.example.infra.servicesregistry.retrieval/META-INF/MANIFEST.MF
+++ b/examples/infra/org.eclipse.papyrus.example.infra.servicesregistry.retrieval/META-INF/MANIFEST.MF
@@ -2,13 +2,13 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.papyrus.example.infra.servicesregistry.retrieval;singleton:=true
-Bundle-Version: 0.9.0.qualifier
+Bundle-Version: 1.0.1.qualifier
Bundle-Activator: org.eclipse.papyrus.example.infra.servicesregistry.retrieval.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
- org.eclipse.papyrus.infra.core;bundle-version="0.9.0",
- org.eclipse.papyrus.infra.emf;bundle-version="0.9.0",
- org.eclipse.emf;bundle-version="2.6.0"
+ org.eclipse.papyrus.infra.core;bundle-version="1.0.1",
+ org.eclipse.papyrus.infra.emf;bundle-version="1.0.1",
+ org.eclipse.emf.ecore;bundle-version="2.10.1"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: %providerName
diff --git a/examples/infra/org.eclipse.papyrus.example.infra.servicesregistry.retrieval/pom.xml b/examples/infra/org.eclipse.papyrus.example.infra.servicesregistry.retrieval/pom.xml
new file mode 100644
index 00000000000..427c41ac81d
--- /dev/null
+++ b/examples/infra/org.eclipse.papyrus.example.infra.servicesregistry.retrieval/pom.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>org.eclipse.papyrus.examples</artifactId>
+ <groupId>org.eclipse.papyrus</groupId>
+ <version>1.0.1-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>org.eclipse.papyrus.example.infra.servicesregistry.retrieval</artifactId>
+ <groupId>org.eclipse.papyrus</groupId>
+ <version>1.0.1-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project> \ No newline at end of file
diff --git a/examples/infra/org.eclipse.papyrus.infra.gmfdiag.connectionpoint.preferences/META-INF/MANIFEST.MF b/examples/infra/org.eclipse.papyrus.infra.gmfdiag.connectionpoint.preferences/META-INF/MANIFEST.MF
index 92db7d01f19..00c3f8859fb 100644
--- a/examples/infra/org.eclipse.papyrus.infra.gmfdiag.connectionpoint.preferences/META-INF/MANIFEST.MF
+++ b/examples/infra/org.eclipse.papyrus.infra.gmfdiag.connectionpoint.preferences/META-INF/MANIFEST.MF
@@ -2,12 +2,12 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.eclipse.papyrus.infra.gmfdiag.connectionpoint.preferences;singleton:=true
-Bundle-Version: 0.10.1.qualifier
+Bundle-Version: 1.0.1.qualifier
Bundle-Activator: org.eclipse.papyrus.infra.gmfdiag.connectionpoint.preferences.Activator
Bundle-Vendor: %Bundle-Vendor
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
- org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="0.10.1",
- org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="0.10.1"
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.0.1",
+ org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="1.0.1"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
diff --git a/examples/infra/org.eclipse.papyrus.infra.gmfdiag.connectionpoint.preferences/pom.xml b/examples/infra/org.eclipse.papyrus.infra.gmfdiag.connectionpoint.preferences/pom.xml
new file mode 100644
index 00000000000..fb4117c629c
--- /dev/null
+++ b/examples/infra/org.eclipse.papyrus.infra.gmfdiag.connectionpoint.preferences/pom.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>org.eclipse.papyrus.examples</artifactId>
+ <groupId>org.eclipse.papyrus</groupId>
+ <version>1.0.1-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>org.eclipse.papyrus.infra.gmfdiag.connectionpoint.preferences</artifactId>
+ <groupId>org.eclipse.papyrus</groupId>
+ <version>1.0.1-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project> \ No newline at end of file
diff --git a/examples/org.eclipse.papyrus.example.text.instance/META-INF/MANIFEST.MF b/examples/org.eclipse.papyrus.example.text.instance/META-INF/MANIFEST.MF
index 58af6e537bd..3ac1fe90e93 100644
--- a/examples/org.eclipse.papyrus.example.text.instance/META-INF/MANIFEST.MF
+++ b/examples/org.eclipse.papyrus.example.text.instance/META-INF/MANIFEST.MF
@@ -1,17 +1,17 @@
-Manifest-Version: 1.0
-Export-Package: org.eclipse.papyrus.example.text.instance.papyrustextinstance,
- org.eclipse.papyrus.example.text.instance.papyrustextinstance.impl,
- org.eclipse.papyrus.example.text.instance.papyrustextinstance.util
-Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.emf.ecore;visibility:=reexport
-Bundle-Vendor: %providerName
-Bundle-ActivationPolicy: lazy
-Bundle-ClassPath: .
-Bundle-Version: 0.10.1.qualifier
-Bundle-Name: %pluginName
-Bundle-Localization: plugin
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.example.text.instance;singlet
- on:=true
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-
+Manifest-Version: 1.0
+Export-Package: org.eclipse.papyrus.example.text.instance.papyrustextinstance,
+ org.eclipse.papyrus.example.text.instance.papyrustextinstance.impl,
+ org.eclipse.papyrus.example.text.instance.papyrustextinstance.util
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.emf.ecore;visibility:=reexport
+Bundle-Vendor: %providerName
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .
+Bundle-Version: 1.0.1.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.example.text.instance;singlet
+ on:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
diff --git a/examples/org.eclipse.papyrus.example.text.instance/pom.xml b/examples/org.eclipse.papyrus.example.text.instance/pom.xml
new file mode 100644
index 00000000000..0e02a711ad9
--- /dev/null
+++ b/examples/org.eclipse.papyrus.example.text.instance/pom.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>org.eclipse.papyrus.examples</artifactId>
+ <groupId>org.eclipse.papyrus</groupId>
+ <version>1.0.1-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>org.eclipse.papyrus.example.text.instance</artifactId>
+ <groupId>org.eclipse.papyrus</groupId>
+ <version>1.0.1-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project> \ No newline at end of file
diff --git a/examples/org.eclipse.papyrus.example.uml.comment.editor.newresource/META-INF/MANIFEST.MF b/examples/org.eclipse.papyrus.example.uml.comment.editor.newresource/META-INF/MANIFEST.MF
index d3cb5fa2cff..be64144cce9 100644
--- a/examples/org.eclipse.papyrus.example.uml.comment.editor.newresource/META-INF/MANIFEST.MF
+++ b/examples/org.eclipse.papyrus.example.uml.comment.editor.newresource/META-INF/MANIFEST.MF
@@ -1,27 +1,29 @@
-Manifest-Version: 1.0
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.papyrus.infra.core.log;bundle-version="0.10.1",
- org.eclipse.ui.editors;bundle-version="3.8.0",
- org.eclipse.text,
- org.eclipse.emf.ecore;bundle-version="2.8.0",
- org.eclipse.papyrus.example.text.instance;bundle-version="0.10.1",
- org.eclipse.uml2.uml;bundle-version="4.0.0",
- org.eclipse.papyrus.infra.core;bundle-version="0.10.1",
- org.eclipse.emf.transaction,
- org.eclipse.emf.workspace,
- org.eclipse.jface.text;bundle-version="3.8.0",
- org.eclipse.papyrus.infra.services.edit;bundle-version="0.10.1",
- org.eclipse.gmf.runtime.common.core,
- org.eclipse.gmf.runtime.emf.type.core
-Bundle-Vendor: Eclipse Modeling Project
-Bundle-ActivationPolicy: lazy
-Bundle-Version: 0.10.1.qualifier
-Bundle-Name: Papyrus Comment Editor Example (Incubation)
-Bundle-ManifestVersion: 2
-Bundle-Activator: org.eclipse.papyrus.example.uml.comment.editor.newre
- source.Activator
-Bundle-SymbolicName: org.eclipse.papyrus.example.uml.comment.editor.ne
- wresource;singleton:=true
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.papyrus.infra.core.log;bundle-version="1.0.1",
+ org.eclipse.ui.editors;bundle-version="3.8.0",
+ org.eclipse.text,
+ org.eclipse.emf.ecore;bundle-version="2.8.0",
+ org.eclipse.papyrus.example.text.instance;bundle-version="1.0.1",
+ org.eclipse.uml2.uml;bundle-version="4.0.0",
+ org.eclipse.papyrus.infra.core;bundle-version="1.0.1",
+ org.eclipse.emf.transaction,
+ org.eclipse.emf.workspace,
+ org.eclipse.jface.text;bundle-version="3.8.0",
+ org.eclipse.papyrus.infra.services.edit;bundle-version="1.0.1",
+ org.eclipse.gmf.runtime.common.core,
+ org.eclipse.gmf.runtime.emf.type.core,
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.0.1",
+ org.eclipse.ui.ide;bundle-version="3.10.0"
+Bundle-Vendor: Eclipse Modeling Project
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 1.0.1.qualifier
+Bundle-Name: Papyrus Comment Editor Example (Incubation)
+Bundle-ManifestVersion: 2
+Bundle-Activator: org.eclipse.papyrus.example.uml.comment.editor.newre
+ source.Activator
+Bundle-SymbolicName: org.eclipse.papyrus.example.uml.comment.editor.ne
+ wresource;singleton:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
diff --git a/examples/org.eclipse.papyrus.example.uml.comment.editor.newresource/pom.xml b/examples/org.eclipse.papyrus.example.uml.comment.editor.newresource/pom.xml
new file mode 100644
index 00000000000..65afb0a46bc
--- /dev/null
+++ b/examples/org.eclipse.papyrus.example.uml.comment.editor.newresource/pom.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>org.eclipse.papyrus.examples</artifactId>
+ <groupId>org.eclipse.papyrus</groupId>
+ <version>1.0.1-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>org.eclipse.papyrus.example.uml.comment.editor.newresource</artifactId>
+ <groupId>org.eclipse.papyrus</groupId>
+ <version>1.0.1-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project> \ No newline at end of file
diff --git a/examples/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/factory/CommentEditorFactory.java b/examples/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/factory/CommentEditorFactory.java
index 0cb524d35c7..aa2c7aca472 100644
--- a/examples/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/factory/CommentEditorFactory.java
+++ b/examples/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/factory/CommentEditorFactory.java
@@ -1,209 +1,213 @@
-/*****************************************************************************
- * 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 v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.example.uml.comment.editor.newresource.factory;
-
-import java.lang.reflect.Constructor;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance;
-import org.eclipse.papyrus.example.uml.comment.editor.newresource.Activator;
-import org.eclipse.papyrus.example.uml.comment.editor.newresource.editor.PapyrusCommentEditor;
-import org.eclipse.papyrus.infra.core.editor.BackboneException;
-import org.eclipse.papyrus.infra.core.extension.diagrameditor.AbstractEditorFactory;
-import org.eclipse.papyrus.infra.core.multidiagram.actionbarcontributor.ActionBarContributorRegistry;
-import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel;
-import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.part.EditorActionBarContributor;
-
-
-public class CommentEditorFactory extends AbstractEditorFactory {
-
- /**
- *
- * Constructor.
- *
- * @param editorClass
- * the editor class
- * @param editorType
- * the type of editor
- */
- public CommentEditorFactory() {
- super(PapyrusCommentEditor.class, PapyrusCommentEditor.EDITOR_TYPE);
- }
-
- /**
- * Create the IPageModel that is used by the SashWindows to manage the editor.
- *
- * @see org.eclipse.papyrus.infra.core.editorsfactory.IEditorFactory#createIPageModel(java.lang.Object)
- *
- * @param pageIdentifier
- * The model pushed in the sashmodel by the creation command
- * @return A model implementing the IPageModel
- */
- public IPageModel createIPageModel(Object pageIdentifier) {
- return new TextEditorModel(pageIdentifier, getServiceRegistry());
- }
-
- /**
- * @see org.eclipse.papyrus.infra.core.editorsfactory.IEditorFactory#isPageModelFactoryFor(java.lang.Object)
- *
- * @param pageIdentifier
- * @return
- */
- public boolean isPageModelFactoryFor(Object pageIdentifier) {
- if(pageIdentifier instanceof PapyrusTextInstance) {
- return ((PapyrusTextInstance)pageIdentifier).getType().equals(this.getExpectedType());
- }
- return false;
- }
-
- /**
- * IEditorModel used internally by the SashContainer. This model know how to handle IEditor creation.
- *
- *
- *
- */
- class TextEditorModel implements IEditorModel {
-
-
- /**
- * The servicesRegistry provided at creation.
- */
- private ServicesRegistry servicesRegistry;
-
- /**
- * The created editor.
- */
- private IEditorPart editor;
-
- /**
- * The raw model stored in the SashProvider.
- */
- private PapyrusTextInstance rawModel;
-
- /**
- *
- * Constructor.
- */
- public TextEditorModel(Object pageIdentifier, ServicesRegistry servicesRegistry) {
- rawModel = (PapyrusTextInstance)pageIdentifier;
- this.servicesRegistry = servicesRegistry;
- }
-
- /**
- * Create the IEditor for the diagram.
- *
- * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel#createIEditorPart()
- * @return
- * @throws PartInitException
- *
- */
- public IEditorPart createIEditorPart() throws PartInitException {
- try {
- //we use this way when there is one factory for several editor types
- // Constructor<?> c = getDiagramClass().getConstructor(ServicesRegistry.class, PapyrusTextInstance.class);
- // editor = (IEditorPart)c.newInstance(servicesRegistry, rawModel);
-
- //we use this way when there is only one editor type
- editor = new PapyrusCommentEditor(servicesRegistry, rawModel);
- return editor;
-
- } catch (Exception e) {
- // Lets propagate. This is an implementation problem that should be solved by
- // programmer.
- throw new PartInitException("Can't create TextEditor", e); //$NON-NLS-1$
- }
-
- }
-
- /**
- * Get the action bar requested by the Editor.
- *
- * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel#getActionBarContributor()
- * @return
- *
- */
- public EditorActionBarContributor getActionBarContributor() {
-
- String actionBarId = editorDescriptor.getActionBarContributorId();
-
- // Do nothing if no EditorActionBarContributor is specify.
- if(actionBarId == null || actionBarId.length() == 0) {
- return null;
- }
-
- // Try to get it.
-
- // Get ServiceRegistry
- // ServicesRegistry serviceRegistry = getServicesRegistry();
- ActionBarContributorRegistry registry;
- try {
- registry = servicesRegistry.getService(ActionBarContributorRegistry.class);
- } catch (ServiceException e) {
- // Service not found
- Activator.log.error(e);
- return null;
- }
-
- try {
- return registry.getActionBarContributor(actionBarId);
- } catch (BackboneException e) {
- Activator.log.error(e);
- return null;
- }
- }
-
- /**
- * Get the underlying RawModel. Return the Diagram.
- *
- * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel#getRawModel()
- * @return
- *
- */
- public Object getRawModel() {
- return rawModel;
- }
-
- /**
- * Get the icon to be shown by Tabs
- *
- * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel#getTabIcon()
- * @return
- *
- */
- public Image getTabIcon() {
- ImageDescriptor imageDescriptor = getEditorDescriptor().getIcon();
- if(imageDescriptor == null) {
- return null;
- }
- return imageDescriptor.createImage();
- }
-
- /**
- * Get the title of the Diagram.
- *
- * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel#getTabTitle()
- * @return
- *
- */
- public String getTabTitle() {
- return rawModel.getName();
- }
- }
-}
+/*****************************************************************************
+ * 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 v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.example.uml.comment.editor.newresource.factory;
+
+import java.lang.reflect.Constructor;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance;
+import org.eclipse.papyrus.example.uml.comment.editor.newresource.Activator;
+import org.eclipse.papyrus.example.uml.comment.editor.newresource.editor.PapyrusCommentEditor;
+import org.eclipse.papyrus.infra.core.editor.BackboneException;
+import org.eclipse.papyrus.infra.core.extension.diagrameditor.AbstractEditorFactory;
+import org.eclipse.papyrus.infra.core.multidiagram.actionbarcontributor.ActionBarContributorRegistry;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.part.EditorActionBarContributor;
+
+
+public class CommentEditorFactory extends AbstractEditorFactory {
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param editorClass
+ * the editor class
+ * @param editorType
+ * the type of editor
+ */
+ public CommentEditorFactory() {
+ super(PapyrusCommentEditor.class, PapyrusCommentEditor.EDITOR_TYPE);
+ }
+
+ /**
+ * Create the IPageModel that is used by the SashWindows to manage the editor.
+ *
+ * @see org.eclipse.papyrus.infra.core.editorsfactory.IEditorFactory#createIPageModel(java.lang.Object)
+ *
+ * @param pageIdentifier
+ * The model pushed in the sashmodel by the creation command
+ * @return A model implementing the IPageModel
+ */
+ public IPageModel createIPageModel(Object pageIdentifier) {
+ return new TextEditorModel(pageIdentifier, getServiceRegistry());
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.core.editorsfactory.IEditorFactory#isPageModelFactoryFor(java.lang.Object)
+ *
+ * @param pageIdentifier
+ * @return
+ */
+ public boolean isPageModelFactoryFor(Object pageIdentifier) {
+ if(pageIdentifier instanceof PapyrusTextInstance) {
+ return ((PapyrusTextInstance)pageIdentifier).getType().equals(this.getExpectedType());
+ }
+ return false;
+ }
+
+ /**
+ * IEditorModel used internally by the SashContainer. This model know how to handle IEditor creation.
+ *
+ *
+ *
+ */
+ class TextEditorModel implements IEditorModel {
+
+
+ /**
+ * The servicesRegistry provided at creation.
+ */
+ private ServicesRegistry servicesRegistry;
+
+ /**
+ * The created editor.
+ */
+ private IEditorPart editor;
+
+ /**
+ * The raw model stored in the SashProvider.
+ */
+ private PapyrusTextInstance rawModel;
+
+ /**
+ *
+ * Constructor.
+ */
+ public TextEditorModel(Object pageIdentifier, ServicesRegistry servicesRegistry) {
+ rawModel = (PapyrusTextInstance)pageIdentifier;
+ this.servicesRegistry = servicesRegistry;
+ }
+
+ /**
+ * Create the IEditor for the diagram.
+ *
+ * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel#createIEditorPart()
+ * @return
+ * @throws PartInitException
+ *
+ */
+ public IEditorPart createIEditorPart() throws PartInitException {
+ try {
+ //we use this way when there is one factory for several editor types
+ // Constructor<?> c = getDiagramClass().getConstructor(ServicesRegistry.class, PapyrusTextInstance.class);
+ // editor = (IEditorPart)c.newInstance(servicesRegistry, rawModel);
+
+ //we use this way when there is only one editor type
+ editor = new PapyrusCommentEditor(servicesRegistry, rawModel);
+ return editor;
+
+ } catch (Exception e) {
+ // Lets propagate. This is an implementation problem that should be solved by
+ // programmer.
+ throw new PartInitException("Can't create TextEditor", e); //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * Get the action bar requested by the Editor.
+ *
+ * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel#getActionBarContributor()
+ * @return
+ *
+ */
+ public EditorActionBarContributor getActionBarContributor() {
+
+ String actionBarId = editorDescriptor.getActionBarContributorId();
+
+ // Do nothing if no EditorActionBarContributor is specify.
+ if(actionBarId == null || actionBarId.length() == 0) {
+ return null;
+ }
+
+ // Try to get it.
+
+ // Get ServiceRegistry
+ // ServicesRegistry serviceRegistry = getServicesRegistry();
+ ActionBarContributorRegistry registry;
+ try {
+ registry = servicesRegistry.getService(ActionBarContributorRegistry.class);
+ } catch (ServiceException e) {
+ // Service not found
+ Activator.log.error(e);
+ return null;
+ }
+
+ try {
+ return registry.getActionBarContributor(actionBarId);
+ } catch (BackboneException e) {
+ Activator.log.error(e);
+ return null;
+ }
+ }
+
+ /**
+ * Get the underlying RawModel. Return the Diagram.
+ *
+ * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel#getRawModel()
+ * @return
+ *
+ */
+ public Object getRawModel() {
+ return rawModel;
+ }
+
+ /**
+ * Get the icon to be shown by Tabs
+ *
+ * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel#getTabIcon()
+ * @return
+ *
+ */
+ public Image getTabIcon() {
+ ImageDescriptor imageDescriptor = getEditorDescriptor().getIcon();
+ if(imageDescriptor == null) {
+ return null;
+ }
+ return imageDescriptor.createImage();
+ }
+
+ /**
+ * Get the title of the Diagram.
+ *
+ * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel#getTabTitle()
+ * @return
+ *
+ */
+ public String getTabTitle() {
+ return rawModel.getName();
+ }
+
+ public void dispose() {
+ // Pass
+ }
+ }
+}
diff --git a/examples/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/META-INF/MANIFEST.MF b/examples/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/META-INF/MANIFEST.MF
index b1b171f3db3..4c141cbe841 100644
--- a/examples/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/META-INF/MANIFEST.MF
+++ b/examples/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/META-INF/MANIFEST.MF
@@ -1,27 +1,29 @@
-Manifest-Version: 1.0
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.papyrus.infra.core.log;bundle-version="0.10.1",
- org.eclipse.ui.editors;bundle-version="3.8.0",
- org.eclipse.text,
- org.eclipse.emf.ecore;bundle-version="2.8.0",
- org.eclipse.papyrus.example.text.instance;bundle-version="0.10.1",
- org.eclipse.uml2.uml;bundle-version="4.0.0",
- org.eclipse.papyrus.infra.core;bundle-version="0.10.1",
- org.eclipse.emf.transaction,
- org.eclipse.emf.workspace,
- org.eclipse.jface.text;bundle-version="3.8.0",
- org.eclipse.papyrus.infra.services.edit;bundle-version="0.10.1",
- org.eclipse.gmf.runtime.common.core,
- org.eclipse.gmf.runtime.emf.type.core
-Bundle-Vendor: Eclipse Modeling Project
-Bundle-ActivationPolicy: lazy
-Bundle-Version: 0.10.1.qualifier
-Bundle-Name: Papyrus Comment Editor Example (Incubation)
-Bundle-ManifestVersion: 2
-Bundle-Activator: org.eclipse.papyrus.example.uml.comment.editor.share
- dresource.Activator
-Bundle-SymbolicName: org.eclipse.papyrus.example.uml.comment.editor.sh
- aredresource;singleton:=true
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.papyrus.infra.core.log;bundle-version="1.0.1",
+ org.eclipse.ui.editors;bundle-version="3.8.0",
+ org.eclipse.text,
+ org.eclipse.emf.ecore;bundle-version="2.8.0",
+ org.eclipse.papyrus.example.text.instance;bundle-version="1.0.1",
+ org.eclipse.uml2.uml;bundle-version="4.0.0",
+ org.eclipse.papyrus.infra.core;bundle-version="1.0.1",
+ org.eclipse.emf.transaction,
+ org.eclipse.emf.workspace,
+ org.eclipse.jface.text;bundle-version="3.8.0",
+ org.eclipse.papyrus.infra.services.edit;bundle-version="1.0.1",
+ org.eclipse.gmf.runtime.common.core,
+ org.eclipse.gmf.runtime.emf.type.core,
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.0.1",
+ org.eclipse.ui.ide;bundle-version="3.10.0"
+Bundle-Vendor: Eclipse Modeling Project
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 1.0.1.qualifier
+Bundle-Name: Papyrus Comment Editor Example (Incubation)
+Bundle-ManifestVersion: 2
+Bundle-Activator: org.eclipse.papyrus.example.uml.comment.editor.share
+ dresource.Activator
+Bundle-SymbolicName: org.eclipse.papyrus.example.uml.comment.editor.sh
+ aredresource;singleton:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
diff --git a/examples/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/pom.xml b/examples/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/pom.xml
new file mode 100644
index 00000000000..f0a01518355
--- /dev/null
+++ b/examples/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/pom.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>org.eclipse.papyrus.examples</artifactId>
+ <groupId>org.eclipse.papyrus</groupId>
+ <version>1.0.1-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>org.eclipse.papyrus.example.uml.comment.editor.sharedresource</artifactId>
+ <groupId>org.eclipse.papyrus</groupId>
+ <version>1.0.1-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project> \ No newline at end of file
diff --git a/examples/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/factory/CommentEditorFactory.java b/examples/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/factory/CommentEditorFactory.java
index 94c266fd4d3..4dffd8c8c12 100644
--- a/examples/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/factory/CommentEditorFactory.java
+++ b/examples/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/factory/CommentEditorFactory.java
@@ -1,207 +1,211 @@
-/*****************************************************************************
- * 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 v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.example.uml.comment.editor.sharedresource.factory;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance;
-import org.eclipse.papyrus.example.uml.comment.editor.sharedresource.Activator;
-import org.eclipse.papyrus.example.uml.comment.editor.sharedresource.editor.PapyrusCommentEditor;
-import org.eclipse.papyrus.infra.core.editor.BackboneException;
-import org.eclipse.papyrus.infra.core.extension.diagrameditor.AbstractEditorFactory;
-import org.eclipse.papyrus.infra.core.multidiagram.actionbarcontributor.ActionBarContributorRegistry;
-import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel;
-import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.part.EditorActionBarContributor;
-
-
-public class CommentEditorFactory extends AbstractEditorFactory {
-
- /**
- *
- * Constructor.
- *
- * @param editorClass
- * the editor class
- * @param editorType
- * the type of editor
- */
- public CommentEditorFactory() {
- super(PapyrusCommentEditor.class, PapyrusCommentEditor.EDITOR_TYPE);
- }
-
- /**
- * Create the IPageModel that is used by the SashWindows to manage the editor.
- *
- * @see org.eclipse.papyrus.infra.core.editorsfactory.IEditorFactory#createIPageModel(java.lang.Object)
- *
- * @param pageIdentifier
- * The model pushed in the sashmodel by the creation command
- * @return A model implementing the IPageModel
- */
- public IPageModel createIPageModel(Object pageIdentifier) {
- return new TextEditorModel(pageIdentifier, getServiceRegistry());
- }
-
- /**
- * @see org.eclipse.papyrus.infra.core.editorsfactory.IEditorFactory#isPageModelFactoryFor(java.lang.Object)
- *
- * @param pageIdentifier
- * @return
- */
- public boolean isPageModelFactoryFor(Object pageIdentifier) {
- if(pageIdentifier instanceof PapyrusTextInstance) {
- return ((PapyrusTextInstance)pageIdentifier).getType().equals(this.getExpectedType());
- }
- return false;
- }
-
- /**
- * IEditorModel used internally by the SashContainer. This model know how to handle IEditor creation.
- *
- *
- *
- */
- class TextEditorModel implements IEditorModel {
-
-
- /**
- * The servicesRegistry provided at creation.
- */
- private ServicesRegistry servicesRegistry;
-
- /**
- * The created editor.
- */
- private IEditorPart editor;
-
- /**
- * The raw model stored in the SashProvider.
- */
- private PapyrusTextInstance rawModel;
-
- /**
- *
- * Constructor.
- */
- public TextEditorModel(Object pageIdentifier, ServicesRegistry servicesRegistry) {
- rawModel = (PapyrusTextInstance)pageIdentifier;
- this.servicesRegistry = servicesRegistry;
- }
-
- /**
- * Create the IEditor for the diagram.
- *
- * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel#createIEditorPart()
- * @return
- * @throws PartInitException
- *
- */
- public IEditorPart createIEditorPart() throws PartInitException {
- try {
- //we use this way when there is one factory for several editor types
- // Constructor<?> c = getDiagramClass().getConstructor(ServicesRegistry.class, PapyrusTextInstance.class);
- // editor = (IEditorPart)c.newInstance(servicesRegistry, rawModel);
-
- //we use this way when there is only one editor type
- editor = new PapyrusCommentEditor(servicesRegistry, rawModel);
- return editor;
-
- } catch (Exception e) {
- // Lets propagate. This is an implementation problem that should be solved by
- // programmer.
- throw new PartInitException("Can't create TextEditor", e); //$NON-NLS-1$
- }
-
- }
-
- /**
- * Get the action bar requested by the Editor.
- *
- * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel#getActionBarContributor()
- * @return
- *
- */
- public EditorActionBarContributor getActionBarContributor() {
-
- String actionBarId = editorDescriptor.getActionBarContributorId();
-
- // Do nothing if no EditorActionBarContributor is specify.
- if(actionBarId == null || actionBarId.length() == 0) {
- return null;
- }
-
- // Try to get it.
-
- // Get ServiceRegistry
- // ServicesRegistry serviceRegistry = getServicesRegistry();
- ActionBarContributorRegistry registry;
- try {
- registry = servicesRegistry.getService(ActionBarContributorRegistry.class);
- } catch (ServiceException e) {
- // Service not found
- Activator.log.error(e);
- return null;
- }
-
- try {
- return registry.getActionBarContributor(actionBarId);
- } catch (BackboneException e) {
- Activator.log.error(e);
- return null;
- }
- }
-
- /**
- * Get the underlying RawModel. Return the Diagram.
- *
- * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel#getRawModel()
- * @return
- *
- */
- public Object getRawModel() {
- return rawModel;
- }
-
- /**
- * Get the icon to be shown by Tabs
- *
- * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel#getTabIcon()
- * @return
- *
- */
- public Image getTabIcon() {
- ImageDescriptor imageDescriptor = getEditorDescriptor().getIcon();
- if(imageDescriptor == null) {
- return null;
- }
- return imageDescriptor.createImage();
- }
-
- /**
- * Get the title of the Diagram.
- *
- * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel#getTabTitle()
- * @return
- *
- */
- public String getTabTitle() {
- return rawModel.getName();
- }
- }
-}
+/*****************************************************************************
+ * 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 v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.example.uml.comment.editor.sharedresource.factory;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance;
+import org.eclipse.papyrus.example.uml.comment.editor.sharedresource.Activator;
+import org.eclipse.papyrus.example.uml.comment.editor.sharedresource.editor.PapyrusCommentEditor;
+import org.eclipse.papyrus.infra.core.editor.BackboneException;
+import org.eclipse.papyrus.infra.core.extension.diagrameditor.AbstractEditorFactory;
+import org.eclipse.papyrus.infra.core.multidiagram.actionbarcontributor.ActionBarContributorRegistry;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.part.EditorActionBarContributor;
+
+
+public class CommentEditorFactory extends AbstractEditorFactory {
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param editorClass
+ * the editor class
+ * @param editorType
+ * the type of editor
+ */
+ public CommentEditorFactory() {
+ super(PapyrusCommentEditor.class, PapyrusCommentEditor.EDITOR_TYPE);
+ }
+
+ /**
+ * Create the IPageModel that is used by the SashWindows to manage the editor.
+ *
+ * @see org.eclipse.papyrus.infra.core.editorsfactory.IEditorFactory#createIPageModel(java.lang.Object)
+ *
+ * @param pageIdentifier
+ * The model pushed in the sashmodel by the creation command
+ * @return A model implementing the IPageModel
+ */
+ public IPageModel createIPageModel(Object pageIdentifier) {
+ return new TextEditorModel(pageIdentifier, getServiceRegistry());
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.core.editorsfactory.IEditorFactory#isPageModelFactoryFor(java.lang.Object)
+ *
+ * @param pageIdentifier
+ * @return
+ */
+ public boolean isPageModelFactoryFor(Object pageIdentifier) {
+ if(pageIdentifier instanceof PapyrusTextInstance) {
+ return ((PapyrusTextInstance)pageIdentifier).getType().equals(this.getExpectedType());
+ }
+ return false;
+ }
+
+ /**
+ * IEditorModel used internally by the SashContainer. This model know how to handle IEditor creation.
+ *
+ *
+ *
+ */
+ class TextEditorModel implements IEditorModel {
+
+
+ /**
+ * The servicesRegistry provided at creation.
+ */
+ private ServicesRegistry servicesRegistry;
+
+ /**
+ * The created editor.
+ */
+ private IEditorPart editor;
+
+ /**
+ * The raw model stored in the SashProvider.
+ */
+ private PapyrusTextInstance rawModel;
+
+ /**
+ *
+ * Constructor.
+ */
+ public TextEditorModel(Object pageIdentifier, ServicesRegistry servicesRegistry) {
+ rawModel = (PapyrusTextInstance)pageIdentifier;
+ this.servicesRegistry = servicesRegistry;
+ }
+
+ /**
+ * Create the IEditor for the diagram.
+ *
+ * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel#createIEditorPart()
+ * @return
+ * @throws PartInitException
+ *
+ */
+ public IEditorPart createIEditorPart() throws PartInitException {
+ try {
+ //we use this way when there is one factory for several editor types
+ // Constructor<?> c = getDiagramClass().getConstructor(ServicesRegistry.class, PapyrusTextInstance.class);
+ // editor = (IEditorPart)c.newInstance(servicesRegistry, rawModel);
+
+ //we use this way when there is only one editor type
+ editor = new PapyrusCommentEditor(servicesRegistry, rawModel);
+ return editor;
+
+ } catch (Exception e) {
+ // Lets propagate. This is an implementation problem that should be solved by
+ // programmer.
+ throw new PartInitException("Can't create TextEditor", e); //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * Get the action bar requested by the Editor.
+ *
+ * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel#getActionBarContributor()
+ * @return
+ *
+ */
+ public EditorActionBarContributor getActionBarContributor() {
+
+ String actionBarId = editorDescriptor.getActionBarContributorId();
+
+ // Do nothing if no EditorActionBarContributor is specify.
+ if(actionBarId == null || actionBarId.length() == 0) {
+ return null;
+ }
+
+ // Try to get it.
+
+ // Get ServiceRegistry
+ // ServicesRegistry serviceRegistry = getServicesRegistry();
+ ActionBarContributorRegistry registry;
+ try {
+ registry = servicesRegistry.getService(ActionBarContributorRegistry.class);
+ } catch (ServiceException e) {
+ // Service not found
+ Activator.log.error(e);
+ return null;
+ }
+
+ try {
+ return registry.getActionBarContributor(actionBarId);
+ } catch (BackboneException e) {
+ Activator.log.error(e);
+ return null;
+ }
+ }
+
+ /**
+ * Get the underlying RawModel. Return the Diagram.
+ *
+ * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel#getRawModel()
+ * @return
+ *
+ */
+ public Object getRawModel() {
+ return rawModel;
+ }
+
+ /**
+ * Get the icon to be shown by Tabs
+ *
+ * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel#getTabIcon()
+ * @return
+ *
+ */
+ public Image getTabIcon() {
+ ImageDescriptor imageDescriptor = getEditorDescriptor().getIcon();
+ if(imageDescriptor == null) {
+ return null;
+ }
+ return imageDescriptor.createImage();
+ }
+
+ /**
+ * Get the title of the Diagram.
+ *
+ * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel#getTabTitle()
+ * @return
+ *
+ */
+ public String getTabTitle() {
+ return rawModel.getName();
+ }
+
+ public void dispose() {
+ // Pass
+ }
+ }
+}
diff --git a/examples/org.eclipse.papyrus.examples.restrictedservicecreation/.classpath b/examples/org.eclipse.papyrus.examples.restrictedservicecreation/.classpath
deleted file mode 100644
index 2d1a4302f04..00000000000
--- a/examples/org.eclipse.papyrus.examples.restrictedservicecreation/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?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/examples/org.eclipse.papyrus.examples.restrictedservicecreation/.project b/examples/org.eclipse.papyrus.examples.restrictedservicecreation/.project
deleted file mode 100644
index d6cd9d20511..00000000000
--- a/examples/org.eclipse.papyrus.examples.restrictedservicecreation/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.papyrus.example.restrictedservicecreation</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>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/examples/org.eclipse.papyrus.examples.restrictedservicecreation/.settings/org.eclipse.jdt.core.prefs b/examples/org.eclipse.papyrus.examples.restrictedservicecreation/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 828157292c3..00000000000
--- a/examples/org.eclipse.papyrus.examples.restrictedservicecreation/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,8 +0,0 @@
-#Tue Aug 24 16:14:29 CEST 2010
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
diff --git a/examples/org.eclipse.papyrus.examples.restrictedservicecreation/META-INF/MANIFEST.MF b/examples/org.eclipse.papyrus.examples.restrictedservicecreation/META-INF/MANIFEST.MF
deleted file mode 100644
index 46e3e6004d7..00000000000
--- a/examples/org.eclipse.papyrus.examples.restrictedservicecreation/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,21 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.papyrus.example.restrictedservicecreation;singleton:=true
-Bundle-Version: 0.7.1.qualifier
-Bundle-Activator: org.eclipse.papyrus.restrictedservicecreation.Activator
-Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.ui,
- org.eclipse.uml2.uml,
- org.eclipse.papyrus.umlutils;bundle-version="0.7.0",
- org.eclipse.papyrus.core;bundle-version="0.7.0",
- org.eclipse.papyrus.diagram.common;bundle-version="0.7.0",
- org.eclipse.gmt.modisco.infra.browser;bundle-version="0.8.0",
- org.eclipse.gmt.modisco.infra.browser.uicore;bundle-version="0.8.0",
- org.eclipse.papyrus.service.creation;bundle-version="0.7.1",
- org.eclipse.papyrus.uml.service.creation;bundle-version="0.7.1",
- org.eclipse.gmf.runtime.emf.type.ui;bundle-version="1.2.0"
-Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Export-Package: org.eclipse.papyrus.restrictedservicecreation
-Bundle-Vendor: %providerName
diff --git a/examples/org.eclipse.papyrus.examples.restrictedservicecreation/build.properties b/examples/org.eclipse.papyrus.examples.restrictedservicecreation/build.properties
deleted file mode 100644
index c0d503fd9e3..00000000000
--- a/examples/org.eclipse.papyrus.examples.restrictedservicecreation/build.properties
+++ /dev/null
@@ -1,8 +0,0 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.xml
-src.includes = src/,\
- plugin.xml,\
- build.properties
diff --git a/examples/org.eclipse.papyrus.examples.restrictedservicecreation/plugin.properties b/examples/org.eclipse.papyrus.examples.restrictedservicecreation/plugin.properties
deleted file mode 100644
index f5b4a67e73b..00000000000
--- a/examples/org.eclipse.papyrus.examples.restrictedservicecreation/plugin.properties
+++ /dev/null
@@ -1,12 +0,0 @@
-#################################################################################
-# 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 v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
-##################################################################################
-pluginName=restrictedservicecreation
-providerName=Eclipse.org
diff --git a/examples/org.eclipse.papyrus.examples.restrictedservicecreation/plugin.xml b/examples/org.eclipse.papyrus.examples.restrictedservicecreation/plugin.xml
deleted file mode 100644
index 5591c133f4c..00000000000
--- a/examples/org.eclipse.papyrus.examples.restrictedservicecreation/plugin.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
- <extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypes">
- <metamodel nsURI="http://www.eclipse.org/uml2/3.0.0/UML">
-
- <adviceBinding
- class="org.eclipse.papyrus.restrictedservicecreation.FilterClassOnPackage"
- id="org.eclipse.papyrus.restrictedservicecreation.FilterClassOnPackage"
- inheritance="all"
- typeId="org.eclipse.papyrus.uml.Element">
- </adviceBinding>
- </metamodel>
- </extension>
-
- <!-- Creating a default binding -->
- <extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypeBindings">
-
- <!-- Bindings declaration -->
- <binding context="org.eclipse.papyrus.uml.service.creation.TypeContext">
- <elementType pattern="org.eclipse.papyrus.uml.*" />
- <advice ref="org.eclipse.papyrus.restrictedservicecreation.FilterClassOnPackage" />
- </binding>
- </extension>
-
-
-</plugin>
diff --git a/examples/org.eclipse.papyrus.examples.restrictedservicecreation/src/org/eclipse/papyrus/restrictedservicecreation/Activator.java b/examples/org.eclipse.papyrus.examples.restrictedservicecreation/src/org/eclipse/papyrus/restrictedservicecreation/Activator.java
deleted file mode 100644
index 0ea5d65b1a6..00000000000
--- a/examples/org.eclipse.papyrus.examples.restrictedservicecreation/src/org/eclipse/papyrus/restrictedservicecreation/Activator.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*****************************************************************************
- * 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 v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.restrictedservicecreation;
-
-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 implements org.eclipse.ui.IStartup{
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.papyrus.example.restrictedservicecreation"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
- public void earlyStartup() {
- // TODO Auto-generated method stub
-
- }
-
-}
diff --git a/examples/org.eclipse.papyrus.examples.restrictedservicecreation/src/org/eclipse/papyrus/restrictedservicecreation/FilterClassOnPackage.java b/examples/org.eclipse.papyrus.examples.restrictedservicecreation/src/org/eclipse/papyrus/restrictedservicecreation/FilterClassOnPackage.java
deleted file mode 100644
index afba04aae08..00000000000
--- a/examples/org.eclipse.papyrus.examples.restrictedservicecreation/src/org/eclipse/papyrus/restrictedservicecreation/FilterClassOnPackage.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*****************************************************************************
- * 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 v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.restrictedservicecreation;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.ConfigureElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.GetEditContextRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
-import org.eclipse.papyrus.service.creation.PapyrusEditHelperFilter;
-import org.eclipse.papyrus.uml.service.creation.element.UMLElementTypes;
-
-/**
- * this is a filter used to allow the creation of a class or package in the context on a package,
- * or to allow only the creation of a property in the context of a class
- *
- */
-public class FilterClassOnPackage extends PapyrusEditHelperFilter {
-
- /**
- * {@inheritDoc}
- */
- protected ICommand getAfterConfigureCommand(final ConfigureRequest request) {
- return new ConfigureElementCommand(request) {
-
- protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
- return CommandResult.newOKCommandResult();
- }
- };
- }
- /**
- * {@inheritDoc}
- */
- public boolean validateRequest(IEditCommandRequest request) {
- if(request instanceof GetEditContextRequest){
- IEditCommandRequest subrequest= ((GetEditContextRequest)request).getEditCommandRequest();
- if( subrequest instanceof CreateElementRequest){
-
- //allow only creation of class or package into a package
- if(((CreateElementRequest) subrequest).getContainer() instanceof org.eclipse.uml2.uml.Package){
- if(((CreateElementRequest) subrequest).getElementType().equals(UMLElementTypes.CLASS)||
- ((CreateElementRequest) subrequest).getElementType().equals(UMLElementTypes.PACKAGE)){
- return true;
- }
- }
- //allow only creation of property into a class
- if(((CreateElementRequest) subrequest).getContainer() instanceof org.eclipse.uml2.uml.Class){
- if(((CreateElementRequest) subrequest).getElementType().equals(UMLElementTypes.PROPERTY)){
- return true;
- }
- }
- }
- }
- return false;
- }
-
-}
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/.classpath b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/.classpath
index f6326c88c74..7aed21cfec6 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/.classpath
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/.classpath
@@ -1,8 +1,8 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="custom-src"/>
- <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="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="custom-src"/>
+ <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="output" path="bin"/>
+</classpath>
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/.project b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/.project
index 3c9db2aad7c..43d05e2a806 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/.project
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/.project
@@ -1,28 +1,28 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.papyrus.example.diagram.simplediagram</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>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.example.diagram.simplediagram</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>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/META-INF/MANIFEST.MF b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/META-INF/MANIFEST.MF
index b4a6d6c7e5f..2496cc41fa3 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/META-INF/MANIFEST.MF
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/META-INF/MANIFEST.MF
@@ -1,52 +1,51 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.uml2.uml.diagram; singleton:=true
-Bundle-Version: 0.8.0.qualifier
-Bundle-Activator: org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditorPlugin
-Bundle-Vendor: %providerName
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.core.resources,
- org.eclipse.core.expressions,
- org.eclipse.jface,
- org.eclipse.ui.ide,
- org.eclipse.ui.views,
- org.eclipse.ui.navigator,
- org.eclipse.ui.navigator.resources,
- org.eclipse.emf.ecore,
- org.eclipse.emf.ecore.xmi,
- org.eclipse.emf.edit.ui,
- org.eclipse.gmf.runtime.emf.core,
- org.eclipse.gmf.runtime.emf.commands.core,
- org.eclipse.gmf.runtime.emf.ui.properties,
- org.eclipse.gmf.runtime.diagram.ui,
- org.eclipse.gmf.runtime.diagram.ui.properties,
- org.eclipse.gmf.runtime.diagram.ui.providers,
- org.eclipse.gmf.runtime.diagram.ui.providers.ide,
- org.eclipse.gmf.runtime.diagram.ui.render,
- org.eclipse.gmf.runtime.diagram.ui.resources.editor,
- org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide,
- org.eclipse.draw2d;visibility:=reexport,
- org.eclipse.uml2.uml;visibility:=reexport,
- org.eclipse.uml2.uml.edit;visibility:=reexport,
- org.eclipse.emf.ecore;visibility:=reexport,
- org.eclipse.emf.ecore.edit;visibility:=reexport,
- org.eclipse.gef,
- org.eclipse.papyrus.preferences,
- org.eclipse.papyrus.extensionpoints.editors,
- org.eclipse.papyrus.core,
- org.eclipse.papyrus.diagram.common,
- org.eclipse.gmf.runtime.draw2d.ui;visibility:=reexport
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Bundle-ActivationPolicy: lazy
-Bundle-ClassPath: .
-Bundle-Localization: plugin
-Export-Package: org.eclipse.papyrus.example.diagram.simplediagram.edit.parts,
- org.eclipse.papyrus.example.diagram.simplediagram.part,
- org.eclipse.papyrus.example.diagram.simplediagram.providers
-Eclipse-LazyStart: true
-Import-Package: org.eclipse.papyrus.core.adaptor.gmf,
- org.eclipse.papyrus.core.editor,
- org.eclipse.papyrus.diagram.common.listeners,
- org.eclipse.papyrus.example.diagram.simplediagram.edit.parts
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.papyrus.example.diagram.simplediagram;singleton:=true
+Bundle-Version: 1.0.1.qualifier
+Bundle-Activator: org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditorPlugin
+Bundle-Vendor: %providerName
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.core.expressions,
+ org.eclipse.jface,
+ org.eclipse.ui.ide,
+ org.eclipse.ui.views,
+ org.eclipse.ui.navigator,
+ org.eclipse.ui.navigator.resources,
+ org.eclipse.emf.ecore,
+ org.eclipse.emf.ecore.xmi,
+ org.eclipse.emf.edit.ui,
+ org.eclipse.gmf.runtime.emf.core,
+ org.eclipse.gmf.runtime.emf.commands.core,
+ org.eclipse.gmf.runtime.emf.ui.properties,
+ org.eclipse.gmf.runtime.diagram.ui,
+ org.eclipse.gmf.runtime.diagram.ui.properties,
+ org.eclipse.gmf.runtime.diagram.ui.providers,
+ org.eclipse.gmf.runtime.diagram.ui.providers.ide,
+ org.eclipse.gmf.runtime.diagram.ui.render,
+ org.eclipse.gmf.runtime.diagram.ui.resources.editor,
+ org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide,
+ org.eclipse.draw2d;visibility:=reexport,
+ org.eclipse.uml2.uml;visibility:=reexport,
+ org.eclipse.uml2.uml.edit;visibility:=reexport,
+ org.eclipse.emf.ecore;visibility:=reexport,
+ org.eclipse.emf.ecore.edit;visibility:=reexport,
+ org.eclipse.gef,
+ org.eclipse.papyrus.extensionpoints.editors,
+ org.eclipse.gmf.runtime.draw2d.ui;visibility:=reexport,
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.0.1",
+ org.eclipse.gmf.tooling.runtime;visibility:=reexport,
+ org.eclipse.gmf.codegen.xtend,
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.0.1",
+ org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.0.1",
+ org.eclipse.papyrus.infra.core;bundle-version="1.0.1"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .
+Bundle-Localization: plugin
+Export-Package: org.eclipse.papyrus.example.diagram.simplediagram.edit.parts,
+ org.eclipse.papyrus.example.diagram.simplediagram.part,
+ org.eclipse.papyrus.example.diagram.simplediagram.providers
+Eclipse-LazyStart: true
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/build.properties b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/build.properties
index 94408cbfe89..4b0c263e3ee 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/build.properties
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/build.properties
@@ -1,5 +1,8 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .
-jars.compile.order = .
+source.. = src/,\
+ custom-src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.properties,\
+ plugin.xml
+jars.compile.order = .
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/custom-src/org/eclipse/papyrus/example/diagram/simplediagram/CreateDiagramCommand.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/custom-src/org/eclipse/papyrus/example/diagram/simplediagram/CreateDiagramCommand.java
index a418539ddd9..738a2cda6b8 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/custom-src/org/eclipse/papyrus/example/diagram/simplediagram/CreateDiagramCommand.java
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/custom-src/org/eclipse/papyrus/example/diagram/simplediagram/CreateDiagramCommand.java
@@ -1,34 +1,47 @@
-package org.eclipse.papyrus.example.diagram.simplediagram;
-
-import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
-import org.eclipse.papyrus.core.adaptor.gmf.AbstractPapyrusGmfCreateDiagramCommandHandler;
-import org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ModelEditPart;
-
-
-public class CreateDiagramCommand extends AbstractPapyrusGmfCreateDiagramCommandHandler {
-
- @Override
- protected String getDefaultDiagramName() {
- return openDiagramNameDialog("NewDiagram");
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getDiagramNotationID() {
- return ModelEditPart.MODEL_ID;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected PreferencesHint getPreferenceHint() {
- return org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT;
- }
-
-}
-
-
-
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST & other.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Bug 445097
+ *****************************************************************************/
+package org.eclipse.papyrus.example.diagram.simplediagram;
+
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ModelEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.AbstractPapyrusGmfCreateDiagramCommandHandler;
+
+
+public class CreateDiagramCommand extends AbstractPapyrusGmfCreateDiagramCommandHandler {
+
+ private static final String EXAMPLE_SIMPLE_DIAGRAM = "ExampleSimpleDiagram"; //$NON-NLS-1$
+
+ @Override
+ protected String getDefaultDiagramName() {
+ return EXAMPLE_SIMPLE_DIAGRAM;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getDiagramNotationID() {
+ return ModelEditPart.MODEL_ID;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected PreferencesHint getPreferenceHint() {
+ return org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT;
+ }
+
+}
+
+
+
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/custom-src/org/eclipse/papyrus/example/diagram/simplediagram/DiagramEditorFactory.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/custom-src/org/eclipse/papyrus/example/diagram/simplediagram/DiagramEditorFactory.java
index 2c00fbb6965..f376b170b50 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/custom-src/org/eclipse/papyrus/example/diagram/simplediagram/DiagramEditorFactory.java
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/custom-src/org/eclipse/papyrus/example/diagram/simplediagram/DiagramEditorFactory.java
@@ -1,18 +1,28 @@
-package org.eclipse.papyrus.example.diagram.simplediagram;
-
-import org.eclipse.papyrus.core.adaptor.gmf.GmfEditorFactory;
-import org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ModelEditPart;
-
-public class DiagramEditorFactory extends GmfEditorFactory {
-
- /**
- * @param diagramClass
- * @param expectedType
- */
- public DiagramEditorFactory() {
- super(UmlDiagramForMultiEditor.class, ModelEditPart.MODEL_ID);
-
- }
-
-
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST & other.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Bug 445097
+ *****************************************************************************/
+package org.eclipse.papyrus.example.diagram.simplediagram;
+
+import org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ModelEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.GmfEditorFactory;
+
+public class DiagramEditorFactory extends GmfEditorFactory {
+
+ /**
+ * @param diagramClass
+ * @param expectedType
+ */
+ public DiagramEditorFactory() {
+ super(UmlDiagramForMultiEditor.class, ModelEditPart.MODEL_ID);
+ }
+
+
+}
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/custom-src/org/eclipse/papyrus/example/diagram/simplediagram/UmlDiagramForMultiEditor.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/custom-src/org/eclipse/papyrus/example/diagram/simplediagram/UmlDiagramForMultiEditor.java
index bb412fdc5a1..26b2e620059 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/custom-src/org/eclipse/papyrus/example/diagram/simplediagram/UmlDiagramForMultiEditor.java
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/custom-src/org/eclipse/papyrus/example/diagram/simplediagram/UmlDiagramForMultiEditor.java
@@ -1,92 +1,98 @@
-package org.eclipse.papyrus.example.diagram.simplediagram;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.emf.common.ui.URIEditorInput;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.papyrus.core.editor.BackboneException;
-import org.eclipse.papyrus.core.services.ServiceException;
-import org.eclipse.papyrus.core.services.ServicesRegistry;
-import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditor;
-import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditorPlugin;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.PartInitException;
-
-
-
-public class UmlDiagramForMultiEditor extends UMLDiagramEditor {
- /**
- * The location of diagram icon in the plug-in
- */
- private static final String DIAG_IMG_PATH = "icons/obj16/newDiagramFile.gif";
-
- /**
- * The image descriptor of the diagram icon
- */
- private static final ImageDescriptor DIAG_IMG_DESC = UMLDiagramEditorPlugin.getBundledImageDescriptor(UmlDiagramForMultiEditor.DIAG_IMG_PATH);
-
- /** The editor splitter. */
- private Composite splitter;
-
- /**
- * Constructor for SashSystem v2. Context and required objects are retrieved from the
- * ServiceRegistry.
- *
- * @throws BackboneException
- * @throws ServiceException
- *
- */
- public UmlDiagramForMultiEditor(ServicesRegistry servicesRegistry, Diagram diagram) throws BackboneException, ServiceException {
- super(servicesRegistry, diagram);
- }
-
- @Override
- public void setInput(IEditorInput input) {
- try {
- // Provide an URI with fragment in order to reuse the same Resource
- // and set the diagram to the fragment.
- URIEditorInput uriInput = new URIEditorInput(EcoreUtil.getURI(getDiagram()));
- doSetInput(uriInput, true);
- } catch (CoreException x) {
- String title = "Problem opening";
- String msg = "Cannot open input element:";
- Shell shell = getSite().getShell();
- ErrorDialog.openError(shell, title, msg, x.getStatus());
- }
- }
-
- @Override
- public void init(IEditorSite site, IEditorInput input)
- throws PartInitException {
- // TODO Auto-generated method stub
- super.init(site, input);
- setPartName(getDiagram().getName());
- setTitleImage(DIAG_IMG_DESC.createImage());
- }
-
- @Override
- protected String getEditingDomainID() {
- // TODO Auto-generated method stub
- return "org.eclipse.papyrus.diagram.newdiagram.EditingDomain";
- }
-
- @Override
- public void setFocus() {
- splitter.setFocus();
- super.setFocus();
- }
-
- @Override
- protected void createGraphicalViewer(Composite parent) {
- splitter = parent;
- super.createGraphicalViewer(parent);
- }
-
-
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST & other.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Bug 445097
+ *****************************************************************************/
+package org.eclipse.papyrus.example.diagram.simplediagram;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.emf.common.ui.URIEditorInput;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditor;
+import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.infra.core.editor.BackboneException;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.PartInitException;
+
+
+
+public class UmlDiagramForMultiEditor extends UMLDiagramEditor {
+ /**
+ * The location of diagram icon in the plug-in
+ */
+ private static final String DIAG_IMG_PATH = "icons/obj16/newDiagramFile.gif";
+
+ /**
+ * The image descriptor of the diagram icon
+ */
+ private static final ImageDescriptor DIAG_IMG_DESC = UMLDiagramEditorPlugin.getBundledImageDescriptor(UmlDiagramForMultiEditor.DIAG_IMG_PATH);
+
+ /** The editor splitter. */
+ private Composite splitter;
+
+ /**
+ * Constructor for SashSystem v2. Context and required objects are retrieved from the
+ * ServiceRegistry.
+ *
+ * @throws BackboneException
+ * @throws ServiceException
+ *
+ */
+ public UmlDiagramForMultiEditor() throws BackboneException, ServiceException {
+ super();
+ }
+
+ @Override
+ public void setInput(IEditorInput input) {
+ try {
+ // Provide an URI with fragment in order to reuse the same Resource
+ // and set the diagram to the fragment.
+ URIEditorInput uriInput = new URIEditorInput(EcoreUtil.getURI(getDiagram()));
+ doSetInput(uriInput, true);
+ } catch (CoreException x) {
+ String title = "Problem opening";
+ String msg = "Cannot open input element:";
+ Shell shell = getSite().getShell();
+ ErrorDialog.openError(shell, title, msg, x.getStatus());
+ }
+ }
+
+ @Override
+ public void init(IEditorSite site, IEditorInput input)
+ throws PartInitException {
+ super.init(site, input);
+ setPartName(getDiagram().getName());
+ setTitleImage(DIAG_IMG_DESC.createImage());
+ }
+
+ @Override
+ protected String getEditingDomainID() {
+ return "org.eclipse.papyrus.diagram.newdiagram.EditingDomain";
+ }
+
+ @Override
+ public void setFocus() {
+ splitter.setFocus();
+ super.setFocus();
+ }
+
+ @Override
+ protected void createGraphicalViewer(Composite parent) {
+ splitter = parent;
+ super.createGraphicalViewer(parent);
+ }
+
+
+}
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/messages.properties b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/messages.properties
index 1239c08a5b0..c3658e68af6 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/messages.properties
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/messages.properties
@@ -97,3 +97,6 @@ NavigatorGroupName_Usage_4001_source=source
NavigatorGroupName_Usage_4001_outgoinglinks=outgoing links
NavigatorGroupName_Interface_2003_incominglinks=incoming links
NavigatorGroupName_Interface_2003_outgoinglinks=outgoing links
+Uml1Group_title=uml
+Component1CreationTool_title=Component
+Component1CreationTool_desc=Create new Component
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/model/newdiagram.gmfgen b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/model/newdiagram.gmfgen
index 3949d5941ed..242ad8b2a4e 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/model/newdiagram.gmfgen
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/model/newdiagram.gmfgen
@@ -1,158 +1,158 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<gmfgen:GenEditorGenerator xmi:version="2.0"
- xmlns:xmi="http://www.omg.org/XMI"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:gmfgen="http://www.eclipse.org/gmf/2009/GenModel" packageNamePrefix="org.eclipse.papyrus.diagram.newdiagram"
- modelID="PapyrusNewDiagram"
- domainFileExtension="PapyrusNewDiagram"
- dynamicTemplates="true"
- templateDirectory="/org.eclipse.papyrus.def/dynamic-templates3.5/codegen"
- pluginDirectory="/org.eclipse.papyrus.diagram.newdiagram/src">
- <diagram
- visualID="1000"
- editPartClassName="ModelEditPart"
- itemSemanticEditPolicyClassName="ModelItemSemanticEditPolicy"
- canonicalEditPolicyClassName="ModelCanonicalEditPolicy"
- iconProviderPriority="Low"
- validationProviderPriority="Low">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Diagram"/>
- <elementType
- xsi:type="gmfgen:MetamodelType"
- editHelperClassName="ModelEditHelper"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.draw2d.FreeformLayer"/>
- <domainDiagramElement
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Model"/>
- <topLevelNodes
- visualID="2001"
- editPartClassName="ComponentEditPart"
- itemSemanticEditPolicyClassName="ComponentItemSemanticEditPolicy"
- notationViewFactoryClassName="ComponentViewFactory"
- canonicalEditPolicyClassName="ComponentCanonicalEditPolicy"
- graphicalNodeEditPolicyClassName="ComponentGraphicalNodeEditPolicy"
- createCommandClassName="ComponentCreateCommand">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:MetamodelType"
- editHelperClassName="ComponentEditHelper"/>
- <viewmap
- xsi:type="gmfgen:InnerClassViewmap"
- layoutType="FLOW_LAYOUT"
- className="ComponentFigure"
- classBody="&#xA;/**&#xA; * @generated&#xA; */&#xA;public class ComponentFigure extends org.eclipse.draw2d.RectangleFigure {&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel fFigureComponentNameFigure; &#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;public ComponentFigure() {&#xA;&#x9;&#x9;&#xA;&#x9;org.eclipse.draw2d.FlowLayout layoutThis = new org.eclipse.draw2d.FlowLayout();&#xA;&#x9;layoutThis.setStretchMinorAxis(false);&#xA;&#x9;layoutThis.setMinorAlignment(org.eclipse.draw2d.FlowLayout.ALIGN_LEFTTOP&#xA;);&#xA;&#xA;&#x9;layoutThis.setMajorAlignment(org.eclipse.draw2d.FlowLayout.ALIGN_LEFTTOP&#xA;);&#xA;&#x9;layoutThis.setMajorSpacing(5);&#xA;&#x9;layoutThis.setMinorSpacing(5);&#xA;&#x9;layoutThis.setHorizontal(true);&#xA;&#xA;&#x9;this.setLayoutManager(layoutThis);&#xA;&#xA;&#x9;&#x9;&#x9;&#x9;createContents();&#xA;&#x9;}&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private void createContents(){&#xA;&#xA;&#xA;fFigureComponentNameFigure = new org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel();&#xA;fFigureComponentNameFigure.setText(&quot;&lt;...>&quot;);&#xA;&#xA;this.add(fFigureComponentNameFigure);&#xA;&#xA;&#xA;&#x9;}&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;public org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel getFigureComponentNameFigure() {&#xA;&#x9;&#x9;return fFigureComponentNameFigure;&#xA;&#x9;}&#xA;&#xA;&#xA;}&#xA;&#xA;"/>
- <modelFacet>
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Component"/>
- <containmentMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Package/packagedElement"/>
- <childMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Package/packagedElement"/>
- </modelFacet>
- <labels
- visualID="5001"
- editPartClassName="ComponentNameEditPart"
- itemSemanticEditPolicyClassName="ComponentNameItemSemanticEditPolicy"
- notationViewFactoryClassName="ComponentNameViewFactory"
- elementIcon="true">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:ParentAssignedViewmap"
- getterName="getFigureComponentNameFigure"
- figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel"/>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="//@labelParsers/@implementations.0">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- </topLevelNodes>
- <palette>
- <groups
- title="uml"
- largeIconPath="icons/obj16/Diagram_UML.gif"
- smallIconPath="icons/obj16/Diagram_UML.gif">
- <entries
- xsi:type="gmfgen:ToolEntry"
- title="Component"
- description="Create new Component"
- largeIconPath="icons/obj16/Component.gif"
- smallIconPath="icons/obj16/Component.gif"
- genNodes="//@diagram/@topLevelNodes.0"/>
- </groups>
- </palette>
- <preferencePages
- xsi:type="gmfgen:GenStandardPreferencePage"
- iD="org.eclipse.uml2.uml.diagram.general"
- name="UML Diagram">
- <children
- xsi:type="gmfgen:GenStandardPreferencePage"
- iD="org.eclipse.uml2.uml.diagram.appearance"
- name="Appearance"
- kind="Appearance"/>
- <children
- xsi:type="gmfgen:GenStandardPreferencePage"
- iD="org.eclipse.uml2.uml.diagram.connections"
- name="Connections"
- kind="Connections"/>
- <children
- xsi:type="gmfgen:GenStandardPreferencePage"
- iD="org.eclipse.uml2.uml.diagram.printing"
- name="Printing"
- kind="Printing"/>
- <children
- xsi:type="gmfgen:GenStandardPreferencePage"
- iD="org.eclipse.uml2.uml.diagram.rulersAndGrid"
- name="Rulers And Grid"
- kind="RulersAndGrid"/>
- </preferencePages>
- </diagram>
- <plugin>
- <requiredPlugins>org.eclipse.draw2d</requiredPlugins>
- </plugin>
- <editor/>
- <navigator>
- <childReferences
- child="//@diagram"/>
- <childReferences
- parent="//@diagram"
- child="//@diagram/@topLevelNodes.0"/>
- </navigator>
- <diagramUpdater/>
- <propertySheet>
- <tabs
- xsi:type="gmfgen:GenStandardPropertyTab"
- iD="appearance"/>
- <tabs
- xsi:type="gmfgen:GenStandardPropertyTab"
- iD="diagram"/>
- <tabs
- xsi:type="gmfgen:GenCustomPropertyTab"
- iD="domain"
- label="Core">
- <filter
- xsi:type="gmfgen:TypeTabFilter">
- <types>org.eclipse.gmf.runtime.notation.View</types>
- <types>org.eclipse.gef.EditPart</types>
- <generatedTypes>abstractNavigatorItem</generatedTypes>
- </filter>
- </tabs>
- </propertySheet>
- <domainGenModel
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#/"/>
- <labelParsers
- extensibleViaService="true">
- <implementations
- xsi:type="gmfgen:PredefinedParser"
- uses="//@diagram/@topLevelNodes.0/@labels.0/@modelFacet"/>
- </labelParsers>
- <contextMenus
- context="//@diagram">
- <items
- xsi:type="gmfgen:LoadResourceAction"/>
- </contextMenus>
-</gmfgen:GenEditorGenerator>
+<?xml version="1.0" encoding="UTF-8"?>
+<gmfgen:GenEditorGenerator xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:gmfgen="http://www.eclipse.org/gmf/2009/GenModel" packageNamePrefix="org.eclipse.papyrus.example.diagram.simplediagram"
+ modelID="PapyrusNewDiagram"
+ domainFileExtension="PapyrusNewDiagram"
+ dynamicTemplates="true"
+ templateDirectory="/org.eclipse.papyrus.def/dynamic-templates3.5/codegen"
+ pluginDirectory="/org.eclipse.papyrus.example.diagram.simplediagram/src">
+ <diagram
+ visualID="1000"
+ editPartClassName="ModelEditPart"
+ itemSemanticEditPolicyClassName="ModelItemSemanticEditPolicy"
+ canonicalEditPolicyClassName="ModelCanonicalEditPolicy"
+ iconProviderPriority="Low"
+ validationProviderPriority="Low">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Diagram"/>
+ <elementType
+ xsi:type="gmfgen:MetamodelType"
+ editHelperClassName="ModelEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.draw2d.FreeformLayer"/>
+ <domainDiagramElement
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Model"/>
+ <topLevelNodes
+ visualID="2001"
+ editPartClassName="ComponentEditPart"
+ itemSemanticEditPolicyClassName="ComponentItemSemanticEditPolicy"
+ notationViewFactoryClassName="ComponentViewFactory"
+ canonicalEditPolicyClassName="ComponentCanonicalEditPolicy"
+ graphicalNodeEditPolicyClassName="ComponentGraphicalNodeEditPolicy"
+ createCommandClassName="ComponentCreateCommand">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:MetamodelType"
+ editHelperClassName="ComponentEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:InnerClassViewmap"
+ layoutType="FLOW_LAYOUT"
+ className="ComponentFigure"
+ classBody="&#xA;/**&#xA; * @generated&#xA; */&#xA;public class ComponentFigure extends org.eclipse.draw2d.RectangleFigure {&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel fFigureComponentNameFigure; &#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;public ComponentFigure() {&#xA;&#x9;&#x9;&#xA;&#x9;org.eclipse.draw2d.FlowLayout layoutThis = new org.eclipse.draw2d.FlowLayout();&#xA;&#x9;layoutThis.setStretchMinorAxis(false);&#xA;&#x9;layoutThis.setMinorAlignment(org.eclipse.draw2d.FlowLayout.ALIGN_LEFTTOP&#xA;);&#xA;&#xA;&#x9;layoutThis.setMajorAlignment(org.eclipse.draw2d.FlowLayout.ALIGN_LEFTTOP&#xA;);&#xA;&#x9;layoutThis.setMajorSpacing(5);&#xA;&#x9;layoutThis.setMinorSpacing(5);&#xA;&#x9;layoutThis.setHorizontal(true);&#xA;&#xA;&#x9;this.setLayoutManager(layoutThis);&#xA;&#xA;&#x9;&#x9;&#x9;&#x9;createContents();&#xA;&#x9;}&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private void createContents(){&#xA;&#xA;&#xA;fFigureComponentNameFigure = new org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel();&#xA;fFigureComponentNameFigure.setText(&quot;&lt;...>&quot;);&#xA;&#xA;this.add(fFigureComponentNameFigure);&#xA;&#xA;&#xA;&#x9;}&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;public org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel getFigureComponentNameFigure() {&#xA;&#x9;&#x9;return fFigureComponentNameFigure;&#xA;&#x9;}&#xA;&#xA;&#xA;}&#xA;&#xA;"/>
+ <modelFacet>
+ <metaClass
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Component"/>
+ <containmentMetaFeature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Package/packagedElement"/>
+ <childMetaFeature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Package/packagedElement"/>
+ </modelFacet>
+ <labels
+ visualID="5001"
+ editPartClassName="ComponentNameEditPart"
+ itemSemanticEditPolicyClassName="ComponentNameItemSemanticEditPolicy"
+ notationViewFactoryClassName="ComponentNameViewFactory"
+ elementIcon="true">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getFigureComponentNameFigure"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel"/>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="//@labelParsers/@implementations.0">
+ <metaFeatures
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </modelFacet>
+ </labels>
+ </topLevelNodes>
+ <palette>
+ <groups
+ title="uml"
+ largeIconPath="icons/obj16/Diagram_UML.gif"
+ smallIconPath="icons/obj16/Diagram_UML.gif">
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="Component"
+ description="Create new Component"
+ largeIconPath="icons/obj16/Component.gif"
+ smallIconPath="icons/obj16/Component.gif"
+ genNodes="//@diagram/@topLevelNodes.0"/>
+ </groups>
+ </palette>
+ <preferencePages
+ xsi:type="gmfgen:GenStandardPreferencePage"
+ iD="org.eclipse.uml2.uml.diagram.general"
+ name="UML Diagram">
+ <children
+ xsi:type="gmfgen:GenStandardPreferencePage"
+ iD="org.eclipse.uml2.uml.diagram.appearance"
+ name="Appearance"
+ kind="Appearance"/>
+ <children
+ xsi:type="gmfgen:GenStandardPreferencePage"
+ iD="org.eclipse.uml2.uml.diagram.connections"
+ name="Connections"
+ kind="Connections"/>
+ <children
+ xsi:type="gmfgen:GenStandardPreferencePage"
+ iD="org.eclipse.uml2.uml.diagram.printing"
+ name="Printing"
+ kind="Printing"/>
+ <children
+ xsi:type="gmfgen:GenStandardPreferencePage"
+ iD="org.eclipse.uml2.uml.diagram.rulersAndGrid"
+ name="Rulers And Grid"
+ kind="RulersAndGrid"/>
+ </preferencePages>
+ </diagram>
+ <plugin>
+ <requiredPlugins>org.eclipse.draw2d</requiredPlugins>
+ </plugin>
+ <editor/>
+ <navigator>
+ <childReferences
+ child="//@diagram"/>
+ <childReferences
+ parent="//@diagram"
+ child="//@diagram/@topLevelNodes.0"/>
+ </navigator>
+ <diagramUpdater/>
+ <propertySheet>
+ <tabs
+ xsi:type="gmfgen:GenStandardPropertyTab"
+ iD="appearance"/>
+ <tabs
+ xsi:type="gmfgen:GenStandardPropertyTab"
+ iD="diagram"/>
+ <tabs
+ xsi:type="gmfgen:GenCustomPropertyTab"
+ iD="domain"
+ label="Core">
+ <filter
+ xsi:type="gmfgen:TypeTabFilter">
+ <types>org.eclipse.gmf.runtime.notation.View</types>
+ <types>org.eclipse.gef.EditPart</types>
+ <generatedTypes>abstractNavigatorItem</generatedTypes>
+ </filter>
+ </tabs>
+ </propertySheet>
+ <domainGenModel
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#/"/>
+ <labelParsers
+ extensibleViaService="true">
+ <implementations
+ xsi:type="gmfgen:PredefinedParser"
+ uses="//@diagram/@topLevelNodes.0/@labels.0/@modelFacet"/>
+ </labelParsers>
+ <contextMenus
+ context="//@diagram">
+ <items
+ xsi:type="gmfgen:LoadResourceAction"/>
+ </contextMenus>
+</gmfgen:GenEditorGenerator>
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/model/newdiagram.gmfgraph b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/model/newdiagram.gmfgraph
index 557af9b570b..3e39b432f81 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/model/newdiagram.gmfgraph
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/model/newdiagram.gmfgraph
@@ -1,31 +1,31 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<gmfgraph:Canvas xmi:version="2.0"
- xmlns:xmi="http://www.omg.org/XMI"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:gmfgraph="http://www.eclipse.org/gmf/2006/GraphicalDefinition" name="uml">
- <figures
- name="Default">
- <descriptors
- name="ComponentFigure">
- <actualFigure
- xsi:type="gmfgraph:Rectangle"
- name="ComponentFigure">
- <layout
- xsi:type="gmfgraph:FlowLayout"/>
- <children
- xsi:type="gmfgraph:Label"
- name="ComponentNameFigure"
- text="&lt;...>"/>
- </actualFigure>
- <accessors
- figure="//@figures.0/@descriptors.0/@actualFigure/@children.0"/>
- </descriptors>
- </figures>
- <nodes
- name="Component"
- figure="ComponentFigure"/>
- <labels
- name="ComponentName"
- figure="ComponentFigure"
- accessor="//@figures.0/@descriptors.0/@accessors.0"/>
-</gmfgraph:Canvas>
+<?xml version="1.0" encoding="UTF-8"?>
+<gmfgraph:Canvas xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:gmfgraph="http://www.eclipse.org/gmf/2006/GraphicalDefinition" name="uml">
+ <figures
+ name="Default">
+ <descriptors
+ name="ComponentFigure">
+ <actualFigure
+ xsi:type="gmfgraph:Rectangle"
+ name="ComponentFigure">
+ <layout
+ xsi:type="gmfgraph:FlowLayout"/>
+ <children
+ xsi:type="gmfgraph:Label"
+ name="ComponentNameFigure"
+ text="&lt;...>"/>
+ </actualFigure>
+ <accessors
+ figure="//@figures.0/@descriptors.0/@actualFigure/@children.0"/>
+ </descriptors>
+ </figures>
+ <nodes
+ name="Component"
+ figure="ComponentFigure"/>
+ <labels
+ name="ComponentName"
+ figure="ComponentFigure"
+ accessor="//@figures.0/@descriptors.0/@accessors.0"/>
+</gmfgraph:Canvas>
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/model/newdiagram.gmfmap b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/model/newdiagram.gmfmap
index 83d8442d6ea..5ef3147c823 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/model/newdiagram.gmfmap
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/model/newdiagram.gmfmap
@@ -1,37 +1,37 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<gmfmap:Mapping xmi:version="2.0"
- xmlns:xmi="http://www.omg.org/XMI"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:gmfmap="http://www.eclipse.org/gmf/2008/mappings"
- xmlns:gmftool="http://www.eclipse.org/gmf/2005/ToolDefinition">
- <nodes>
- <containmentFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.ecore#//Package/packagedElement"/>
- <ownedChild>
- <domainMetaElement
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.ecore#//Component"/>
- <labelMappings
- xsi:type="gmfmap:FeatureLabelMapping">
- <diagramLabel
- href="newdiagram.gmfgraph#ComponentName"/>
- <features
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.ecore#//NamedElement/name"/>
- </labelMappings>
- <tool
- xsi:type="gmftool:CreationTool"
- href="newdiagram.gmftool#//@palette/@tools.0/@tools.0"/>
- <diagramNode
- href="newdiagram.gmfgraph#Component"/>
- </ownedChild>
- </nodes>
- <diagram>
- <diagramCanvas
- href="newdiagram.gmfgraph#uml"/>
- <domainModel
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.ecore#/"/>
- <domainMetaElement
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.ecore#//Model"/>
- <palette
- href="newdiagram.gmftool#//@palette"/>
- </diagram>
-</gmfmap:Mapping>
+<?xml version="1.0" encoding="UTF-8"?>
+<gmfmap:Mapping xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:gmfmap="http://www.eclipse.org/gmf/2008/mappings"
+ xmlns:gmftool="http://www.eclipse.org/gmf/2005/ToolDefinition">
+ <nodes>
+ <containmentFeature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.ecore#//Package/packagedElement"/>
+ <ownedChild>
+ <domainMetaElement
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.ecore#//Component"/>
+ <labelMappings
+ xsi:type="gmfmap:FeatureLabelMapping">
+ <diagramLabel
+ href="newdiagram.gmfgraph#ComponentName"/>
+ <features
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.ecore#//NamedElement/name"/>
+ </labelMappings>
+ <tool
+ xsi:type="gmftool:CreationTool"
+ href="newdiagram.gmftool#//@palette/@tools.0/@tools.0"/>
+ <diagramNode
+ href="newdiagram.gmfgraph#Component"/>
+ </ownedChild>
+ </nodes>
+ <diagram>
+ <diagramCanvas
+ href="newdiagram.gmfgraph#uml"/>
+ <domainModel
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.ecore#/"/>
+ <domainMetaElement
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.ecore#//Model"/>
+ <palette
+ href="newdiagram.gmftool#//@palette"/>
+ </diagram>
+</gmfmap:Mapping>
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/model/newdiagram.gmftool b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/model/newdiagram.gmftool
index af9d32d62d9..e654bacff66 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/model/newdiagram.gmftool
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/model/newdiagram.gmftool
@@ -1,30 +1,30 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<gmftool:ToolRegistry xmi:version="2.0"
- xmlns:xmi="http://www.omg.org/XMI"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:gmftool="http://www.eclipse.org/gmf/2005/ToolDefinition">
- <palette
- title="umlPalette">
- <tools
- xsi:type="gmftool:ToolGroup"
- title="uml">
- <smallIcon
- xsi:type="gmftool:BundleImage"
- path="icons/obj16/Diagram_UML.gif"/>
- <largeIcon
- xsi:type="gmftool:BundleImage"
- path="icons/obj16/Diagram_UML.gif"/>
- <tools
- xsi:type="gmftool:CreationTool"
- title="Component"
- description="Create new Component">
- <smallIcon
- xsi:type="gmftool:BundleImage"
- path="icons/obj16/Component.gif"/>
- <largeIcon
- xsi:type="gmftool:BundleImage"
- path="icons/obj16/Component.gif"/>
- </tools>
- </tools>
- </palette>
-</gmftool:ToolRegistry>
+<?xml version="1.0" encoding="UTF-8"?>
+<gmftool:ToolRegistry xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:gmftool="http://www.eclipse.org/gmf/2005/ToolDefinition">
+ <palette
+ title="umlPalette">
+ <tools
+ xsi:type="gmftool:ToolGroup"
+ title="uml">
+ <smallIcon
+ xsi:type="gmftool:BundleImage"
+ path="icons/obj16/Diagram_UML.gif"/>
+ <largeIcon
+ xsi:type="gmftool:BundleImage"
+ path="icons/obj16/Diagram_UML.gif"/>
+ <tools
+ xsi:type="gmftool:CreationTool"
+ title="Component"
+ description="Create new Component">
+ <smallIcon
+ xsi:type="gmftool:BundleImage"
+ path="icons/obj16/Component.gif"/>
+ <largeIcon
+ xsi:type="gmftool:BundleImage"
+ path="icons/obj16/Component.gif"/>
+ </tools>
+ </tools>
+ </palette>
+</gmftool:ToolRegistry>
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/model/newdiagram.trace b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/model/newdiagram.trace
index 48670f3a490..e1872d5471a 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/model/newdiagram.trace
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/model/newdiagram.trace
@@ -1,12 +1,12 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<trace:TraceModel xmi:version="2.0"
- xmlns:xmi="http://www.omg.org/XMI"
- xmlns:trace="http://www.eclipse.org/gmf/2006/Trace">
- <nodeTraces
- visualID="2001"
- queryText="(let _eClass_:ecore::EClass = modelFacet.metaClass.ecoreClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/uml2/3.0.0/UML' and _eClass_.name = 'Component') and (let _containmentMF_:ecore::EStructuralFeature = modelFacet.containmentMetaFeature.ecoreFeature in (let _eClass_:ecore::EClass = _containmentMF_.eContainingClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/uml2/3.0.0/UML' and _eClass_.name = 'Package') and _containmentMF_.name = 'packagedElement')">
- <nodeLabelTraces
- visualID="5001"
- queryText="true"/>
- </nodeTraces>
-</trace:TraceModel>
+<?xml version="1.0" encoding="UTF-8"?>
+<trace:TraceModel xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:trace="http://www.eclipse.org/gmf/2006/Trace">
+ <nodeTraces
+ visualID="2001"
+ queryText="(let _eClass_:ecore::EClass = modelFacet.metaClass.ecoreClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/uml2/3.0.0/UML' and _eClass_.name = 'Component') and (let _containmentMF_:ecore::EStructuralFeature = modelFacet.containmentMetaFeature.ecoreFeature in (let _eClass_:ecore::EClass = _containmentMF_.eContainingClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/uml2/3.0.0/UML' and _eClass_.name = 'Package') and _containmentMF_.name = 'packagedElement')">
+ <nodeLabelTraces
+ visualID="5001"
+ queryText="true"/>
+ </nodeTraces>
+</trace:TraceModel>
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/plugin.properties b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/plugin.properties
index 7017c272c72..cdf71de4b1b 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/plugin.properties
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/plugin.properties
@@ -1,34 +1,34 @@
-pluginName=Papyrus New Diagram (Incubation)
-providerName=Eclipse Modeling Project
-editorName=PapyrusNewDiagram Diagram Editing
-context.description=PapyrusNewDiagram Diagram Editing
-context.name=In PapyrusNewDiagram Diagram Editor
-newWizardName=PapyrusNewDiagram Diagram
-newWizardDesc=Creates PapyrusNewDiagram diagram.
- initDiagramActionLabel=Initialize PapyrusNewDiagram_diagram diagram file
- navigatorContentName=*.PapyrusNewDiagram_diagram diagram contents
-domainNavigatorContentName=*.PapyrusNewDiagram model contents
-update.diagram.name=Update PapyrusNewDiagram diagram
-update.diagram.description=Perform PapyrusNewDiagram diagram update
- tab.appearance=Appearance
-tab.diagram=Rulers & Grid
-tab.domain=Core
- prefpage.org.eclipse.uml2.uml.diagram.general=UML Diagram
-prefpage.org.eclipse.uml2.uml.diagram.appearance=Appearance
-prefpage.org.eclipse.uml2.uml.diagram.connections=Connections
-prefpage.org.eclipse.uml2.uml.diagram.printing=Printing
-prefpage.org.eclipse.uml2.uml.diagram.rulersAndGrid=Rulers And Grid
- metatype.name.Package_1000=Undefined
-metatype.name.Component_2001=Component
- cmdcategory.name=PapyrusNewDiagram Editor Commands
-cmdcategory.desc=PapyrusNewDiagram Editor Commands
-
-metatype.name.Model_1000=Undefined
-metatype.name.Interface_2003=Interface
-metatype.name.Comment_2002=Comment
-metatype.name.Property_3001=Property
-metatype.name.Operation_3002=Operation
-metatype.name.Usage_4001=Usage
-metatype.name.Generalization_4002=Generalization
-metatype.name.Realization_4003=Realization
-
+pluginName=Papyrus New Diagram (Incubation)
+providerName=Eclipse Modeling Project
+editorName=PapyrusNewDiagram Diagram Editing
+context.description=PapyrusNewDiagram Diagram Editing
+context.name=In PapyrusNewDiagram Diagram Editor
+newWizardName=PapyrusNewDiagram Diagram
+newWizardDesc=Creates PapyrusNewDiagram diagram.
+ initDiagramActionLabel=Initialize PapyrusNewDiagram_diagram diagram file
+ navigatorContentName=*.PapyrusNewDiagram_diagram diagram contents
+domainNavigatorContentName=*.PapyrusNewDiagram model contents
+update.diagram.name=Update PapyrusNewDiagram diagram
+update.diagram.description=Perform PapyrusNewDiagram diagram update
+ tab.appearance=Appearance
+tab.diagram=Rulers & Grid
+tab.domain=Core
+ prefpage.org.eclipse.uml2.uml.diagram.general=UML Diagram
+prefpage.org.eclipse.uml2.uml.diagram.appearance=Appearance
+prefpage.org.eclipse.uml2.uml.diagram.connections=Connections
+prefpage.org.eclipse.uml2.uml.diagram.printing=Printing
+prefpage.org.eclipse.uml2.uml.diagram.rulersAndGrid=Rulers And Grid
+ metatype.name.Package_1000=Undefined
+metatype.name.Component_2001=Component
+ cmdcategory.name=PapyrusNewDiagram Editor Commands
+cmdcategory.desc=PapyrusNewDiagram Editor Commands
+
+metatype.name.Model_1000=Undefined
+metatype.name.Interface_2003=Interface
+metatype.name.Comment_2002=Comment
+metatype.name.Property_3001=Property
+metatype.name.Operation_3002=Operation
+metatype.name.Usage_4001=Usage
+metatype.name.Generalization_4002=Generalization
+metatype.name.Realization_4003=Realization
+
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/plugin.xml b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/plugin.xml
index 3670be5797c..0702ebb060b 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/plugin.xml
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/plugin.xml
@@ -1,187 +1,196 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin>
- <extension
- point="org.eclipse.ui.commands">
- <command
- categoryId="org.eclipse.papyrus.editor.category"
- defaultHandler="org.eclipse.papyrus.example.diagram.simplediagram.CreateDiagramCommand"
- description="Create a Tutorial Diagram"
- id="org.eclipse.papyrus.diagram.newdiagram.CreateDiagramCommand"
- name="Create a Tutorial Diagram">
- </command>
- </extension>
- <extension
- point="org.eclipse.ui.handlers">
- <handler
- class="org.eclipse.papyrus.example.diagram.simplediagram.CreateDiagramCommand"
- commandId="org.eclipse.papyrus.diagram.newdiagram.CreateDiagramCommand">
- <activeWhen>
- <with
- variable="activeEditorId">
- <equals
- value="org.eclipse.papyrus.core.papyrusEditor">
- </equals>
- </with>
- </activeWhen>
- </handler>
- </extension>
- <extension
- point="org.eclipse.ui.menus">
- <menuContribution
- locationURI="menu:org.eclipse.papyrus.ui.menu">
- <menu
- id="org.eclipse.papyrus.diagram.ui.menu.diagrams"
- label="Diagrams">
- <command
- commandId="org.eclipse.papyrus.diagram.newdiagram.CreateDiagramCommand"
- icon="icons/obj16/newDiagramFile.gif"
- label="Create a new Simple Diagram"
- style="push"
- tooltip="Create a new Simple Diagram">
- <visibleWhen>
- <reference
- definitionId="org.eclipse.papyrus.diagram.common.IsPapyrusActiveWithUMLModel">
- </reference>
- </visibleWhen>
- </command>
- </menu>
- </menuContribution>
- <menuContribution
- locationURI="toolbar:org.eclipse.ui.main.toolbar">
- <toolbar
- id="org.eclipse.papyrus.diagram.ui.toolbar">
- <command
- commandId="org.eclipse.papyrus.diagram.newdiagram.CreateDiagramCommand"
- icon="icons/obj16/newDiagramFile.gif"
- label="Create a new Simple Diagram"
- style="push"
- tooltip="Create a new Simple Diagram">
- <visibleWhen>
- <reference
- definitionId="org.eclipse.papyrus.diagram.common.IsPapyrusActiveWithUMLModel">
- </reference>
- </visibleWhen>
- </command>
- </toolbar>
- </menuContribution>
- <menuContribution
- locationURI="popup:org.eclipse.papyrus.modelexplorer.popupmenu.creatediagram">
- <command
- commandId="org.eclipse.papyrus.diagram.newdiagram.CreateDiagramCommand"
- icon="icons/obj16/newDiagramFile.gif"
- label="Create a new Simple Diagram"
- style="push"
- tooltip="Create a new Component Diagram">
- <visibleWhen>
- <reference
- definitionId="org.eclipse.papyrus.diagram.common.IsPapyrusActiveWithUMLModel">
- </reference>
- </visibleWhen>
- </command>
- </menuContribution>
- </extension>
- <extension
- point="org.eclipse.papyrus.core.papyrusDiagram">
- <editorDiagram
- actionBarContributorId="org.eclipse.papyrus.diagram.common.part.UMLDiagramActionBarContributor"
- contextId="com.cea.papyrus.gmf.editor.context"
- factoryClass="org.eclipse.papyrus.example.diagram.simplediagram.DiagramEditorFactory"
- icon="icons/obj16/newDiagramFile.gif">
- </editorDiagram>
- <creationCommand
- creationCommandClass="org.eclipse.papyrus.example.diagram.simplediagram.CreateDiagramCommand"
- icon="icons/obj16/newDiagramFile.gif"
- id="org.eclipse.papyrus.diagram.newdiagram.CreateDiagramCommand"
- label="UML Tutorial Diagram"
- language="uml">
- </creationCommand>
- </extension>
-
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ categoryId="org.eclipse.papyrus.editor.category"
+ defaultHandler="org.eclipse.papyrus.example.diagram.simplediagram.CreateDiagramCommand"
+ description="Create a Tutorial Diagram"
+ id="org.eclipse.papyrus.diagram.newdiagram.CreateDiagramCommand"
+ name="Create a Tutorial Diagram">
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.handlers">
+ <handler
+ class="org.eclipse.papyrus.example.diagram.simplediagram.CreateDiagramCommand"
+ commandId="org.eclipse.papyrus.diagram.newdiagram.CreateDiagramCommand">
+ <activeWhen>
+ <with
+ variable="activeEditorId">
+ <equals
+ value="org.eclipse.papyrus.core.papyrusEditor">
+ </equals>
+ </with>
+ </activeWhen>
+ </handler>
+ </extension>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ locationURI="menu:org.eclipse.papyrus.ui.menu">
+ <menu
+ id="org.eclipse.papyrus.diagram.ui.menu.diagrams"
+ label="Diagrams">
+ <command
+ commandId="org.eclipse.papyrus.diagram.newdiagram.CreateDiagramCommand"
+ icon="icons/obj16/newDiagramFile.gif"
+ label="Create a new Simple Diagram"
+ style="push"
+ tooltip="Create a new Simple Diagram">
+ <visibleWhen>
+ <reference
+ definitionId="org.eclipse.papyrus.diagram.common.IsPapyrusActiveWithUMLModel">
+ </reference>
+ </visibleWhen>
+ </command>
+ </menu>
+ </menuContribution>
+ <menuContribution
+ locationURI="toolbar:org.eclipse.ui.main.toolbar">
+ <toolbar
+ id="org.eclipse.papyrus.diagram.ui.toolbar">
+ <command
+ commandId="org.eclipse.papyrus.diagram.newdiagram.CreateDiagramCommand"
+ icon="icons/obj16/newDiagramFile.gif"
+ label="Create a new Simple Diagram"
+ style="push"
+ tooltip="Create a new Simple Diagram">
+ <visibleWhen>
+ <reference
+ definitionId="org.eclipse.papyrus.diagram.common.IsPapyrusActiveWithUMLModel">
+ </reference>
+ </visibleWhen>
+ </command>
+ </toolbar>
+ </menuContribution>
+ <menuContribution
+ locationURI="popup:org.eclipse.papyrus.modelexplorer.popupmenu.creatediagram">
+ <command
+ commandId="org.eclipse.papyrus.diagram.newdiagram.CreateDiagramCommand"
+ icon="icons/obj16/newDiagramFile.gif"
+ label="Create a new Simple Diagram"
+ style="push"
+ tooltip="Create a new Component Diagram">
+ <visibleWhen>
+ <reference
+ definitionId="org.eclipse.papyrus.diagram.common.IsPapyrusActiveWithUMLModel">
+ </reference>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+ </extension>
+ <extension
+ point="org.eclipse.papyrus.infra.core.papyrusDiagram">
+ <editorDiagram
+ actionBarContributorId="org.eclipse.papyrus.diagram.common.part.UMLDiagramActionBarContributor"
+ factoryClass="org.eclipse.papyrus.example.diagram.simplediagram.DiagramEditorFactory"
+ icon="icons/obj16/newDiagramFile.gif">
+ </editorDiagram>
+ <creationCommand
+ creationCommandClass="org.eclipse.papyrus.example.diagram.simplediagram.CreateDiagramCommand"
+ icon="icons/obj16/newDiagramFile.gif"
+ id="org.eclipse.papyrus.diagram.newdiagram.CreateDiagramCommand"
+ label="UML Tutorial Diagram"
+ language="uml">
+ </creationCommand>
+ </extension>
+
<extension point="org.eclipse.ui.contexts" id="ui-context">
<?gmfgen generated="true"?>
<context
description="%context.description"
- id="org.eclipse.papyrus.diagram.newdiagram.ui.diagramContext"
+ id="org.eclipse.papyrus.example.diagram.simplediagram.ui.diagramContext"
name="%context.name"
parentId="org.eclipse.gmf.runtime.diagram.ui.diagramContext">
</context>
</extension>
-
- <extension point="org.eclipse.gmf.runtime.common.ui.services.action.globalActionHandlerProviders" id="global-actions">
- <?gmfgen generated="true"?>
- <GlobalActionHandlerProvider
- class="org.eclipse.papyrus.diagram.common.providers.PapyrusGlobalActionHandlerProvider"
- id="PapyrusNewDiagramPresentation">
- <Priority name="Highest"/>
- <ViewId id="org.eclipse.papyrus.core.papyrusEditor">
- <ElementType class="org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart">
- <GlobalActionId actionId="delete"/>
- </ElementType>
- <ElementType class="org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart">
- <GlobalActionId actionId="save"/>
- </ElementType>
- </ViewId>
- </GlobalActionHandlerProvider>
- <GlobalActionHandlerProvider
- class="org.eclipse.gmf.runtime.diagram.ui.providers.ide.providers.DiagramIDEGlobalActionHandlerProvider"
- id="PapyrusNewDiagramPresentationIDE">
- <Priority name="Low"/>
- <ViewId id="org.eclipse.papyrus.core.papyrusEditor">
- <ElementType class="org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart">
- <GlobalActionId actionId="bookmark"/>
- </ElementType>
- </ViewId>
- </GlobalActionHandlerProvider>
- <GlobalActionHandlerProvider
- class="org.eclipse.papyrus.diagram.common.providers.PapyrusGlobalActionHandlerProvider"
- id="PapyrusNewDiagramRender">
- <Priority name="Highest"/>
- <ViewId id="org.eclipse.papyrus.core.papyrusEditor">
- <ElementType class="org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart">
- <GlobalActionId actionId="cut"/>
- <GlobalActionId actionId="copy"/>
- <GlobalActionId actionId="paste"/>
- </ElementType>
- </ViewId>
- </GlobalActionHandlerProvider>
- </extension>
-
-
-
- <?gmfgen generated="true"?>
-
- <?gmfgen generated="true"?>
-
- <extension point="org.eclipse.ui.preferencePages" id="prefpages">
- <?gmfgen generated="true"?>
- <page
- id="org.eclipse.papyrus.preferences.diagrams.PapyrusNewDiagram"
- name="PapyrusNewDiagram Diagram"
- category="org.eclipse.papyrus.preferences.diagrams"
- class="org.eclipse.papyrus.example.diagram.simplediagram.preferences.DiagramGeneralPreferencePage">
- </page>
-
-
-
- <page
- id="org.eclipse.papyrus.diagram.newdiagram.preferences.DiagramPrintingPreferencePage"
- name="%prefpage.org.eclipse.uml2.uml.diagram.printing"
- category="org.eclipse.papyrus.preferences.diagrams.PapyrusNewDiagram"
- class="org.eclipse.papyrus.example.diagram.simplediagram.preferences.DiagramPrintingPreferencePage">
- </page>
-
- <page
- id="org.eclipse.papyrus.diagram.newdiagram.preferences.DiagramRulersAndGridPreferencePage"
- name="%prefpage.org.eclipse.uml2.uml.diagram.rulersAndGrid"
- category="org.eclipse.papyrus.preferences.diagrams.PapyrusNewDiagram"
- class="org.eclipse.papyrus.example.diagram.simplediagram.preferences.DiagramRulersAndGridPreferencePage">
- </page>
-
- </extension>
+
+ <extension point="org.eclipse.gmf.runtime.common.ui.services.action.globalActionHandlerProviders" id="global-actions">
+ <?gmfgen generated="true"?>
+ <GlobalActionHandlerProvider
+ class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramGlobalActionHandlerProvider"
+ id="PapyrusNewDiagramPresentation">
+ <Priority name="Lowest"/>
+ <ViewId id="org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditorID">
+ <ElementType class="org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart">
+ <GlobalActionId actionId="delete"/>
+ </ElementType>
+ <ElementType class="org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart">
+ <GlobalActionId actionId="save"/>
+ </ElementType>
+ <ElementType class="org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart">
+ <GlobalActionId actionId="save">
+ </GlobalActionId>
+ </ElementType>
+ </ViewId>
+ </GlobalActionHandlerProvider>
+ <GlobalActionHandlerProvider
+ class="org.eclipse.gmf.runtime.diagram.ui.providers.ide.providers.DiagramIDEGlobalActionHandlerProvider"
+ id="PapyrusNewDiagramPresentationIDE">
+ <Priority name="Lowest"/>
+ <ViewId id="org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditorID">
+ <ElementType class="org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart">
+ <GlobalActionId actionId="bookmark"/>
+ </ElementType>
+ </ViewId>
+ </GlobalActionHandlerProvider>
+ <GlobalActionHandlerProvider
+ class="org.eclipse.gmf.runtime.diagram.ui.render.providers.DiagramUIRenderGlobalActionHandlerProvider"
+ id="PapyrusNewDiagramRender">
+ <Priority name="Lowest"/>
+ <ViewId id="org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditorID">
+ <ElementType class="org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart">
+ <GlobalActionId actionId="cut"/>
+ <GlobalActionId actionId="copy"/>
+ <GlobalActionId actionId="paste"/>
+ </ElementType>
+ </ViewId>
+ </GlobalActionHandlerProvider>
+ </extension>
+
+
+
+ <?gmfgen generated="true"?>
+
+ <?gmfgen generated="true"?>
+
+ <extension point="org.eclipse.ui.preferencePages" id="prefpages">
+ <?gmfgen generated="true"?>
+ <page
+ id="org.eclipse.uml2.uml.diagram.general"
+ name="%prefpage.org.eclipse.uml2.uml.diagram.general"
+ class="org.eclipse.papyrus.example.diagram.simplediagram.preferences.DiagramGeneralPreferencePage">
+ </page>
+ <page
+ id="org.eclipse.uml2.uml.diagram.appearance"
+ name="%prefpage.org.eclipse.uml2.uml.diagram.appearance"
+ category="org.eclipse.uml2.uml.diagram.general"
+ class="org.eclipse.papyrus.example.diagram.simplediagram.preferences.DiagramAppearancePreferencePage">
+ </page>
+ <page
+ id="org.eclipse.uml2.uml.diagram.connections"
+ name="%prefpage.org.eclipse.uml2.uml.diagram.connections"
+ category="org.eclipse.uml2.uml.diagram.general"
+ class="org.eclipse.papyrus.example.diagram.simplediagram.preferences.DiagramConnectionsPreferencePage">
+ </page>
+ <page
+ id="org.eclipse.uml2.uml.diagram.printing"
+ name="%prefpage.org.eclipse.uml2.uml.diagram.printing"
+ category="org.eclipse.uml2.uml.diagram.general"
+ class="org.eclipse.papyrus.example.diagram.simplediagram.preferences.DiagramPrintingPreferencePage">
+ </page>
+ <page
+ id="org.eclipse.uml2.uml.diagram.rulersAndGrid"
+ name="%prefpage.org.eclipse.uml2.uml.diagram.rulersAndGrid"
+ category="org.eclipse.uml2.uml.diagram.general"
+ class="org.eclipse.papyrus.example.diagram.simplediagram.preferences.DiagramRulersAndGridPreferencePage">
+ </page>
+ </extension>
<extension point="org.eclipse.ui.views.properties.tabbed.propertyContributor" id="prop-contrib">
<?gmfgen generated="true"?>
@@ -245,14 +254,14 @@
</propertySection>
</propertySections>
</extension>
-
-
-<?gmfgen generated="true"?>
-
- <extension point="org.eclipse.core.runtime.preferences">
- <?gmfgen generated="true"?>
- <initializer class="org.eclipse.papyrus.example.diagram.simplediagram.preferences.DiagramPreferenceInitializer"/>
- </extension>
+
+
+<?gmfgen generated="true"?>
+
+ <extension point="org.eclipse.core.runtime.preferences" id="prefs">
+ <?gmfgen generated="true"?>
+ <initializer class="org.eclipse.papyrus.example.diagram.simplediagram.preferences.DiagramPreferenceInitializer"/>
+ </extension>
<extension point="org.eclipse.gmf.runtime.diagram.core.viewProviders" id="view-provider">
<?gmfgen generated="true"?>
@@ -287,14 +296,18 @@
</extension>
<extension point="org.eclipse.gmf.runtime.emf.ui.modelingAssistantProviders" id="modelassist-provider">
- <?gmfgen generated="true"?>
- <modelingAssistantProvider class="org.eclipse.papyrus.example.diagram.simplediagram.providers.UMLModelingAssistantProvider">
- <Priority name="Lowest"/>
- <object class="org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ModelEditPart" id="Model_1000"/>
- <object class="org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ComponentEditPart" id="Component_2001"/>
- <context elements="Model_1000,Component_2001"/>
- </modelingAssistantProvider>
- </extension>
+ <?gmfgen generated="true"?>
+ <modelingAssistantProvider class="org.eclipse.papyrus.example.diagram.simplediagram.providers.assistants.UMLModelingAssistantProviderOfModelEditPart">
+ <Priority name="Lowest"/>
+ <object class="org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ModelEditPart" id="Model_1000"/>
+ <context elements="Model_1000"/>
+ </modelingAssistantProvider>
+ <modelingAssistantProvider class="org.eclipse.papyrus.example.diagram.simplediagram.providers.assistants.UMLModelingAssistantProviderOfComponentEditPart">
+ <Priority name="Lowest"/>
+ <object class="org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ComponentEditPart" id="Component_2001"/>
+ <context elements="Component_2001"/>
+ </modelingAssistantProvider>
+</extension>
<extension point="org.eclipse.gmf.runtime.common.ui.services.iconProviders" id="icon-provider">
<?gmfgen generated="true"?>
@@ -312,7 +325,7 @@
<extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypes" id="element-types">
<?gmfgen generated="true"?>
- <metamodel nsURI="http://www.eclipse.org/uml2/3.0.0/UML">
+ <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML">
<metamodelType
id="org.eclipse.uml2.uml.diagram.Model_1000"
name="%metatype.name.Model_1000"
@@ -322,7 +335,7 @@
<param name="semanticHint" value="1000"/>
</metamodelType>
</metamodel>
- <metamodel nsURI="http://www.eclipse.org/uml2/3.0.0/UML">
+ <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML">
<metamodelType
id="org.eclipse.uml2.uml.diagram.Component_2001"
name="%metatype.name.Component_2001"
@@ -351,13 +364,13 @@
</extension>
<extension point="org.eclipse.core.expressions.propertyTesters" id="navigator-proptest.isURIEditorInput">
<?gmfgen generated="true"?>
- <propertyTester
- id="org.eclipse.uml2.uml.diagram.URIEditorInputPropertyTester"
- type="org.eclipse.emf.common.ui.URIEditorInput"
- namespace="org.eclipse.uml2.uml.diagram"
- properties="isURIEditorInput"
- class="org.eclipse.papyrus.example.diagram.simplediagram.part.UMLUriEditorInputTester">
- </propertyTester>
+ <propertyTester
+ id="org.eclipse.uml2.uml.diagram.URIEditorInputPropertyTester"
+ type="org.eclipse.emf.common.ui.URIEditorInput"
+ namespace="org.eclipse.uml2.uml.diagram"
+ properties="isURIEditorInput"
+ class="org.eclipse.papyrus.example.diagram.simplediagram.part.UMLUriEditorInputTester">
+ </propertyTester>
</extension>
<extension point="org.eclipse.ui.navigator.viewer" id="navigator-viewbinding">
@@ -365,7 +378,7 @@
<viewerContentBinding viewerId="org.eclipse.ui.navigator.ProjectExplorer">
<includes>
<contentExtension pattern="org.eclipse.uml2.uml.diagram.resourceContent"/>
- <contentExtension pattern="org.eclipse.uml2.uml.diagram.domainResourceContent"/>
+ <contentExtension pattern="org.eclipse.uml2.uml.diagram.domainResourceContent"/>
<contentExtension pattern="org.eclipse.uml2.uml.diagram.navigatorLinkHelper"/>
</includes>
</viewerContentBinding>
@@ -388,16 +401,16 @@
activeByDefault="true">
<triggerPoints>
<or>
- <and>
- <instanceof value="org.eclipse.core.resources.IFile"/>
- <test property="org.eclipse.core.resources.extension" value="PapyrusNewDiagram_diagram"/>
+ <and>
+ <instanceof value="org.eclipse.core.resources.IFile"/>
+ <test property="org.eclipse.core.resources.extension" value="PapyrusNewDiagram_diagram"/>
</and>
<instanceof value="org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLAbstractNavigatorItem"/>
</or>
</triggerPoints>
<possibleChildren>
<or>
- <instanceof value="org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLAbstractNavigatorItem"/>
+ <instanceof value="org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLAbstractNavigatorItem"/>
</or>
</possibleChildren>
<commonSorter
@@ -405,9 +418,9 @@
class="org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLNavigatorSorter">
<parentExpression>
<or>
- <and>
- <instanceof value="org.eclipse.core.resources.IFile"/>
- <test property="org.eclipse.core.resources.extension" value="PapyrusNewDiagram_diagram"/>
+ <and>
+ <instanceof value="org.eclipse.core.resources.IFile"/>
+ <test property="org.eclipse.core.resources.extension" value="PapyrusNewDiagram_diagram"/>
</and>
<instanceof value="org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLAbstractNavigatorItem"/>
</or>
@@ -424,9 +437,9 @@
activeByDefault="true">
<triggerPoints>
<or>
- <and>
- <instanceof value="org.eclipse.core.resources.IFile"/>
- <test property="org.eclipse.core.resources.extension" value="PapyrusNewDiagram"/>
+ <and>
+ <instanceof value="org.eclipse.core.resources.IFile"/>
+ <test property="org.eclipse.core.resources.extension" value="PapyrusNewDiagram"/>
</and>
<instanceof value="org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLDomainNavigatorItem"/>
</or>
@@ -468,15 +481,15 @@
categoryId="org.eclipse.ui.category.edit"
defaultHandler="org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramUpdateCommand"
description="%update.diagram.description"
- id="org.eclipse.papyrus.diagram.newdiagram.updateDiagram"
+ id="org.eclipse.papyrus.example.diagram.simplediagram.updateDiagram"
name="%update.diagram.name"/>
</extension>
<extension point="org.eclipse.ui.bindings" id="update-cmd-binding">
<?gmfgen generated="true"?>
<key
- commandId="org.eclipse.papyrus.diagram.newdiagram.updateDiagram"
- contextId="org.eclipse.papyrus.diagram.newdiagram.ui.diagramContext"
+ commandId="org.eclipse.papyrus.example.diagram.simplediagram.updateDiagram"
+ contextId="org.eclipse.papyrus.example.diagram.simplediagram.ui.diagramContext"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
sequence="F5"/>
</extension>
@@ -491,7 +504,7 @@
<command commandId="org.eclipse.uml2.uml.diagram.LoadResourceAction">
<visibleWhen>
<and>
- <with variable="activePartId"><equals value="org.eclipse.papyrus.diagram.newdiagram.part.UMLDiagramEditorID"/></with>
+ <with variable="activePartId"><equals value="org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditorID"/></with>
<with variable="selection"><iterate ifEmpty="false">
<instanceof value="org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ModelEditPart"/>
</iterate></with>
@@ -503,10 +516,10 @@
<extension point="org.eclipse.ui.commands" id="menu-commands">
<?gmfgen generated="true"?>
- <category id="org.eclipse.papyrus.diagram.newdiagram.part.UMLDiagramEditorID" name="%cmdcategory.name" description="%cmdcategory.desc"/>
+ <category id="org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditorID" name="%cmdcategory.name" description="%cmdcategory.desc"/>
<command id="org.eclipse.uml2.uml.diagram.LoadResourceAction"
name="Load Resource"
- categoryId="org.eclipse.papyrus.diagram.newdiagram.part.UMLDiagramEditorID"
+ categoryId="org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditorID"
defaultHandler="org.eclipse.papyrus.example.diagram.simplediagram.part.LoadResourceAction"/>
</extension>
@@ -517,89 +530,65 @@
-<extension
- id="UML Plugin.palettedefinition"
- name="UML Plugin Predefined Entries"
- point="org.eclipse.gmf.runtime.diagram.ui.paletteProviders">
-
- <?gmfgen generated="true"?>
- <paletteProvider class="org.eclipse.gmf.runtime.diagram.ui.providers.DefaultPaletteProvider">
- <Priority name="Lowest"/>
- <contribution
- factoryClass="org.eclipse.papyrus.example.diagram.simplediagram.part.UMLPaletteFactory">
- <predefinedEntry id="standardGroup/noteStack/noteTool" remove="true"/>
- <predefinedEntry id="standardGroup/noteStack/textTool" remove="true"/>
- <predefinedEntry id="standardGroup/noteStack/noteattachmentTool" remove="true"/>
- <entry
- defineOnly="true"
- description="Create new Component"
- id="createComponent1CreationTool"
- kind="tool"
- label="Component"
- large_icon="icons/obj16/Component.gif"
- path=""
- small_icon="icons/obj16/Component.gif">
- </entry>
-
- </contribution>
- </paletteProvider>
-
- </extension>
-
-<extension
- id="UML Plugin.standard"
- name="UML Plugin Standard Palette"
- point="org.eclipse.gmf.runtime.diagram.ui.paletteProviders">
-
- <?gmfgen generated="true"?>
- <paletteProvider class="org.eclipse.gmf.runtime.diagram.ui.providers.DefaultPaletteProvider">
- <Priority name="Low"/>
- <contribution
- factoryClass="org.eclipse.papyrus.example.diagram.simplediagram.part.UMLPaletteFactory">
- <predefinedEntry id="standardGroup/noteStack/noteTool" remove="true"/>
- <predefinedEntry id="standardGroup/noteStack/textTool" remove="true"/>
- <predefinedEntry id="standardGroup/noteStack/noteattachmentTool" remove="true"/>
- <entry
- description=""
- id="createUml1Group"
- kind="drawer"
- label="uml"
- large_icon="icons/obj16/Diagram_UML.gif"
- path="/"
- small_icon="icons/obj16/Diagram_UML.gif">
- <expand
- force="true">
- </expand>
- </entry>
-
- <predefinedEntry
- id="createComponent1CreationTool"
- path="/createUml1Group">
- </predefinedEntry>
-
-
- </contribution>
- <editor id="org.eclipse.uml2.uml.diagram"/>
- </paletteProvider>
-
- </extension>
-
-<extension point="org.eclipse.ui.preferencePages">
-
-
-
- <?gmfgen generated="true"?>
- <page category="org.eclipse.papyrus.preferences.diagrams.PapyrusNewDiagram"
- class="org.eclipse.papyrus.example.diagram.simplediagram.preferences.ComponentPreferencePage"
- id="org.eclipse.papyrus.diagram.newdiagram.preferences.ComponentPreferencePage"
- name="Component Node" />
-
-
-
-
-</extension>
-
+
+
+<extension point="org.eclipse.team.core.fileTypes" id="repo-ftype">
+ <?gmfgen generated="true"?>
+ <fileTypes type="text" extension="PapyrusNewDiagram_diagram"/>
+ </extension>
+
+<extension point="org.eclipse.emf.ecore.extension_parser" id="resource-factory">
+ <?gmfgen generated="true"?>
+ <parser
+ type="PapyrusNewDiagram_diagram"
+ class="org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactory">
+ </parser>
+ </extension>
+
+<extension point="org.eclipse.ui.editors" id="gmf-editor">
+ <?gmfgen generated="true"?>
+ <editor
+ id="org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditorID"
+ name="%editorName"
+ icon="icons/obj16/UMLDiagramFile.gif"
+ extensions="PapyrusNewDiagram_diagram"
+ default="true"
+ class="org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditor"
+ matchingStrategy="org.eclipse.papyrus.example.diagram.simplediagram.part.UMLMatchingStrategy"
+ contributorClass="org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramActionBarContributor">
+ </editor>
+ </extension>
+
+<extension point="org.eclipse.ui.newWizards" id="creation-wizard">
+ <?gmfgen generated="true"?>
+ <wizard
+ name="%newWizardName"
+ icon="icons/obj16/UMLDiagramFile.gif"
+ category="org.eclipse.ui.Examples"
+ class="org.eclipse.papyrus.example.diagram.simplediagram.part.UMLCreationWizard"
+ id="org.eclipse.papyrus.example.diagram.simplediagram.part.UMLCreationWizardID">
+ <description>%newWizardDesc</description>
+ </wizard>
+ </extension>
+
+<extension point="org.eclipse.ui.popupMenus" id="init-diagram-action">
+ <?gmfgen generated="true"?>
+ <objectContribution
+ id="org.eclipse.uml2.uml.diagram.InitDiagram"
+ nameFilter="*.PapyrusNewDiagram"
+ objectClass="org.eclipse.core.resources.IFile">
+ <action
+ label="%initDiagramActionLabel"
+ class="org.eclipse.papyrus.example.diagram.simplediagram.part.UMLInitDiagramFileAction"
+ menubarPath="additions"
+ enablesFor="1"
+ id="org.eclipse.uml2.uml.diagram.InitDiagramAction">
+ </action>
+ </objectContribution>
+ </extension>
+
+
<!-- optionally, specify keybindings -->
-</plugin>
+</plugin>
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/pom.xml b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/pom.xml
new file mode 100644
index 00000000000..95e5bb0c857
--- /dev/null
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/pom.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>org.eclipse.papyrus.examples</artifactId>
+ <groupId>org.eclipse.papyrus</groupId>
+ <version>1.0.1-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>org.eclipse.papyrus.example.diagram.simplediagram</artifactId>
+ <groupId>org.eclipse.papyrus</groupId>
+ <version>1.0.1-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project> \ No newline at end of file
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/commands/ComponentCreateCommand.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/commands/ComponentCreateCommand.java
index 83341f3826a..c38ddbc695e 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/commands/ComponentCreateCommand.java
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/commands/ComponentCreateCommand.java
@@ -1,119 +1,86 @@
-package org.eclipse.papyrus.example.diagram.simplediagram.edit.commands;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.uml2.uml.Component;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.UMLFactory;
-
-/**
- * @generated
- */
-public class ComponentCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private EClass eClass = null;
- /**
- * @generated
- */
- private EObject eObject = null;
-
- /**
- * @generated
- */
- public ComponentCreateCommand(CreateElementRequest req, EObject eObject) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
- }
-
- /**
- * @generated
- */
- public static ComponentCreateCommand create(CreateElementRequest req,
- EObject eObject) {
- return new ComponentCreateCommand(req, eObject);
- }
-
- /**
- * @generated
- */
- public ComponentCreateCommand(CreateElementRequest req) {
- super(req.getLabel(), null, req);
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- * @generated
- */
- protected EObject getElementToEdit() {
-
- EObject container = ((CreateElementRequest) getRequest())
- .getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- if (container != null) {
- return container;
- }
- return eObject;
- }
-
- /**
- * @generated
- */
- public boolean canExecute() {
-
- return true;
-
- }
-
- /**
- * @generated
- */
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
- IAdaptable info) throws ExecutionException {
-
- Component newElement = UMLFactory.eINSTANCE.createComponent();
-
- Package owner = (Package) getElementToEdit();
- owner.getPackagedElements().add(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Component newElement, IProgressMonitor monitor,
- IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest())
- .getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(
- getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest())
- .getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType
- .getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.uml2.uml.Component;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLFactory;
+
+/**
+ * @generated
+ */
+public class ComponentCreateCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ public ComponentCreateCommand(CreateElementRequest req) {
+ super(req.getLabel(), null, req);
+ }
+
+ /**
+ * FIXME: replace with setElementToEdit()
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest())
+ .getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ return true;
+
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
+ IAdaptable info) throws ExecutionException {
+ Component newElement = UMLFactory.eINSTANCE.createComponent();
+
+ Package owner = (Package) getElementToEdit();
+ owner.getPackagedElements().add(newElement);
+
+ doConfigure(newElement, monitor, info);
+
+ ((CreateElementRequest) getRequest()).setNewElement(newElement);
+ return CommandResult.newOKCommandResult(newElement);
+ }
+
+ /**
+ * @generated
+ */
+ protected void doConfigure(Component newElement, IProgressMonitor monitor,
+ IAdaptable info) throws ExecutionException {
+ IElementType elementType = ((CreateElementRequest) getRequest())
+ .getElementType();
+ ConfigureRequest configureRequest = new ConfigureRequest(
+ getEditingDomain(), newElement, elementType);
+ configureRequest.setClientContext(((CreateElementRequest) getRequest())
+ .getClientContext());
+ configureRequest.addParameters(getRequest().getParameters());
+ ICommand configureCommand = elementType
+ .getEditCommand(configureRequest);
+ if (configureCommand != null && configureCommand.canExecute()) {
+ configureCommand.execute(monitor, info);
+ }
+ }
+
+}
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/helpers/ComponentEditHelper.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/helpers/ComponentEditHelper.java
index 7207c3db8d5..91b2a07c7c7 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/helpers/ComponentEditHelper.java
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/helpers/ComponentEditHelper.java
@@ -1,7 +1,7 @@
-package org.eclipse.papyrus.example.diagram.simplediagram.edit.helpers;
-
-/**
- * @generated
- */
-public class ComponentEditHelper extends UMLBaseEditHelper {
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.edit.helpers;
+
+/**
+ * @generated
+ */
+public class ComponentEditHelper extends UMLBaseEditHelper {
+}
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/helpers/ModelEditHelper.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/helpers/ModelEditHelper.java
index c12113eb6be..73e0b2cceb3 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/helpers/ModelEditHelper.java
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/helpers/ModelEditHelper.java
@@ -1,7 +1,7 @@
-package org.eclipse.papyrus.example.diagram.simplediagram.edit.helpers;
-
-/**
- * @generated
- */
-public class ModelEditHelper extends UMLBaseEditHelper {
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.edit.helpers;
+
+/**
+ * @generated
+ */
+public class ModelEditHelper extends UMLBaseEditHelper {
+}
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/helpers/UMLBaseEditHelper.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/helpers/UMLBaseEditHelper.java
index f91a12227e5..13b851314b0 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/helpers/UMLBaseEditHelper.java
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/helpers/UMLBaseEditHelper.java
@@ -1,88 +1,10 @@
-package org.eclipse.papyrus.example.diagram.simplediagram.edit.helpers;
-
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelper;
-import org.eclipse.gmf.runtime.emf.type.core.edithelper.IEditHelperAdvice;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
-
-/**
- * @generated
- */
-public class UMLBaseEditHelper extends AbstractEditHelper {
-
- /**
- * @generated
- */
- public static final String EDIT_POLICY_COMMAND = "edit policy command"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final String CONTEXT_ELEMENT_TYPE = "context element type"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- protected IEditHelperAdvice[] getEditHelperAdvice(IEditCommandRequest req) {
- if (req.getParameter(CONTEXT_ELEMENT_TYPE) instanceof IElementType) {
- return ElementTypeRegistry.getInstance().getEditHelperAdvice(
- (IElementType) req.getParameter(CONTEXT_ELEMENT_TYPE));
- }
- return super.getEditHelperAdvice(req);
- }
-
- /**
- * @generated
- */
- protected ICommand getInsteadCommand(IEditCommandRequest req) {
- ICommand epCommand = (ICommand) req.getParameter(EDIT_POLICY_COMMAND);
- req.setParameter(EDIT_POLICY_COMMAND, null);
- ICommand ehCommand = super.getInsteadCommand(req);
- if (epCommand == null) {
- return ehCommand;
- }
- if (ehCommand == null) {
- return epCommand;
- }
- CompositeCommand command = new CompositeCommand(null);
- command.add(epCommand);
- command.add(ehCommand);
- return command;
- }
-
- /**
- * @generated
- */
- protected ICommand getCreateCommand(CreateElementRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected ICommand getCreateRelationshipCommand(
- CreateRelationshipRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected ICommand getDestroyElementCommand(DestroyElementRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected ICommand getDestroyReferenceCommand(DestroyReferenceRequest req) {
- return null;
- }
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.edit.helpers;
+
+import org.eclipse.gmf.tooling.runtime.edit.helpers.GeneratedEditHelperBase;
+
+/**
+ * @generated
+ */
+public class UMLBaseEditHelper extends GeneratedEditHelperBase {
+
+}
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/parts/ComponentEditPart.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/parts/ComponentEditPart.java
index e224e1d8acb..f2b2cc7f09f 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/parts/ComponentEditPart.java
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/parts/ComponentEditPart.java
@@ -1,361 +1,296 @@
-package org.eclipse.papyrus.example.diagram.simplediagram.edit.parts;
-
-import org.eclipse.draw2d.FlowLayout;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.Shape;
-import org.eclipse.draw2d.StackLayout;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.editpolicies.LayoutEditPolicy;
-import org.eclipse.gef.requests.CreateRequest;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.FlowLayoutEditPolicy;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
-import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.papyrus.diagram.common.helper.PreferenceInitializerForElementHelper;
-import org.eclipse.papyrus.example.diagram.simplediagram.edit.policies.ComponentItemSemanticEditPolicy;
-import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.preferences.utils.GradientPreferenceConverter;
-import org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class ComponentEditPart extends
-
-ShapeNodeEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 2001;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public ComponentEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE,
- new ComponentItemSemanticEditPolicy());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
- // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
- }
-
- /**
- * @generated
- */
- protected LayoutEditPolicy createLayoutEditPolicy() {
-
- FlowLayoutEditPolicy lep = new FlowLayoutEditPolicy() {
-
- protected Command createAddCommand(EditPart child, EditPart after) {
- return null;
- }
-
- protected Command createMoveChildCommand(EditPart child,
- EditPart after) {
- return null;
- }
-
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * @generated
- */
- protected IFigure createNodeShape() {
- return primaryShape = new ComponentFigure();
- }
-
- /**
- * @generated
- */
- public ComponentFigure getPrimaryShape() {
- return (ComponentFigure) primaryShape;
- }
-
- /**
- * @generated
- */
- protected boolean addFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof ComponentNameEditPart) {
- ((ComponentNameEditPart) childEditPart).setLabel(getPrimaryShape()
- .getFigureComponentNameFigure());
- return true;
- }
-
- return false;
- }
-
- /**
- * @generated
- */
- protected boolean removeFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof ComponentNameEditPart) {
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- protected void addChildVisual(EditPart childEditPart, int index) {
- if (addFixedChild(childEditPart)) {
- return;
- }
- super.addChildVisual(childEditPart, -1);
- }
-
- /**
- * @generated
- */
- protected void removeChildVisual(EditPart childEditPart) {
- if (removeFixedChild(childEditPart)) {
- return;
- }
- super.removeChildVisual(childEditPart);
- }
-
- /**
- * @generated
- */
- protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
- return getContentPane();
- }
-
- /**
- * @generated
- */
- protected NodeFigure createNodePlate() {
- String prefElementId = "Component";
- IPreferenceStore store = UMLDiagramEditorPlugin.getInstance()
- .getPreferenceStore();
- String preferenceConstantWitdh = PreferenceInitializerForElementHelper
- .getpreferenceKey(getNotationView(), prefElementId,
- PreferenceConstantHelper.WIDTH);
- String preferenceConstantHeight = PreferenceInitializerForElementHelper
- .getpreferenceKey(getNotationView(), prefElementId,
- PreferenceConstantHelper.HEIGHT);
- DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(
- store.getInt(preferenceConstantWitdh),
- store.getInt(preferenceConstantHeight));
-
- return result;
- }
-
- /**
- * Creates figure for this edit part.
- *
- * Body of this method does not depend on settings in generation model
- * so you may safely remove <i>generated</i> tag and modify it.
- *
- * @generated
- */
- protected NodeFigure createNodeFigure() {
- NodeFigure figure = createNodePlate();
- figure.setLayoutManager(new StackLayout());
- IFigure shape = createNodeShape();
- figure.add(shape);
- contentPane = setupContentPane(shape);
- return figure;
- }
-
- /**
- * Default implementation treats passed figure as content pane.
- * Respects layout one may have set for generated figure.
- * @param nodeShape instance of generated figure class
- * @generated
- */
- protected IFigure setupContentPane(IFigure nodeShape) {
- if (nodeShape.getLayoutManager() == null) {
- ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
- layout.setSpacing(5);
- nodeShape.setLayoutManager(layout);
- }
- return nodeShape; // use nodeShape itself as contentPane
- }
-
- /**
- * @generated
- */
- public IFigure getContentPane() {
- if (contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- protected void setForegroundColor(Color color) {
- if (primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- protected void setLineWidth(int width) {
- if (primaryShape instanceof Shape) {
- ((Shape) primaryShape).setLineWidth(width);
- }
- }
-
- /**
- * @generated
- */
- protected void setLineType(int style) {
- if (primaryShape instanceof Shape) {
- ((Shape) primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(UMLVisualIDRegistry
- .getType(ComponentNameEditPart.VISUAL_ID));
- }
-
- /**
- * @generated
- */
- public class ComponentFigure extends RectangleFigure {
-
- /**
- * @generated
- */
- private WrappingLabel fFigureComponentNameFigure;
-
- /**
- * @generated
- */
- public ComponentFigure() {
-
- FlowLayout layoutThis = new FlowLayout();
- layoutThis.setStretchMinorAxis(false);
- layoutThis.setMinorAlignment(FlowLayout.ALIGN_LEFTTOP);
-
- layoutThis.setMajorAlignment(FlowLayout.ALIGN_LEFTTOP);
- layoutThis.setMajorSpacing(5);
- layoutThis.setMinorSpacing(5);
- layoutThis.setHorizontal(true);
-
- this.setLayoutManager(layoutThis);
-
- createContents();
- }
-
- /**
- * @generated
- */
- private void createContents() {
-
- fFigureComponentNameFigure = new WrappingLabel();
- fFigureComponentNameFigure.setText("<...>");
-
- this.add(fFigureComponentNameFigure);
-
- }
-
- /**
- * @generated
- */
- public WrappingLabel getFigureComponentNameFigure() {
- return fFigureComponentNameFigure;
- }
-
- }
-
- /**
- * @generated
- */
- @Override
- public Object getPreferredValue(EStructuralFeature feature) {
- IPreferenceStore preferenceStore = (IPreferenceStore) getDiagramPreferencesHint()
- .getPreferenceStore();
- Object result = null;
-
- if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor()
- || feature == NotationPackage.eINSTANCE
- .getFontStyle_FontColor()
- || feature == NotationPackage.eINSTANCE
- .getFillStyle_FillColor()) {
- String prefColor = null;
- if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant(
- "Component", PreferenceConstantHelper.COLOR_LINE);
- } else if (feature == NotationPackage.eINSTANCE
- .getFontStyle_FontColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant(
- "Component", PreferenceConstantHelper.COLOR_FONT);
- } else if (feature == NotationPackage.eINSTANCE
- .getFillStyle_FillColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant(
- "Component", PreferenceConstantHelper.COLOR_FILL);
- }
- result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor(
- (IPreferenceStore) preferenceStore, prefColor));
- } else if (feature == NotationPackage.eINSTANCE
- .getFillStyle_Transparency()
- || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
- String prefGradient = PreferenceConstantHelper.getElementConstant(
- "Component", PreferenceConstantHelper.COLOR_GRADIENT);
- GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(
- preferenceStore.getString(prefGradient));
- if (feature == NotationPackage.eINSTANCE
- .getFillStyle_Transparency()) {
- result = new Integer(
- gradientPreferenceConverter.getTransparency());
- } else if (feature == NotationPackage.eINSTANCE
- .getFillStyle_Gradient()) {
- result = gradientPreferenceConverter.getGradientData();
- }
- }
-
- if (result == null) {
- result = getStructuralFeatureValue(feature);
- }
- return result;
- }
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.edit.parts;
+
+import org.eclipse.draw2d.FlowLayout;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.Shape;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.FlowLayoutEditPolicy;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.example.diagram.simplediagram.edit.policies.ComponentItemSemanticEditPolicy;
+import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+public class ComponentEditPart extends ShapeNodeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 2001;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public ComponentEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE,
+ new ComponentItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+
+ FlowLayoutEditPolicy lep = new FlowLayoutEditPolicy() {
+
+ protected Command createAddCommand(EditPart child, EditPart after) {
+ return null;
+ }
+
+ protected Command createMoveChildCommand(EditPart child,
+ EditPart after) {
+ return null;
+ }
+
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ return primaryShape = new ComponentFigure();
+ }
+
+ /**
+ * ComponentFigure
+ * @generated
+ */
+ public ComponentFigure getPrimaryShape() {
+ return (ComponentFigure) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof ComponentNameEditPart) {
+ ((ComponentNameEditPart) childEditPart).setLabel(getPrimaryShape()
+ .getFigureComponentNameFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof ComponentNameEditPart) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+ return getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(40, 40);
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model
+ * so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected NodeFigure createNodeFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane.
+ * Respects layout one may have set for generated figure.
+ * @param nodeShape instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(5);
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ protected void setForegroundColor(Color color) {
+ if (primaryShape != null) {
+ primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setBackgroundColor(Color color) {
+ if (primaryShape != null) {
+ primaryShape.setBackgroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLineWidth(int width) {
+ if (primaryShape instanceof Shape) {
+ ((Shape) primaryShape).setLineWidth(width);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLineType(int style) {
+ if (primaryShape instanceof Shape) {
+ ((Shape) primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry
+ .getType(ComponentNameEditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public class ComponentFigure extends RectangleFigure {
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fFigureComponentNameFigure;
+
+ /**
+ * @generated
+ */
+ public ComponentFigure() {
+
+ FlowLayout layoutThis = new FlowLayout();
+ layoutThis.setStretchMinorAxis(false);
+ layoutThis.setMinorAlignment(FlowLayout.ALIGN_LEFTTOP);
+
+ layoutThis.setMajorAlignment(FlowLayout.ALIGN_LEFTTOP);
+ layoutThis.setMajorSpacing(5);
+ layoutThis.setMinorSpacing(5);
+ layoutThis.setHorizontal(true);
+
+ this.setLayoutManager(layoutThis);
+
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fFigureComponentNameFigure = new WrappingLabel();
+ fFigureComponentNameFigure.setText("<...>");
+
+ this.add(fFigureComponentNameFigure);
+
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getFigureComponentNameFigure() {
+ return fFigureComponentNameFigure;
+ }
+
+ }
+
+}
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/parts/ComponentNameEditPart.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/parts/ComponentNameEditPart.java
index 1a671f4c1d7..3eac86c5fdf 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/parts/ComponentNameEditPart.java
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/parts/ComponentNameEditPart.java
@@ -1,868 +1,626 @@
-package org.eclipse.papyrus.example.diagram.simplediagram.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.diagram.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.diagram.common.util.DiagramEditPartsUtil;
-import org.eclipse.papyrus.example.diagram.simplediagram.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.example.diagram.simplediagram.providers.UMLElementTypes;
-import org.eclipse.papyrus.example.diagram.simplediagram.providers.UMLParserProvider;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.umlutils.ui.VisualInformationPapyrusConstant;
-import org.eclipse.papyrus.umlutils.ui.helper.NameLabelIconHelper;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @generated
- */
-public class ComponentNameEditPart extends CompartmentEditPart implements
- ITextAwareEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 5001;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
-
- /**
- * @generated
- */
- public ComponentNameEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE,
- new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE,
- new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE,
- new ModelEditPart.NodeLabelDragPolicy());
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(WrappingLabel figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- protected List getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- EObject parserElement = getParserElement();
- if (parserElement == null) {
- return null;
- }
-
- List<View> views = DiagramEditPartsUtil.findViews(parserElement,
- getViewer());
- for (View view : views) {
- if (NameLabelIconHelper.showLabelIcon(view)) {
- return UMLElementTypes.getImage(parserElement.eClass());
- }
- }
- return null;
-
- }
-
- /**
- * @generated
- */
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- new EObjectAdapter(parserElement),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- new EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain()
- .runExclusive(new RunnableWithResult.Impl() {
-
- public void run() {
- setResult(parser.isValidEditString(
- new EObjectAdapter(element),
- (String) value));
- }
- });
- return valid.getCode() == ParserEditStatus.EDITABLE ? null
- : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(
- new EObjectAdapter(getParserElement()));
- }
-
- /**
- * @generated
- */
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- public IParser getParser() {
- if (parser == null) {
- parser = UMLParserProvider
- .getParser(
- UMLElementTypes.Component_2001,
- getParserElement(),
- UMLVisualIDRegistry
- .getType(org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ComponentNameEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager
- .getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- getManager().show();
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation
- .getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if (configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration)
- .createPopupEditorHelper(this);
- helper.showEditor();
- return;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration)
- .createDialog(
- PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow()
- .getShell(),
- resolveSemanticElement(),
- configuration
- .getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI
- .getWorkbench().getActiveWorkbenchWindow()
- .getShell(), resolveSemanticElement(),
- ((IDirectEditorConfiguration) configuration)
- .getTextToEdit(resolveSemanticElement()),
- (IDirectEditorConfiguration) configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain,
- "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(
- resolveSemanticElement(),
- ((ILabelEditorDialog) finalDialog)
- .getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
-
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- public void run() {
- if (isActive() && isEditable()) {
- if (theRequest
- .getExtendedData()
- .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) theRequest
- .getExtendedData()
- .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if ((theRequest instanceof DirectEditRequest)
- && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest) theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style
- .isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(style.getFontName(),
- style.getFontHeight(), (style.isBold() ? SWT.BOLD
- : SWT.NORMAL)
- | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser())
- .getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter(
- "SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil
- .hasSpecificEditorConfiguration(resolveSemanticElement()
- .eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator
- .getDefault()
- .getPreferenceStore()
- .getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT
- + resolveSemanticElement().eClass()
- .getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(
- languagePreferred, resolveSemanticElement().eClass()
- .getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(
- IDirectEditorsIds.UML_LANGUAGE,
- resolveSemanticElement().eClass()
- .getInstanceClassName());
- }
- }
- }
-
- /**
- * Updates the preference configuration
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator
- .getDefault()
- .getPreferenceStore()
- .getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT
- + resolveSemanticElement().eClass()
- .getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")
- && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(
- languagePreferred, resolveSemanticElement().eClass()
- .getInstanceClassName());
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR
- .equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- * @param theRequest the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- public void run() {
- if (isActive() && isEditable()) {
- if (theRequest
- .getExtendedData()
- .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) theRequest
- .getExtendedData()
- .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if ((theRequest instanceof DirectEditRequest)
- && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest) theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- protected void handleNotificationEvent(Notification event) {
- refreshLabel();
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(
- feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough()
- .equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(
- feature)
- || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(
- feature)
- || NotationPackage.eINSTANCE.getFontStyle_Bold()
- .equals(feature)
- || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(
- feature)) {
- refreshFont();
- } else {
- if (getParser() != null
- && getParser().isAffectingEvent(event,
- getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
-
- if (event.getNewValue() instanceof EAnnotation
- && VisualInformationPapyrusConstant.DISPLAY_NAMELABELICON
- .equals(((EAnnotation) event.getNewValue()).getSource())) {
- refreshLabel();
- }
-
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- /**
- * @generated
- */
- private static final String ADD_PARENT_MODEL = "AddParentModel";
-
- /**
- * @generated
- */
- public void activate() {
- super.activate();
- addOwnerElementListeners();
- }
-
- /**
- * @generated
- */
- protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent()
- .getModel())); //$NON-NLS-1$
-
- }
-
- /**
- * @generated
- */
- public void deactivate() {
- removeOwnerElementListeners();
- super.deactivate();
-
- }
-
- /**
- * @generated
- */
- protected void removeOwnerElementListeners() {
- removeListenerFilter(ADD_PARENT_MODEL);
-
- }
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.label.ILabelDelegate;
+import org.eclipse.gmf.runtime.diagram.ui.label.WrappingLabelDelegate;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tooling.runtime.draw2d.labels.SimpleLabelDelegate;
+import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
+import org.eclipse.gmf.tooling.runtime.edit.policies.labels.IRefreshableFeedbackEditPolicy;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.papyrus.example.diagram.simplediagram.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.example.diagram.simplediagram.providers.UMLElementTypes;
+import org.eclipse.papyrus.example.diagram.simplediagram.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class ComponentNameEditPart extends CompartmentEditPart implements
+ ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5001;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ private ILabelDelegate labelDelegate;
+
+ /**
+ * @generated
+ */
+ public ComponentNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE,
+ new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE,
+ new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE,
+ new DefaultNodeLabelDragPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof Label) {
+ return ((Label) figure).getText();
+ } else {
+ return getLabelDelegate().getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof Label) {
+ ((Label) figure).setText(text);
+ } else {
+ getLabelDelegate().setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof Label) {
+ return ((Label) figure).getIcon();
+ } else {
+ return getLabelDelegate().getIcon(0);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ return;
+ } else if (figure instanceof Label) {
+ ((Label) figure).setIcon(icon);
+ return;
+ } else {
+ getLabelDelegate().setIcon(icon, 0);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @SuppressWarnings("rawtypes")
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ return UMLElementTypes.getImage(parserElement.eClass());
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ refreshSelectionFeedback();
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain()
+ .runExclusive(
+ new RunnableWithResult.Impl<IParserEditStatus>() {
+
+ public void run() {
+ setResult(parser
+ .isValidEditString(
+ new EObjectAdapter(
+ element),
+ (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null
+ : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(
+ new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ parser = UMLParserProvider
+ .getParser(
+ UMLElementTypes.Component_2001,
+ getParserElement(),
+ UMLVisualIDRegistry
+ .getType(org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ComponentNameEditPart.VISUAL_ID));
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, null,
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation
+ .getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else //
+ {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest
+ .getExtendedData()
+ .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest
+ .getExtendedData()
+ .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest)
+ && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ refreshSelectionFeedback();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style
+ .isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(),
+ style.getFontHeight(), (style.isBold() ? SWT.BOLD
+ : SWT.NORMAL)
+ | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void refreshSelectionFeedback() {
+ requestEditPolicyFeedbackRefresh(EditPolicy.PRIMARY_DRAG_ROLE);
+ requestEditPolicyFeedbackRefresh(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ }
+
+ /**
+ * @generated
+ */
+ private void requestEditPolicyFeedbackRefresh(String editPolicyKey) {
+ Object editPolicy = getEditPolicy(editPolicyKey);
+ if (editPolicy instanceof IRefreshableFeedbackEditPolicy) {
+ ((IRefreshableFeedbackEditPolicy) editPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser())
+ .getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter(
+ "SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ private ILabelDelegate getLabelDelegate() {
+ if (labelDelegate == null) {
+ IFigure label = getFigure();
+ if (label instanceof WrappingLabel) {
+ labelDelegate = new WrappingLabelDelegate((WrappingLabel) label);
+ } else {
+ labelDelegate = new SimpleLabelDelegate((Label) label);
+ }
+ }
+ return labelDelegate;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public Object getAdapter(Class key) {
+ if (ILabelDelegate.class.equals(key)) {
+ return getLabelDelegate();
+ }
+ return super.getAdapter(key);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(
+ feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough()
+ .equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(
+ feature)
+ || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(
+ feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold()
+ .equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(
+ feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null
+ && getParser().isAffectingEvent(event,
+ getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+}
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/parts/ModelEditPart.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/parts/ModelEditPart.java
index 0b3c169dc6e..f1cc8686540 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/parts/ModelEditPart.java
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/parts/ModelEditPart.java
@@ -1,171 +1,48 @@
-package org.eclipse.papyrus.example.diagram.simplediagram.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IClippingStrategy;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
-import org.eclipse.gef.handles.MoveHandle;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
-import org.eclipse.gmf.runtime.diagram.ui.figures.BorderedNodeFigure;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.common.editpolicies.DuplicatePasteEditPolicy;
-import org.eclipse.papyrus.diagram.common.providers.ViewInfo;
-import org.eclipse.papyrus.diagram.common.util.MDTUtil;
-import org.eclipse.papyrus.example.diagram.simplediagram.edit.policies.ModelItemSemanticEditPolicy;
-import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry;
-
-/**
- * @generated
- */
-public class ModelEditPart extends DiagramEditPart {
-
- /**
- * @generated
- */
- public final static String MODEL_ID = "PapyrusNewDiagram"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 1000;
-
- /**
- * @generated
- */
- public ModelEditPart(View view) {
- super(view);
-
- getFigure().setClippingStrategy(new IClippingStrategy() {
-
- public Rectangle[] getClip(IFigure childFigure) {
- // very inefficient, since it implies several tree traversals. Bit handles modifications of the tree structure
- // It's a workaround instead of the better solution to fix BorderedNodeFigure (overload and let it return
- // getExtendedBounds)
- // See bug 313985 (https://bugs.eclipse.org/bugs/show_bug.cgi?id=313985) for more details
- applyClippingStrategy(childFigure);
- if (childFigure instanceof BorderedNodeFigure) {
- return new Rectangle[] { ((BorderedNodeFigure) childFigure)
- .getExtendedBounds() };
-
- } else {
- return new Rectangle[] { childFigure.getBounds() };
- }
- }
- });
- }
-
- /**
- * @generated
- */
- public void applyClippingStrategy(IFigure fig) {
- boolean hasBorderedNodeChild = false;
- for (Object child : fig.getChildren()) {
- if (child instanceof IFigure) {
- applyClippingStrategy((IFigure) child);
- if (child instanceof BorderedNodeFigure) {
- hasBorderedNodeChild = true;
- }
- }
- }
- if (hasBorderedNodeChild && (fig.getClippingStrategy() == null)) {
- fig.setClippingStrategy(new IClippingStrategy() {
-
- public Rectangle[] getClip(IFigure childFigure) {
- if (childFigure instanceof BorderedNodeFigure) {
- return new Rectangle[] { ((BorderedNodeFigure) childFigure)
- .getExtendedBounds() };
- } else {
- return new Rectangle[] { childFigure.getBounds() };
- }
- }
- });
- }
-
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(DuplicatePasteEditPolicy.PASTE_ROLE,
- new DuplicatePasteEditPolicy());
-
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE,
- new ModelItemSemanticEditPolicy());
-
- //in Papyrus diagrams are not strongly synchronised
- //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.diagram.newdiagram.edit.policies.ModelCanonicalEditPolicy());
-
- // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.POPUPBAR_ROLE);
- }
-
- /**
- * @generated
- */
- /*package-local*/static class NodeLabelDragPolicy extends
- NonResizableEditPolicy {
-
- /**
- * @generated
- */
- @SuppressWarnings("rawtypes")
- protected List createSelectionHandles() {
- MoveHandle h = new MoveHandle((GraphicalEditPart) getHost());
- h.setBorder(null);
- return Collections.singletonList(h);
- }
-
- /**
- * @generated
- */
- public Command getCommand(Request request) {
- return null;
- }
-
- /**
- * @generated
- */
- public boolean understandsRequest(Request request) {
- return false;
- }
- }
-
- /**
- * @generated
- */
- protected void handleNotificationEvent(Notification event) {
-
- super.handleNotificationEvent(event);
- if (event.getNotifier() instanceof EAnnotation) {
- EAnnotation eAnnotation = (EAnnotation) event.getNotifier();
- if (eAnnotation.getSource() != null
- && eAnnotation.getSource().equals(
- MDTUtil.FilterViewAndLabelsSource)) {
- //modification form MOSKitt approach, canonical policies are not called
- MDTUtil.filterDiagramViews(this.getDiagramView());
- }
- }
- }
-
- /**
- * @generated
- */
- public Object getAdapter(Class adapter) {
-
- if (adapter != null && adapter.equals(ViewInfo.class)) {
- return UMLVisualIDRegistry.getDiagramViewInfo();
- }
- return super.getAdapter(adapter);
- }
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.edit.parts;
+
+import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tooling.runtime.edit.policies.reparent.CreationEditPolicyWithCustomReparent;
+import org.eclipse.papyrus.example.diagram.simplediagram.edit.policies.ModelCanonicalEditPolicy;
+import org.eclipse.papyrus.example.diagram.simplediagram.edit.policies.ModelItemSemanticEditPolicy;
+import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class ModelEditPart extends DiagramEditPart {
+
+ /**
+ * @generated
+ */
+ public final static String MODEL_ID = "PapyrusNewDiagram"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 1000;
+
+ /**
+ * @generated
+ */
+ public ModelEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE,
+ new ModelItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE,
+ new ModelCanonicalEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE,
+ new CreationEditPolicyWithCustomReparent(
+ UMLVisualIDRegistry.TYPED_INSTANCE));
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.POPUPBAR_ROLE);
+ }
+
+}
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/parts/UMLEditPartFactory.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/parts/UMLEditPartFactory.java
index 9c544e6a6b4..fb276a2959c 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/parts/UMLEditPartFactory.java
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/parts/UMLEditPartFactory.java
@@ -1,203 +1,54 @@
-package org.eclipse.papyrus.example.diagram.simplediagram.edit.parts;
-
-import org.eclipse.draw2d.FigureUtilities;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPartFactory;
-import org.eclipse.gef.tools.CellEditorLocator;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.papyrus.diagram.common.figure.node.IMultilineEditableFigure;
-import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * @generated
- */
-public class UMLEditPartFactory implements EditPartFactory {
-
- /**
- * @generated
- */
- public EditPart createEditPart(EditPart context, Object model) {
- if (model instanceof View) {
- View view = (View) model;
- switch (UMLVisualIDRegistry.getVisualID(view)) {
-
- case ModelEditPart.VISUAL_ID:
- return new ModelEditPart(view);
-
- case ComponentEditPart.VISUAL_ID:
- return new ComponentEditPart(view);
-
- case ComponentNameEditPart.VISUAL_ID:
- return new ComponentNameEditPart(view);
- }
- }
- return createUnrecognizedEditPart(context, model);
- }
-
- /**
- * @generated
- */
- private EditPart createUnrecognizedEditPart(EditPart context, Object model) {
- // Handle creation of unrecognized child node EditParts here
- return null;
- }
-
- /**
- * @generated
- */
- public static CellEditorLocator getTextCellEditorLocator(
- ITextAwareEditPart source) {
- if (source.getFigure() instanceof IMultilineEditableFigure)
- return new MultilineCellEditorLocator(
- (IMultilineEditableFigure) source.getFigure());
- else if (source.getFigure() instanceof WrappingLabel)
- return new TextCellEditorLocator((WrappingLabel) source.getFigure());
- else {
- return new LabelCellEditorLocator((Label) source.getFigure());
- }
- }
-
- /**
- * @generated
- */
- static private class MultilineCellEditorLocator implements
- CellEditorLocator {
-
- /**
- * @generated
- */
- private IMultilineEditableFigure multilineEditableFigure;
-
- /**
- * @generated
- */
- public MultilineCellEditorLocator(IMultilineEditableFigure figure) {
- this.multilineEditableFigure = figure;
- }
-
- /**
- * @generated
- */
- public IMultilineEditableFigure getMultilineEditableFigure() {
- return multilineEditableFigure;
- }
-
- /**
- * @generated
- */
- public void relocate(CellEditor celleditor) {
- Text text = (Text) celleditor.getControl();
- Rectangle rect = getMultilineEditableFigure().getBounds().getCopy();
- rect.x = getMultilineEditableFigure().getEditionLocation().x;
- rect.y = getMultilineEditableFigure().getEditionLocation().y;
- getMultilineEditableFigure().translateToAbsolute(rect);
- if (getMultilineEditableFigure().getText().length() > 0) {
- rect.setSize(new Dimension(text.computeSize(rect.width,
- SWT.DEFAULT)));
- }
- if (!rect.equals(new Rectangle(text.getBounds()))) {
- text.setBounds(rect.x, rect.y, rect.width, rect.height);
- }
- }
- }
-
- /**
- * @generated
- */
- static private class TextCellEditorLocator implements CellEditorLocator {
-
- /**
- * @generated
- */
- private WrappingLabel wrapLabel;
-
- /**
- * @generated
- */
- public TextCellEditorLocator(WrappingLabel wrapLabel) {
- this.wrapLabel = wrapLabel;
- }
-
- /**
- * @generated
- */
- public WrappingLabel getWrapLabel() {
- return wrapLabel;
- }
-
- /**
- * @generated
- */
- public void relocate(CellEditor celleditor) {
- Text text = (Text) celleditor.getControl();
- Rectangle rect = getWrapLabel().getTextBounds().getCopy();
- getWrapLabel().translateToAbsolute(rect);
- if (!text.getFont().isDisposed()) {
- if (getWrapLabel().isTextWrapOn()
- && getWrapLabel().getText().length() > 0) {
- rect.setSize(new Dimension(text.computeSize(rect.width,
- SWT.DEFAULT)));
- } else {
- int avr = FigureUtilities.getFontMetrics(text.getFont())
- .getAverageCharWidth();
- rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT,
- SWT.DEFAULT)).expand(avr * 2, 0));
- }
- }
- if (!rect.equals(new Rectangle(text.getBounds()))) {
- text.setBounds(rect.x, rect.y, rect.width, rect.height);
- }
- }
- }
-
- /**
- * @generated
- */
- private static class LabelCellEditorLocator implements CellEditorLocator {
-
- /**
- * @generated
- */
- private Label label;
-
- /**
- * @generated
- */
- public LabelCellEditorLocator(Label label) {
- this.label = label;
- }
-
- /**
- * @generated
- */
- public Label getLabel() {
- return label;
- }
-
- /**
- * @generated
- */
- public void relocate(CellEditor celleditor) {
- Text text = (Text) celleditor.getControl();
- Rectangle rect = getLabel().getTextBounds().getCopy();
- getLabel().translateToAbsolute(rect);
- if (!text.getFont().isDisposed()) {
- int avr = FigureUtilities.getFontMetrics(text.getFont())
- .getAverageCharWidth();
- rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT,
- SWT.DEFAULT)).expand(avr * 2, 0));
- }
- if (!rect.equals(new Rectangle(text.getBounds()))) {
- text.setBounds(rect.x, rect.y, rect.width, rect.height);
- }
- }
- }
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.edit.parts;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartFactory;
+import org.eclipse.gef.tools.CellEditorLocator;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tooling.runtime.directedit.locator.CellEditorLocatorAccess;
+import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class UMLEditPartFactory implements EditPartFactory {
+
+ /**
+ * @generated
+ */
+ public EditPart createEditPart(EditPart context, Object model) {
+ if (model instanceof View) {
+ View view = (View) model;
+ switch (UMLVisualIDRegistry.getVisualID(view)) {
+
+ case ModelEditPart.VISUAL_ID:
+ return new ModelEditPart(view);
+
+ case ComponentEditPart.VISUAL_ID:
+ return new ComponentEditPart(view);
+
+ case ComponentNameEditPart.VISUAL_ID:
+ return new ComponentNameEditPart(view);
+ }
+ }
+ return createUnrecognizedEditPart(context, model);
+ }
+
+ /**
+ * @generated
+ */
+ private EditPart createUnrecognizedEditPart(EditPart context, Object model) {
+ // Handle creation of unrecognized child node EditParts here
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public static CellEditorLocator getTextCellEditorLocator(
+ ITextAwareEditPart source) {
+ return CellEditorLocatorAccess.INSTANCE
+ .getTextCellEditorLocator(source);
+ }
+
+}
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/ComponentItemSemanticEditPolicy.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/ComponentItemSemanticEditPolicy.java
index a3d307e0131..5461fac6226 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/ComponentItemSemanticEditPolicy.java
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/ComponentItemSemanticEditPolicy.java
@@ -1,55 +1,45 @@
-package org.eclipse.papyrus.example.diagram.simplediagram.edit.policies;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.edit.command.DeleteCommand;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.common.command.wrappers.EMFtoGMFCommandWrapper;
-import org.eclipse.papyrus.example.diagram.simplediagram.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class ComponentItemSemanticEditPolicy extends
- UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public ComponentItemSemanticEditPolicy() {
- super(UMLElementTypes.Component_2001);
- }
-
- /**
- * @generated
- */
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- View view = (View) getHost().getModel();
- CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(
- getEditingDomain(), null);
- cmd.setTransactionNestingEnabled(true);
-
- EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
- if (annotation == null) {
- // there are indirectly referenced children, need extra commands: false
- addDestroyShortcutsCommand(cmd, view);
- // delete host element
- List<EObject> todestroy = new ArrayList<EObject>();
- todestroy.add(req.getElementToDestroy());
- //cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req));
- cmd.add(new EMFtoGMFCommandWrapper(new DeleteCommand(
- getEditingDomain(), todestroy)));
- } else {
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
- getEditingDomain(), view));
- }
- return getGEFWrapper(cmd.reduce());
- }
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.edit.policies;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
+import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.example.diagram.simplediagram.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class ComponentItemSemanticEditPolicy extends
+ UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ public ComponentItemSemanticEditPolicy() {
+ super(UMLElementTypes.Component_2001);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ View view = (View) getHost().getModel();
+ CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(
+ getEditingDomain(), null);
+ cmd.setTransactionNestingEnabled(false);
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation == null) {
+ // there are indirectly referenced children, need extra commands: false
+ addDestroyShortcutsCommand(cmd, view);
+ // delete host element
+ cmd.add(new DestroyElementCommand(req));
+ } else {
+ cmd.add(new DeleteCommand(getEditingDomain(), view));
+ }
+ return getGEFWrapper(cmd.reduce());
+ }
+
+}
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/ModelCanonicalEditPolicy.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/ModelCanonicalEditPolicy.java
index b0d85c84f3e..f95aaf49317 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/ModelCanonicalEditPolicy.java
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/ModelCanonicalEditPolicy.java
@@ -1,158 +1,202 @@
-package org.eclipse.papyrus.example.diagram.simplediagram.edit.policies;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.diagram.ui.commands.DeferredLayoutCommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.commands.SetViewMutabilityCommand;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ComponentEditPart;
-import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramUpdater;
-import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLNodeDescriptor;
-import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class ModelCanonicalEditPolicy extends CanonicalEditPolicy {
-
- /**
- * @generated
- */
- protected EStructuralFeature getFeatureToSynchronize() {
- return UMLPackage.eINSTANCE.getPackage_PackagedElement();
- }
-
- /**
- * @generated
- */
- @SuppressWarnings("rawtypes")
- protected List getSemanticChildrenList() {
- View viewObject = (View) getHost().getModel();
- LinkedList<EObject> result = new LinkedList<EObject>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater
- .getModel_1000SemanticChildren(viewObject);
- for (UMLNodeDescriptor d : childDescriptors) {
- result.add(d.getModelElement());
- }
- return result;
- }
-
- /**
- * @generated
- */
- protected boolean isOrphaned(Collection<EObject> semanticChildren,
- final View view) {
- return isMyDiagramElement(view)
- && !semanticChildren.contains(view.getElement());
- }
-
- /**
- * @generated
- */
- private boolean isMyDiagramElement(View view) {
- return ComponentEditPart.VISUAL_ID == UMLVisualIDRegistry
- .getVisualID(view);
- }
-
- /**
- * @generated
- */
- protected void refreshSemantic() {
- if (resolveSemanticElement() == null) {
- return;
- }
- LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater
- .getModel_1000SemanticChildren((View) getHost().getModel());
- LinkedList<View> orphaned = new LinkedList<View>();
- // we care to check only views we recognize as ours
- LinkedList<View> knownViewChildren = new LinkedList<View>();
- for (View v : getViewChildren()) {
- if (isMyDiagramElement(v)) {
- knownViewChildren.add(v);
- }
- }
- // alternative to #cleanCanonicalSemanticChildren(getViewChildren(), semanticChildren)
- //
- // iteration happens over list of desired semantic elements, trying to find best matching View, while original CEP
- // iterates views, potentially losing view (size/bounds) information - i.e. if there are few views to reference same EObject, only last one
- // to answer isOrphaned == true will be used for the domain element representation, see #cleanCanonicalSemanticChildren()
- for (Iterator<UMLNodeDescriptor> descriptorsIterator = childDescriptors
- .iterator(); descriptorsIterator.hasNext();) {
- UMLNodeDescriptor next = descriptorsIterator.next();
- String hint = UMLVisualIDRegistry.getType(next.getVisualID());
- LinkedList<View> perfectMatch = new LinkedList<View>(); // both semanticElement and hint match that of NodeDescriptor
- for (View childView : getViewChildren()) {
- EObject semanticElement = childView.getElement();
- if (next.getModelElement().equals(semanticElement)) {
- if (hint.equals(childView.getType())) {
- perfectMatch.add(childView);
- // actually, can stop iteration over view children here, but
- // may want to use not the first view but last one as a 'real' match (the way original CEP does
- // with its trick with viewToSemanticMap inside #cleanCanonicalSemanticChildren
- }
- }
- }
- if (perfectMatch.size() > 0) {
- descriptorsIterator.remove(); // precise match found no need to create anything for the NodeDescriptor
- // use only one view (first or last?), keep rest as orphaned for further consideration
- knownViewChildren.remove(perfectMatch.getFirst());
- }
- }
- // those left in knownViewChildren are subject to removal - they are our diagram elements we didn't find match to,
- // or those we have potential matches to, and thus need to be recreated, preserving size/location information.
- orphaned.addAll(knownViewChildren);
- //
- ArrayList<CreateViewRequest.ViewDescriptor> viewDescriptors = new ArrayList<CreateViewRequest.ViewDescriptor>(
- childDescriptors.size());
- for (UMLNodeDescriptor next : childDescriptors) {
- String hint = UMLVisualIDRegistry.getType(next.getVisualID());
- IAdaptable elementAdapter = new CanonicalElementAdapter(
- next.getModelElement(), hint);
- CreateViewRequest.ViewDescriptor descriptor = new CreateViewRequest.ViewDescriptor(
- elementAdapter, Node.class, hint, ViewUtil.APPEND, false,
- host().getDiagramPreferencesHint());
- viewDescriptors.add(descriptor);
- }
-
- boolean changed = deleteViews(orphaned.iterator());
- //
- CreateViewRequest request = getCreateViewRequest(viewDescriptors);
- Command cmd = getCreateViewCommand(request);
- if (cmd != null && cmd.canExecute()) {
- SetViewMutabilityCommand.makeMutable(
- new EObjectAdapter(host().getNotationView())).execute();
- executeCommand(cmd);
- @SuppressWarnings("unchecked")
- List<IAdaptable> nl = (List<IAdaptable>) request.getNewObject();
- createdViews.addAll(nl);
- }
- if (changed || createdViews.size() > 0) {
- postProcessRefreshSemantic(createdViews);
- }
-
- if (createdViews.size() > 1) {
- // perform a layout of the container
- DeferredLayoutCommand layoutCmd = new DeferredLayoutCommand(host()
- .getEditingDomain(), createdViews, host());
- executeCommand(new ICommandProxy(layoutCmd));
- }
-
- makeViewsImmutable(createdViews);
- }
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.edit.policies;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.commands.DeferredLayoutCommand;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.commands.SetViewMutabilityCommand;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ComponentEditPart;
+import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class ModelCanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected void refreshOnActivate() {
+ // Need to activate editpart children before invoking the canonical refresh for EditParts to add event listeners
+ List<?> c = getHost().getChildren();
+ for (int i = 0; i < c.size(); i++) {
+ ((EditPart) c.get(i)).activate();
+ }
+ super.refreshOnActivate();
+ }
+
+ /**
+ * @generated
+ */
+ protected EStructuralFeature getFeatureToSynchronize() {
+ return UMLPackage.eINSTANCE.getPackage_PackagedElement();
+ }
+
+ /**
+ * @generated
+ */
+ @SuppressWarnings("rawtypes")
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ LinkedList<EObject> result = new LinkedList<EObject>();
+ List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater
+ .getModel_1000SemanticChildren(viewObject);
+ for (UMLNodeDescriptor d : childDescriptors) {
+ result.add(d.getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection<EObject> semanticChildren,
+ final View view) {
+ return isMyDiagramElement(view)
+ && !semanticChildren.contains(view.getElement());
+ }
+
+ /**
+ * @generated
+ */
+ private boolean isMyDiagramElement(View view) {
+ return ComponentEditPart.VISUAL_ID == UMLVisualIDRegistry
+ .getVisualID(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshSemantic() {
+ if (resolveSemanticElement() == null) {
+ return;
+ }
+ LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
+ List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater
+ .getModel_1000SemanticChildren((View) getHost().getModel());
+ LinkedList<View> orphaned = new LinkedList<View>();
+ // we care to check only views we recognize as ours
+ LinkedList<View> knownViewChildren = new LinkedList<View>();
+ for (View v : getViewChildren()) {
+ if (isMyDiagramElement(v)) {
+ knownViewChildren.add(v);
+ }
+ }
+ // alternative to #cleanCanonicalSemanticChildren(getViewChildren(), semanticChildren)
+ //
+ // iteration happens over list of desired semantic elements, trying to find best matching View, while original CEP
+ // iterates views, potentially losing view (size/bounds) information - i.e. if there are few views to reference same EObject, only last one
+ // to answer isOrphaned == true will be used for the domain element representation, see #cleanCanonicalSemanticChildren()
+ for (Iterator<UMLNodeDescriptor> descriptorsIterator = childDescriptors
+ .iterator(); descriptorsIterator.hasNext();) {
+ UMLNodeDescriptor next = descriptorsIterator.next();
+ String hint = UMLVisualIDRegistry.getType(next.getVisualID());
+ LinkedList<View> perfectMatch = new LinkedList<View>(); // both semanticElement and hint match that of NodeDescriptor
+ for (View childView : getViewChildren()) {
+ EObject semanticElement = childView.getElement();
+ if (next.getModelElement().equals(semanticElement)) {
+ if (hint.equals(childView.getType())) {
+ perfectMatch.add(childView);
+ // actually, can stop iteration over view children here, but
+ // may want to use not the first view but last one as a 'real' match (the way original CEP does
+ // with its trick with viewToSemanticMap inside #cleanCanonicalSemanticChildren
+ }
+ }
+ }
+ if (perfectMatch.size() > 0) {
+ descriptorsIterator.remove(); // precise match found no need to create anything for the NodeDescriptor
+ // use only one view (first or last?), keep rest as orphaned for further consideration
+ knownViewChildren.remove(perfectMatch.getFirst());
+ }
+ }
+ // those left in knownViewChildren are subject to removal - they are our diagram elements we didn't find match to,
+ // or those we have potential matches to, and thus need to be recreated, preserving size/location information.
+ orphaned.addAll(knownViewChildren);
+ //
+ ArrayList<CreateViewRequest.ViewDescriptor> viewDescriptors = new ArrayList<CreateViewRequest.ViewDescriptor>(
+ childDescriptors.size());
+ for (UMLNodeDescriptor next : childDescriptors) {
+ String hint = UMLVisualIDRegistry.getType(next.getVisualID());
+ IAdaptable elementAdapter = new CanonicalElementAdapter(
+ next.getModelElement(), hint);
+ CreateViewRequest.ViewDescriptor descriptor = new CreateViewRequest.ViewDescriptor(
+ elementAdapter, Node.class, hint, ViewUtil.APPEND, false,
+ host().getDiagramPreferencesHint());
+ viewDescriptors.add(descriptor);
+ }
+
+ boolean changed = deleteViews(orphaned.iterator());
+ //
+ CreateViewRequest request = getCreateViewRequest(viewDescriptors);
+ Command cmd = getCreateViewCommand(request);
+ if (cmd != null && cmd.canExecute()) {
+ SetViewMutabilityCommand.makeMutable(
+ new EObjectAdapter(host().getNotationView())).execute();
+ executeCommand(cmd);
+ @SuppressWarnings("unchecked")
+ List<IAdaptable> nl = (List<IAdaptable>) request.getNewObject();
+ createdViews.addAll(nl);
+ }
+ if (changed || createdViews.size() > 0) {
+ postProcessRefreshSemantic(createdViews);
+ }
+
+ if (createdViews.size() > 1) {
+ // perform a layout of the container
+ DeferredLayoutCommand layoutCmd = new DeferredLayoutCommand(host()
+ .getEditingDomain(), createdViews, host());
+ executeCommand(new ICommandProxy(layoutCmd));
+ }
+
+ makeViewsImmutable(createdViews);
+ }
+
+ /**
+ * @generated
+ */
+ @SuppressWarnings("serial")
+ protected static class Domain2Notation extends HashMap<EObject, View> {
+ /**
+ * @generated
+ */
+ public boolean containsDomainElement(EObject domainElement) {
+ return this.containsKey(domainElement);
+ }
+
+ /**
+ * @generated
+ */
+ public View getHinted(EObject domainEObject, String hint) {
+ return this.get(domainEObject);
+ }
+
+ /**
+ * @generated
+ */
+ public void putView(EObject domainElement, View view) {
+ if (!containsKey(view.getElement())) {
+ this.put(domainElement, view);
+ }
+ }
+
+ }
+}
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/ModelItemSemanticEditPolicy.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/ModelItemSemanticEditPolicy.java
index 7f7d75f0020..995bf48180b 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/ModelItemSemanticEditPolicy.java
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/ModelItemSemanticEditPolicy.java
@@ -1,73 +1,62 @@
-package org.eclipse.papyrus.example.diagram.simplediagram.edit.policies;
-
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.papyrus.diagram.common.commands.DuplicateNamedElementCommand;
-import org.eclipse.papyrus.example.diagram.simplediagram.edit.commands.ComponentCreateCommand;
-import org.eclipse.papyrus.example.diagram.simplediagram.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class ModelItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public ModelItemSemanticEditPolicy() {
- super(UMLElementTypes.Model_1000);
- }
-
- /**
- * @generated
- */
- protected Command getCreateCommand(CreateElementRequest req) {
- if (UMLElementTypes.Component_2001 == req.getElementType()) {
- return getGEFWrapper(new ComponentCreateCommand(req));
- }
- return super.getCreateCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getDuplicateCommand(DuplicateElementsRequest req) {
- TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost())
- .getEditingDomain();
- Diagram currentDiagram = null;
- if (getHost() instanceof IGraphicalEditPart) {
- currentDiagram = ((IGraphicalEditPart) getHost()).getNotationView()
- .getDiagram();
- }
- return getGEFWrapper(new DuplicateAnythingCommand(editingDomain, req,
- currentDiagram));
- }
-
- /**
- * @generated
- */
- private static class DuplicateAnythingCommand extends
- DuplicateNamedElementCommand {
- /**
- * @generated
- */
- private Diagram diagram;
-
- /**
- * @generated
- */
- public DuplicateAnythingCommand(
- TransactionalEditingDomain editingDomain,
- DuplicateElementsRequest req, Diagram currentDiagram) {
- super(editingDomain, req.getLabel(), req
- .getElementsToBeDuplicated(), req
- .getAllDuplicatedElementsMap(), currentDiagram);
- this.diagram = currentDiagram;
- }
- }
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.edit.policies;
+
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.emf.commands.core.commands.DuplicateEObjectsCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest;
+import org.eclipse.papyrus.example.diagram.simplediagram.edit.commands.ComponentCreateCommand;
+import org.eclipse.papyrus.example.diagram.simplediagram.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class ModelItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ public ModelItemSemanticEditPolicy() {
+ super(UMLElementTypes.Model_1000);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (UMLElementTypes.Component_2001 == req.getElementType()) {
+ return getGEFWrapper(new ComponentCreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getDuplicateCommand(DuplicateElementsRequest req) {
+ TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost())
+ .getEditingDomain();
+ return getGEFWrapper(new DuplicateAnythingCommand(editingDomain, req));
+ }
+
+ /**
+ * @generated
+ */
+ private static class DuplicateAnythingCommand extends
+ DuplicateEObjectsCommand {
+
+ /**
+ * @generated
+ */
+ public DuplicateAnythingCommand(
+ TransactionalEditingDomain editingDomain,
+ DuplicateElementsRequest req) {
+ super(editingDomain, req.getLabel(), req
+ .getElementsToBeDuplicated(), req
+ .getAllDuplicatedElementsMap());
+ }
+
+ }
+
+}
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/UMLBaseItemSemanticEditPolicy.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/UMLBaseItemSemanticEditPolicy.java
index 82e5a0c17ea..5a3228cb309 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/UMLBaseItemSemanticEditPolicy.java
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/UMLBaseItemSemanticEditPolicy.java
@@ -1,306 +1,295 @@
-package org.eclipse.papyrus.example.diagram.simplediagram.edit.policies;
-
-import java.util.Iterator;
-
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gef.requests.ReconnectRequest;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.core.command.ICompositeCommand;
-import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.SemanticEditPolicy;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.commands.MoveElementsCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.GetEditContextRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.example.diagram.simplediagram.edit.helpers.UMLBaseEditHelper;
-import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.example.diagram.simplediagram.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy {
- /**
- * Extended request data key to hold editpart visual id.
- * @generated
- */
- public static final String VISUAL_ID_KEY = "visual_id"; //$NON-NLS-1$
- /**
- * Extended request data key to hold the edge view during a reconnect request.
- * @generated
- */
- public static final String GRAPHICAL_RECONNECTED_EDGE = "graphical_edge"; //$NON-NLS-1$
- /**
- * @generated
- */
- private final IElementType myElementType;
-
- /**
- * @generated
- */
- protected UMLBaseItemSemanticEditPolicy(IElementType elementType) {
- myElementType = elementType;
- }
-
- /**
- * Extended request data key to hold editpart visual id.
- * Add visual id of edited editpart to extended data of the request
- * so command switch can decide what kind of diagram element is being edited.
- * It is done in those cases when it's not possible to deduce diagram
- * element kind from domain element.
- * Add the reoriented view to the request extended data so that the view
- * currently edited can be distinguished from other views of the same element
- * and these latter possibly removed if they become inconsistent after reconnect
- *
- * @generated
- */
- @SuppressWarnings("unchecked")
- public Command getCommand(Request request) {
- if (request instanceof ReconnectRequest) {
- Object view = ((ReconnectRequest) request).getConnectionEditPart()
- .getModel();
- if (view instanceof View) {
- Integer id = new Integer(
- UMLVisualIDRegistry.getVisualID((View) view));
- request.getExtendedData().put(VISUAL_ID_KEY, id);
- request.getExtendedData().put(GRAPHICAL_RECONNECTED_EDGE,
- (View) view);
- }
- }
- return super.getCommand(request);
- }
-
- /**
- * Returns visual id from request parameters.
- * @generated
- */
- protected int getVisualID(IEditCommandRequest request) {
- Object id = request.getParameter(VISUAL_ID_KEY);
- return id instanceof Integer ? ((Integer) id).intValue() : -1;
- }
-
- /**
- * @generated
- */
- protected Command getSemanticCommand(IEditCommandRequest request) {
- IEditCommandRequest completedRequest = completeRequest(request);
- Command semanticCommand = getSemanticCommandSwitch(completedRequest);
- semanticCommand = getEditHelperCommand(completedRequest,
- semanticCommand);
- if (completedRequest instanceof DestroyRequest) {
- DestroyRequest destroyRequest = (DestroyRequest) completedRequest;
- return shouldProceed(destroyRequest) ? addDeleteViewCommand(
- semanticCommand, destroyRequest) : null;
- }
- return semanticCommand;
- }
-
- /**
- * @generated
- */
- protected Command addDeleteViewCommand(Command mainCommand,
- DestroyRequest completedRequest) {
- Command deleteViewCommand = getGEFWrapper(new DeleteCommand(
- getEditingDomain(), (View) getHost().getModel()));
- return mainCommand == null ? deleteViewCommand : mainCommand
- .chain(deleteViewCommand);
- }
-
- /**
- * @generated
- */
- private Command getEditHelperCommand(IEditCommandRequest request,
- Command editPolicyCommand) {
- if (editPolicyCommand != null) {
- ICommand command = editPolicyCommand instanceof ICommandProxy ? ((ICommandProxy) editPolicyCommand)
- .getICommand() : new CommandProxy(editPolicyCommand);
- request.setParameter(UMLBaseEditHelper.EDIT_POLICY_COMMAND, command);
- }
- IElementType requestContextElementType = getContextElementType(request);
- request.setParameter(UMLBaseEditHelper.CONTEXT_ELEMENT_TYPE,
- requestContextElementType);
- ICommand command = requestContextElementType.getEditCommand(request);
- request.setParameter(UMLBaseEditHelper.EDIT_POLICY_COMMAND, null);
- request.setParameter(UMLBaseEditHelper.CONTEXT_ELEMENT_TYPE, null);
- if (command != null) {
- if (!(command instanceof CompositeTransactionalCommand)) {
- command = new CompositeTransactionalCommand(getEditingDomain(),
- command.getLabel()).compose(command);
- }
- return new ICommandProxy(command);
- }
- return editPolicyCommand;
- }
-
- /**
- * @generated
- */
- protected IElementType getContextElementType(IEditCommandRequest request) {
- IElementType requestContextElementType = UMLElementTypes
- .getElementType(getVisualID(request));
- return requestContextElementType != null ? requestContextElementType
- : myElementType;
- }
-
- /**
- * @generated
- */
- protected Command getSemanticCommandSwitch(IEditCommandRequest req) {
- if (req instanceof CreateRelationshipRequest) {
- return getCreateRelationshipCommand((CreateRelationshipRequest) req);
- } else if (req instanceof CreateElementRequest) {
- return getCreateCommand((CreateElementRequest) req);
- } else if (req instanceof ConfigureRequest) {
- return getConfigureCommand((ConfigureRequest) req);
- } else if (req instanceof DestroyElementRequest) {
- return getDestroyElementCommand((DestroyElementRequest) req);
- } else if (req instanceof DestroyReferenceRequest) {
- return getDestroyReferenceCommand((DestroyReferenceRequest) req);
- } else if (req instanceof DuplicateElementsRequest) {
- return getDuplicateCommand((DuplicateElementsRequest) req);
- } else if (req instanceof GetEditContextRequest) {
- return getEditContextCommand((GetEditContextRequest) req);
- } else if (req instanceof MoveRequest) {
- return getMoveCommand((MoveRequest) req);
- } else if (req instanceof ReorientReferenceRelationshipRequest) {
- return getReorientReferenceRelationshipCommand((ReorientReferenceRelationshipRequest) req);
- } else if (req instanceof ReorientRelationshipRequest) {
- return getReorientRelationshipCommand((ReorientRelationshipRequest) req);
- } else if (req instanceof SetRequest) {
- return getSetCommand((SetRequest) req);
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getConfigureCommand(ConfigureRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCreateCommand(CreateElementRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getSetCommand(SetRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getEditContextCommand(GetEditContextRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getDestroyReferenceCommand(DestroyReferenceRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getDuplicateCommand(DuplicateElementsRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getMoveCommand(MoveRequest req) {
-
- return getGEFWrapper(new MoveElementsCommand(req));
-
- }
-
- /**
- * @generated
- */
- protected Command getReorientReferenceRelationshipCommand(
- ReorientReferenceRelationshipRequest req) {
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * @generated
- */
- protected Command getReorientRelationshipCommand(
- ReorientRelationshipRequest req) {
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * @generated
- */
- protected final Command getGEFWrapper(ICommand cmd) {
- return new ICommandProxy(cmd);
- }
-
- /**
- * Returns editing domain from the host edit part.
- * @generated
- */
- protected TransactionalEditingDomain getEditingDomain() {
- return ((IGraphicalEditPart) getHost()).getEditingDomain();
- }
-
- /**
- * Clean all shortcuts to the host element from the same diagram
- * @generated
- */
- protected void addDestroyShortcutsCommand(ICompositeCommand cmd, View view) {
- assert view.getEAnnotation("Shortcut") == null; //$NON-NLS-1$
- for (Iterator it = view.getDiagram().getChildren().iterator(); it
- .hasNext();) {
- View nextView = (View) it.next();
- if (nextView.getEAnnotation("Shortcut") == null || !nextView.isSetElement() || nextView.getElement() != view.getElement()) { //$NON-NLS-1$
- continue;
- }
- cmd.add(new DeleteCommand(getEditingDomain(), nextView));
- }
- }
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.edit.policies;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gef.requests.ReconnectRequest;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.common.core.command.ICompositeCommand;
+import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
+import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.SemanticEditPolicy;
+import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.GetEditContextRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tooling.runtime.edit.helpers.GeneratedEditHelperBase;
+import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.example.diagram.simplediagram.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy {
+
+ /**
+ * Extended request data key to hold editpart visual id.
+ * @generated
+ */
+ public static final String VISUAL_ID_KEY = "visual_id"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ private final IElementType myElementType;
+
+ /**
+ * @generated
+ */
+ protected UMLBaseItemSemanticEditPolicy(IElementType elementType) {
+ myElementType = elementType;
+ }
+
+ /**
+ * Extended request data key to hold editpart visual id.
+ * Add visual id of edited editpart to extended data of the request
+ * so command switch can decide what kind of diagram element is being edited.
+ * It is done in those cases when it's not possible to deduce diagram
+ * element kind from domain element.
+ *
+ * @generated
+ */
+ public Command getCommand(Request request) {
+ if (request instanceof ReconnectRequest) {
+ Object view = ((ReconnectRequest) request).getConnectionEditPart()
+ .getModel();
+ if (view instanceof View) {
+ Integer id = new Integer(
+ UMLVisualIDRegistry.getVisualID((View) view));
+ request.getExtendedData().put(VISUAL_ID_KEY, id);
+ }
+ }
+ return super.getCommand(request);
+ }
+
+ /**
+ * Returns visual id from request parameters.
+ * @generated
+ */
+ protected int getVisualID(IEditCommandRequest request) {
+ Object id = request.getParameter(VISUAL_ID_KEY);
+ return id instanceof Integer ? ((Integer) id).intValue() : -1;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getSemanticCommand(IEditCommandRequest request) {
+ IEditCommandRequest completedRequest = completeRequest(request);
+ Command semanticCommand = getSemanticCommandSwitch(completedRequest);
+ semanticCommand = getEditHelperCommand(completedRequest,
+ semanticCommand);
+ if (completedRequest instanceof DestroyRequest) {
+ DestroyRequest destroyRequest = (DestroyRequest) completedRequest;
+ return shouldProceed(destroyRequest) ? addDeleteViewCommand(
+ semanticCommand, destroyRequest) : null;
+ }
+ return semanticCommand;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command addDeleteViewCommand(Command mainCommand,
+ DestroyRequest completedRequest) {
+ Command deleteViewCommand = getGEFWrapper(new DeleteCommand(
+ getEditingDomain(), (View) getHost().getModel()));
+ return mainCommand == null ? deleteViewCommand : mainCommand
+ .chain(deleteViewCommand);
+ }
+
+ /**
+ * @generated
+ */
+ private Command getEditHelperCommand(IEditCommandRequest request,
+ Command editPolicyCommand) {
+ if (editPolicyCommand != null) {
+ ICommand command = editPolicyCommand instanceof ICommandProxy ? ((ICommandProxy) editPolicyCommand)
+ .getICommand() : new CommandProxy(editPolicyCommand);
+ request.setParameter(GeneratedEditHelperBase.EDIT_POLICY_COMMAND,
+ command);
+ }
+ IElementType requestContextElementType = getContextElementType(request);
+ request.setParameter(GeneratedEditHelperBase.CONTEXT_ELEMENT_TYPE,
+ requestContextElementType);
+ ICommand command = requestContextElementType.getEditCommand(request);
+ request.setParameter(GeneratedEditHelperBase.EDIT_POLICY_COMMAND, null);
+ request.setParameter(GeneratedEditHelperBase.CONTEXT_ELEMENT_TYPE, null);
+ if (command != null) {
+ if (!(command instanceof CompositeTransactionalCommand)) {
+ command = new CompositeTransactionalCommand(getEditingDomain(),
+ command.getLabel()).compose(command);
+ }
+ return new ICommandProxy(command);
+ }
+ return editPolicyCommand;
+ }
+
+ /**
+ * @generated
+ */
+ private IElementType getContextElementType(IEditCommandRequest request) {
+ IElementType requestContextElementType = UMLElementTypes
+ .getElementType(getVisualID(request));
+ return requestContextElementType != null ? requestContextElementType
+ : myElementType;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getSemanticCommandSwitch(IEditCommandRequest req) {
+ if (req instanceof CreateRelationshipRequest) {
+ return getCreateRelationshipCommand((CreateRelationshipRequest) req);
+ } else if (req instanceof CreateElementRequest) {
+ return getCreateCommand((CreateElementRequest) req);
+ } else if (req instanceof ConfigureRequest) {
+ return getConfigureCommand((ConfigureRequest) req);
+ } else if (req instanceof DestroyElementRequest) {
+ return getDestroyElementCommand((DestroyElementRequest) req);
+ } else if (req instanceof DestroyReferenceRequest) {
+ return getDestroyReferenceCommand((DestroyReferenceRequest) req);
+ } else if (req instanceof DuplicateElementsRequest) {
+ return getDuplicateCommand((DuplicateElementsRequest) req);
+ } else if (req instanceof GetEditContextRequest) {
+ return getEditContextCommand((GetEditContextRequest) req);
+ } else if (req instanceof MoveRequest) {
+ return getMoveCommand((MoveRequest) req);
+ } else if (req instanceof ReorientReferenceRelationshipRequest) {
+ return getReorientReferenceRelationshipCommand((ReorientReferenceRelationshipRequest) req);
+ } else if (req instanceof ReorientRelationshipRequest) {
+ return getReorientRelationshipCommand((ReorientRelationshipRequest) req);
+ } else if (req instanceof SetRequest) {
+ return getSetCommand((SetRequest) req);
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getConfigureCommand(ConfigureRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getSetCommand(SetRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getEditContextCommand(GetEditContextRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyReferenceCommand(DestroyReferenceRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getDuplicateCommand(DuplicateElementsRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getMoveCommand(MoveRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(
+ ReorientReferenceRelationshipRequest req) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(
+ ReorientRelationshipRequest req) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * @generated
+ */
+ protected final Command getGEFWrapper(ICommand cmd) {
+ return new ICommandProxy(cmd);
+ }
+
+ /**
+ * Returns editing domain from the host edit part.
+ * @generated
+ */
+ protected TransactionalEditingDomain getEditingDomain() {
+ return ((IGraphicalEditPart) getHost()).getEditingDomain();
+ }
+
+ /**
+ * Clean all shortcuts to the host element from the same diagram
+ * @generated
+ */
+ protected void addDestroyShortcutsCommand(ICompositeCommand cmd, View view) {
+ assert view.getEAnnotation("Shortcut") == null; //$NON-NLS-1$
+ for (Iterator it = view.getDiagram().getChildren().iterator(); it
+ .hasNext();) {
+ View nextView = (View) it.next();
+ if (nextView.getEAnnotation("Shortcut") == null || !nextView.isSetElement() || nextView.getElement() != view.getElement()) { //$NON-NLS-1$
+ continue;
+ }
+ cmd.add(new DeleteCommand(getEditingDomain(), nextView));
+ }
+ }
+
+}
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/UMLTextNonResizableEditPolicy.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/UMLTextNonResizableEditPolicy.java
index 8257f356428..ac9f480449d 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/UMLTextNonResizableEditPolicy.java
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/UMLTextNonResizableEditPolicy.java
@@ -1,225 +1,229 @@
-package org.eclipse.papyrus.example.diagram.simplediagram.edit.policies;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.FigureListener;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.handles.MoveHandle;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableEditPolicyEx;
-import org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-
-/**
- * @generated
- */
-public class UMLTextNonResizableEditPolicy extends NonResizableEditPolicyEx {
-
- /**
- * @generated
- */
- private IFigure selectionFeedbackFigure;
-
- /**
- * @generated
- */
- private IFigure focusFeedbackFigure;
-
- /**
- * @generated
- */
- private FigureListener hostPositionListener;
-
- /**
- * @generated
- */
- protected void showPrimarySelection() {
- if (getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getHostFigure()).setSelected(true);
- ((WrappingLabel) getHostFigure()).setFocus(true);
- } else {
- showSelection();
- showFocus();
- }
- }
-
- /**
- * @generated
- */
- protected void showSelection() {
- if (getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getHostFigure()).setSelected(true);
- ((WrappingLabel) getHostFigure()).setFocus(false);
- } else {
- hideSelection();
- addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure());
- getHostFigure().addFigureListener(getHostPositionListener());
- refreshSelectionFeedback();
- hideFocus();
- }
- }
-
- /**
- * @generated
- */
- protected void hideSelection() {
- if (getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getHostFigure()).setSelected(false);
- ((WrappingLabel) getHostFigure()).setFocus(false);
- } else {
- if (selectionFeedbackFigure != null) {
- removeFeedback(selectionFeedbackFigure);
- getHostFigure().removeFigureListener(getHostPositionListener());
- selectionFeedbackFigure = null;
- }
- hideFocus();
- }
- }
-
- /**
- * @generated
- */
- protected void showFocus() {
- if (getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getHostFigure()).setFocus(true);
- } else {
- hideFocus();
- addFeedback(focusFeedbackFigure = createFocusFeedbackFigure());
- refreshFocusFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void hideFocus() {
- if (getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getHostFigure()).setFocus(false);
- } else {
- if (focusFeedbackFigure != null) {
- removeFeedback(focusFeedbackFigure);
- focusFeedbackFigure = null;
- }
- }
- }
-
- /**
- * @generated
- */
- protected Rectangle getFeedbackBounds() {
- Rectangle bounds;
- if (getHostFigure() instanceof Label) {
- bounds = ((Label) getHostFigure()).getTextBounds();
- bounds.intersect(getHostFigure().getBounds());
- } else {
- bounds = getHostFigure().getBounds().getCopy();
- }
- getHostFigure().getParent().translateToAbsolute(bounds);
- getFeedbackLayer().translateToRelative(bounds);
- return bounds;
- }
-
- /**
- * @generated
- */
- protected IFigure createSelectionFeedbackFigure() {
- if (getHostFigure() instanceof Label) {
- Label feedbackFigure = new Label();
- feedbackFigure.setOpaque(true);
- feedbackFigure
- .setBackgroundColor(ColorConstants.menuBackgroundSelected);
- feedbackFigure
- .setForegroundColor(ColorConstants.menuForegroundSelected);
- return feedbackFigure;
- } else {
- RectangleFigure feedbackFigure = new RectangleFigure();
- feedbackFigure.setFill(false);
- return feedbackFigure;
- }
- }
-
- /**
- * @generated
- */
- protected IFigure createFocusFeedbackFigure() {
- return new Figure() {
-
- protected void paintFigure(Graphics graphics) {
- graphics.drawFocus(getBounds().getResized(-1, -1));
- }
- };
- }
-
- /**
- * @generated
- */
- protected void updateLabel(Label target) {
- Label source = (Label) getHostFigure();
- target.setText(source.getText());
- target.setTextAlignment(source.getTextAlignment());
- target.setFont(source.getFont());
- }
-
- /**
- * @generated
- */
- protected void refreshSelectionFeedback() {
- if (selectionFeedbackFigure != null) {
- if (selectionFeedbackFigure instanceof Label) {
- updateLabel((Label) selectionFeedbackFigure);
- selectionFeedbackFigure.setBounds(getFeedbackBounds());
- } else {
- selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5,
- 5));
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshFocusFeedback() {
- if (focusFeedbackFigure != null) {
- focusFeedbackFigure.setBounds(getFeedbackBounds());
- }
- }
-
- /**
- * @generated
- */
- public void refreshFeedback() {
- refreshSelectionFeedback();
- refreshFocusFeedback();
- }
-
- /**
- * @generated
- */
- private FigureListener getHostPositionListener() {
- if (hostPositionListener == null) {
- hostPositionListener = new FigureListener() {
- public void figureMoved(IFigure source) {
- refreshFeedback();
- }
- };
- }
- return hostPositionListener;
- }
-
- /**
- * @generated
- */
- protected List createSelectionHandles() {
- MoveHandle moveHandle = new MoveHandle((GraphicalEditPart) getHost());
- moveHandle.setBorder(null);
- moveHandle.setDragTracker(new DragEditPartsTrackerEx(getHost()));
- return Collections.singletonList(moveHandle);
- }
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.edit.policies;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.FigureListener;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.handles.MoveHandle;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableEditPolicyEx;
+import org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.tooling.runtime.edit.policies.labels.IRefreshableFeedbackEditPolicy;
+
+/**
+ * @generated
+ */
+public class UMLTextNonResizableEditPolicy extends NonResizableEditPolicyEx
+ implements IRefreshableFeedbackEditPolicy {
+
+ /**
+ * @generated
+ */
+ private IFigure selectionFeedbackFigure;
+
+ /**
+ * @generated
+ */
+ private IFigure focusFeedbackFigure;
+
+ /**
+ * @generated
+ */
+ private FigureListener hostPositionListener;
+
+ /**
+ * @generated
+ */
+ protected void showPrimarySelection() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setSelected(true);
+ ((WrappingLabel) getHostFigure()).setFocus(true);
+ } else {
+ showSelection();
+ showFocus();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void showSelection() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setSelected(true);
+ ((WrappingLabel) getHostFigure()).setFocus(false);
+ } else {
+ hideSelection();
+ addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure());
+ getHostFigure().addFigureListener(getHostPositionListener());
+ refreshSelectionFeedback();
+ hideFocus();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void hideSelection() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setSelected(false);
+ ((WrappingLabel) getHostFigure()).setFocus(false);
+ } else {
+ if (selectionFeedbackFigure != null) {
+ removeFeedback(selectionFeedbackFigure);
+ getHostFigure().removeFigureListener(getHostPositionListener());
+ selectionFeedbackFigure = null;
+ }
+ hideFocus();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void showFocus() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setFocus(true);
+ } else {
+ hideFocus();
+ addFeedback(focusFeedbackFigure = createFocusFeedbackFigure());
+ refreshFocusFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void hideFocus() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setFocus(false);
+ } else {
+ if (focusFeedbackFigure != null) {
+ removeFeedback(focusFeedbackFigure);
+ focusFeedbackFigure = null;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Rectangle getFeedbackBounds() {
+ Rectangle bounds;
+ if (getHostFigure() instanceof Label) {
+ bounds = ((Label) getHostFigure()).getTextBounds();
+ bounds.intersect(getHostFigure().getBounds());
+ } else {
+ bounds = getHostFigure().getBounds().getCopy();
+ }
+ getHostFigure().getParent().translateToAbsolute(bounds);
+ getFeedbackLayer().translateToRelative(bounds);
+ return bounds;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createSelectionFeedbackFigure() {
+ if (getHostFigure() instanceof Label) {
+ Label feedbackFigure = new Label();
+ feedbackFigure.setOpaque(true);
+ feedbackFigure
+ .setBackgroundColor(ColorConstants.menuBackgroundSelected);
+ feedbackFigure
+ .setForegroundColor(ColorConstants.menuForegroundSelected);
+ return feedbackFigure;
+ } else {
+ RectangleFigure feedbackFigure = new RectangleFigure();
+ feedbackFigure.setFill(false);
+ return feedbackFigure;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFocusFeedbackFigure() {
+ return new Figure() {
+
+ protected void paintFigure(Graphics graphics) {
+ graphics.drawFocus(getBounds().getResized(-1, -1));
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ protected void updateLabel(Label target) {
+ Label source = (Label) getHostFigure();
+ target.setText(source.getText());
+ target.setTextAlignment(source.getTextAlignment());
+ target.setFont(source.getFont());
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshSelectionFeedback() {
+ if (selectionFeedbackFigure != null) {
+ if (selectionFeedbackFigure instanceof Label) {
+ updateLabel((Label) selectionFeedbackFigure);
+ selectionFeedbackFigure.setBounds(getFeedbackBounds());
+ } else {
+ selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5,
+ 5));
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFocusFeedback() {
+ if (focusFeedbackFigure != null) {
+ focusFeedbackFigure.setBounds(getFeedbackBounds());
+ }
+ }
+
+ /**
+ * @generated
+ */
+
+ public void refreshFeedback() {
+ refreshSelectionFeedback();
+ refreshFocusFeedback();
+ }
+
+ /**
+ * @generated
+ */
+ private FigureListener getHostPositionListener() {
+ if (hostPositionListener == null) {
+ hostPositionListener = new FigureListener() {
+ public void figureMoved(IFigure source) {
+ refreshFeedback();
+ }
+ };
+ }
+ return hostPositionListener;
+ }
+
+ /**
+ * @generated
+ */
+ protected List createSelectionHandles() {
+ MoveHandle moveHandle = new MoveHandle((GraphicalEditPart) getHost());
+ moveHandle.setBorder(null);
+ moveHandle.setDragTracker(new DragEditPartsTrackerEx(getHost()));
+ return Collections.singletonList(moveHandle);
+ }
+
+}
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/UMLTextSelectionEditPolicy.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/UMLTextSelectionEditPolicy.java
index 4072e532af9..252e5eb0c49 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/UMLTextSelectionEditPolicy.java
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/UMLTextSelectionEditPolicy.java
@@ -1,209 +1,213 @@
-package org.eclipse.papyrus.example.diagram.simplediagram.edit.policies;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.FigureListener;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.editpolicies.SelectionEditPolicy;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-
-/**
- * @generated
- */
-public class UMLTextSelectionEditPolicy extends SelectionEditPolicy {
-
- /**
- * @generated
- */
- private IFigure selectionFeedbackFigure;
-
- /**
- * @generated
- */
- private IFigure focusFeedbackFigure;
-
- /**
- * @generated
- */
- private FigureListener hostPositionListener;
-
- /**
- * @generated
- */
- protected void showPrimarySelection() {
- if (getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getHostFigure()).setSelected(true);
- ((WrappingLabel) getHostFigure()).setFocus(true);
- } else {
- showSelection();
- showFocus();
- }
- }
-
- /**
- * @generated
- */
- protected void showSelection() {
- if (getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getHostFigure()).setSelected(true);
- ((WrappingLabel) getHostFigure()).setFocus(false);
- } else {
- hideSelection();
- addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure());
- getHostFigure().addFigureListener(getHostPositionListener());
- refreshSelectionFeedback();
- hideFocus();
- }
- }
-
- /**
- * @generated
- */
- protected void hideSelection() {
- if (getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getHostFigure()).setSelected(false);
- ((WrappingLabel) getHostFigure()).setFocus(false);
- } else {
- if (selectionFeedbackFigure != null) {
- removeFeedback(selectionFeedbackFigure);
- getHostFigure().removeFigureListener(getHostPositionListener());
- selectionFeedbackFigure = null;
- }
- hideFocus();
- }
- }
-
- /**
- * @generated
- */
- protected void showFocus() {
- if (getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getHostFigure()).setFocus(true);
- } else {
- hideFocus();
- addFeedback(focusFeedbackFigure = createFocusFeedbackFigure());
- refreshFocusFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void hideFocus() {
- if (getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getHostFigure()).setFocus(false);
- } else {
- if (focusFeedbackFigure != null) {
- removeFeedback(focusFeedbackFigure);
- focusFeedbackFigure = null;
- }
- }
- }
-
- /**
- * @generated
- */
- protected Rectangle getFeedbackBounds() {
- Rectangle bounds;
- if (getHostFigure() instanceof Label) {
- bounds = ((Label) getHostFigure()).getTextBounds();
- bounds.intersect(getHostFigure().getBounds());
- } else {
- bounds = getHostFigure().getBounds().getCopy();
- }
- getHostFigure().getParent().translateToAbsolute(bounds);
- getFeedbackLayer().translateToRelative(bounds);
- return bounds;
- }
-
- /**
- * @generated
- */
- protected IFigure createSelectionFeedbackFigure() {
- if (getHostFigure() instanceof Label) {
- Label feedbackFigure = new Label();
- feedbackFigure.setOpaque(true);
- feedbackFigure
- .setBackgroundColor(ColorConstants.menuBackgroundSelected);
- feedbackFigure
- .setForegroundColor(ColorConstants.menuForegroundSelected);
- return feedbackFigure;
- } else {
- RectangleFigure feedbackFigure = new RectangleFigure();
- feedbackFigure.setFill(false);
- return feedbackFigure;
- }
- }
-
- /**
- * @generated
- */
- protected IFigure createFocusFeedbackFigure() {
- return new Figure() {
-
- protected void paintFigure(Graphics graphics) {
- graphics.drawFocus(getBounds().getResized(-1, -1));
- }
- };
- }
-
- /**
- * @generated
- */
- protected void updateLabel(Label target) {
- Label source = (Label) getHostFigure();
- target.setText(source.getText());
- target.setTextAlignment(source.getTextAlignment());
- target.setFont(source.getFont());
- }
-
- /**
- * @generated
- */
- protected void refreshSelectionFeedback() {
- if (selectionFeedbackFigure != null) {
- if (selectionFeedbackFigure instanceof Label) {
- updateLabel((Label) selectionFeedbackFigure);
- selectionFeedbackFigure.setBounds(getFeedbackBounds());
- } else {
- selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5,
- 5));
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshFocusFeedback() {
- if (focusFeedbackFigure != null) {
- focusFeedbackFigure.setBounds(getFeedbackBounds());
- }
- }
-
- /**
- * @generated
- */
- public void refreshFeedback() {
- refreshSelectionFeedback();
- refreshFocusFeedback();
- }
-
- /**
- * @generated
- */
- private FigureListener getHostPositionListener() {
- if (hostPositionListener == null) {
- hostPositionListener = new FigureListener() {
- public void figureMoved(IFigure source) {
- refreshFeedback();
- }
- };
- }
- return hostPositionListener;
- }
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.edit.policies;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.FigureListener;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.editpolicies.SelectionEditPolicy;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.tooling.runtime.edit.policies.labels.IRefreshableFeedbackEditPolicy;
+
+/**
+ * @generated
+ */
+public class UMLTextSelectionEditPolicy extends SelectionEditPolicy implements
+ IRefreshableFeedbackEditPolicy {
+
+ /**
+ * @generated
+ */
+ private IFigure selectionFeedbackFigure;
+
+ /**
+ * @generated
+ */
+ private IFigure focusFeedbackFigure;
+
+ /**
+ * @generated
+ */
+ private FigureListener hostPositionListener;
+
+ /**
+ * @generated
+ */
+ protected void showPrimarySelection() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setSelected(true);
+ ((WrappingLabel) getHostFigure()).setFocus(true);
+ } else {
+ showSelection();
+ showFocus();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void showSelection() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setSelected(true);
+ ((WrappingLabel) getHostFigure()).setFocus(false);
+ } else {
+ hideSelection();
+ addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure());
+ getHostFigure().addFigureListener(getHostPositionListener());
+ refreshSelectionFeedback();
+ hideFocus();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void hideSelection() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setSelected(false);
+ ((WrappingLabel) getHostFigure()).setFocus(false);
+ } else {
+ if (selectionFeedbackFigure != null) {
+ removeFeedback(selectionFeedbackFigure);
+ getHostFigure().removeFigureListener(getHostPositionListener());
+ selectionFeedbackFigure = null;
+ }
+ hideFocus();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void showFocus() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setFocus(true);
+ } else {
+ hideFocus();
+ addFeedback(focusFeedbackFigure = createFocusFeedbackFigure());
+ refreshFocusFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void hideFocus() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setFocus(false);
+ } else {
+ if (focusFeedbackFigure != null) {
+ removeFeedback(focusFeedbackFigure);
+ focusFeedbackFigure = null;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Rectangle getFeedbackBounds() {
+ Rectangle bounds;
+ if (getHostFigure() instanceof Label) {
+ bounds = ((Label) getHostFigure()).getTextBounds();
+ bounds.intersect(getHostFigure().getBounds());
+ } else {
+ bounds = getHostFigure().getBounds().getCopy();
+ }
+ getHostFigure().getParent().translateToAbsolute(bounds);
+ getFeedbackLayer().translateToRelative(bounds);
+ return bounds;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createSelectionFeedbackFigure() {
+ if (getHostFigure() instanceof Label) {
+ Label feedbackFigure = new Label();
+ feedbackFigure.setOpaque(true);
+ feedbackFigure
+ .setBackgroundColor(ColorConstants.menuBackgroundSelected);
+ feedbackFigure
+ .setForegroundColor(ColorConstants.menuForegroundSelected);
+ return feedbackFigure;
+ } else {
+ RectangleFigure feedbackFigure = new RectangleFigure();
+ feedbackFigure.setFill(false);
+ return feedbackFigure;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFocusFeedbackFigure() {
+ return new Figure() {
+
+ protected void paintFigure(Graphics graphics) {
+ graphics.drawFocus(getBounds().getResized(-1, -1));
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ protected void updateLabel(Label target) {
+ Label source = (Label) getHostFigure();
+ target.setText(source.getText());
+ target.setTextAlignment(source.getTextAlignment());
+ target.setFont(source.getFont());
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshSelectionFeedback() {
+ if (selectionFeedbackFigure != null) {
+ if (selectionFeedbackFigure instanceof Label) {
+ updateLabel((Label) selectionFeedbackFigure);
+ selectionFeedbackFigure.setBounds(getFeedbackBounds());
+ } else {
+ selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5,
+ 5));
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFocusFeedback() {
+ if (focusFeedbackFigure != null) {
+ focusFeedbackFigure.setBounds(getFeedbackBounds());
+ }
+ }
+
+ /**
+ * @generated
+ */
+
+ public void refreshFeedback() {
+ refreshSelectionFeedback();
+ refreshFocusFeedback();
+ }
+
+ /**
+ * @generated
+ */
+ private FigureListener getHostPositionListener() {
+ if (hostPositionListener == null) {
+ hostPositionListener = new FigureListener() {
+ public void figureMoved(IFigure source) {
+ refreshFeedback();
+ }
+ };
+ }
+ return hostPositionListener;
+ }
+
+}
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLAbstractNavigatorItem.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLAbstractNavigatorItem.java
index 89fb8953e66..ccd8c283612 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLAbstractNavigatorItem.java
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLAbstractNavigatorItem.java
@@ -1,61 +1,61 @@
-package org.eclipse.papyrus.example.diagram.simplediagram.navigator;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
-
-/**
- * @generated
- */
-public abstract class UMLAbstractNavigatorItem extends PlatformObject {
-
- /**
- * @generated
- */
- static {
- final Class[] supportedTypes = new Class[] { ITabbedPropertySheetPageContributor.class };
- final ITabbedPropertySheetPageContributor propertySheetPageContributor = new ITabbedPropertySheetPageContributor() {
- public String getContributorId() {
- return "org.eclipse.uml2.uml.diagram"; //$NON-NLS-1$
- }
- };
- Platform.getAdapterManager().registerAdapters(
- new IAdapterFactory() {
-
- public Object getAdapter(Object adaptableObject,
- Class adapterType) {
- if (adaptableObject instanceof org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLAbstractNavigatorItem
- && adapterType == ITabbedPropertySheetPageContributor.class) {
- return propertySheetPageContributor;
- }
- return null;
- }
-
- public Class[] getAdapterList() {
- return supportedTypes;
- }
- },
- org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLAbstractNavigatorItem.class);
- }
-
- /**
- * @generated
- */
- private Object myParent;
-
- /**
- * @generated
- */
- protected UMLAbstractNavigatorItem(Object parent) {
- myParent = parent;
- }
-
- /**
- * @generated
- */
- public Object getParent() {
- return myParent;
- }
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.navigator;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
+
+/**
+ * @generated
+ */
+public abstract class UMLAbstractNavigatorItem extends PlatformObject {
+
+ /**
+ * @generated
+ */
+ static {
+ final Class[] supportedTypes = new Class[] { ITabbedPropertySheetPageContributor.class };
+ final ITabbedPropertySheetPageContributor propertySheetPageContributor = new ITabbedPropertySheetPageContributor() {
+ public String getContributorId() {
+ return "org.eclipse.uml2.uml.diagram"; //$NON-NLS-1$
+ }
+ };
+ Platform.getAdapterManager().registerAdapters(
+ new IAdapterFactory() {
+
+ public Object getAdapter(Object adaptableObject,
+ Class adapterType) {
+ if (adaptableObject instanceof org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLAbstractNavigatorItem
+ && adapterType == ITabbedPropertySheetPageContributor.class) {
+ return propertySheetPageContributor;
+ }
+ return null;
+ }
+
+ public Class[] getAdapterList() {
+ return supportedTypes;
+ }
+ },
+ org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLAbstractNavigatorItem.class);
+ }
+
+ /**
+ * @generated
+ */
+ private Object myParent;
+
+ /**
+ * @generated
+ */
+ protected UMLAbstractNavigatorItem(Object parent) {
+ myParent = parent;
+ }
+
+ /**
+ * @generated
+ */
+ public Object getParent() {
+ return myParent;
+ }
+
+}
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLDomainNavigatorContentProvider.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLDomainNavigatorContentProvider.java
index c00743a5713..288a70b01ef 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLDomainNavigatorContentProvider.java
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLDomainNavigatorContentProvider.java
@@ -1,230 +1,229 @@
-package org.eclipse.papyrus.example.diagram.simplediagram.navigator;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
-import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
-import org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditorPlugin;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.navigator.ICommonContentExtensionSite;
-import org.eclipse.ui.navigator.ICommonContentProvider;
-
-/**
- * @generated
- */
-public class UMLDomainNavigatorContentProvider implements
- ICommonContentProvider {
-
- /**
- * @generated
- */
- private AdapterFactoryContentProvider myAdapterFctoryContentProvier;
-
- /**
- * @generated
- */
- private static final Object[] EMPTY_ARRAY = new Object[0];
- /**
- * @generated
- */
- private Viewer myViewer;
- /**
- * @generated
- */
- private AdapterFactoryEditingDomain myEditingDomain;
- /**
- * @generated
- */
- private WorkspaceSynchronizer myWorkspaceSynchronizer;
- /**
- * @generated
- */
- private Runnable myViewerRefreshRunnable;
-
- /**
- * @generated
- */
- public UMLDomainNavigatorContentProvider() {
- myAdapterFctoryContentProvier = new AdapterFactoryContentProvider(
- UMLDiagramEditorPlugin.getInstance()
- .getItemProvidersAdapterFactory());
- TransactionalEditingDomain editingDomain = GMFEditingDomainFactory.INSTANCE
- .createEditingDomain();
- myEditingDomain = (AdapterFactoryEditingDomain) editingDomain;
- myEditingDomain.setResourceToReadOnlyMap(new HashMap() {
- public Object get(Object key) {
- if (!containsKey(key)) {
- put(key, Boolean.TRUE);
- }
- return super.get(key);
- }
- });
- myViewerRefreshRunnable = new Runnable() {
- public void run() {
- if (myViewer != null) {
- myViewer.refresh();
- }
- }
- };
- myWorkspaceSynchronizer = new WorkspaceSynchronizer(editingDomain,
- new WorkspaceSynchronizer.Delegate() {
- public void dispose() {
- }
-
- public boolean handleResourceChanged(final Resource resource) {
- for (Iterator it = myEditingDomain.getResourceSet()
- .getResources().iterator(); it.hasNext();) {
- Resource nextResource = (Resource) it.next();
- nextResource.unload();
- }
- if (myViewer != null) {
- myViewer.getControl().getDisplay()
- .asyncExec(myViewerRefreshRunnable);
- }
- return true;
- }
-
- public boolean handleResourceDeleted(Resource resource) {
- for (Iterator it = myEditingDomain.getResourceSet()
- .getResources().iterator(); it.hasNext();) {
- Resource nextResource = (Resource) it.next();
- nextResource.unload();
- }
- if (myViewer != null) {
- myViewer.getControl().getDisplay()
- .asyncExec(myViewerRefreshRunnable);
- }
- return true;
- }
-
- public boolean handleResourceMoved(Resource resource,
- final URI newURI) {
- for (Iterator it = myEditingDomain.getResourceSet()
- .getResources().iterator(); it.hasNext();) {
- Resource nextResource = (Resource) it.next();
- nextResource.unload();
- }
- if (myViewer != null) {
- myViewer.getControl().getDisplay()
- .asyncExec(myViewerRefreshRunnable);
- }
- return true;
- }
- });
- }
-
- /**
- * @generated
- */
- public void dispose() {
- myWorkspaceSynchronizer.dispose();
- myWorkspaceSynchronizer = null;
- myViewerRefreshRunnable = null;
- for (Iterator it = myEditingDomain.getResourceSet().getResources()
- .iterator(); it.hasNext();) {
- Resource resource = (Resource) it.next();
- resource.unload();
- }
- ((TransactionalEditingDomain) myEditingDomain).dispose();
- myEditingDomain = null;
- }
-
- /**
- * @generated
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- myViewer = viewer;
- }
-
- /**
- * @generated
- */
- public Object[] getElements(Object inputElement) {
- return getChildren(inputElement);
- }
-
- /**
- * @generated
- */
- public void restoreState(IMemento aMemento) {
- }
-
- /**
- * @generated
- */
- public void saveState(IMemento aMemento) {
- }
-
- /**
- * @generated
- */
- public void init(ICommonContentExtensionSite aConfig) {
- }
-
- /**
- * @generated
- */
- public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof IFile) {
- IFile file = (IFile) parentElement;
- URI fileURI = URI.createPlatformResourceURI(file.getFullPath()
- .toString(), true);
- Resource resource = myEditingDomain.getResourceSet().getResource(
- fileURI, true);
- return wrapEObjects(
- myAdapterFctoryContentProvier.getChildren(resource),
- parentElement);
- }
-
- if (parentElement instanceof UMLDomainNavigatorItem) {
- return wrapEObjects(
- myAdapterFctoryContentProvier.getChildren(((UMLDomainNavigatorItem) parentElement)
- .getEObject()), parentElement);
- }
- return EMPTY_ARRAY;
- }
-
- /**
- * @generated
- */
- public Object[] wrapEObjects(Object[] objects, Object parentElement) {
- Collection result = new ArrayList();
- for (int i = 0; i < objects.length; i++) {
- if (objects[i] instanceof EObject) {
- result.add(new UMLDomainNavigatorItem((EObject) objects[i],
- parentElement, myAdapterFctoryContentProvier));
- }
- }
- return result.toArray();
- }
-
- /**
- * @generated
- */
- public Object getParent(Object element) {
- if (element instanceof UMLAbstractNavigatorItem) {
- UMLAbstractNavigatorItem abstractNavigatorItem = (UMLAbstractNavigatorItem) element;
- return abstractNavigatorItem.getParent();
- }
- return null;
- }
-
- /**
- * @generated
- */
- public boolean hasChildren(Object element) {
- return element instanceof IFile || getChildren(element).length > 0;
- }
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.navigator;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditorPlugin;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.navigator.ICommonContentExtensionSite;
+import org.eclipse.ui.navigator.ICommonContentProvider;
+
+/**
+ * @generated
+ */
+public class UMLDomainNavigatorContentProvider implements
+ ICommonContentProvider {
+
+ /**
+ * @generated
+ */
+ private AdapterFactoryContentProvider myAdapterFctoryContentProvier;
+
+ /**
+ * @generated
+ */
+ private static final Object[] EMPTY_ARRAY = new Object[0];
+
+ /**
+ * @generated
+ */
+ private Viewer myViewer;
+
+ /**
+ * @generated
+ */
+ private AdapterFactoryEditingDomain myEditingDomain;
+
+ /**
+ * @generated
+ */
+ private WorkspaceSynchronizer myWorkspaceSynchronizer;
+
+ /**
+ * @generated
+ */
+ private Runnable myViewerRefreshRunnable;
+
+ /**
+ * @generated
+ */
+ public UMLDomainNavigatorContentProvider() {
+ myAdapterFctoryContentProvier = new AdapterFactoryContentProvider(
+ UMLDiagramEditorPlugin.getInstance()
+ .getItemProvidersAdapterFactory());
+ TransactionalEditingDomain editingDomain = GMFEditingDomainFactory.INSTANCE
+ .createEditingDomain();
+ myEditingDomain = (AdapterFactoryEditingDomain) editingDomain;
+ myEditingDomain.setResourceToReadOnlyMap(new HashMap() {
+ public Object get(Object key) {
+ if (!containsKey(key)) {
+ put(key, Boolean.TRUE);
+ }
+ return super.get(key);
+ }
+ });
+ myViewerRefreshRunnable = new Runnable() {
+ public void run() {
+ if (myViewer != null) {
+ myViewer.refresh();
+ }
+ }
+ };
+ myWorkspaceSynchronizer = new WorkspaceSynchronizer(editingDomain,
+ new WorkspaceSynchronizer.Delegate() {
+ public void dispose() {
+ }
+
+ public boolean handleResourceChanged(final Resource resource) {
+ unloadAllResources();
+ asyncRefresh();
+ return true;
+ }
+
+ public boolean handleResourceDeleted(Resource resource) {
+ unloadAllResources();
+ asyncRefresh();
+ return true;
+ }
+
+ public boolean handleResourceMoved(Resource resource,
+ final URI newURI) {
+ unloadAllResources();
+ asyncRefresh();
+ return true;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ public void dispose() {
+ myWorkspaceSynchronizer.dispose();
+ myWorkspaceSynchronizer = null;
+ myViewerRefreshRunnable = null;
+ myViewer = null;
+ unloadAllResources();
+ ((TransactionalEditingDomain) myEditingDomain).dispose();
+ myEditingDomain = null;
+ }
+
+ /**
+ * @generated
+ */
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ myViewer = viewer;
+ }
+
+ /**
+ * @generated
+ */
+ void unloadAllResources() {
+ for (Resource nextResource : myEditingDomain.getResourceSet()
+ .getResources()) {
+ nextResource.unload();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ void asyncRefresh() {
+ if (myViewer != null && !myViewer.getControl().isDisposed()) {
+ myViewer.getControl().getDisplay()
+ .asyncExec(myViewerRefreshRunnable);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public Object[] getElements(Object inputElement) {
+ return getChildren(inputElement);
+ }
+
+ /**
+ * @generated
+ */
+ public void restoreState(IMemento aMemento) {
+ }
+
+ /**
+ * @generated
+ */
+ public void saveState(IMemento aMemento) {
+ }
+
+ /**
+ * @generated
+ */
+ public void init(ICommonContentExtensionSite aConfig) {
+ }
+
+ /**
+ * @generated
+ */
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof IFile) {
+ IFile file = (IFile) parentElement;
+ URI fileURI = URI.createPlatformResourceURI(file.getFullPath()
+ .toString(), true);
+ Resource resource = myEditingDomain.getResourceSet().getResource(
+ fileURI, true);
+ return wrapEObjects(
+ myAdapterFctoryContentProvier.getChildren(resource),
+ parentElement);
+ }
+
+ if (parentElement instanceof UMLDomainNavigatorItem) {
+ return wrapEObjects(
+ myAdapterFctoryContentProvier.getChildren(((UMLDomainNavigatorItem) parentElement)
+ .getEObject()), parentElement);
+ }
+ return EMPTY_ARRAY;
+ }
+
+ /**
+ * @generated
+ */
+ public Object[] wrapEObjects(Object[] objects, Object parentElement) {
+ Collection result = new ArrayList();
+ for (int i = 0; i < objects.length; i++) {
+ if (objects[i] instanceof EObject) {
+ result.add(new UMLDomainNavigatorItem((EObject) objects[i],
+ parentElement, myAdapterFctoryContentProvier));
+ }
+ }
+ return result.toArray();
+ }
+
+ /**
+ * @generated
+ */
+ public Object getParent(Object element) {
+ if (element instanceof UMLAbstractNavigatorItem) {
+ UMLAbstractNavigatorItem abstractNavigatorItem = (UMLAbstractNavigatorItem) element;
+ return abstractNavigatorItem.getParent();
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean hasChildren(Object element) {
+ return element instanceof IFile || getChildren(element).length > 0;
+ }
+
+}
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLDomainNavigatorItem.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLDomainNavigatorItem.java
index 4fc3fba6bac..e2b0cd94ef3 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLDomainNavigatorItem.java
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLDomainNavigatorItem.java
@@ -1,117 +1,117 @@
-package org.eclipse.papyrus.example.diagram.simplediagram.navigator;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.ui.views.properties.IPropertySourceProvider;
-
-/**
- * @generated
- */
-public class UMLDomainNavigatorItem extends PlatformObject {
-
- /**
- * @generated
- */
- static {
- final Class[] supportedTypes = new Class[] { EObject.class,
- IPropertySource.class };
- Platform.getAdapterManager().registerAdapters(
- new IAdapterFactory() {
-
- public Object getAdapter(Object adaptableObject,
- Class adapterType) {
- if (adaptableObject instanceof org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLDomainNavigatorItem) {
- org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLDomainNavigatorItem domainNavigatorItem = (org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLDomainNavigatorItem) adaptableObject;
- EObject eObject = domainNavigatorItem.getEObject();
- if (adapterType == EObject.class) {
- return eObject;
- }
- if (adapterType == IPropertySource.class) {
- return domainNavigatorItem
- .getPropertySourceProvider()
- .getPropertySource(eObject);
- }
- }
-
- return null;
- }
-
- public Class[] getAdapterList() {
- return supportedTypes;
- }
- },
- org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLDomainNavigatorItem.class);
- }
-
- /**
- * @generated
- */
- private Object myParent;
-
- /**
- * @generated
- */
- private EObject myEObject;
-
- /**
- * @generated
- */
- private IPropertySourceProvider myPropertySourceProvider;
-
- /**
- * @generated
- */
- public UMLDomainNavigatorItem(EObject eObject, Object parent,
- IPropertySourceProvider propertySourceProvider) {
- myParent = parent;
- myEObject = eObject;
- myPropertySourceProvider = propertySourceProvider;
- }
-
- /**
- * @generated
- */
- public Object getParent() {
- return myParent;
- }
-
- /**
- * @generated
- */
- public EObject getEObject() {
- return myEObject;
- }
-
- /**
- * @generated
- */
- public IPropertySourceProvider getPropertySourceProvider() {
- return myPropertySourceProvider;
- }
-
- /**
- * @generated
- */
- public boolean equals(Object obj) {
- if (obj instanceof org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLDomainNavigatorItem) {
- return EcoreUtil
- .getURI(getEObject())
- .equals(EcoreUtil
- .getURI(((org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLDomainNavigatorItem) obj)
- .getEObject()));
- }
- return super.equals(obj);
- }
-
- /**
- * @generated
- */
- public int hashCode() {
- return EcoreUtil.getURI(getEObject()).hashCode();
- }
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.navigator;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.ui.views.properties.IPropertySourceProvider;
+
+/**
+ * @generated
+ */
+public class UMLDomainNavigatorItem extends PlatformObject {
+
+ /**
+ * @generated
+ */
+ static {
+ final Class[] supportedTypes = new Class[] { EObject.class,
+ IPropertySource.class };
+ Platform.getAdapterManager().registerAdapters(
+ new IAdapterFactory() {
+
+ public Object getAdapter(Object adaptableObject,
+ Class adapterType) {
+ if (adaptableObject instanceof org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLDomainNavigatorItem) {
+ org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLDomainNavigatorItem domainNavigatorItem = (org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLDomainNavigatorItem) adaptableObject;
+ EObject eObject = domainNavigatorItem.getEObject();
+ if (adapterType == EObject.class) {
+ return eObject;
+ }
+ if (adapterType == IPropertySource.class) {
+ return domainNavigatorItem
+ .getPropertySourceProvider()
+ .getPropertySource(eObject);
+ }
+ }
+
+ return null;
+ }
+
+ public Class[] getAdapterList() {
+ return supportedTypes;
+ }
+ },
+ org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLDomainNavigatorItem.class);
+ }
+
+ /**
+ * @generated
+ */
+ private Object myParent;
+
+ /**
+ * @generated
+ */
+ private EObject myEObject;
+
+ /**
+ * @generated
+ */
+ private IPropertySourceProvider myPropertySourceProvider;
+
+ /**
+ * @generated
+ */
+ public UMLDomainNavigatorItem(EObject eObject, Object parent,
+ IPropertySourceProvider propertySourceProvider) {
+ myParent = parent;
+ myEObject = eObject;
+ myPropertySourceProvider = propertySourceProvider;
+ }
+
+ /**
+ * @generated
+ */
+ public Object getParent() {
+ return myParent;
+ }
+
+ /**
+ * @generated
+ */
+ public EObject getEObject() {
+ return myEObject;
+ }
+
+ /**
+ * @generated
+ */
+ public IPropertySourceProvider getPropertySourceProvider() {
+ return myPropertySourceProvider;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean equals(Object obj) {
+ if (obj instanceof org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLDomainNavigatorItem) {
+ return EcoreUtil
+ .getURI(getEObject())
+ .equals(EcoreUtil
+ .getURI(((org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLDomainNavigatorItem) obj)
+ .getEObject()));
+ }
+ return super.equals(obj);
+ }
+
+ /**
+ * @generated
+ */
+ public int hashCode() {
+ return EcoreUtil.getURI(getEObject()).hashCode();
+ }
+
+}
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLDomainNavigatorLabelProvider.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLDomainNavigatorLabelProvider.java
index f85d66abf52..54d0bcc36ff 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLDomainNavigatorLabelProvider.java
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLDomainNavigatorLabelProvider.java
@@ -1,98 +1,98 @@
-package org.eclipse.papyrus.example.diagram.simplediagram.navigator;
-
-import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditorPlugin;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.navigator.ICommonContentExtensionSite;
-import org.eclipse.ui.navigator.ICommonLabelProvider;
-
-/**
- * @generated
- */
-public class UMLDomainNavigatorLabelProvider implements ICommonLabelProvider {
-
- /**
- * @generated
- */
- private AdapterFactoryLabelProvider myAdapterFactoryLabelProvider = new AdapterFactoryLabelProvider(
- UMLDiagramEditorPlugin.getInstance()
- .getItemProvidersAdapterFactory());
-
- /**
- * @generated
- */
- public void init(ICommonContentExtensionSite aConfig) {
- }
-
- /**
- * @generated
- */
- public Image getImage(Object element) {
- if (element instanceof UMLDomainNavigatorItem) {
- return myAdapterFactoryLabelProvider
- .getImage(((UMLDomainNavigatorItem) element).getEObject());
- }
- return null;
- }
-
- /**
- * @generated
- */
- public String getText(Object element) {
- if (element instanceof UMLDomainNavigatorItem) {
- return myAdapterFactoryLabelProvider
- .getText(((UMLDomainNavigatorItem) element).getEObject());
- }
- return null;
- }
-
- /**
- * @generated
- */
- public void addListener(ILabelProviderListener listener) {
- myAdapterFactoryLabelProvider.addListener(listener);
- }
-
- /**
- * @generated
- */
- public void dispose() {
- myAdapterFactoryLabelProvider.dispose();
- }
-
- /**
- * @generated
- */
- public boolean isLabelProperty(Object element, String property) {
- return myAdapterFactoryLabelProvider.isLabelProperty(element, property);
- }
-
- /**
- * @generated
- */
- public void removeListener(ILabelProviderListener listener) {
- myAdapterFactoryLabelProvider.removeListener(listener);
- }
-
- /**
- * @generated
- */
- public void restoreState(IMemento aMemento) {
- }
-
- /**
- * @generated
- */
- public void saveState(IMemento aMemento) {
- }
-
- /**
- * @generated
- */
- public String getDescription(Object anElement) {
- return null;
- }
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.navigator;
+
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditorPlugin;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.navigator.ICommonContentExtensionSite;
+import org.eclipse.ui.navigator.ICommonLabelProvider;
+
+/**
+ * @generated
+ */
+public class UMLDomainNavigatorLabelProvider implements ICommonLabelProvider {
+
+ /**
+ * @generated
+ */
+ private AdapterFactoryLabelProvider myAdapterFactoryLabelProvider = new AdapterFactoryLabelProvider(
+ UMLDiagramEditorPlugin.getInstance()
+ .getItemProvidersAdapterFactory());
+
+ /**
+ * @generated
+ */
+ public void init(ICommonContentExtensionSite aConfig) {
+ }
+
+ /**
+ * @generated
+ */
+ public Image getImage(Object element) {
+ if (element instanceof UMLDomainNavigatorItem) {
+ return myAdapterFactoryLabelProvider
+ .getImage(((UMLDomainNavigatorItem) element).getEObject());
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public String getText(Object element) {
+ if (element instanceof UMLDomainNavigatorItem) {
+ return myAdapterFactoryLabelProvider
+ .getText(((UMLDomainNavigatorItem) element).getEObject());
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public void addListener(ILabelProviderListener listener) {
+ myAdapterFactoryLabelProvider.addListener(listener);
+ }
+
+ /**
+ * @generated
+ */
+ public void dispose() {
+ myAdapterFactoryLabelProvider.dispose();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isLabelProperty(Object element, String property) {
+ return myAdapterFactoryLabelProvider.isLabelProperty(element, property);
+ }
+
+ /**
+ * @generated
+ */
+ public void removeListener(ILabelProviderListener listener) {
+ myAdapterFactoryLabelProvider.removeListener(listener);
+ }
+
+ /**
+ * @generated
+ */
+ public void restoreState(IMemento aMemento) {
+ }
+
+ /**
+ * @generated
+ */
+ public void saveState(IMemento aMemento) {
+ }
+
+ /**
+ * @generated
+ */
+ public String getDescription(Object anElement) {
+ return null;
+ }
+
+}
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLNavigatorActionProvider.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLNavigatorActionProvider.java
index 5cf944b823f..4a334567c98 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLNavigatorActionProvider.java
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLNavigatorActionProvider.java
@@ -1,176 +1,176 @@
-package org.eclipse.papyrus.example.diagram.simplediagram.navigator;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.ui.URIEditorInput;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ModelEditPart;
-import org.eclipse.papyrus.example.diagram.simplediagram.part.Messages;
-import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditor;
-import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.navigator.CommonActionProvider;
-import org.eclipse.ui.navigator.ICommonActionConstants;
-import org.eclipse.ui.navigator.ICommonActionExtensionSite;
-import org.eclipse.ui.navigator.ICommonViewerWorkbenchSite;
-import org.eclipse.ui.part.FileEditorInput;
-
-/**
- * @generated
- */
-public class UMLNavigatorActionProvider extends CommonActionProvider {
-
- /**
- * @generated
- */
- private boolean myContribute;
-
- /**
- * @generated
- */
- private OpenDiagramAction myOpenDiagramAction;
-
- /**
- * @generated
- */
- public void init(ICommonActionExtensionSite aSite) {
- super.init(aSite);
- if (aSite.getViewSite() instanceof ICommonViewerWorkbenchSite) {
- myContribute = true;
- makeActions((ICommonViewerWorkbenchSite) aSite.getViewSite());
- } else {
- myContribute = false;
- }
- }
-
- /**
- * @generated
- */
- private void makeActions(ICommonViewerWorkbenchSite viewerSite) {
- myOpenDiagramAction = new OpenDiagramAction(viewerSite);
- }
-
- /**
- * @generated
- */
- public void fillActionBars(IActionBars actionBars) {
- if (!myContribute) {
- return;
- }
- IStructuredSelection selection = (IStructuredSelection) getContext()
- .getSelection();
- myOpenDiagramAction.selectionChanged(selection);
- if (myOpenDiagramAction.isEnabled()) {
- actionBars.setGlobalActionHandler(ICommonActionConstants.OPEN,
- myOpenDiagramAction);
- }
- }
-
- /**
- * @generated
- */
- public void fillContextMenu(IMenuManager menu) {
- }
-
- /**
- * @generated
- */
- private static class OpenDiagramAction extends Action {
-
- /**
- * @generated
- */
- private Diagram myDiagram;
-
- /**
- * @generated
- */
- private ICommonViewerWorkbenchSite myViewerSite;
-
- /**
- * @generated
- */
- public OpenDiagramAction(ICommonViewerWorkbenchSite viewerSite) {
- super(Messages.NavigatorActionProvider_OpenDiagramActionName);
- myViewerSite = viewerSite;
- }
-
- /**
- * @generated
- */
- public final void selectionChanged(IStructuredSelection selection) {
- myDiagram = null;
- if (selection.size() == 1) {
- Object selectedElement = selection.getFirstElement();
- if (selectedElement instanceof UMLNavigatorItem) {
- selectedElement = ((UMLNavigatorItem) selectedElement)
- .getView();
- } else if (selectedElement instanceof IAdaptable) {
- selectedElement = ((IAdaptable) selectedElement)
- .getAdapter(View.class);
- }
- if (selectedElement instanceof Diagram) {
- Diagram diagram = (Diagram) selectedElement;
- if (ModelEditPart.MODEL_ID.equals(UMLVisualIDRegistry
- .getModelID(diagram))) {
- myDiagram = diagram;
- }
- }
- }
- setEnabled(myDiagram != null);
- }
-
- /**
- * @generated
- */
- public void run() {
- if (myDiagram == null || myDiagram.eResource() == null) {
- return;
- }
-
- IEditorInput editorInput = getEditorInput(myDiagram);
- IWorkbenchPage page = myViewerSite.getPage();
- try {
- page.openEditor(editorInput, UMLDiagramEditor.ID);
- } catch (PartInitException e) {
- UMLDiagramEditorPlugin.getInstance().logError(
- "Exception while openning diagram", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private static IEditorInput getEditorInput(Diagram diagram) {
- Resource diagramResource = diagram.eResource();
- for (EObject nextEObject : diagramResource.getContents()) {
- if (nextEObject == diagram) {
- return new FileEditorInput(
- WorkspaceSynchronizer.getFile(diagramResource));
- }
- if (nextEObject instanceof Diagram) {
- break;
- }
- }
- URI uri = EcoreUtil.getURI(diagram);
- String editorName = uri.lastSegment() + '#'
- + diagram.eResource().getContents().indexOf(diagram);
- IEditorInput editorInput = new URIEditorInput(uri, editorName);
- return editorInput;
- }
-
- }
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.navigator;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.ui.URIEditorInput;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ModelEditPart;
+import org.eclipse.papyrus.example.diagram.simplediagram.part.Messages;
+import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditor;
+import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.navigator.CommonActionProvider;
+import org.eclipse.ui.navigator.ICommonActionConstants;
+import org.eclipse.ui.navigator.ICommonActionExtensionSite;
+import org.eclipse.ui.navigator.ICommonViewerWorkbenchSite;
+import org.eclipse.ui.part.FileEditorInput;
+
+/**
+ * @generated
+ */
+public class UMLNavigatorActionProvider extends CommonActionProvider {
+
+ /**
+ * @generated
+ */
+ private boolean myContribute;
+
+ /**
+ * @generated
+ */
+ private OpenDiagramAction myOpenDiagramAction;
+
+ /**
+ * @generated
+ */
+ public void init(ICommonActionExtensionSite aSite) {
+ super.init(aSite);
+ if (aSite.getViewSite() instanceof ICommonViewerWorkbenchSite) {
+ myContribute = true;
+ makeActions((ICommonViewerWorkbenchSite) aSite.getViewSite());
+ } else {
+ myContribute = false;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void makeActions(ICommonViewerWorkbenchSite viewerSite) {
+ myOpenDiagramAction = new OpenDiagramAction(viewerSite);
+ }
+
+ /**
+ * @generated
+ */
+ public void fillActionBars(IActionBars actionBars) {
+ if (!myContribute) {
+ return;
+ }
+ IStructuredSelection selection = (IStructuredSelection) getContext()
+ .getSelection();
+ myOpenDiagramAction.selectionChanged(selection);
+ if (myOpenDiagramAction.isEnabled()) {
+ actionBars.setGlobalActionHandler(ICommonActionConstants.OPEN,
+ myOpenDiagramAction);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void fillContextMenu(IMenuManager menu) {
+ }
+
+ /**
+ * @generated
+ */
+ private static class OpenDiagramAction extends Action {
+
+ /**
+ * @generated
+ */
+ private Diagram myDiagram;
+
+ /**
+ * @generated
+ */
+ private ICommonViewerWorkbenchSite myViewerSite;
+
+ /**
+ * @generated
+ */
+ public OpenDiagramAction(ICommonViewerWorkbenchSite viewerSite) {
+ super(Messages.NavigatorActionProvider_OpenDiagramActionName);
+ myViewerSite = viewerSite;
+ }
+
+ /**
+ * @generated
+ */
+ public final void selectionChanged(IStructuredSelection selection) {
+ myDiagram = null;
+ if (selection.size() == 1) {
+ Object selectedElement = selection.getFirstElement();
+ if (selectedElement instanceof UMLNavigatorItem) {
+ selectedElement = ((UMLNavigatorItem) selectedElement)
+ .getView();
+ } else if (selectedElement instanceof IAdaptable) {
+ selectedElement = ((IAdaptable) selectedElement)
+ .getAdapter(View.class);
+ }
+ if (selectedElement instanceof Diagram) {
+ Diagram diagram = (Diagram) selectedElement;
+ if (ModelEditPart.MODEL_ID.equals(UMLVisualIDRegistry
+ .getModelID(diagram))) {
+ myDiagram = diagram;
+ }
+ }
+ }
+ setEnabled(myDiagram != null);
+ }
+
+ /**
+ * @generated
+ */
+ public void run() {
+ if (myDiagram == null || myDiagram.eResource() == null) {
+ return;
+ }
+
+ IEditorInput editorInput = getEditorInput(myDiagram);
+ IWorkbenchPage page = myViewerSite.getPage();
+ try {
+ page.openEditor(editorInput, UMLDiagramEditor.ID);
+ } catch (PartInitException e) {
+ UMLDiagramEditorPlugin.getInstance().logError(
+ "Exception while openning diagram", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private static IEditorInput getEditorInput(Diagram diagram) {
+ Resource diagramResource = diagram.eResource();
+ for (EObject nextEObject : diagramResource.getContents()) {
+ if (nextEObject == diagram) {
+ return new FileEditorInput(
+ WorkspaceSynchronizer.getFile(diagramResource));
+ }
+ if (nextEObject instanceof Diagram) {
+ break;
+ }
+ }
+ URI uri = EcoreUtil.getURI(diagram);
+ String editorName = uri.lastSegment() + '#'
+ + diagram.eResource().getContents().indexOf(diagram);
+ IEditorInput editorInput = new URIEditorInput(uri, editorName);
+ return editorInput;
+ }
+
+ }
+
+}
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLNavigatorContentProvider.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLNavigatorContentProvider.java
index d952b9b8ea1..420181e6e89 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLNavigatorContentProvider.java
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLNavigatorContentProvider.java
@@ -1,368 +1,366 @@
-package org.eclipse.papyrus.example.diagram.simplediagram.navigator;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
-import org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.Edge;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ComponentEditPart;
-import org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ModelEditPart;
-import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.navigator.ICommonContentExtensionSite;
-import org.eclipse.ui.navigator.ICommonContentProvider;
-
-/**
- * @generated
- */
-public class UMLNavigatorContentProvider implements ICommonContentProvider {
- /**
- * @generated
- */
- private static final Object[] EMPTY_ARRAY = new Object[0];
- /**
- * @generated
- */
- private Viewer myViewer;
- /**
- * @generated
- */
- private AdapterFactoryEditingDomain myEditingDomain;
- /**
- * @generated
- */
- private WorkspaceSynchronizer myWorkspaceSynchronizer;
- /**
- * @generated
- */
- private Runnable myViewerRefreshRunnable;
-
- /**
- * @generated
- */
- @SuppressWarnings({ "unchecked", "serial", "rawtypes" })
- public UMLNavigatorContentProvider() {
- TransactionalEditingDomain editingDomain = GMFEditingDomainFactory.INSTANCE
- .createEditingDomain();
- myEditingDomain = (AdapterFactoryEditingDomain) editingDomain;
- myEditingDomain.setResourceToReadOnlyMap(new HashMap() {
- public Object get(Object key) {
- if (!containsKey(key)) {
- put(key, Boolean.TRUE);
- }
- return super.get(key);
- }
- });
- myViewerRefreshRunnable = new Runnable() {
- public void run() {
- if (myViewer != null) {
- myViewer.refresh();
- }
- }
- };
- myWorkspaceSynchronizer = new WorkspaceSynchronizer(editingDomain,
- new WorkspaceSynchronizer.Delegate() {
- public void dispose() {
- }
-
- public boolean handleResourceChanged(final Resource resource) {
- for (Iterator it = myEditingDomain.getResourceSet()
- .getResources().iterator(); it.hasNext();) {
- Resource nextResource = (Resource) it.next();
- nextResource.unload();
- }
- if (myViewer != null) {
- myViewer.getControl().getDisplay()
- .asyncExec(myViewerRefreshRunnable);
- }
- return true;
- }
-
- public boolean handleResourceDeleted(Resource resource) {
- for (Iterator it = myEditingDomain.getResourceSet()
- .getResources().iterator(); it.hasNext();) {
- Resource nextResource = (Resource) it.next();
- nextResource.unload();
- }
- if (myViewer != null) {
- myViewer.getControl().getDisplay()
- .asyncExec(myViewerRefreshRunnable);
- }
- return true;
- }
-
- public boolean handleResourceMoved(Resource resource,
- final URI newURI) {
- for (Iterator it = myEditingDomain.getResourceSet()
- .getResources().iterator(); it.hasNext();) {
- Resource nextResource = (Resource) it.next();
- nextResource.unload();
- }
- if (myViewer != null) {
- myViewer.getControl().getDisplay()
- .asyncExec(myViewerRefreshRunnable);
- }
- return true;
- }
- });
- }
-
- /**
- *
- *Papyrus Template
- *this method is a modification of gmf code in order to avoid getViewChidreen() method becoming greater than 64kb.
- *@generated
- **/
- private Object[] getViewChildrenForModelEditPart(View view,
- Object parentElement) {
- Collection result = new ArrayList();
- Collection connectedViews = getChildrenByType(
- Collections.singleton(view),
- UMLVisualIDRegistry.getType(ComponentEditPart.VISUAL_ID));
- result.addAll(createNavigatorItems(connectedViews, parentElement, false));
- return result.toArray();
- }
-
- /**
- * @generated
- */
- public void dispose() {
- myWorkspaceSynchronizer.dispose();
- myWorkspaceSynchronizer = null;
- myViewerRefreshRunnable = null;
- for (Iterator it = myEditingDomain.getResourceSet().getResources()
- .iterator(); it.hasNext();) {
- Resource resource = (Resource) it.next();
- resource.unload();
- }
- ((TransactionalEditingDomain) myEditingDomain).dispose();
- myEditingDomain = null;
- }
-
- /**
- * @generated
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- myViewer = viewer;
- }
-
- /**
- * @generated
- */
- public Object[] getElements(Object inputElement) {
- return getChildren(inputElement);
- }
-
- /**
- * @generated
- */
- public void restoreState(IMemento aMemento) {
- }
-
- /**
- * @generated
- */
- public void saveState(IMemento aMemento) {
- }
-
- /**
- * @generated
- */
- public void init(ICommonContentExtensionSite aConfig) {
- }
-
- /**
- * @generated
- */
- public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof IFile) {
- IFile file = (IFile) parentElement;
- URI fileURI = URI.createPlatformResourceURI(file.getFullPath()
- .toString(), true);
- Resource resource = myEditingDomain.getResourceSet().getResource(
- fileURI, true);
- Collection result = new ArrayList();
- result.addAll(createNavigatorItems(
- selectViewsByType(resource.getContents(),
- ModelEditPart.MODEL_ID), file, false));
- return result.toArray();
- }
-
- if (parentElement instanceof UMLNavigatorGroup) {
- UMLNavigatorGroup group = (UMLNavigatorGroup) parentElement;
- return group.getChildren();
- }
-
- if (parentElement instanceof UMLNavigatorItem) {
- UMLNavigatorItem navigatorItem = (UMLNavigatorItem) parentElement;
- if (navigatorItem.isLeaf() || !isOwnView(navigatorItem.getView())) {
- return EMPTY_ARRAY;
- }
- return getViewChildren(navigatorItem.getView(), parentElement);
- }
-
- return EMPTY_ARRAY;
- }
-
- /**
- * @generated
- */
- private Object[] getViewChildren(View view, Object parentElement) {
- switch (UMLVisualIDRegistry.getVisualID(view)) {
-
- case ModelEditPart.VISUAL_ID: {
-
- //modification of the template to avoid mistake of 65kb.
- return getViewChildrenForModelEditPart(view, parentElement);
-
- }
-
- }
- return EMPTY_ARRAY;
- }
-
- /**
- * @generated
- */
- private Collection getLinksSourceByType(Collection edges, String type) {
- Collection result = new ArrayList();
- for (Iterator it = edges.iterator(); it.hasNext();) {
- Edge nextEdge = (Edge) it.next();
- View nextEdgeSource = nextEdge.getSource();
- if (type.equals(nextEdgeSource.getType())
- && isOwnView(nextEdgeSource)) {
- result.add(nextEdgeSource);
- }
- }
- return result;
- }
-
- /**
- * @generated
- */
- private Collection getLinksTargetByType(Collection edges, String type) {
- Collection result = new ArrayList();
- for (Iterator it = edges.iterator(); it.hasNext();) {
- Edge nextEdge = (Edge) it.next();
- View nextEdgeTarget = nextEdge.getTarget();
- if (type.equals(nextEdgeTarget.getType())
- && isOwnView(nextEdgeTarget)) {
- result.add(nextEdgeTarget);
- }
- }
- return result;
- }
-
- /**
- * @generated
- */
- private Collection getOutgoingLinksByType(Collection nodes, String type) {
- Collection result = new ArrayList();
- for (Iterator it = nodes.iterator(); it.hasNext();) {
- View nextNode = (View) it.next();
- result.addAll(selectViewsByType(nextNode.getSourceEdges(), type));
- }
- return result;
- }
-
- /**
- * @generated
- */
- private Collection getIncomingLinksByType(Collection nodes, String type) {
- Collection result = new ArrayList();
- for (Iterator it = nodes.iterator(); it.hasNext();) {
- View nextNode = (View) it.next();
- result.addAll(selectViewsByType(nextNode.getTargetEdges(), type));
- }
- return result;
- }
-
- /**
- * @generated
- */
- private Collection getChildrenByType(Collection nodes, String type) {
- Collection result = new ArrayList();
- for (Iterator it = nodes.iterator(); it.hasNext();) {
- View nextNode = (View) it.next();
- result.addAll(selectViewsByType(nextNode.getChildren(), type));
- }
- return result;
- }
-
- /**
- * @generated
- */
- private Collection getDiagramLinksByType(Collection diagrams, String type) {
- Collection result = new ArrayList();
- for (Iterator it = diagrams.iterator(); it.hasNext();) {
- Diagram nextDiagram = (Diagram) it.next();
- result.addAll(selectViewsByType(nextDiagram.getEdges(), type));
- }
- return result;
- }
-
- /**
- * @generated
- */
- private Collection selectViewsByType(Collection views, String type) {
- Collection result = new ArrayList();
- for (Iterator it = views.iterator(); it.hasNext();) {
- View nextView = (View) it.next();
- if (type.equals(nextView.getType()) && isOwnView(nextView)) {
- result.add(nextView);
- }
- }
- return result;
- }
-
- /**
- * @generated
- */
- private boolean isOwnView(View view) {
- return ModelEditPart.MODEL_ID.equals(UMLVisualIDRegistry
- .getModelID(view));
- }
-
- /**
- * @generated
- */
- private Collection createNavigatorItems(Collection views, Object parent,
- boolean isLeafs) {
- Collection result = new ArrayList();
- for (Iterator it = views.iterator(); it.hasNext();) {
- result.add(new UMLNavigatorItem((View) it.next(), parent, isLeafs));
- }
- return result;
- }
-
- /**
- * @generated
- */
- public Object getParent(Object element) {
- if (element instanceof UMLAbstractNavigatorItem) {
- UMLAbstractNavigatorItem abstractNavigatorItem = (UMLAbstractNavigatorItem) element;
- return abstractNavigatorItem.getParent();
- }
- return null;
- }
-
- /**
- * @generated
- */
- public boolean hasChildren(Object element) {
- return element instanceof IFile || getChildren(element).length > 0;
- }
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.navigator;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedList;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ComponentEditPart;
+import org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ModelEditPart;
+import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.navigator.ICommonContentExtensionSite;
+import org.eclipse.ui.navigator.ICommonContentProvider;
+
+/**
+ * @generated
+ */
+public class UMLNavigatorContentProvider implements ICommonContentProvider {
+
+ /**
+ * @generated
+ */
+ private static final Object[] EMPTY_ARRAY = new Object[0];
+
+ /**
+ * @generated
+ */
+ private Viewer myViewer;
+
+ /**
+ * @generated
+ */
+ private AdapterFactoryEditingDomain myEditingDomain;
+
+ /**
+ * @generated
+ */
+ private WorkspaceSynchronizer myWorkspaceSynchronizer;
+
+ /**
+ * @generated
+ */
+ private Runnable myViewerRefreshRunnable;
+
+ /**
+ * @generated
+ */
+ @SuppressWarnings({ "unchecked", "serial", "rawtypes" })
+ public UMLNavigatorContentProvider() {
+ TransactionalEditingDomain editingDomain = GMFEditingDomainFactory.INSTANCE
+ .createEditingDomain();
+ myEditingDomain = (AdapterFactoryEditingDomain) editingDomain;
+ myEditingDomain.setResourceToReadOnlyMap(new HashMap() {
+ public Object get(Object key) {
+ if (!containsKey(key)) {
+ put(key, Boolean.TRUE);
+ }
+ return super.get(key);
+ }
+ });
+ myViewerRefreshRunnable = new Runnable() {
+ public void run() {
+ if (myViewer != null) {
+ myViewer.refresh();
+ }
+ }
+ };
+ myWorkspaceSynchronizer = new WorkspaceSynchronizer(editingDomain,
+ new WorkspaceSynchronizer.Delegate() {
+ public void dispose() {
+ }
+
+ public boolean handleResourceChanged(final Resource resource) {
+ unloadAllResources();
+ asyncRefresh();
+ return true;
+ }
+
+ public boolean handleResourceDeleted(Resource resource) {
+ unloadAllResources();
+ asyncRefresh();
+ return true;
+ }
+
+ public boolean handleResourceMoved(Resource resource,
+ final URI newURI) {
+ unloadAllResources();
+ asyncRefresh();
+ return true;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ public void dispose() {
+ myWorkspaceSynchronizer.dispose();
+ myWorkspaceSynchronizer = null;
+ myViewerRefreshRunnable = null;
+ myViewer = null;
+ unloadAllResources();
+ ((TransactionalEditingDomain) myEditingDomain).dispose();
+ myEditingDomain = null;
+ }
+
+ /**
+ * @generated
+ */
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ myViewer = viewer;
+ }
+
+ /**
+ * @generated
+ */
+ void unloadAllResources() {
+ for (Resource nextResource : myEditingDomain.getResourceSet()
+ .getResources()) {
+ nextResource.unload();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ void asyncRefresh() {
+ if (myViewer != null && !myViewer.getControl().isDisposed()) {
+ myViewer.getControl().getDisplay()
+ .asyncExec(myViewerRefreshRunnable);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public Object[] getElements(Object inputElement) {
+ return getChildren(inputElement);
+ }
+
+ /**
+ * @generated
+ */
+ public void restoreState(IMemento aMemento) {
+ }
+
+ /**
+ * @generated
+ */
+ public void saveState(IMemento aMemento) {
+ }
+
+ /**
+ * @generated
+ */
+ public void init(ICommonContentExtensionSite aConfig) {
+ }
+
+ /**
+ * @generated
+ */
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof IFile) {
+ IFile file = (IFile) parentElement;
+ URI fileURI = URI.createPlatformResourceURI(file.getFullPath()
+ .toString(), true);
+ Resource resource = myEditingDomain.getResourceSet().getResource(
+ fileURI, true);
+ ArrayList<UMLNavigatorItem> result = new ArrayList<UMLNavigatorItem>();
+ ArrayList<View> topViews = new ArrayList<View>(resource
+ .getContents().size());
+ for (EObject o : resource.getContents()) {
+ if (o instanceof View) {
+ topViews.add((View) o);
+ }
+ }
+ result.addAll(createNavigatorItems(
+ selectViewsByType(topViews, ModelEditPart.MODEL_ID), file,
+ false));
+ return result.toArray();
+ }
+
+ if (parentElement instanceof UMLNavigatorGroup) {
+ UMLNavigatorGroup group = (UMLNavigatorGroup) parentElement;
+ return group.getChildren();
+ }
+
+ if (parentElement instanceof UMLNavigatorItem) {
+ UMLNavigatorItem navigatorItem = (UMLNavigatorItem) parentElement;
+ if (navigatorItem.isLeaf() || !isOwnView(navigatorItem.getView())) {
+ return EMPTY_ARRAY;
+ }
+ return getViewChildren(navigatorItem.getView(), parentElement);
+ }
+
+ return EMPTY_ARRAY;
+ }
+
+ /**
+ * @generated
+ */
+ private Object[] getViewChildren(View view, Object parentElement) {
+ switch (UMLVisualIDRegistry.getVisualID(view)) {
+
+ case ModelEditPart.VISUAL_ID: {
+ LinkedList<UMLAbstractNavigatorItem> result = new LinkedList<UMLAbstractNavigatorItem>();
+ Diagram sv = (Diagram) view;
+ Collection<View> connectedViews;
+ connectedViews = getChildrenByType(Collections.singleton(sv),
+ UMLVisualIDRegistry.getType(ComponentEditPart.VISUAL_ID));
+ result.addAll(createNavigatorItems(connectedViews, parentElement,
+ false));
+ return result.toArray();
+ }
+ }
+ return EMPTY_ARRAY;
+ }
+
+ /**
+ * @generated
+ */
+ private Collection<View> getLinksSourceByType(Collection<Edge> edges,
+ String type) {
+ LinkedList<View> result = new LinkedList<View>();
+ for (Edge nextEdge : edges) {
+ View nextEdgeSource = nextEdge.getSource();
+ if (type.equals(nextEdgeSource.getType())
+ && isOwnView(nextEdgeSource)) {
+ result.add(nextEdgeSource);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private Collection<View> getLinksTargetByType(Collection<Edge> edges,
+ String type) {
+ LinkedList<View> result = new LinkedList<View>();
+ for (Edge nextEdge : edges) {
+ View nextEdgeTarget = nextEdge.getTarget();
+ if (type.equals(nextEdgeTarget.getType())
+ && isOwnView(nextEdgeTarget)) {
+ result.add(nextEdgeTarget);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private Collection<View> getOutgoingLinksByType(
+ Collection<? extends View> nodes, String type) {
+ LinkedList<View> result = new LinkedList<View>();
+ for (View nextNode : nodes) {
+ result.addAll(selectViewsByType(nextNode.getSourceEdges(), type));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private Collection<View> getIncomingLinksByType(
+ Collection<? extends View> nodes, String type) {
+ LinkedList<View> result = new LinkedList<View>();
+ for (View nextNode : nodes) {
+ result.addAll(selectViewsByType(nextNode.getTargetEdges(), type));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private Collection<View> getChildrenByType(
+ Collection<? extends View> nodes, String type) {
+ LinkedList<View> result = new LinkedList<View>();
+ for (View nextNode : nodes) {
+ result.addAll(selectViewsByType(nextNode.getChildren(), type));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private Collection<View> getDiagramLinksByType(
+ Collection<Diagram> diagrams, String type) {
+ ArrayList<View> result = new ArrayList<View>();
+ for (Diagram nextDiagram : diagrams) {
+ result.addAll(selectViewsByType(nextDiagram.getEdges(), type));
+ }
+ return result;
+ }
+
+ // TODO refactor as static method
+ /**
+ * @generated
+ */
+ private Collection<View> selectViewsByType(Collection<View> views,
+ String type) {
+ ArrayList<View> result = new ArrayList<View>();
+ for (View nextView : views) {
+ if (type.equals(nextView.getType()) && isOwnView(nextView)) {
+ result.add(nextView);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private boolean isOwnView(View view) {
+ return ModelEditPart.MODEL_ID.equals(UMLVisualIDRegistry
+ .getModelID(view));
+ }
+
+ /**
+ * @generated
+ */
+ private Collection<UMLNavigatorItem> createNavigatorItems(
+ Collection<View> views, Object parent, boolean isLeafs) {
+ ArrayList<UMLNavigatorItem> result = new ArrayList<UMLNavigatorItem>(
+ views.size());
+ for (View nextView : views) {
+ result.add(new UMLNavigatorItem(nextView, parent, isLeafs));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public Object getParent(Object element) {
+ if (element instanceof UMLAbstractNavigatorItem) {
+ UMLAbstractNavigatorItem abstractNavigatorItem = (UMLAbstractNavigatorItem) element;
+ return abstractNavigatorItem.getParent();
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean hasChildren(Object element) {
+ return element instanceof IFile || getChildren(element).length > 0;
+ }
+
+}
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLNavigatorGroup.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLNavigatorGroup.java
index e8264e8b8db..61a2a0b9a1f 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLNavigatorGroup.java
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLNavigatorGroup.java
@@ -1,97 +1,97 @@
-package org.eclipse.papyrus.example.diagram.simplediagram.navigator;
-
-import java.util.Collection;
-import java.util.LinkedList;
-
-/**
- * @generated
- */
-public class UMLNavigatorGroup extends UMLAbstractNavigatorItem {
-
- /**
- * @generated
- */
- private String myGroupName;
-
- /**
- * @generated
- */
- private String myIcon;
-
- /**
- * @generated
- */
- private Collection myChildren = new LinkedList();
-
- /**
- * @generated
- */
- UMLNavigatorGroup(String groupName, String icon, Object parent) {
- super(parent);
- myGroupName = groupName;
- myIcon = icon;
- }
-
- /**
- * @generated
- */
- public String getGroupName() {
- return myGroupName;
- }
-
- /**
- * @generated
- */
- public String getIcon() {
- return myIcon;
- }
-
- /**
- * @generated
- */
- public Object[] getChildren() {
- return myChildren.toArray();
- }
-
- /**
- * @generated
- */
- public void addChildren(Collection children) {
- myChildren.addAll(children);
- }
-
- /**
- * @generated
- */
- public void addChild(Object child) {
- myChildren.add(child);
- }
-
- /**
- * @generated
- */
- public boolean isEmpty() {
- return myChildren.size() == 0;
- }
-
- /**
- * @generated
- */
- public boolean equals(Object obj) {
- if (obj instanceof org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLNavigatorGroup) {
- org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLNavigatorGroup anotherGroup = (org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLNavigatorGroup) obj;
- if (getGroupName().equals(anotherGroup.getGroupName())) {
- return getParent().equals(anotherGroup.getParent());
- }
- }
- return super.equals(obj);
- }
-
- /**
- * @generated
- */
- public int hashCode() {
- return getGroupName().hashCode();
- }
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.navigator;
+
+import java.util.Collection;
+import java.util.LinkedList;
+
+/**
+ * @generated
+ */
+public class UMLNavigatorGroup extends UMLAbstractNavigatorItem {
+
+ /**
+ * @generated
+ */
+ private String myGroupName;
+
+ /**
+ * @generated
+ */
+ private String myIcon;
+
+ /**
+ * @generated
+ */
+ private Collection myChildren = new LinkedList();
+
+ /**
+ * @generated
+ */
+ UMLNavigatorGroup(String groupName, String icon, Object parent) {
+ super(parent);
+ myGroupName = groupName;
+ myIcon = icon;
+ }
+
+ /**
+ * @generated
+ */
+ public String getGroupName() {
+ return myGroupName;
+ }
+
+ /**
+ * @generated
+ */
+ public String getIcon() {
+ return myIcon;
+ }
+
+ /**
+ * @generated
+ */
+ public Object[] getChildren() {
+ return myChildren.toArray();
+ }
+
+ /**
+ * @generated
+ */
+ public void addChildren(Collection children) {
+ myChildren.addAll(children);
+ }
+
+ /**
+ * @generated
+ */
+ public void addChild(Object child) {
+ myChildren.add(child);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isEmpty() {
+ return myChildren.size() == 0;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean equals(Object obj) {
+ if (obj instanceof org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLNavigatorGroup) {
+ org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLNavigatorGroup anotherGroup = (org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLNavigatorGroup) obj;
+ if (getGroupName().equals(anotherGroup.getGroupName())) {
+ return getParent().equals(anotherGroup.getParent());
+ }
+ }
+ return super.equals(obj);
+ }
+
+ /**
+ * @generated
+ */
+ public int hashCode() {
+ return getGroupName().hashCode();
+ }
+
+}
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLNavigatorItem.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLNavigatorItem.java
index 5acc41ce96a..751e8a1fc10 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLNavigatorItem.java
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLNavigatorItem.java
@@ -1,93 +1,93 @@
-package org.eclipse.papyrus.example.diagram.simplediagram.navigator;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.gmf.runtime.notation.View;
-
-/**
- * @generated
- */
-public class UMLNavigatorItem extends UMLAbstractNavigatorItem {
-
- /**
- * @generated
- */
- static {
- final Class[] supportedTypes = new Class[] { View.class, EObject.class };
- Platform.getAdapterManager().registerAdapters(
- new IAdapterFactory() {
-
- public Object getAdapter(Object adaptableObject,
- Class adapterType) {
- if (adaptableObject instanceof org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLNavigatorItem
- && (adapterType == View.class || adapterType == EObject.class)) {
- return ((org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLNavigatorItem) adaptableObject)
- .getView();
- }
- return null;
- }
-
- public Class[] getAdapterList() {
- return supportedTypes;
- }
- },
- org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLNavigatorItem.class);
- }
-
- /**
- * @generated
- */
- private View myView;
-
- /**
- * @generated
- */
- private boolean myLeaf = false;
-
- /**
- * @generated
- */
- public UMLNavigatorItem(View view, Object parent, boolean isLeaf) {
- super(parent);
- myView = view;
- myLeaf = isLeaf;
- }
-
- /**
- * @generated
- */
- public View getView() {
- return myView;
- }
-
- /**
- * @generated
- */
- public boolean isLeaf() {
- return myLeaf;
- }
-
- /**
- * @generated
- */
- public boolean equals(Object obj) {
- if (obj instanceof org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLNavigatorItem) {
- return EcoreUtil
- .getURI(getView())
- .equals(EcoreUtil
- .getURI(((org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLNavigatorItem) obj)
- .getView()));
- }
- return super.equals(obj);
- }
-
- /**
- * @generated
- */
- public int hashCode() {
- return EcoreUtil.getURI(getView()).hashCode();
- }
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.navigator;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class UMLNavigatorItem extends UMLAbstractNavigatorItem {
+
+ /**
+ * @generated
+ */
+ static {
+ final Class[] supportedTypes = new Class[] { View.class, EObject.class };
+ Platform.getAdapterManager().registerAdapters(
+ new IAdapterFactory() {
+
+ public Object getAdapter(Object adaptableObject,
+ Class adapterType) {
+ if (adaptableObject instanceof org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLNavigatorItem
+ && (adapterType == View.class || adapterType == EObject.class)) {
+ return ((org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLNavigatorItem) adaptableObject)
+ .getView();
+ }
+ return null;
+ }
+
+ public Class[] getAdapterList() {
+ return supportedTypes;
+ }
+ },
+ org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLNavigatorItem.class);
+ }
+
+ /**
+ * @generated
+ */
+ private View myView;
+
+ /**
+ * @generated
+ */
+ private boolean myLeaf = false;
+
+ /**
+ * @generated
+ */
+ public UMLNavigatorItem(View view, Object parent, boolean isLeaf) {
+ super(parent);
+ myView = view;
+ myLeaf = isLeaf;
+ }
+
+ /**
+ * @generated
+ */
+ public View getView() {
+ return myView;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isLeaf() {
+ return myLeaf;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean equals(Object obj) {
+ if (obj instanceof org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLNavigatorItem) {
+ return EcoreUtil
+ .getURI(getView())
+ .equals(EcoreUtil
+ .getURI(((org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLNavigatorItem) obj)
+ .getView()));
+ }
+ return super.equals(obj);
+ }
+
+ /**
+ * @generated
+ */
+ public int hashCode() {
+ return EcoreUtil.getURI(getView()).hashCode();
+ }
+
+}
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLNavigatorLabelProvider.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLNavigatorLabelProvider.java
index fbf3b7944f2..af8e02de682 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLNavigatorLabelProvider.java
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLNavigatorLabelProvider.java
@@ -1,232 +1,232 @@
-package org.eclipse.papyrus.example.diagram.simplediagram.navigator;
-
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.jface.viewers.ITreePathLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.TreePath;
-import org.eclipse.jface.viewers.ViewerLabel;
-import org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ComponentEditPart;
-import org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ComponentNameEditPart;
-import org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ModelEditPart;
-import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.example.diagram.simplediagram.providers.UMLElementTypes;
-import org.eclipse.papyrus.example.diagram.simplediagram.providers.UMLParserProvider;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.navigator.ICommonContentExtensionSite;
-import org.eclipse.ui.navigator.ICommonLabelProvider;
-import org.eclipse.uml2.uml.Model;
-
-/**
- * @generated
- */
-public class UMLNavigatorLabelProvider extends LabelProvider implements
- ICommonLabelProvider, ITreePathLabelProvider {
-
- /**
- * @generated
- */
- static {
- UMLDiagramEditorPlugin
- .getInstance()
- .getImageRegistry()
- .put("Navigator?UnknownElement", ImageDescriptor.getMissingImageDescriptor()); //$NON-NLS-1$
- UMLDiagramEditorPlugin
- .getInstance()
- .getImageRegistry()
- .put("Navigator?ImageNotFound", ImageDescriptor.getMissingImageDescriptor()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- public void updateLabel(ViewerLabel label, TreePath elementPath) {
- Object element = elementPath.getLastSegment();
- if (element instanceof UMLNavigatorItem
- && !isOwnView(((UMLNavigatorItem) element).getView())) {
- return;
- }
- label.setText(getText(element));
- label.setImage(getImage(element));
- }
-
- /**
- * @generated
- */
- public Image getImage(Object element) {
- if (element instanceof UMLNavigatorGroup) {
- UMLNavigatorGroup group = (UMLNavigatorGroup) element;
- return UMLDiagramEditorPlugin.getInstance().getBundledImage(
- group.getIcon());
- }
-
- if (element instanceof UMLNavigatorItem) {
- UMLNavigatorItem navigatorItem = (UMLNavigatorItem) element;
- if (!isOwnView(navigatorItem.getView())) {
- return super.getImage(element);
- }
- return getImage(navigatorItem.getView());
- }
-
- return super.getImage(element);
- }
-
- /**
- * @generated
- */
- public Image getImage(View view) {
- switch (UMLVisualIDRegistry.getVisualID(view)) {
- case ModelEditPart.VISUAL_ID:
- return getImage(
- "Navigator?Diagram?http://www.eclipse.org/uml2/3.0.0/UML?Model", UMLElementTypes.Model_1000); //$NON-NLS-1$
- case ComponentEditPart.VISUAL_ID:
- return getImage(
- "Navigator?TopLevelNode?http://www.eclipse.org/uml2/3.0.0/UML?Component", UMLElementTypes.Component_2001); //$NON-NLS-1$
- }
- return getImage("Navigator?UnknownElement", null); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- private Image getImage(String key, IElementType elementType) {
- ImageRegistry imageRegistry = UMLDiagramEditorPlugin.getInstance()
- .getImageRegistry();
- Image image = imageRegistry.get(key);
- if (image == null && elementType != null
- && UMLElementTypes.isKnownElementType(elementType)) {
- image = UMLElementTypes.getImage(elementType);
- imageRegistry.put(key, image);
- }
-
- if (image == null) {
- image = imageRegistry.get("Navigator?ImageNotFound"); //$NON-NLS-1$
- imageRegistry.put(key, image);
- }
- return image;
- }
-
- /**
- * @generated
- */
- public String getText(Object element) {
- if (element instanceof UMLNavigatorGroup) {
- UMLNavigatorGroup group = (UMLNavigatorGroup) element;
- return group.getGroupName();
- }
-
- if (element instanceof UMLNavigatorItem) {
- UMLNavigatorItem navigatorItem = (UMLNavigatorItem) element;
- if (!isOwnView(navigatorItem.getView())) {
- return null;
- }
- return getText(navigatorItem.getView());
- }
-
- return super.getText(element);
- }
-
- /**
- * @generated
- */
- public String getText(View view) {
- if (view.getElement() != null && view.getElement().eIsProxy()) {
- return getUnresolvedDomainElementProxyText(view);
- }
- switch (UMLVisualIDRegistry.getVisualID(view)) {
- case ModelEditPart.VISUAL_ID:
- return getModel_1000Text(view);
- case ComponentEditPart.VISUAL_ID:
- return getComponent_2001Text(view);
- }
- return getUnknownElementText(view);
- }
-
- /**
- * @generated
- */
- private String getModel_1000Text(View view) {
- Model domainModelElement = (Model) view.getElement();
- if (domainModelElement != null) {
- return String.valueOf(domainModelElement.getName());
- } else {
- UMLDiagramEditorPlugin.getInstance().logError(
- "No domain element for view with visualID = " + 1000); //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private String getComponent_2001Text(View view) {
- IParser parser = UMLParserProvider.getParser(
- UMLElementTypes.Component_2001,
- view.getElement() != null ? view.getElement() : view,
- UMLVisualIDRegistry.getType(ComponentNameEditPart.VISUAL_ID));
- if (parser != null) {
- return parser.getPrintString(new EObjectAdapter(
- view.getElement() != null ? view.getElement() : view),
- ParserOptions.NONE.intValue());
- } else {
- UMLDiagramEditorPlugin.getInstance().logError(
- "Parser was not found for label " + 5001); //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private String getUnknownElementText(View view) {
- return "<UnknownElement Visual_ID = " + view.getType() + ">"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * @generated
- */
- private String getUnresolvedDomainElementProxyText(View view) {
- return "<Unresolved domain element Visual_ID = " + view.getType() + ">"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * @generated
- */
- public void init(ICommonContentExtensionSite aConfig) {
- }
-
- /**
- * @generated
- */
- public void restoreState(IMemento aMemento) {
- }
-
- /**
- * @generated
- */
- public void saveState(IMemento aMemento) {
- }
-
- /**
- * @generated
- */
- public String getDescription(Object anElement) {
- return null;
- }
-
- /**
- * @generated
- */
- private boolean isOwnView(View view) {
- return ModelEditPart.MODEL_ID.equals(UMLVisualIDRegistry
- .getModelID(view));
- }
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.navigator;
+
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.jface.viewers.ITreePathLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TreePath;
+import org.eclipse.jface.viewers.ViewerLabel;
+import org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ComponentEditPart;
+import org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ComponentNameEditPart;
+import org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ModelEditPart;
+import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.example.diagram.simplediagram.providers.UMLElementTypes;
+import org.eclipse.papyrus.example.diagram.simplediagram.providers.UMLParserProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.navigator.ICommonContentExtensionSite;
+import org.eclipse.ui.navigator.ICommonLabelProvider;
+import org.eclipse.uml2.uml.Model;
+
+/**
+ * @generated
+ */
+public class UMLNavigatorLabelProvider extends LabelProvider implements
+ ICommonLabelProvider, ITreePathLabelProvider {
+
+ /**
+ * @generated
+ */
+ static {
+ UMLDiagramEditorPlugin
+ .getInstance()
+ .getImageRegistry()
+ .put("Navigator?UnknownElement", ImageDescriptor.getMissingImageDescriptor()); //$NON-NLS-1$
+ UMLDiagramEditorPlugin
+ .getInstance()
+ .getImageRegistry()
+ .put("Navigator?ImageNotFound", ImageDescriptor.getMissingImageDescriptor()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ public void updateLabel(ViewerLabel label, TreePath elementPath) {
+ Object element = elementPath.getLastSegment();
+ if (element instanceof UMLNavigatorItem
+ && !isOwnView(((UMLNavigatorItem) element).getView())) {
+ return;
+ }
+ label.setText(getText(element));
+ label.setImage(getImage(element));
+ }
+
+ /**
+ * @generated
+ */
+ public Image getImage(Object element) {
+ if (element instanceof UMLNavigatorGroup) {
+ UMLNavigatorGroup group = (UMLNavigatorGroup) element;
+ return UMLDiagramEditorPlugin.getInstance().getBundledImage(
+ group.getIcon());
+ }
+
+ if (element instanceof UMLNavigatorItem) {
+ UMLNavigatorItem navigatorItem = (UMLNavigatorItem) element;
+ if (!isOwnView(navigatorItem.getView())) {
+ return super.getImage(element);
+ }
+ return getImage(navigatorItem.getView());
+ }
+
+ return super.getImage(element);
+ }
+
+ /**
+ * @generated
+ */
+ public Image getImage(View view) {
+ switch (UMLVisualIDRegistry.getVisualID(view)) {
+ case ModelEditPart.VISUAL_ID:
+ return getImage(
+ "Navigator?Diagram?http://www.eclipse.org/uml2/5.0.0/UML?Model", UMLElementTypes.Model_1000); //$NON-NLS-1$
+ case ComponentEditPart.VISUAL_ID:
+ return getImage(
+ "Navigator?TopLevelNode?http://www.eclipse.org/uml2/5.0.0/UML?Component", UMLElementTypes.Component_2001); //$NON-NLS-1$
+ }
+ return getImage("Navigator?UnknownElement", null); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ private Image getImage(String key, IElementType elementType) {
+ ImageRegistry imageRegistry = UMLDiagramEditorPlugin.getInstance()
+ .getImageRegistry();
+ Image image = imageRegistry.get(key);
+ if (image == null && elementType != null
+ && UMLElementTypes.isKnownElementType(elementType)) {
+ image = UMLElementTypes.getImage(elementType);
+ imageRegistry.put(key, image);
+ }
+
+ if (image == null) {
+ image = imageRegistry.get("Navigator?ImageNotFound"); //$NON-NLS-1$
+ imageRegistry.put(key, image);
+ }
+ return image;
+ }
+
+ /**
+ * @generated
+ */
+ public String getText(Object element) {
+ if (element instanceof UMLNavigatorGroup) {
+ UMLNavigatorGroup group = (UMLNavigatorGroup) element;
+ return group.getGroupName();
+ }
+
+ if (element instanceof UMLNavigatorItem) {
+ UMLNavigatorItem navigatorItem = (UMLNavigatorItem) element;
+ if (!isOwnView(navigatorItem.getView())) {
+ return null;
+ }
+ return getText(navigatorItem.getView());
+ }
+
+ return super.getText(element);
+ }
+
+ /**
+ * @generated
+ */
+ public String getText(View view) {
+ if (view.getElement() != null && view.getElement().eIsProxy()) {
+ return getUnresolvedDomainElementProxyText(view);
+ }
+ switch (UMLVisualIDRegistry.getVisualID(view)) {
+ case ModelEditPart.VISUAL_ID:
+ return getModel_1000Text(view);
+ case ComponentEditPart.VISUAL_ID:
+ return getComponent_2001Text(view);
+ }
+ return getUnknownElementText(view);
+ }
+
+ /**
+ * @generated
+ */
+ private String getModel_1000Text(View view) {
+ Model domainModelElement = (Model) view.getElement();
+ if (domainModelElement != null) {
+ return String.valueOf(domainModelElement.getName());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError(
+ "No domain element for view with visualID = " + 1000); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private String getComponent_2001Text(View view) {
+ IParser parser = UMLParserProvider.getParser(
+ UMLElementTypes.Component_2001,
+ view.getElement() != null ? view.getElement() : view,
+ UMLVisualIDRegistry.getType(ComponentNameEditPart.VISUAL_ID));
+ if (parser != null) {
+ return parser.getPrintString(new EObjectAdapter(
+ view.getElement() != null ? view.getElement() : view),
+ ParserOptions.NONE.intValue());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError(
+ "Parser was not found for label " + 5001); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private String getUnknownElementText(View view) {
+ return "<UnknownElement Visual_ID = " + view.getType() + ">"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * @generated
+ */
+ private String getUnresolvedDomainElementProxyText(View view) {
+ return "<Unresolved domain element Visual_ID = " + view.getType() + ">"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * @generated
+ */
+ public void init(ICommonContentExtensionSite aConfig) {
+ }
+
+ /**
+ * @generated
+ */
+ public void restoreState(IMemento aMemento) {
+ }
+
+ /**
+ * @generated
+ */
+ public void saveState(IMemento aMemento) {
+ }
+
+ /**
+ * @generated
+ */
+ public String getDescription(Object anElement) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private boolean isOwnView(View view) {
+ return ModelEditPart.MODEL_ID.equals(UMLVisualIDRegistry
+ .getModelID(view));
+ }
+
+}
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLNavigatorLinkHelper.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLNavigatorLinkHelper.java
index 7b1e024674d..d5706be791b 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLNavigatorLinkHelper.java
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLNavigatorLinkHelper.java
@@ -1,123 +1,126 @@
-package org.eclipse.papyrus.example.diagram.simplediagram.navigator;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.common.ui.URIEditorInput;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.GraphicalViewer;
-import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;
-import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditorPlugin;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.navigator.ILinkHelper;
-import org.eclipse.ui.part.FileEditorInput;
-
-/**
- * @generated
- */
-public class UMLNavigatorLinkHelper implements ILinkHelper {
-
- /**
- * @generated
- */
- private static IEditorInput getEditorInput(Diagram diagram) {
- Resource diagramResource = diagram.eResource();
- for (EObject nextEObject : diagramResource.getContents()) {
- if (nextEObject == diagram) {
- return new FileEditorInput(
- WorkspaceSynchronizer.getFile(diagramResource));
- }
- if (nextEObject instanceof Diagram) {
- break;
- }
- }
- URI uri = EcoreUtil.getURI(diagram);
- String editorName = uri.lastSegment() + '#'
- + diagram.eResource().getContents().indexOf(diagram);
- IEditorInput editorInput = new URIEditorInput(uri, editorName);
- return editorInput;
- }
-
- /**
- * @generated
- */
- public IStructuredSelection findSelection(IEditorInput anInput) {
- IDiagramDocument document = UMLDiagramEditorPlugin.getInstance()
- .getDocumentProvider().getDiagramDocument(anInput);
- if (document == null) {
- return StructuredSelection.EMPTY;
- }
- Diagram diagram = document.getDiagram();
- IFile file = WorkspaceSynchronizer.getFile(diagram.eResource());
- if (file != null) {
- UMLNavigatorItem item = new UMLNavigatorItem(diagram, file, false);
- return new StructuredSelection(item);
- }
- return StructuredSelection.EMPTY;
- }
-
- /**
- * @generated
- */
- public void activateEditor(IWorkbenchPage aPage,
- IStructuredSelection aSelection) {
- if (aSelection == null || aSelection.isEmpty()) {
- return;
- }
- if (false == aSelection.getFirstElement() instanceof UMLAbstractNavigatorItem) {
- return;
- }
-
- UMLAbstractNavigatorItem abstractNavigatorItem = (UMLAbstractNavigatorItem) aSelection
- .getFirstElement();
- View navigatorView = null;
- if (abstractNavigatorItem instanceof UMLNavigatorItem) {
- navigatorView = ((UMLNavigatorItem) abstractNavigatorItem)
- .getView();
- } else if (abstractNavigatorItem instanceof UMLNavigatorGroup) {
- UMLNavigatorGroup navigatorGroup = (UMLNavigatorGroup) abstractNavigatorItem;
- if (navigatorGroup.getParent() instanceof UMLNavigatorItem) {
- navigatorView = ((UMLNavigatorItem) navigatorGroup.getParent())
- .getView();
- }
- }
- if (navigatorView == null) {
- return;
- }
- IEditorInput editorInput = getEditorInput(navigatorView.getDiagram());
- IEditorPart editor = aPage.findEditor(editorInput);
- if (editor == null) {
- return;
- }
- aPage.bringToTop(editor);
- if (editor instanceof DiagramEditor) {
- DiagramEditor diagramEditor = (DiagramEditor) editor;
- ResourceSet diagramEditorResourceSet = diagramEditor
- .getEditingDomain().getResourceSet();
- EObject selectedView = diagramEditorResourceSet.getEObject(
- EcoreUtil.getURI(navigatorView), true);
- if (selectedView == null) {
- return;
- }
- GraphicalViewer graphicalViewer = (GraphicalViewer) diagramEditor
- .getAdapter(GraphicalViewer.class);
- EditPart selectedEditPart = (EditPart) graphicalViewer
- .getEditPartRegistry().get(selectedView);
- if (selectedEditPart != null) {
- graphicalViewer.select(selectedEditPart);
- }
- }
- }
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.navigator;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.common.ui.URIEditorInput;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.GraphicalViewer;
+import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditorPlugin;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.navigator.ILinkHelper;
+import org.eclipse.ui.part.FileEditorInput;
+
+/**
+ * @generated
+ */
+public class UMLNavigatorLinkHelper implements ILinkHelper {
+
+ /**
+ * @generated
+ */
+ private static IEditorInput getEditorInput(Diagram diagram) {
+ Resource diagramResource = diagram.eResource();
+ for (EObject nextEObject : diagramResource.getContents()) {
+ if (nextEObject == diagram) {
+ return new FileEditorInput(
+ WorkspaceSynchronizer.getFile(diagramResource));
+ }
+ if (nextEObject instanceof Diagram) {
+ break;
+ }
+ }
+ URI uri = EcoreUtil.getURI(diagram);
+ String editorName = uri.lastSegment() + '#'
+ + diagram.eResource().getContents().indexOf(diagram);
+ IEditorInput editorInput = new URIEditorInput(uri, editorName);
+ return editorInput;
+ }
+
+ /**
+ * @generated
+ */
+ public IStructuredSelection findSelection(IEditorInput anInput) {
+ IDiagramDocument document = UMLDiagramEditorPlugin.getInstance()
+ .getDocumentProvider().getDiagramDocument(anInput);
+ if (document == null) {
+ return StructuredSelection.EMPTY;
+ }
+ Diagram diagram = document.getDiagram();
+ if (diagram == null || diagram.eResource() == null) {
+ return StructuredSelection.EMPTY;
+ }
+ IFile file = WorkspaceSynchronizer.getFile(diagram.eResource());
+ if (file != null) {
+ UMLNavigatorItem item = new UMLNavigatorItem(diagram, file, false);
+ return new StructuredSelection(item);
+ }
+ return StructuredSelection.EMPTY;
+ }
+
+ /**
+ * @generated
+ */
+ public void activateEditor(IWorkbenchPage aPage,
+ IStructuredSelection aSelection) {
+ if (aSelection == null || aSelection.isEmpty()) {
+ return;
+ }
+ if (false == aSelection.getFirstElement() instanceof UMLAbstractNavigatorItem) {
+ return;
+ }
+
+ UMLAbstractNavigatorItem abstractNavigatorItem = (UMLAbstractNavigatorItem) aSelection
+ .getFirstElement();
+ View navigatorView = null;
+ if (abstractNavigatorItem instanceof UMLNavigatorItem) {
+ navigatorView = ((UMLNavigatorItem) abstractNavigatorItem)
+ .getView();
+ } else if (abstractNavigatorItem instanceof UMLNavigatorGroup) {
+ UMLNavigatorGroup navigatorGroup = (UMLNavigatorGroup) abstractNavigatorItem;
+ if (navigatorGroup.getParent() instanceof UMLNavigatorItem) {
+ navigatorView = ((UMLNavigatorItem) navigatorGroup.getParent())
+ .getView();
+ }
+ }
+ if (navigatorView == null) {
+ return;
+ }
+ IEditorInput editorInput = getEditorInput(navigatorView.getDiagram());
+ IEditorPart editor = aPage.findEditor(editorInput);
+ if (editor == null) {
+ return;
+ }
+ aPage.bringToTop(editor);
+ if (editor instanceof DiagramEditor) {
+ DiagramEditor diagramEditor = (DiagramEditor) editor;
+ ResourceSet diagramEditorResourceSet = diagramEditor
+ .getEditingDomain().getResourceSet();
+ EObject selectedView = diagramEditorResourceSet.getEObject(
+ EcoreUtil.getURI(navigatorView), true);
+ if (selectedView == null) {
+ return;
+ }
+ GraphicalViewer graphicalViewer = (GraphicalViewer) diagramEditor
+ .getAdapter(GraphicalViewer.class);
+ EditPart selectedEditPart = (EditPart) graphicalViewer
+ .getEditPartRegistry().get(selectedView);
+ if (selectedEditPart != null) {
+ graphicalViewer.select(selectedEditPart);
+ }
+ }
+ }
+
+}
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLNavigatorSorter.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLNavigatorSorter.java
index a713e6119cf..b2dd5ee161e 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLNavigatorSorter.java
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/navigator/UMLNavigatorSorter.java
@@ -1,27 +1,27 @@
-package org.eclipse.papyrus.example.diagram.simplediagram.navigator;
-
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry;
-
-/**
- * @generated
- */
-public class UMLNavigatorSorter extends ViewerSorter {
-
- /**
- * @generated
- */
- private static final int GROUP_CATEGORY = 2003;
-
- /**
- * @generated
- */
- public int category(Object element) {
- if (element instanceof UMLNavigatorItem) {
- UMLNavigatorItem item = (UMLNavigatorItem) element;
- return UMLVisualIDRegistry.getVisualID(item.getView());
- }
- return GROUP_CATEGORY;
- }
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.navigator;
+
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class UMLNavigatorSorter extends ViewerSorter {
+
+ /**
+ * @generated
+ */
+ private static final int GROUP_CATEGORY = 2003;
+
+ /**
+ * @generated
+ */
+ public int category(Object element) {
+ if (element instanceof UMLNavigatorItem) {
+ UMLNavigatorItem item = (UMLNavigatorItem) element;
+ return UMLVisualIDRegistry.getVisualID(item.getView());
+ }
+ return GROUP_CATEGORY;
+ }
+
+}
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/parsers/AbstractParser.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/parsers/AbstractParser.java
index dd5d75fa54d..f5b29e4ea0d 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/parsers/AbstractParser.java
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/parsers/AbstractParser.java
@@ -1,464 +1 @@
-package org.eclipse.papyrus.example.diagram.simplediagram.parsers;
-
-import java.util.Arrays;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EDataType;
-import org.eclipse.emf.ecore.EEnum;
-import org.eclipse.emf.ecore.EEnumLiteral;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.papyrus.example.diagram.simplediagram.part.Messages;
-import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditorPlugin;
-
-/**
- * @generated
- */
-public abstract class AbstractParser implements IParser {
-
- /**
- * @generated
- */
- protected final EAttribute[] features;
-
- /**
- * @generated
- */
- protected final EAttribute[] editableFeatures;
-
- /**
- * @generated
- */
- private String viewPattern;
-
- /**
- * @generated
- */
- private String editorPattern;
-
- /**
- * @generated
- */
- private String editPattern;
-
- /**
- * @generated
- */
- public AbstractParser(EAttribute[] features) {
- if (features == null || Arrays.asList(features).contains(null)) {
- throw new IllegalArgumentException();
- }
- this.editableFeatures = this.features = features;
- }
-
- /**
- * @generated
- */
- public AbstractParser(EAttribute[] features, EAttribute[] editableFeatures) {
- if (features == null || Arrays.asList(features).contains(null)) {
- throw new IllegalArgumentException();
- }
- this.features = features;
- if (editableFeatures == null
- || Arrays.asList(editableFeatures).contains(null)) {
- throw new IllegalArgumentException();
- }
- this.editableFeatures = editableFeatures;
- }
-
- /**
- * @generated
- */
- public String getViewPattern() {
- return viewPattern;
- }
-
- /**
- * @generated
- */
- public void setViewPattern(String viewPattern) {
- this.viewPattern = viewPattern;
- }
-
- /**
- * @generated
- */
- public String getEditorPattern() {
- return editorPattern;
- }
-
- /**
- * @generated
- */
- public void setEditorPattern(String editorPattern) {
- this.editorPattern = editorPattern;
- }
-
- /**
- * @generated
- */
- public String getEditPattern() {
- return editPattern;
- }
-
- /**
- * @generated
- */
- public void setEditPattern(String editPattern) {
- this.editPattern = editPattern;
- }
-
- /**
- * @generated
- */
- public boolean isAffectingEvent(Object event, int flags) {
- if (event instanceof Notification) {
- return isAffectingFeature(((Notification) event).getFeature());
- }
- return false;
- }
-
- /**
- * @generated
- */
- protected boolean isAffectingFeature(Object feature) {
- for (int i = 0; i < features.length; i++) {
- if (features[i] == feature) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * @generated
- */
- public IContentAssistProcessor getCompletionProcessor(IAdaptable element) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Object[] getValues(EObject element) {
- Object[] values = new Object[features.length];
- for (int i = 0; i < features.length; i++) {
- values[i] = getValue(element, features[i]);
- }
- return values;
- }
-
- /**
- * @generated
- */
- protected Object[] getEditableValues(EObject element) {
- Object[] values = new Object[editableFeatures.length];
- for (int i = 0; i < editableFeatures.length; i++) {
- values[i] = getValue(element, editableFeatures[i]);
- }
- return values;
- }
-
- /**
- * @generated
- */
- protected Object getValue(EObject element, EAttribute feature) {
- Object value = element.eGet(feature);
- Class iClass = feature.getEAttributeType().getInstanceClass();
- if (String.class.equals(iClass)) {
- if (value == null) {
- value = ""; //$NON-NLS-1$
- }
- }
- return value;
- }
-
- /**
- * @generated
- */
- protected ICommand getParseCommand(IAdaptable adapter, Object[] values,
- int flags) {
- if (values == null
- || validateNewValues(values).getCode() != IParserEditStatus.EDITABLE) {
- return UnexecutableCommand.INSTANCE;
- }
- EObject element = (EObject) adapter.getAdapter(EObject.class);
- TransactionalEditingDomain editingDomain = TransactionUtil
- .getEditingDomain(element);
- if (editingDomain == null) {
- return UnexecutableCommand.INSTANCE;
- }
- CompositeTransactionalCommand command = new CompositeTransactionalCommand(
- editingDomain, "Set Values"); //$NON-NLS-1$
- for (int i = 0; i < values.length; i++) {
- command.compose(getModificationCommand(element,
- editableFeatures[i], values[i]));
- }
- return command;
- }
-
- /**
- * @generated
- */
- protected ICommand getModificationCommand(EObject element,
- EAttribute feature, Object value) {
- value = getValidNewValue(feature, value);
- if (value instanceof InvalidValue) {
- return UnexecutableCommand.INSTANCE;
- }
- SetRequest request = new SetRequest(element, feature, value);
- return new SetValueCommand(request);
- }
-
- /**
- * @generated
- */
- protected IParserEditStatus validateNewValues(Object[] values) {
- if (values.length != editableFeatures.length) {
- return ParserEditStatus.UNEDITABLE_STATUS;
- }
- for (int i = 0; i < values.length; i++) {
- Object value = getValidNewValue(editableFeatures[i], values[i]);
- if (value instanceof InvalidValue) {
- return new ParserEditStatus(UMLDiagramEditorPlugin.ID,
- IParserEditStatus.UNEDITABLE, value.toString());
- }
- }
- return ParserEditStatus.EDITABLE_STATUS;
- }
-
- /**
- * @generated
- */
- protected Object getValidNewValue(EAttribute feature, Object value) {
- EClassifier type = feature.getEType();
- if (type instanceof EDataType) {
- Class iClass = type.getInstanceClass();
- if (Boolean.TYPE.equals(iClass)) {
- if (value instanceof Boolean) {
- // ok
- } else if (value instanceof String) {
- value = Boolean.valueOf((String) value);
- } else {
- value = new InvalidValue(NLS.bind(
- Messages.AbstractParser_UnexpectedValueType,
- iClass.getName()));
- }
- } else if (Character.TYPE.equals(iClass)) {
- if (value instanceof Character) {
- // ok
- } else if (value instanceof String) {
- String s = (String) value;
- if (s.length() == 0) {
- value = null;
- } else {
- value = new Character(s.charAt(0));
- }
- } else {
- value = new InvalidValue(NLS.bind(
- Messages.AbstractParser_UnexpectedValueType,
- iClass.getName()));
- }
- } else if (Byte.TYPE.equals(iClass)) {
- if (value instanceof Byte) {
- // ok
- } else if (value instanceof Number) {
- value = new Byte(((Number) value).byteValue());
- } else if (value instanceof String) {
- String s = (String) value;
- if (s.length() == 0) {
- value = null;
- } else {
- try {
- value = Byte.valueOf(s);
- } catch (NumberFormatException nfe) {
- value = new InvalidValue(
- NLS.bind(
- Messages.AbstractParser_WrongStringConversion,
- iClass.getName()));
- }
- }
- } else {
- value = new InvalidValue(NLS.bind(
- Messages.AbstractParser_UnexpectedValueType,
- iClass.getName()));
- }
- } else if (Short.TYPE.equals(iClass)) {
- if (value instanceof Short) {
- // ok
- } else if (value instanceof Number) {
- value = new Short(((Number) value).shortValue());
- } else if (value instanceof String) {
- String s = (String) value;
- if (s.length() == 0) {
- value = null;
- } else {
- try {
- value = Short.valueOf(s);
- } catch (NumberFormatException nfe) {
- value = new InvalidValue(
- NLS.bind(
- Messages.AbstractParser_WrongStringConversion,
- iClass.getName()));
- }
- }
- } else {
- value = new InvalidValue(NLS.bind(
- Messages.AbstractParser_UnexpectedValueType,
- iClass.getName()));
- }
- } else if (Integer.TYPE.equals(iClass)) {
- if (value instanceof Integer) {
- // ok
- } else if (value instanceof Number) {
- value = new Integer(((Number) value).intValue());
- } else if (value instanceof String) {
- String s = (String) value;
- if (s.length() == 0) {
- value = null;
- } else {
- try {
- value = Integer.valueOf(s);
- } catch (NumberFormatException nfe) {
- value = new InvalidValue(
- NLS.bind(
- Messages.AbstractParser_WrongStringConversion,
- iClass.getName()));
- }
- }
- } else {
- value = new InvalidValue(NLS.bind(
- Messages.AbstractParser_UnexpectedValueType,
- iClass.getName()));
- }
- } else if (Long.TYPE.equals(iClass)) {
- if (value instanceof Long) {
- // ok
- } else if (value instanceof Number) {
- value = new Long(((Number) value).longValue());
- } else if (value instanceof String) {
- String s = (String) value;
- if (s.length() == 0) {
- value = null;
- } else {
- try {
- value = Long.valueOf(s);
- } catch (NumberFormatException nfe) {
- value = new InvalidValue(
- NLS.bind(
- Messages.AbstractParser_WrongStringConversion,
- iClass.getName()));
- }
- }
- } else {
- value = new InvalidValue(NLS.bind(
- Messages.AbstractParser_UnexpectedValueType,
- iClass.getName()));
- }
- } else if (Float.TYPE.equals(iClass)) {
- if (value instanceof Float) {
- // ok
- } else if (value instanceof Number) {
- value = new Float(((Number) value).floatValue());
- } else if (value instanceof String) {
- String s = (String) value;
- if (s.length() == 0) {
- value = null;
- } else {
- try {
- value = Float.valueOf(s);
- } catch (NumberFormatException nfe) {
- value = new InvalidValue(
- NLS.bind(
- Messages.AbstractParser_WrongStringConversion,
- iClass.getName()));
- }
- }
- } else {
- value = new InvalidValue(NLS.bind(
- Messages.AbstractParser_UnexpectedValueType,
- iClass.getName()));
- }
- } else if (Double.TYPE.equals(iClass)) {
- if (value instanceof Double) {
- // ok
- } else if (value instanceof Number) {
- value = new Double(((Number) value).doubleValue());
- } else if (value instanceof String) {
- String s = (String) value;
- if (s.length() == 0) {
- value = null;
- } else {
- try {
- value = Double.valueOf(s);
- } catch (NumberFormatException nfe) {
- value = new InvalidValue(
- NLS.bind(
- Messages.AbstractParser_WrongStringConversion,
- iClass.getName()));
- }
- }
- } else {
- value = new InvalidValue(NLS.bind(
- Messages.AbstractParser_UnexpectedValueType,
- iClass.getName()));
- }
- } else if (type instanceof EEnum) {
- if (value instanceof String) {
- EEnumLiteral literal = ((EEnum) type)
- .getEEnumLiteralByLiteral((String) value);
- if (literal == null) {
- value = new InvalidValue(NLS.bind(
- Messages.AbstractParser_UnknownLiteral, value));
- } else {
- value = literal.getInstance();
- }
- } else {
- value = new InvalidValue(NLS.bind(
- Messages.AbstractParser_UnexpectedValueType,
- String.class.getName()));
- }
- }
- }
- return value;
- }
-
- /**
- * @generated
- */
- protected class InvalidValue {
-
- /**
- * @generated
- */
- private String description;
-
- /**
- * @generated
- */
- public InvalidValue(String description) {
- this.description = description;
- }
-
- /**
- * @generated
- */
- public String toString() {
- return description;
- }
- }
-}
+//Since GMFT 3.1 we don't generate class AbstractParser into every diagram, instead extend org.eclipse.gmf.tooling.runtime.parsers.AbstractAttributeParser.
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/parsers/MessageFormatParser.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/parsers/MessageFormatParser.java
index 89f2573129d..605b092148a 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/parsers/MessageFormatParser.java
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/parsers/MessageFormatParser.java
@@ -1,204 +1,204 @@
-package org.eclipse.papyrus.example.diagram.simplediagram.parsers;
-
-import java.text.FieldPosition;
-import java.text.MessageFormat;
-import java.text.ParsePosition;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.papyrus.example.diagram.simplediagram.part.Messages;
-import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditorPlugin;
-
-/**
- * @generated
- */
-public class MessageFormatParser extends AbstractParser {
-
- /**
- * @generated
- */
- private String defaultPattern;
-
- /**
- * @generated
- */
- private String defaultEditablePattern;
-
- /**
- * @generated
- */
- private MessageFormat viewProcessor;
-
- /**
- * @generated
- */
- private MessageFormat editorProcessor;
-
- /**
- * @generated
- */
- private MessageFormat editProcessor;
-
- /**
- * @generated
- */
- public MessageFormatParser(EAttribute[] features) {
- super(features);
- }
-
- /**
- * @generated
- */
- public MessageFormatParser(EAttribute[] features,
- EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- /**
- * @generated
- */
- protected String getDefaultPattern() {
- if (defaultPattern == null) {
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < features.length; i++) {
- if (i > 0) {
- sb.append(' ');
- }
- sb.append('{');
- sb.append(i);
- sb.append('}');
- }
- defaultPattern = sb.toString();
- }
- return defaultPattern;
- }
-
- /**
- * @generated
- */
- public void setViewPattern(String viewPattern) {
- super.setViewPattern(viewPattern);
- viewProcessor = null;
- }
-
- /**
- * @generated
- */
- public void setEditorPattern(String editorPattern) {
- super.setEditorPattern(editorPattern);
- editorProcessor = null;
- }
-
- /**
- * @generated
- */
- protected MessageFormat getViewProcessor() {
- if (viewProcessor == null) {
- viewProcessor = new MessageFormat(
- getViewPattern() == null ? getDefaultPattern()
- : getViewPattern());
- }
- return viewProcessor;
- }
-
- /**
- * @generated
- */
- protected MessageFormat getEditorProcessor() {
- if (editorProcessor == null) {
- editorProcessor = new MessageFormat(
- getEditorPattern() == null ? getDefaultEditablePattern()
- : getEditorPattern());
- }
- return editorProcessor;
- }
-
- /**
- * @generated
- */
- protected String getDefaultEditablePattern() {
- if (defaultEditablePattern == null) {
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < editableFeatures.length; i++) {
- if (i > 0) {
- sb.append(' ');
- }
- sb.append('{');
- sb.append(i);
- sb.append('}');
- }
- defaultEditablePattern = sb.toString();
- }
- return defaultEditablePattern;
- }
-
- /**
- * @generated
- */
- public void setEditPattern(String editPattern) {
- super.setEditPattern(editPattern);
- editProcessor = null;
- }
-
- /**
- * @generated
- */
- protected MessageFormat getEditProcessor() {
- if (editProcessor == null) {
- editProcessor = new MessageFormat(
- getEditPattern() == null ? getDefaultEditablePattern()
- : getEditPattern());
- }
- return editProcessor;
- }
-
- /**
- * @generated
- */
- public String getEditString(IAdaptable adapter, int flags) {
- EObject element = (EObject) adapter.getAdapter(EObject.class);
- return getEditorProcessor().format(getEditableValues(element),
- new StringBuffer(), new FieldPosition(0)).toString();
- }
-
- /**
- * @generated
- */
- public IParserEditStatus isValidEditString(IAdaptable adapter,
- String editString) {
- ParsePosition pos = new ParsePosition(0);
- Object[] values = getEditProcessor().parse(editString, pos);
- if (values == null) {
- return new ParserEditStatus(UMLDiagramEditorPlugin.ID,
- IParserEditStatus.UNEDITABLE, NLS.bind(
- Messages.MessageFormatParser_InvalidInputError,
- new Integer(pos.getErrorIndex())));
- }
- return validateNewValues(values);
- }
-
- /**
- * @generated
- */
- public ICommand getParseCommand(IAdaptable adapter, String newString,
- int flags) {
- Object[] values = getEditProcessor().parse(newString,
- new ParsePosition(0));
- return getParseCommand(adapter, values, flags);
- }
-
- /**
- * @generated
- */
- public String getPrintString(IAdaptable adapter, int flags) {
- EObject element = (EObject) adapter.getAdapter(EObject.class);
- return getViewProcessor().format(getValues(element),
- new StringBuffer(), new FieldPosition(0)).toString();
- }
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.parsers;
+
+import java.text.FieldPosition;
+import java.text.MessageFormat;
+import java.text.ParsePosition;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.tooling.runtime.parsers.AbstractAttributeParser;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.papyrus.example.diagram.simplediagram.part.Messages;
+import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+public class MessageFormatParser extends AbstractAttributeParser {
+
+ /**
+ * @generated
+ */
+ private String defaultPattern;
+ /**
+ * @generated
+ */
+ private String defaultEditablePattern;
+
+ /**
+ * @generated
+ */
+ private MessageFormat viewProcessor;
+
+ /**
+ * @generated
+ */
+ private MessageFormat editorProcessor;
+
+ /**
+ * @generated
+ */
+ private MessageFormat editProcessor;
+
+ /**
+ * @generated
+ */
+ public MessageFormatParser(EAttribute[] features) {
+ super(features);
+ }
+
+ /**
+ * @generated
+ */
+ public MessageFormatParser(EAttribute[] features,
+ EAttribute[] editableFeatures) {
+ super(features, editableFeatures);
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultPattern() {
+ if (defaultPattern == null) {
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < features.length; i++) {
+ if (i > 0) {
+ sb.append(' ');
+ }
+ sb.append('{');
+ sb.append(i);
+ sb.append('}');
+ }
+ defaultPattern = sb.toString();
+ }
+ return defaultPattern;
+ }
+
+ /**
+ * @generated
+ */
+ public void setViewPattern(String viewPattern) {
+ super.setViewPattern(viewPattern);
+ viewProcessor = null;
+ }
+
+ /**
+ * @generated
+ */
+ public void setEditorPattern(String editorPattern) {
+ super.setEditorPattern(editorPattern);
+ editorProcessor = null;
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageFormat getViewProcessor() {
+ if (viewProcessor == null) {
+ viewProcessor = new MessageFormat(
+ getViewPattern() == null ? getDefaultPattern()
+ : getViewPattern());
+ }
+ return viewProcessor;
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageFormat getEditorProcessor() {
+ if (editorProcessor == null) {
+ editorProcessor = new MessageFormat(
+ getEditorPattern() == null ? getDefaultEditablePattern()
+ : getEditorPattern());
+ }
+ return editorProcessor;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultEditablePattern() {
+ if (defaultEditablePattern == null) {
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < editableFeatures.length; i++) {
+ if (i > 0) {
+ sb.append(' ');
+ }
+ sb.append('{');
+ sb.append(i);
+ sb.append('}');
+ }
+ defaultEditablePattern = sb.toString();
+ }
+ return defaultEditablePattern;
+ }
+
+ /**
+ * @generated
+ */
+ public void setEditPattern(String editPattern) {
+ super.setEditPattern(editPattern);
+ editProcessor = null;
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageFormat getEditProcessor() {
+ if (editProcessor == null) {
+ editProcessor = new MessageFormat(
+ getEditPattern() == null ? getDefaultEditablePattern()
+ : getEditPattern());
+ }
+ return editProcessor;
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditString(IAdaptable adapter, int flags) {
+ EObject element = (EObject) adapter.getAdapter(EObject.class);
+ return getEditorProcessor().format(getEditableValues(element),
+ new StringBuffer(), new FieldPosition(0)).toString();
+ }
+
+ /**
+ * @generated
+ */
+ public IParserEditStatus isValidEditString(IAdaptable adapter,
+ String editString) {
+ ParsePosition pos = new ParsePosition(0);
+ Object[] values = getEditProcessor().parse(editString, pos);
+ if (values == null) {
+ return new ParserEditStatus(UMLDiagramEditorPlugin.ID,
+ IParserEditStatus.UNEDITABLE, NLS.bind(
+ Messages.MessageFormatParser_InvalidInputError,
+ new Integer(pos.getErrorIndex())));
+ }
+ return validateNewValues(values);
+ }
+
+ /**
+ * @generated
+ */
+ public ICommand getParseCommand(IAdaptable adapter, String newString,
+ int flags) {
+ Object[] values = getEditProcessor().parse(newString,
+ new ParsePosition(0));
+ return getParseCommand(adapter, values, flags);
+ }
+
+ /**
+ * @generated
+ */
+ public String getPrintString(IAdaptable adapter, int flags) {
+ EObject element = (EObject) adapter.getAdapter(EObject.class);
+ return getViewProcessor().format(getValues(element),
+ new StringBuffer(), new FieldPosition(0)).toString();
+ }
+
+}
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/DeleteElementAction.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/DeleteElementAction.java
deleted file mode 100644
index e73f96c8896..00000000000
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/DeleteElementAction.java
+++ /dev/null
@@ -1,3 +0,0 @@
-package org.eclipse.papyrus.example.diagram.simplediagram.part;
-//This file is not used.
-//The DeleteElementAction is removed from the plugin and replaced by DeleteFromModelAction in the plugin org.eclipse.diagram.common.
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/DiagramEditorContextMenuProvider.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/DiagramEditorContextMenuProvider.java
index 262669de761..1c4eb01f7a1 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/DiagramEditorContextMenuProvider.java
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/DiagramEditorContextMenuProvider.java
@@ -1,58 +1,40 @@
-package org.eclipse.papyrus.example.diagram.simplediagram.part;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.gef.EditPartViewer;
-import org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.ContributionItemService;
-import org.eclipse.gmf.runtime.diagram.ui.actions.ActionIds;
-import org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * @generated
- */
-public class DiagramEditorContextMenuProvider extends
- DiagramContextMenuProvider {
-
- /**
- * @generated
- */
- private IWorkbenchPart part;
-
- /**
- * @generated
- */
- public DiagramEditorContextMenuProvider(IWorkbenchPart part,
- EditPartViewer viewer) {
- super(part, viewer);
- this.part = part;
-
- }
-
- /**
- * @generated
- */
- public void buildContextMenu(final IMenuManager menu) {
- getViewer().flush();
- try {
- TransactionUtil.getEditingDomain(
- (EObject) getViewer().getContents().getModel())
- .runExclusive(new Runnable() {
-
- public void run() {
- ContributionItemService
- .getInstance()
- .contributeToPopupMenu(
- DiagramEditorContextMenuProvider.this,
- part);
- menu.remove(ActionIds.ACTION_DELETE_FROM_MODEL);
-
- }
- });
- } catch (Exception e) {
- UMLDiagramEditorPlugin.getInstance().logError(
- "Error building context menu", e);
- }
- }
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.part;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.ContributionItemService;
+import org.eclipse.gmf.runtime.diagram.ui.actions.ActionIds;
+import org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * @generated
+ */
+public class DiagramEditorContextMenuProvider extends
+ DiagramContextMenuProvider {
+
+ /**
+ * @generated
+ */
+ private IWorkbenchPart part;
+
+
+ /**
+ * @generated
+ */
+ public DiagramEditorContextMenuProvider(IWorkbenchPart part,
+ EditPartViewer viewer) {
+ super(part, viewer);
+ this.part = part;
+ }
+
+ /**
+ * @generated
+ */
+ public void dispose() {
+ super.dispose();
+ }
+
+}
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/LoadResourceAction.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/LoadResourceAction.java
index 040d7e7f999..b64ceeefb47 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/LoadResourceAction.java
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/LoadResourceAction.java
@@ -1,31 +1,18 @@
-package org.eclipse.papyrus.example.diagram.simplediagram.part;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * @generated
- */
-public class LoadResourceAction extends AbstractHandler {
- /**
- * @generated
- */
- public Object execute(ExecutionEvent event) throws ExecutionException {
- IEditorPart diagramEditor = HandlerUtil.getActiveEditorChecked(event);
- Shell shell = diagramEditor.getEditorSite().getShell();
- assert diagramEditor instanceof DiagramEditor;
- TransactionalEditingDomain editingDomain = ((DiagramEditor) diagramEditor)
- .getEditingDomain();
- org.eclipse.emf.edit.ui.action.LoadResourceAction.LoadResourceDialog loadResourceDialog = new org.eclipse.emf.edit.ui.action.LoadResourceAction.LoadResourceDialog(
- shell, editingDomain);
- loadResourceDialog.open();
- return null;
- }
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.part;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.gmf.tooling.runtime.actions.DefaultLoadResourceAction;
+
+/**
+ * @generated
+ */
+public class LoadResourceAction extends DefaultLoadResourceAction {
+ /**
+ * @generated
+ */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ return super.execute(event);
+ }
+
+}
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/Messages.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/Messages.java
index 7c22a98c419..94e886511fe 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/Messages.java
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/Messages.java
@@ -1,299 +1,284 @@
-package org.eclipse.papyrus.example.diagram.simplediagram.part;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * @generated
- */
-public class Messages extends NLS {
-
- /**
- * @generated
- */
- static {
- NLS.initializeMessages("messages", Messages.class); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- private Messages() {
- }
-
- /**
- * @generated
- */
- public static String UMLCreationWizardTitle;
-
- /**
- * @generated
- */
- public static String UMLCreationWizard_DiagramModelFilePageTitle;
-
- /**
- * @generated
- */
- public static String UMLCreationWizard_DiagramModelFilePageDescription;
-
- /**
- * @generated
- */
- public static String UMLCreationWizard_DomainModelFilePageTitle;
-
- /**
- * @generated
- */
- public static String UMLCreationWizard_DomainModelFilePageDescription;
-
- /**
- * @generated
- */
- public static String UMLCreationWizardOpenEditorError;
-
- /**
- * @generated
- */
- public static String UMLCreationWizardCreationError;
-
- /**
- * @generated
- */
- public static String UMLCreationWizardPageExtensionError;
-
- /**
- * @generated
- */
- public static String UMLDiagramEditorUtil_OpenModelResourceErrorDialogTitle;
-
- /**
- * @generated
- */
- public static String UMLDiagramEditorUtil_OpenModelResourceErrorDialogMessage;
-
- /**
- * @generated
- */
- public static String UMLDiagramEditorUtil_CreateDiagramProgressTask;
-
- /**
- * @generated
- */
- public static String UMLDiagramEditorUtil_CreateDiagramCommandLabel;
-
- /**
- * @generated
- */
- public static String UMLDocumentProvider_isModifiable;
-
- /**
- * @generated
- */
- public static String UMLDocumentProvider_handleElementContentChanged;
-
- /**
- * @generated
- */
- public static String UMLDocumentProvider_IncorrectInputError;
-
- /**
- * @generated
- */
- public static String UMLDocumentProvider_NoDiagramInResourceError;
-
- /**
- * @generated
- */
- public static String UMLDocumentProvider_DiagramLoadingError;
-
- /**
- * @generated
- */
- public static String UMLDocumentProvider_UnsynchronizedFileSaveError;
-
- /**
- * @generated
- */
- public static String UMLDocumentProvider_SaveDiagramTask;
-
- /**
- * @generated
- */
- public static String UMLDocumentProvider_SaveNextResourceTask;
-
- /**
- * @generated
- */
- public static String UMLDocumentProvider_SaveAsOperation;
-
- /**
- * @generated
- */
- public static String InitDiagramFile_ResourceErrorDialogTitle;
-
- /**
- * @generated
- */
- public static String InitDiagramFile_ResourceErrorDialogMessage;
-
- /**
- * @generated
- */
- public static String InitDiagramFile_WizardTitle;
-
- /**
- * @generated
- */
- public static String InitDiagramFile_OpenModelFileDialogTitle;
-
- /**
- * @generated
- */
- public static String UMLNewDiagramFileWizard_CreationPageName;
-
- /**
- * @generated
- */
- public static String UMLNewDiagramFileWizard_CreationPageTitle;
-
- /**
- * @generated
- */
- public static String UMLNewDiagramFileWizard_CreationPageDescription;
-
- /**
- * @generated
- */
- public static String UMLNewDiagramFileWizard_RootSelectionPageName;
-
- /**
- * @generated
- */
- public static String UMLNewDiagramFileWizard_RootSelectionPageTitle;
-
- /**
- * @generated
- */
- public static String UMLNewDiagramFileWizard_RootSelectionPageDescription;
-
- /**
- * @generated
- */
- public static String UMLNewDiagramFileWizard_RootSelectionPageSelectionTitle;
-
- /**
- * @generated
- */
- public static String UMLNewDiagramFileWizard_RootSelectionPageNoSelectionMessage;
-
- /**
- * @generated
- */
- public static String UMLNewDiagramFileWizard_RootSelectionPageInvalidSelectionMessage;
-
- /**
- * @generated
- */
- public static String UMLNewDiagramFileWizard_InitDiagramCommand;
-
- /**
- * @generated
- */
- public static String UMLNewDiagramFileWizard_IncorrectRootError;
-
- /**
- * @generated
- */
- public static String UMLDiagramEditor_SavingDeletedFile;
-
- /**
- * @generated
- */
- public static String UMLDiagramEditor_SaveAsErrorTitle;
-
- /**
- * @generated
- */
- public static String UMLDiagramEditor_SaveAsErrorMessage;
-
- /**
- * @generated
- */
- public static String UMLDiagramEditor_SaveErrorTitle;
-
- /**
- * @generated
- */
- public static String UMLDiagramEditor_SaveErrorMessage;
-
- /**
- * @generated
- */
- public static String UMLElementChooserDialog_SelectModelElementTitle;
-
- /**
- * @generated
- */
- public static String ModelElementSelectionPageMessage;
-
- /**
- * @generated
- */
- public static String ValidateActionMessage;
-
- /**
- * @generated
- */
- public static String createUml1Group_title;
-
- /**
- * @generated
- */
- public static String createComponent1CreationTool_title;
-
- /**
- * @generated
- */
- public static String createComponent1CreationTool_desc;
-
- /**
- * @generated
- */
- public static String CommandName_OpenDiagram;
-
- /**
- * @generated
- */
- public static String NavigatorActionProvider_OpenDiagramActionName;
-
- /**
- * @generated
- */
- public static String AbstractParser_UnexpectedValueType;
-
- /**
- * @generated
- */
- public static String AbstractParser_WrongStringConversion;
-
- /**
- * @generated
- */
- public static String AbstractParser_UnknownLiteral;
-
- /**
- * @generated
- */
- public static String MessageFormatParser_InvalidInputError;
-
- /**
- * @generated
- */
- public static String UMLModelingAssistantProviderTitle;
-
- /**
- * @generated
- */
- public static String UMLModelingAssistantProviderMessage;
-
- //TODO: put accessor fields manually
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.part;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * @generated
+ */
+public class Messages extends NLS {
+
+ /**
+ * @generated
+ */
+ static {
+ NLS.initializeMessages("messages", Messages.class); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ private Messages() {
+ }
+
+ /**
+ * @generated
+ */
+ public static String UMLCreationWizardTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLCreationWizard_DiagramModelFilePageTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLCreationWizard_DiagramModelFilePageDescription;
+
+ /**
+ * @generated
+ */
+ public static String UMLCreationWizard_DomainModelFilePageTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLCreationWizard_DomainModelFilePageDescription;
+
+ /**
+ * @generated
+ */
+ public static String UMLCreationWizardOpenEditorError;
+
+ /**
+ * @generated
+ */
+ public static String UMLCreationWizardCreationError;
+
+ /**
+ * @generated
+ */
+ public static String UMLCreationWizardPageExtensionError;
+
+ /**
+ * @generated
+ */
+ public static String UMLDiagramEditorUtil_OpenModelResourceErrorDialogTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLDiagramEditorUtil_OpenModelResourceErrorDialogMessage;
+
+ /**
+ * @generated
+ */
+ public static String UMLDiagramEditorUtil_CreateDiagramProgressTask;
+
+ /**
+ * @generated
+ */
+ public static String UMLDiagramEditorUtil_CreateDiagramCommandLabel;
+
+ /**
+ * @generated
+ */
+ public static String UMLDocumentProvider_isModifiable;
+
+ /**
+ * @generated
+ */
+ public static String UMLDocumentProvider_handleElementContentChanged;
+
+ /**
+ * @generated
+ */
+ public static String UMLDocumentProvider_IncorrectInputError;
+
+ /**
+ * @generated
+ */
+ public static String UMLDocumentProvider_NoDiagramInResourceError;
+
+ /**
+ * @generated
+ */
+ public static String UMLDocumentProvider_DiagramLoadingError;
+
+ /**
+ * @generated
+ */
+ public static String UMLDocumentProvider_UnsynchronizedFileSaveError;
+
+ /**
+ * @generated
+ */
+ public static String UMLDocumentProvider_SaveDiagramTask;
+
+ /**
+ * @generated
+ */
+ public static String UMLDocumentProvider_SaveNextResourceTask;
+
+ /**
+ * @generated
+ */
+ public static String UMLDocumentProvider_SaveAsOperation;
+
+ /**
+ * @generated
+ */
+ public static String InitDiagramFile_ResourceErrorDialogTitle;
+
+ /**
+ * @generated
+ */
+ public static String InitDiagramFile_ResourceErrorDialogMessage;
+
+ /**
+ * @generated
+ */
+ public static String InitDiagramFile_WizardTitle;
+
+ /**
+ * @generated
+ */
+ public static String InitDiagramFile_OpenModelFileDialogTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_CreationPageName;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_CreationPageTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_CreationPageDescription;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_RootSelectionPageName;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_RootSelectionPageTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_RootSelectionPageDescription;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_RootSelectionPageSelectionTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_RootSelectionPageNoSelectionMessage;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_RootSelectionPageInvalidSelectionMessage;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_InitDiagramCommand;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_IncorrectRootError;
+
+ /**
+ * @generated
+ */
+ public static String UMLDiagramEditor_SavingDeletedFile;
+
+ /**
+ * @generated
+ */
+ public static String UMLDiagramEditor_SaveAsErrorTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLDiagramEditor_SaveAsErrorMessage;
+
+ /**
+ * @generated
+ */
+ public static String UMLDiagramEditor_SaveErrorTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLDiagramEditor_SaveErrorMessage;
+
+ /**
+ * @generated
+ */
+ public static String UMLElementChooserDialog_SelectModelElementTitle;
+
+ /**
+ * @generated
+ */
+ public static String ModelElementSelectionPageMessage;
+
+ /**
+ * @generated
+ */
+ public static String ValidateActionMessage;
+
+ /**
+ * @generated
+ */
+ public static String Uml1Group_title;
+
+ /**
+ * @generated
+ */
+ public static String Component1CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String Component1CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String CommandName_OpenDiagram;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorActionProvider_OpenDiagramActionName;
+
+ /**
+ * @generated
+ */
+ public static String MessageFormatParser_InvalidInputError;
+
+ /**
+ * @generated
+ */
+ public static String UMLModelingAssistantProviderTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLModelingAssistantProviderMessage;
+
+ //TODO: put accessor fields manually
+}
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/ModelElementSelectionPage.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/ModelElementSelectionPage.java
index 3f38408b03d..16f7a8cb0e1 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/ModelElementSelectionPage.java
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/ModelElementSelectionPage.java
@@ -1,150 +1,27 @@
-package org.eclipse.papyrus.example.diagram.simplediagram.part;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.util.FeatureMap;
-import org.eclipse.emf.edit.provider.IWrapperItemProvider;
-import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
-import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-
-/**
- * Wizard page that allows to select element from model.
- * @generated
- */
-public class ModelElementSelectionPage extends WizardPage {
- /**
- * @generated
- */
- protected EObject selectedModelElement;
-
- /**
- * @generated
- */
- private TreeViewer modelViewer;
-
- /**
- * @generated
- */
- public ModelElementSelectionPage(String pageName) {
- super(pageName);
- }
-
- /**
- * @generated
- */
- public EObject getModelElement() {
- return selectedModelElement;
- }
-
- /**
- * @generated
- */
- public void setModelElement(EObject modelElement) {
- selectedModelElement = modelElement;
- if (modelViewer != null) {
- if (selectedModelElement != null) {
- modelViewer.setInput(selectedModelElement.eResource());
- modelViewer.setSelection(new StructuredSelection(
- selectedModelElement));
- } else {
- modelViewer.setInput(null);
- }
- setPageComplete(validatePage());
- }
- }
-
- /**
- * @generated
- */
- public void createControl(Composite parent) {
- initializeDialogUnits(parent);
-
- Composite plate = new Composite(parent, SWT.NONE);
- plate.setLayoutData(new GridData(GridData.FILL_BOTH));
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- plate.setLayout(layout);
- setControl(plate);
-
- Label label = new Label(plate, SWT.NONE);
- label.setText(getSelectionTitle());
- label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
-
- modelViewer = new TreeViewer(plate, SWT.SINGLE | SWT.H_SCROLL
- | SWT.V_SCROLL | SWT.BORDER);
- GridData layoutData = new GridData(GridData.FILL_BOTH);
- layoutData.heightHint = 300;
- layoutData.widthHint = 300;
- modelViewer.getTree().setLayoutData(layoutData);
- modelViewer.setContentProvider(new AdapterFactoryContentProvider(
- UMLDiagramEditorPlugin.getInstance()
- .getItemProvidersAdapterFactory()));
- modelViewer.setLabelProvider(new AdapterFactoryLabelProvider(
- UMLDiagramEditorPlugin.getInstance()
- .getItemProvidersAdapterFactory()));
- if (selectedModelElement != null) {
- modelViewer.setInput(selectedModelElement.eResource());
- modelViewer.setSelection(new StructuredSelection(
- selectedModelElement));
- }
- modelViewer
- .addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- ModelElementSelectionPage.this
- .updateSelection((IStructuredSelection) event
- .getSelection());
- }
- });
-
- setPageComplete(validatePage());
- }
-
- /**
- * Override to provide custom model element description.
- * @generated
- */
- protected String getSelectionTitle() {
- return Messages.ModelElementSelectionPageMessage;
- }
-
- /**
- * @generated
- */
- protected void updateSelection(IStructuredSelection selection) {
- selectedModelElement = null;
- if (selection.size() == 1) {
- Object selectedElement = selection.getFirstElement();
- if (selectedElement instanceof IWrapperItemProvider) {
- selectedElement = ((IWrapperItemProvider) selectedElement)
- .getValue();
- }
- if (selectedElement instanceof FeatureMap.Entry) {
- selectedElement = ((FeatureMap.Entry) selectedElement)
- .getValue();
- }
- if (selectedElement instanceof EObject) {
- selectedModelElement = (EObject) selectedElement;
- }
- }
- setPageComplete(validatePage());
- }
-
- /**
- * Override to provide specific validation of the selected model element.
- * @generated
- */
- protected boolean validatePage() {
- return true;
- }
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.part;
+
+import org.eclipse.gmf.tooling.runtime.part.DefaultModelElementSelectionPage;
+
+/**
+ * Wizard page that allows to select element from model.
+ * @generated
+ */
+public class ModelElementSelectionPage extends DefaultModelElementSelectionPage {
+
+ /**
+ * @generated
+ */
+ public ModelElementSelectionPage(String pageName) {
+ super(UMLDiagramEditorPlugin.getInstance()
+ .getItemProvidersAdapterFactory(), pageName);
+ }
+
+ /**
+ * Override to provide custom model element description.
+ * @generated
+ */
+ protected String getSelectionTitle() {
+ return Messages.ModelElementSelectionPageMessage;
+ }
+
+}
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLCreationWizard.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLCreationWizard.java
index ad751a67752..89cfd4ff84c 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLCreationWizard.java
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLCreationWizard.java
@@ -1,173 +1,173 @@
-package org.eclipse.papyrus.example.diagram.simplediagram.part;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-
-/**
- * @generated
- */
-public class UMLCreationWizard extends Wizard implements INewWizard {
-
- /**
- * @generated
- */
- private IWorkbench workbench;
-
- /**
- * @generated
- */
- protected IStructuredSelection selection;
-
- /**
- * @generated
- */
- protected UMLCreationWizardPage diagramModelFilePage;
-
- /**
- * @generated
- */
- protected UMLCreationWizardPage domainModelFilePage;
-
- /**
- * @generated
- */
- protected Resource diagram;
-
- /**
- * @generated
- */
- private boolean openNewlyCreatedDiagramEditor = true;
-
- /**
- * @generated
- */
- public IWorkbench getWorkbench() {
- return workbench;
- }
-
- /**
- * @generated
- */
- public IStructuredSelection getSelection() {
- return selection;
- }
-
- /**
- * @generated
- */
- public final Resource getDiagram() {
- return diagram;
- }
-
- /**
- * @generated
- */
- public final boolean isOpenNewlyCreatedDiagramEditor() {
- return openNewlyCreatedDiagramEditor;
- }
-
- /**
- * @generated
- */
- public void setOpenNewlyCreatedDiagramEditor(
- boolean openNewlyCreatedDiagramEditor) {
- this.openNewlyCreatedDiagramEditor = openNewlyCreatedDiagramEditor;
- }
-
- /**
- * @generated
- */
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- this.workbench = workbench;
- this.selection = selection;
- setWindowTitle(Messages.UMLCreationWizardTitle);
- setDefaultPageImageDescriptor(UMLDiagramEditorPlugin
- .getBundledImageDescriptor("icons/wizban/NewUMLWizard.gif")); //$NON-NLS-1$
- setNeedsProgressMonitor(true);
- }
-
- /**
- * @generated
- */
- public void addPages() {
- diagramModelFilePage = new UMLCreationWizardPage(
- "DiagramModelFile", getSelection(), "PapyrusNewDiagram_diagram"); //$NON-NLS-1$ //$NON-NLS-2$
- diagramModelFilePage
- .setTitle(Messages.UMLCreationWizard_DiagramModelFilePageTitle);
- diagramModelFilePage
- .setDescription(Messages.UMLCreationWizard_DiagramModelFilePageDescription);
- addPage(diagramModelFilePage);
-
- domainModelFilePage = new UMLCreationWizardPage(
- "DomainModelFile", getSelection(), "PapyrusNewDiagram") { //$NON-NLS-1$ //$NON-NLS-2$
-
- public void setVisible(boolean visible) {
- if (visible) {
- String fileName = diagramModelFilePage.getFileName();
- fileName = fileName.substring(0, fileName.length()
- - ".PapyrusNewDiagram_diagram".length()); //$NON-NLS-1$
- setFileName(UMLDiagramEditorUtil.getUniqueFileName(
- getContainerFullPath(), fileName,
- "PapyrusNewDiagram")); //$NON-NLS-1$
- }
- super.setVisible(visible);
- }
- };
- domainModelFilePage
- .setTitle(Messages.UMLCreationWizard_DomainModelFilePageTitle);
- domainModelFilePage
- .setDescription(Messages.UMLCreationWizard_DomainModelFilePageDescription);
- addPage(domainModelFilePage);
- }
-
- /**
- * @generated
- */
- public boolean performFinish() {
- IRunnableWithProgress op = new WorkspaceModifyOperation(null) {
-
- protected void execute(IProgressMonitor monitor)
- throws CoreException, InterruptedException {
- diagram = UMLDiagramEditorUtil.createDiagram(
- diagramModelFilePage.getURI(),
- domainModelFilePage.getURI(), monitor);
- if (isOpenNewlyCreatedDiagramEditor() && diagram != null) {
- try {
- UMLDiagramEditorUtil.openDiagram(diagram);
- } catch (PartInitException e) {
- ErrorDialog.openError(getContainer().getShell(),
- Messages.UMLCreationWizardOpenEditorError,
- null, e.getStatus());
- }
- }
- }
- };
- try {
- getContainer().run(false, true, op);
- } catch (InterruptedException e) {
- return false;
- } catch (InvocationTargetException e) {
- if (e.getTargetException() instanceof CoreException) {
- ErrorDialog.openError(getContainer().getShell(),
- Messages.UMLCreationWizardCreationError, null,
- ((CoreException) e.getTargetException()).getStatus());
- } else {
- UMLDiagramEditorPlugin.getInstance().logError(
- "Error creating diagram", e.getTargetException()); //$NON-NLS-1$
- }
- return false;
- }
- return diagram != null;
- }
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.part;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.actions.WorkspaceModifyOperation;
+
+/**
+ * @generated
+ */
+public class UMLCreationWizard extends Wizard implements INewWizard {
+
+ /**
+ * @generated
+ */
+ private IWorkbench workbench;
+
+ /**
+ * @generated
+ */
+ protected IStructuredSelection selection;
+
+ /**
+ * @generated
+ */
+ protected UMLCreationWizardPage diagramModelFilePage;
+
+ /**
+ * @generated
+ */
+ protected UMLCreationWizardPage domainModelFilePage;
+
+ /**
+ * @generated
+ */
+ protected Resource diagram;
+
+ /**
+ * @generated
+ */
+ private boolean openNewlyCreatedDiagramEditor = true;
+
+ /**
+ * @generated
+ */
+ public IWorkbench getWorkbench() {
+ return workbench;
+ }
+
+ /**
+ * @generated
+ */
+ public IStructuredSelection getSelection() {
+ return selection;
+ }
+
+ /**
+ * @generated
+ */
+ public final Resource getDiagram() {
+ return diagram;
+ }
+
+ /**
+ * @generated
+ */
+ public final boolean isOpenNewlyCreatedDiagramEditor() {
+ return openNewlyCreatedDiagramEditor;
+ }
+
+ /**
+ * @generated
+ */
+ public void setOpenNewlyCreatedDiagramEditor(
+ boolean openNewlyCreatedDiagramEditor) {
+ this.openNewlyCreatedDiagramEditor = openNewlyCreatedDiagramEditor;
+ }
+
+ /**
+ * @generated
+ */
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ this.workbench = workbench;
+ this.selection = selection;
+ setWindowTitle(Messages.UMLCreationWizardTitle);
+ setDefaultPageImageDescriptor(UMLDiagramEditorPlugin
+ .getBundledImageDescriptor("icons/wizban/NewUMLWizard.gif")); //$NON-NLS-1$
+ setNeedsProgressMonitor(true);
+ }
+
+ /**
+ * @generated
+ */
+ public void addPages() {
+ diagramModelFilePage = new UMLCreationWizardPage(
+ "DiagramModelFile", getSelection(), "PapyrusNewDiagram_diagram"); //$NON-NLS-1$ //$NON-NLS-2$
+ diagramModelFilePage
+ .setTitle(Messages.UMLCreationWizard_DiagramModelFilePageTitle);
+ diagramModelFilePage
+ .setDescription(Messages.UMLCreationWizard_DiagramModelFilePageDescription);
+ addPage(diagramModelFilePage);
+
+ domainModelFilePage = new UMLCreationWizardPage(
+ "DomainModelFile", getSelection(), "PapyrusNewDiagram") { //$NON-NLS-1$ //$NON-NLS-2$
+
+ public void setVisible(boolean visible) {
+ if (visible) {
+ String fileName = diagramModelFilePage.getFileName();
+ fileName = fileName.substring(0, fileName.length()
+ - ".PapyrusNewDiagram_diagram".length()); //$NON-NLS-1$
+ setFileName(UMLDiagramEditorUtil.getUniqueFileName(
+ getContainerFullPath(), fileName,
+ "PapyrusNewDiagram")); //$NON-NLS-1$
+ }
+ super.setVisible(visible);
+ }
+ };
+ domainModelFilePage
+ .setTitle(Messages.UMLCreationWizard_DomainModelFilePageTitle);
+ domainModelFilePage
+ .setDescription(Messages.UMLCreationWizard_DomainModelFilePageDescription);
+ addPage(domainModelFilePage);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean performFinish() {
+ IRunnableWithProgress op = new WorkspaceModifyOperation(null) {
+
+ protected void execute(IProgressMonitor monitor)
+ throws CoreException, InterruptedException {
+ diagram = UMLDiagramEditorUtil.createDiagram(
+ diagramModelFilePage.getURI(),
+ domainModelFilePage.getURI(), monitor);
+ if (isOpenNewlyCreatedDiagramEditor() && diagram != null) {
+ try {
+ UMLDiagramEditorUtil.openDiagram(diagram);
+ } catch (PartInitException e) {
+ ErrorDialog.openError(getContainer().getShell(),
+ Messages.UMLCreationWizardOpenEditorError,
+ null, e.getStatus());
+ }
+ }
+ }
+ };
+ try {
+ getContainer().run(false, true, op);
+ } catch (InterruptedException e) {
+ return false;
+ } catch (InvocationTargetException e) {
+ if (e.getTargetException() instanceof CoreException) {
+ ErrorDialog.openError(getContainer().getShell(),
+ Messages.UMLCreationWizardCreationError, null,
+ ((CoreException) e.getTargetException()).getStatus());
+ } else {
+ UMLDiagramEditorPlugin.getInstance().logError(
+ "Error creating diagram", e.getTargetException()); //$NON-NLS-1$
+ }
+ return false;
+ }
+ return diagram != null;
+ }
+}
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLCreationWizardPage.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLCreationWizardPage.java
index cd8e8a17270..b95164e227e 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLCreationWizardPage.java
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLCreationWizardPage.java
@@ -1,87 +1,87 @@
-package org.eclipse.papyrus.example.diagram.simplediagram.part;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
-
-/**
- * @generated
- */
-public class UMLCreationWizardPage extends WizardNewFileCreationPage {
-
- /**
- * @generated
- */
- private final String fileExtension;
-
- /**
- * @generated
- */
- public UMLCreationWizardPage(String pageName,
- IStructuredSelection selection, String fileExtension) {
- super(pageName, selection);
- this.fileExtension = fileExtension;
- }
-
- /**
- * Override to create files with this extension.
- *
- * @generated
- */
- protected String getExtension() {
- return fileExtension;
- }
-
- /**
- * @generated
- */
- public URI getURI() {
- return URI.createPlatformResourceURI(getFilePath().toString(), false);
- }
-
- /**
- * @generated
- */
- protected IPath getFilePath() {
- IPath path = getContainerFullPath();
- if (path == null) {
- path = new Path(""); //$NON-NLS-1$
- }
- String fileName = getFileName();
- if (fileName != null) {
- path = path.append(fileName);
- }
- return path;
- }
-
- /**
- * @generated
- */
- public void createControl(Composite parent) {
- super.createControl(parent);
- setFileName(UMLDiagramEditorUtil.getUniqueFileName(
- getContainerFullPath(), getFileName(), getExtension()));
- setPageComplete(validatePage());
- }
-
- /**
- * @generated
- */
- protected boolean validatePage() {
- if (!super.validatePage()) {
- return false;
- }
- String extension = getExtension();
- if (extension != null
- && !getFilePath().toString().endsWith("." + extension)) {
- setErrorMessage(NLS.bind(
- Messages.UMLCreationWizardPageExtensionError, extension));
- return false;
- }
- return true;
- }
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.part;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
+
+/**
+ * @generated
+ */
+public class UMLCreationWizardPage extends WizardNewFileCreationPage {
+
+ /**
+ * @generated
+ */
+ private final String fileExtension;
+
+ /**
+ * @generated
+ */
+ public UMLCreationWizardPage(String pageName,
+ IStructuredSelection selection, String fileExtension) {
+ super(pageName, selection);
+ this.fileExtension = fileExtension;
+ }
+
+ /**
+ * Override to create files with this extension.
+ *
+ * @generated
+ */
+ protected String getExtension() {
+ return fileExtension;
+ }
+
+ /**
+ * @generated
+ */
+ public URI getURI() {
+ return URI.createPlatformResourceURI(getFilePath().toString(), false);
+ }
+
+ /**
+ * @generated
+ */
+ protected IPath getFilePath() {
+ IPath path = getContainerFullPath();
+ if (path == null) {
+ path = new Path(""); //$NON-NLS-1$
+ }
+ String fileName = getFileName();
+ if (fileName != null) {
+ path = path.append(fileName);
+ }
+ return path;
+ }
+
+ /**
+ * @generated
+ */
+ public void createControl(Composite parent) {
+ super.createControl(parent);
+ setFileName(UMLDiagramEditorUtil.getUniqueFileName(
+ getContainerFullPath(), getFileName(), getExtension()));
+ setPageComplete(validatePage());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean validatePage() {
+ if (!super.validatePage()) {
+ return false;
+ }
+ String extension = getExtension();
+ if (extension != null
+ && !getFilePath().toString().endsWith("." + extension)) {
+ setErrorMessage(NLS.bind(
+ Messages.UMLCreationWizardPageExtensionError, extension));
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLDiagramActionBarContributor.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLDiagramActionBarContributor.java
index 1088c2d01d9..2eb135fa1b6 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLDiagramActionBarContributor.java
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLDiagramActionBarContributor.java
@@ -1,39 +1,39 @@
-package org.eclipse.papyrus.example.diagram.simplediagram.part;
-
-import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramActionBarContributor;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * @generated
- */
-public class UMLDiagramActionBarContributor extends DiagramActionBarContributor {
-
- /**
- * @generated
- */
- protected Class getEditorClass() {
- return UMLDiagramEditor.class;
- }
-
- /**
- * @generated
- */
- protected String getEditorId() {
- return UMLDiagramEditor.ID;
- }
-
- /**
- * @generated
- */
- public void init(IActionBars bars, IWorkbenchPage page) {
- super.init(bars, page);
- // print preview
- IMenuManager fileMenu = bars.getMenuManager().findMenuUsingPath(
- IWorkbenchActionConstants.M_FILE);
- assert fileMenu != null;
- fileMenu.remove("pageSetupAction"); //$NON-NLS-1$
- }
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.part;
+
+import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramActionBarContributor;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @generated
+ */
+public class UMLDiagramActionBarContributor extends DiagramActionBarContributor {
+
+ /**
+ * @generated
+ */
+ protected Class getEditorClass() {
+ return UMLDiagramEditor.class;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getEditorId() {
+ return UMLDiagramEditor.ID;
+ }
+
+ /**
+ * @generated
+ */
+ public void init(IActionBars bars, IWorkbenchPage page) {
+ super.init(bars, page);
+ // print preview
+ IMenuManager fileMenu = bars.getMenuManager().findMenuUsingPath(
+ IWorkbenchActionConstants.M_FILE);
+ assert fileMenu != null;
+ fileMenu.remove("pageSetupAction"); //$NON-NLS-1$
+ }
+}
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLDiagramEditor.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLDiagramEditor.java
index 5eb9655bd73..0f162d53034 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLDiagramEditor.java
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLDiagramEditor.java
@@ -1,540 +1,290 @@
-package org.eclipse.papyrus.example.diagram.simplediagram.part;
-
-import java.util.EventObject;
-
-import org.eclipse.core.commands.operations.IUndoableOperation;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
-import org.eclipse.gef.GraphicalViewer;
-import org.eclipse.gef.KeyHandler;
-import org.eclipse.gef.Tool;
-import org.eclipse.gef.commands.CommandStackListener;
-import org.eclipse.gef.palette.PaletteRoot;
-import org.eclipse.gef.ui.palette.PaletteViewer;
-import org.eclipse.gef.ui.palette.PaletteViewerProvider;
-import org.eclipse.gmf.runtime.common.core.service.IProviderChangeListener;
-import org.eclipse.gmf.runtime.common.core.service.ProviderChangeEvent;
-import org.eclipse.gmf.runtime.common.ui.services.marker.MarkerNavigationService;
-import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
-import org.eclipse.gmf.runtime.diagram.ui.actions.ActionIds;
-import org.eclipse.gmf.runtime.diagram.ui.internal.parts.PaletteToolTransferDragSourceListener;
-import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument;
-import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocumentProvider;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.jface.util.LocalSelectionTransfer;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.papyrus.core.adaptor.gmf.GmfMultiDiagramDocumentProvider;
-import org.eclipse.papyrus.core.editor.IMultiDiagramEditor;
-import org.eclipse.papyrus.core.services.ServiceException;
-import org.eclipse.papyrus.core.services.ServicesRegistry;
-import org.eclipse.papyrus.diagram.common.listeners.DropTargetListener;
-import org.eclipse.papyrus.diagram.common.part.PapyrusPaletteContextMenuProvider;
-import org.eclipse.papyrus.diagram.common.part.PapyrusPaletteViewer;
-import org.eclipse.papyrus.diagram.common.part.UmlGmfDiagramEditor;
-import org.eclipse.papyrus.diagram.common.service.PapyrusPaletteService;
-import org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLNavigatorItem;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.TransferData;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.ide.IGotoMarker;
-import org.eclipse.ui.navigator.resources.ProjectExplorer;
-import org.eclipse.ui.part.IShowInTargetList;
-import org.eclipse.ui.part.ShowInContext;
-
-/**
- * @generated
- */
-public class UMLDiagramEditor extends UmlGmfDiagramEditor implements
- IProviderChangeListener, IGotoMarker {
-
- /**
- * @generated
- */
- public static final String ID = "org.eclipse.papyrus.diagram.newdiagram.part.UMLDiagramEditorID"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final String CONTEXT_ID = "org.eclipse.papyrus.diagram.newdiagram.ui.diagramContext"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- private KeyHandler paletteKeyHandler = null;
-
- /**
- * @generated
- */
- private MouseListener paletteMouseListener = null;
-
- /**
- * @generated
- */
- private IUndoableOperation savedOperation = null;
-
- /**
- * @generated
- */
- private TransactionalEditingDomain editingDomain;
-
- /**
- * @generated
- */
- private IDocumentProvider documentProvider;
-
- /**
- * @generated
- */
- public UMLDiagramEditor(ServicesRegistry servicesRegistry, Diagram diagram)
- throws ServiceException {
- super(servicesRegistry, diagram);
-
- // adds a listener to the palette service, which reacts to palette customizations
- PapyrusPaletteService.getInstance().addProviderChangeListener(this);
-
- // Share the same editing provider
- editingDomain = servicesRegistry
- .getService(TransactionalEditingDomain.class);
- documentProvider = new GmfMultiDiagramDocumentProvider(editingDomain);
-
- // overrides editing domain created by super constructor
- setDocumentProvider(documentProvider);
-
- }
-
- /**
- * @generated
- */
- protected String getContextID() {
- return CONTEXT_ID;
- }
-
- /**
- * @generated
- */
- protected PaletteRoot createPaletteRoot(PaletteRoot existingPaletteRoot) {
- PaletteRoot paletteRoot;
- if (existingPaletteRoot == null) {
- paletteRoot = PapyrusPaletteService.getInstance().createPalette(
- this, getDefaultPaletteContent());
- } else {
- PapyrusPaletteService.getInstance().updatePalette(
- existingPaletteRoot, this, getDefaultPaletteContent());
- paletteRoot = existingPaletteRoot;
- }
- applyCustomizationsToPalette(paletteRoot);
- return paletteRoot;
- }
-
- /**
- * @generated
- */
- protected PreferencesHint getPreferencesHint() {
- return UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT;
- }
-
- /**
- * @generated
- */
- public String getContributorId() {
- return UMLDiagramEditorPlugin.ID;
- }
-
- /**
- * @generated
- */
- public Object getAdapter(Class type) {
- if (type == IShowInTargetList.class) {
- return new IShowInTargetList() {
- public String[] getShowInTargetIds() {
- return new String[] { ProjectExplorer.VIEW_ID };
- }
- };
- }
- return super.getAdapter(type);
- }
-
- /**
- * @generated
- */
- protected final IDocumentProvider getDocumentProvider(IEditorInput input) {
- return documentProvider;
- }
-
- /**
- * @generated
- */
- public TransactionalEditingDomain getEditingDomain() {
- return editingDomain;
- }
-
- /**
- * @generated
- */
- protected final void setDocumentProvider(IEditorInput input) {
- // Already set in the constructor
- }
-
- /**
- * @generated
- */
- public void gotoMarker(IMarker marker) {
- MarkerNavigationService.getInstance().gotoMarker(this, marker);
- }
-
- /**
- * @generated
- */
- public boolean isSaveAsAllowed() {
- return true;
- }
-
- /**
- * @generated
- */
- public void doSaveAs() {
- performSaveAs(new NullProgressMonitor());
- }
-
- /**
- * @generated
- */
- protected void performSaveAs(IProgressMonitor progressMonitor) {
- // Nothing
- }
-
- /**
- * @generated
- */
- public ShowInContext getShowInContext() {
- return new ShowInContext(getEditorInput(), getNavigatorSelection());
- }
-
- /**
- * @generated
- */
- private ISelection getNavigatorSelection() {
- IDiagramDocument document = getDiagramDocument();
- if (document == null) {
- return StructuredSelection.EMPTY;
- }
- Diagram diagram = document.getDiagram();
- IFile file = WorkspaceSynchronizer.getFile(diagram.eResource());
- if (file != null) {
- UMLNavigatorItem item = new UMLNavigatorItem(diagram, file, false);
- return new StructuredSelection(item);
- }
- return StructuredSelection.EMPTY;
- }
-
- /**
- * @generated
- */
- protected void configureGraphicalViewer() {
- super.configureGraphicalViewer();
- DiagramEditorContextMenuProvider provider = new DiagramEditorContextMenuProvider(
- this, getDiagramGraphicalViewer());
- getDiagramGraphicalViewer().setContextMenu(provider);
- getSite().registerContextMenu(ActionIds.DIAGRAM_EDITOR_CONTEXT_MENU,
- provider, getDiagramGraphicalViewer());
- }
-
- /**
- * @generated
- */
- protected TransactionalEditingDomain createEditingDomain() {
- // Already configured
- return editingDomain;
- }
-
- /**
- * @generated
- */
- protected void configureDiagramEditDomain() {
- super.configureDiagramEditDomain();
- getDiagramEditDomain().getDiagramCommandStack()
- .addCommandStackListener(new CommandStackListener() {
-
- public void commandStackChanged(EventObject event) {
- firePropertyChange(IEditorPart.PROP_DIRTY);
- }
- });
- }
-
- /**
- * @generated
- */
- public void doSave(IProgressMonitor progressMonitor) {
- // The saving of the resource is done by the CoreMultiDiagramEditor
- savedOperation = getOperationHistory().getUndoOperation(
- getUndoContext());
- }
-
- /**
- * @generated
- */
- public boolean isDirty() {
- IUndoableOperation op = getOperationHistory().getUndoOperation(
- getUndoContext());
- return savedOperation != op;
- }
-
- /**
- * @generated
- */
- public void providerChanged(ProviderChangeEvent event) {
- // update the palette if the palette service has changed
- if (PapyrusPaletteService.getInstance().equals(event.getSource())) {
- PapyrusPaletteService.getInstance().updatePalette(
- getPaletteViewer().getPaletteRoot(), this,
- getDefaultPaletteContent());
- }
- }
-
- /**
- * @generated
- */
- public void dispose() {
- // remove palette service listener
- // remove preference listener
- PapyrusPaletteService.getInstance().removeProviderChangeListener(this);
-
- super.dispose();
- }
-
- /**
- * @generated
- */
- protected PaletteViewer getPaletteViewer() {
- return getEditDomain().getPaletteViewer();
- }
-
- /**
- * @generated
- */
- protected PaletteViewer constructPaletteViewer() {
- return new PapyrusPaletteViewer();
- }
-
- /**
- * @generated
- */
- protected PaletteViewerProvider createPaletteViewerProvider() {
- getEditDomain().setPaletteRoot(createPaletteRoot(null));
- return new PaletteViewerProvider(getEditDomain()) {
-
- /**
- * Override to provide the additional behavior for the tools. Will intialize with a
- * PaletteEditPartFactory that has a TrackDragger that understand how to handle the
- * mouseDoubleClick event for shape creation tools. Also will initialize the palette
- * with a defaultTool that is the SelectToolEx that undestands how to handle the enter
- * key which will result in the creation of the shape also.
- */
- protected void configurePaletteViewer(PaletteViewer viewer) {
- super.configurePaletteViewer(viewer);
-
- // customize menu...
- viewer.setContextMenu(new PapyrusPaletteContextMenuProvider(
- viewer));
-
- viewer.getKeyHandler().setParent(getPaletteKeyHandler());
- viewer.getControl().addMouseListener(getPaletteMouseListener());
-
- // Add a transfer drag target listener that is supported on
- // palette template entries whose template is a creation tool.
- // This will enable drag and drop of the palette shape creation
- // tools.
- viewer.addDragSourceListener(new PaletteToolTransferDragSourceListener(
- viewer));
- viewer.setCustomizer(createPaletteCustomizer());
- }
-
- public PaletteViewer createPaletteViewer(Composite parent) {
- PaletteViewer pViewer = constructPaletteViewer();
- pViewer.createControl(parent);
- configurePaletteViewer(pViewer);
- hookPaletteViewer(pViewer);
- return pViewer;
- }
-
- /**
- * @return Palette Key Handler for the palette
- */
- private KeyHandler getPaletteKeyHandler() {
-
- if (paletteKeyHandler == null) {
-
- paletteKeyHandler = new KeyHandler() {
-
- /**
- * Processes a <i>key released </i> event. This method is called by the Tool
- * whenever a key is released, and the Tool is in the proper state. Override
- * to support pressing the enter key to create a shape or connection
- * (between two selected shapes)
- *
- * @param event
- * the KeyEvent
- * @return <code>true</code> if KeyEvent was handled in some way
- */
- public boolean keyReleased(KeyEvent event) {
-
- if (event.keyCode == SWT.Selection) {
-
- Tool tool = getPaletteViewer().getActiveTool()
- .createTool();
-
- if (toolSupportsAccessibility(tool)) {
-
- tool.keyUp(event,
- getDiagramGraphicalViewer());
-
- // deactivate current selection
- getPaletteViewer().setActiveTool(null);
-
- return true;
- }
-
- }
- return super.keyReleased(event);
- }
-
- };
-
- }
- return paletteKeyHandler;
- }
-
- /**
- * @return Palette Mouse listener for the palette
- */
- private MouseListener getPaletteMouseListener() {
-
- if (paletteMouseListener == null) {
-
- paletteMouseListener = new MouseListener() {
-
- /**
- * Flag to indicate that the current active tool should be cleared after a
- * mouse double-click event.
- */
- private boolean clearActiveTool = false;
-
- /**
- * Override to support double-clicking a palette tool entry to create a
- * shape or connection (between two selected shapes).
- *
- * @see MouseListener#mouseDoubleClick(MouseEvent)
- */
- public void mouseDoubleClick(MouseEvent e) {
- Tool tool = getPaletteViewer().getActiveTool()
- .createTool();
-
- if (toolSupportsAccessibility(tool)) {
-
- tool.setViewer(getDiagramGraphicalViewer());
- tool.setEditDomain(getDiagramGraphicalViewer()
- .getEditDomain());
- tool.mouseDoubleClick(e,
- getDiagramGraphicalViewer());
-
- // Current active tool should be deactivated,
- // but if it is down here it will get
- // reactivated deep in GEF palette code after
- // receiving mouse up events.
- clearActiveTool = true;
- }
- }
-
- public void mouseDown(MouseEvent e) {
- // do nothing
- }
-
- public void mouseUp(MouseEvent e) {
- // Deactivate current active tool here if a
- // double-click was handled.
- if (clearActiveTool) {
- getPaletteViewer().setActiveTool(null);
- clearActiveTool = false;
- }
-
- }
- };
-
- }
- return paletteMouseListener;
- }
-
- };
- }
-
- /**
- * @generated
- */
- @Override
- public GraphicalViewer getGraphicalViewer() {
- return super.getGraphicalViewer();
- }
-
- /**
- * @generated
- */
- @Override
- protected void initializeGraphicalViewer() {
- super.initializeGraphicalViewer();
-
- // Enable Drop
- getDiagramGraphicalViewer().addDropTargetListener(
- new DropTargetListener(getDiagramGraphicalViewer(),
- LocalSelectionTransfer.getTransfer()) {
-
- @Override
- protected Object getJavaObject(TransferData data) {
- return LocalSelectionTransfer.getTransfer()
- .nativeToJava(data);
- }
-
- @Override
- protected TransactionalEditingDomain getTransactionalEditingDomain() {
- return getEditingDomain();
- }
- });
-
- }
-
- /**
- * @generated
- */
- @Override
- public void selectionChanged(IWorkbenchPart part, ISelection selection) {
- if (getSite().getPage().getActiveEditor() instanceof IMultiDiagramEditor) {
- IMultiDiagramEditor editor = (IMultiDiagramEditor) getSite()
- .getPage().getActiveEditor();
- // If not the active editor, ignore selection changed.
- if (this.equals(editor.getActiveEditor())) {
- updateActions(getSelectionActions());
- super.selectionChanged(part, selection);
- } else {
- super.selectionChanged(part, selection);
- }
- } else {
- super.selectionChanged(part, selection);
- }
- // from
- // org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor.selectionChanged(IWorkbenchPart,
- // ISelection)
- if (part == this) {
- rebuildStatusLine();
- }
- }
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.part;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.common.ui.URIEditorInput;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.gef.palette.PaletteRoot;
+import org.eclipse.gmf.runtime.common.ui.services.marker.MarkerNavigationService;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.actions.ActionIds;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocumentProvider;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.papyrus.example.diagram.simplediagram.navigator.UMLNavigatorItem;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorMatchingStrategy;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.SaveAsDialog;
+import org.eclipse.ui.ide.IGotoMarker;
+import org.eclipse.ui.navigator.resources.ProjectExplorer;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.part.IShowInTargetList;
+import org.eclipse.ui.part.ShowInContext;
+
+/**
+ * @generated
+ */
+public class UMLDiagramEditor extends DiagramDocumentEditor implements
+ IGotoMarker {
+
+ /**
+ * @generated
+ */
+ public static final String ID = "org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditorID"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final String CONTEXT_ID = "org.eclipse.papyrus.example.diagram.simplediagram.ui.diagramContext"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public UMLDiagramEditor() {
+ super(true);
+ }
+
+ /**
+ * @generated
+ */
+ protected String getContextID() {
+ return CONTEXT_ID;
+ }
+
+ /**
+ * @generated
+ */
+ protected PaletteRoot createPaletteRoot(PaletteRoot existingPaletteRoot) {
+ PaletteRoot root = super.createPaletteRoot(existingPaletteRoot);
+ new UMLPaletteFactory().fillPalette(root);
+ return root;
+ }
+
+ /**
+ * @generated
+ */
+ protected PreferencesHint getPreferencesHint() {
+ return UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT;
+ }
+
+ /**
+ * @generated
+ */
+ public String getContributorId() {
+ return UMLDiagramEditorPlugin.ID;
+ }
+
+ /**
+ * @generated
+ */
+ @SuppressWarnings("rawtypes")
+ public Object getAdapter(Class type) {
+ if (type == IShowInTargetList.class) {
+ return new IShowInTargetList() {
+ public String[] getShowInTargetIds() {
+ return new String[] { ProjectExplorer.VIEW_ID };
+ }
+ };
+ }
+ return super.getAdapter(type);
+ }
+
+ /**
+ * @generated
+ */
+ protected IDocumentProvider getDocumentProvider(IEditorInput input) {
+ if (input instanceof IFileEditorInput
+ || input instanceof URIEditorInput) {
+ return UMLDiagramEditorPlugin.getInstance().getDocumentProvider();
+ }
+ return super.getDocumentProvider(input);
+ }
+
+ /**
+ * @generated
+ */
+ public TransactionalEditingDomain getEditingDomain() {
+ IDocument document = getEditorInput() != null ? getDocumentProvider()
+ .getDocument(getEditorInput()) : null;
+ if (document instanceof IDiagramDocument) {
+ return ((IDiagramDocument) document).getEditingDomain();
+ }
+ return super.getEditingDomain();
+ }
+
+ /**
+ * @generated
+ */
+ protected void setDocumentProvider(IEditorInput input) {
+ if (input instanceof IFileEditorInput
+ || input instanceof URIEditorInput) {
+ setDocumentProvider(UMLDiagramEditorPlugin.getInstance()
+ .getDocumentProvider());
+ } else {
+ super.setDocumentProvider(input);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void gotoMarker(IMarker marker) {
+ MarkerNavigationService.getInstance().gotoMarker(this, marker);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isSaveAsAllowed() {
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public void doSaveAs() {
+ performSaveAs(new NullProgressMonitor());
+ }
+
+ /**
+ * @generated
+ */
+ protected void performSaveAs(IProgressMonitor progressMonitor) {
+ Shell shell = getSite().getShell();
+ IEditorInput input = getEditorInput();
+ SaveAsDialog dialog = new SaveAsDialog(shell);
+ IFile original = input instanceof IFileEditorInput ? ((IFileEditorInput) input)
+ .getFile() : null;
+ if (original != null) {
+ dialog.setOriginalFile(original);
+ }
+ dialog.create();
+ IDocumentProvider provider = getDocumentProvider();
+ if (provider == null) {
+ // editor has been programmatically closed while the dialog was open
+ return;
+ }
+ if (provider.isDeleted(input) && original != null) {
+ String message = NLS.bind(
+ Messages.UMLDiagramEditor_SavingDeletedFile,
+ original.getName());
+ dialog.setErrorMessage(null);
+ dialog.setMessage(message, IMessageProvider.WARNING);
+ }
+ if (dialog.open() == Window.CANCEL) {
+ if (progressMonitor != null) {
+ progressMonitor.setCanceled(true);
+ }
+ return;
+ }
+ IPath filePath = dialog.getResult();
+ if (filePath == null) {
+ if (progressMonitor != null) {
+ progressMonitor.setCanceled(true);
+ }
+ return;
+ }
+ IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
+ IFile file = workspaceRoot.getFile(filePath);
+ final IEditorInput newInput = new FileEditorInput(file);
+ // Check if the editor is already open
+ IEditorMatchingStrategy matchingStrategy = getEditorDescriptor()
+ .getEditorMatchingStrategy();
+ IEditorReference[] editorRefs = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage()
+ .getEditorReferences();
+ for (int i = 0; i < editorRefs.length; i++) {
+ if (matchingStrategy.matches(editorRefs[i], newInput)) {
+ MessageDialog.openWarning(shell,
+ Messages.UMLDiagramEditor_SaveAsErrorTitle,
+ Messages.UMLDiagramEditor_SaveAsErrorMessage);
+ return;
+ }
+ }
+ boolean success = false;
+ try {
+ provider.aboutToChange(newInput);
+ getDocumentProvider(newInput).saveDocument(progressMonitor,
+ newInput,
+ getDocumentProvider().getDocument(getEditorInput()), true);
+ success = true;
+ } catch (CoreException x) {
+ IStatus status = x.getStatus();
+ if (status == null || status.getSeverity() != IStatus.CANCEL) {
+ ErrorDialog.openError(shell,
+ Messages.UMLDiagramEditor_SaveErrorTitle,
+ Messages.UMLDiagramEditor_SaveErrorMessage,
+ x.getStatus());
+ }
+ } finally {
+ provider.changed(newInput);
+ if (success) {
+ setInput(newInput);
+ }
+ }
+ if (progressMonitor != null) {
+ progressMonitor.setCanceled(!success);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public ShowInContext getShowInContext() {
+ return new ShowInContext(getEditorInput(), getNavigatorSelection());
+ }
+
+ /**
+ * @generated
+ */
+ private ISelection getNavigatorSelection() {
+ IDiagramDocument document = getDiagramDocument();
+ if (document == null) {
+ return StructuredSelection.EMPTY;
+ }
+ Diagram diagram = document.getDiagram();
+ if (diagram == null || diagram.eResource() == null) {
+ return StructuredSelection.EMPTY;
+ }
+ IFile file = WorkspaceSynchronizer.getFile(diagram.eResource());
+ if (file != null) {
+ UMLNavigatorItem item = new UMLNavigatorItem(diagram, file, false);
+ return new StructuredSelection(item);
+ }
+ return StructuredSelection.EMPTY;
+ }
+
+ /**
+ * @generated
+ */
+ protected void configureGraphicalViewer() {
+ super.configureGraphicalViewer();
+ DiagramEditorContextMenuProvider provider = new DiagramEditorContextMenuProvider(
+ this, getDiagramGraphicalViewer());
+ getDiagramGraphicalViewer().setContextMenu(provider);
+ getSite().registerContextMenu(ActionIds.DIAGRAM_EDITOR_CONTEXT_MENU,
+ provider, getDiagramGraphicalViewer());
+ }
+
+}
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLDiagramEditorPlugin.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLDiagramEditorPlugin.java
index 1596fcc0732..32feb50c63c 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLDiagramEditorPlugin.java
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLDiagramEditorPlugin.java
@@ -1,284 +1,256 @@
-package org.eclipse.papyrus.example.diagram.simplediagram.part;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory;
-import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
-import org.eclipse.emf.edit.provider.IItemLabelProvider;
-import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
-import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;
-import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
-import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.papyrus.example.diagram.simplediagram.preferences.DiagramPreferenceInitializer;
-import org.eclipse.papyrus.example.diagram.simplediagram.providers.ElementInitializers;
-import org.eclipse.papyrus.preferences.Activator;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.uml2.uml.edit.providers.UMLItemProviderAdapterFactory;
-import org.osgi.framework.BundleContext;
-
-/**
- * @generated
- */
-public class UMLDiagramEditorPlugin extends AbstractUIPlugin {
-
- /**
- * @generated
- */
- public static final String ID = "org.eclipse.uml2.uml.diagram"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final PreferencesHint DIAGRAM_PREFERENCES_HINT = new PreferencesHint(
- ID);
-
- /**
- * @generated
- */
- private static UMLDiagramEditorPlugin instance;
-
- /**
- * @generated
- */
- private ComposedAdapterFactory adapterFactory;
-
- /**
- * @generated
- */
- private UMLDocumentProvider documentProvider;
-
- /**
- * @generated
- */
- private ElementInitializers initializers;
-
- /**
- * @generated
- */
- public UMLDiagramEditorPlugin() {
- }
-
- /**
- * @generated
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- instance = this;
- PreferencesHint.registerPreferenceStore(DIAGRAM_PREFERENCES_HINT,
- getPreferenceStore());
- adapterFactory = createAdapterFactory();
- DiagramPreferenceInitializer diagramPreferenceInitializer = new DiagramPreferenceInitializer();
- diagramPreferenceInitializer.initializeDefaultPreferences();
- }
-
- /**
- * @generated
- */
- public void stop(BundleContext context) throws Exception {
- adapterFactory.dispose();
- adapterFactory = null;
- initializers = null;
- instance = null;
- super.stop(context);
- }
-
- /**
- * @generated
- */
- public static UMLDiagramEditorPlugin getInstance() {
- return instance;
- }
-
- /**
- * @generated
- */
- public IPreferenceStore getPreferenceStore() {
- IPreferenceStore store = Activator.getDefault().getPreferenceStore();
- return store;
- }
-
- /**
- * @generated
- */
- protected ComposedAdapterFactory createAdapterFactory() {
- ArrayList<AdapterFactory> factories = new ArrayList<AdapterFactory>();
- fillItemProviderFactories(factories);
- return new ComposedAdapterFactory(factories);
- }
-
- /**
- * @generated
- */
- protected void fillItemProviderFactories(List<AdapterFactory> factories) {
- factories.add(new UMLItemProviderAdapterFactory());
- factories.add(new EcoreItemProviderAdapterFactory());
- factories.add(new ResourceItemProviderAdapterFactory());
- factories.add(new ReflectiveItemProviderAdapterFactory());
- }
-
- /**
- * @generated
- */
- public AdapterFactory getItemProvidersAdapterFactory() {
- return adapterFactory;
- }
-
- /**
- * @generated
- */
- public ImageDescriptor getItemImageDescriptor(Object item) {
- IItemLabelProvider labelProvider = (IItemLabelProvider) adapterFactory
- .adapt(item, IItemLabelProvider.class);
- if (labelProvider != null) {
- return ExtendedImageRegistry.getInstance().getImageDescriptor(
- labelProvider.getImage(item));
- }
- return null;
- }
-
- /**
- * Returns an image descriptor for the image file at the given
- * plug-in relative path.
- *
- * @generated
- * @param path the path
- * @return the image descriptor
- */
- public static ImageDescriptor getBundledImageDescriptor(String path) {
- return AbstractUIPlugin.imageDescriptorFromPlugin(ID, path);
- }
-
- /**
- * Respects images residing in any plug-in. If path is relative,
- * then this bundle is looked up for the image, otherwise, for absolute
- * path, first segment is taken as id of plug-in with image
- *
- * @generated
- * @param path the path to image, either absolute (with plug-in id as first segment), or relative for bundled images
- * @return the image descriptor
- */
- public static ImageDescriptor findImageDescriptor(String path) {
- final IPath p = new Path(path);
- if (p.isAbsolute() && p.segmentCount() > 1) {
- return AbstractUIPlugin.imageDescriptorFromPlugin(p.segment(0), p
- .removeFirstSegments(1).makeAbsolute().toString());
- } else {
- return getBundledImageDescriptor(p.makeAbsolute().toString());
- }
- }
-
- /**
- * Returns an image for the image file at the given plug-in relative path.
- * Client do not need to dispose this image. Images will be disposed automatically.
- *
- * @generated
- * @param path the path
- * @return image instance
- */
- public Image getBundledImage(String path) {
- Image image = getImageRegistry().get(path);
- if (image == null) {
- getImageRegistry().put(path, getBundledImageDescriptor(path));
- image = getImageRegistry().get(path);
- }
- return image;
- }
-
- /**
- * Returns string from plug-in's resource bundle
- *
- * @generated
- */
- public static String getString(String key) {
- return Platform.getResourceString(getInstance().getBundle(), "%" + key); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- public UMLDocumentProvider getDocumentProvider() {
- if (documentProvider == null) {
- documentProvider = new UMLDocumentProvider();
- }
- return documentProvider;
- }
-
- /**
- * @generated
- */
- public ElementInitializers getElementInitializers() {
- return initializers;
- }
-
- /**
- * @generated
- */
- public void setElementInitializers(ElementInitializers i) {
- this.initializers = i;
- }
-
- /**
- * @generated
- */
- public void logError(String error) {
- logError(error, null);
- }
-
- /**
- * @generated
- */
- public void logError(String error, Throwable throwable) {
- if (error == null && throwable != null) {
- error = throwable.getMessage();
- }
- getLog().log(
- new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID,
- IStatus.OK, error, throwable));
- debug(error, throwable);
- }
-
- /**
- * @generated
- */
- public void logInfo(String message) {
- logInfo(message, null);
- }
-
- /**
- * @generated
- */
- public void logInfo(String message, Throwable throwable) {
- if (message == null && throwable != null) {
- message = throwable.getMessage();
- }
- getLog().log(
- new Status(IStatus.INFO, UMLDiagramEditorPlugin.ID, IStatus.OK,
- message, throwable));
- debug(message, throwable);
- }
-
- /**
- * @generated
- */
- private void debug(String message, Throwable throwable) {
- if (!isDebugging()) {
- return;
- }
- if (message != null) {
- System.err.println(message);
- }
- if (throwable != null) {
- throwable.printStackTrace();
- }
- }
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.part;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
+import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;
+import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.tooling.runtime.LogHelper;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.papyrus.example.diagram.simplediagram.providers.ElementInitializers;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.eclipse.uml2.uml.edit.providers.UMLItemProviderAdapterFactory;
+import org.osgi.framework.BundleContext;
+
+/**
+ * @generated
+ */
+public class UMLDiagramEditorPlugin extends AbstractUIPlugin {
+
+ /**
+ * @generated
+ */
+ public static final String ID = "org.eclipse.uml2.uml.diagram"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ private LogHelper myLogHelper;
+
+ /**
+ * @generated
+ */
+ public static final PreferencesHint DIAGRAM_PREFERENCES_HINT = new PreferencesHint(
+ ID);
+
+ /**
+ * @generated
+ */
+ private static UMLDiagramEditorPlugin instance;
+
+ /**
+ * @generated
+ */
+ private ComposedAdapterFactory adapterFactory;
+
+ /**
+ * @generated
+ */
+ private UMLDocumentProvider documentProvider;
+
+ /**
+ * @generated
+ */
+ private ElementInitializers initializers;
+
+ /**
+ * @generated
+ */
+ public UMLDiagramEditorPlugin() {
+ }
+
+ /**
+ * @generated
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ instance = this;
+ myLogHelper = new LogHelper(this);
+ PreferencesHint.registerPreferenceStore(DIAGRAM_PREFERENCES_HINT,
+ getPreferenceStore());
+ adapterFactory = createAdapterFactory();
+ }
+
+ /**
+ * @generated
+ */
+ public void stop(BundleContext context) throws Exception {
+ adapterFactory.dispose();
+ adapterFactory = null;
+ initializers = null;
+ instance = null;
+ super.stop(context);
+ }
+
+ /**
+ * @generated
+ */
+ public static UMLDiagramEditorPlugin getInstance() {
+ return instance;
+ }
+
+ /**
+ * @generated
+ */
+ protected ComposedAdapterFactory createAdapterFactory() {
+ ArrayList<AdapterFactory> factories = new ArrayList<AdapterFactory>();
+ fillItemProviderFactories(factories);
+ return new ComposedAdapterFactory(factories);
+ }
+
+ /**
+ * @generated
+ */
+ protected void fillItemProviderFactories(List<AdapterFactory> factories) {
+ factories.add(new UMLItemProviderAdapterFactory());
+ factories.add(new EcoreItemProviderAdapterFactory());
+ factories.add(new ResourceItemProviderAdapterFactory());
+ factories.add(new ReflectiveItemProviderAdapterFactory());
+ }
+
+ /**
+ * @generated
+ */
+ public AdapterFactory getItemProvidersAdapterFactory() {
+ return adapterFactory;
+ }
+
+ /**
+ * @generated
+ */
+ public ImageDescriptor getItemImageDescriptor(Object item) {
+ IItemLabelProvider labelProvider = (IItemLabelProvider) adapterFactory
+ .adapt(item, IItemLabelProvider.class);
+ if (labelProvider != null) {
+ return ExtendedImageRegistry.getInstance().getImageDescriptor(
+ labelProvider.getImage(item));
+ }
+ return null;
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path.
+ *
+ * @generated
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getBundledImageDescriptor(String path) {
+ return AbstractUIPlugin.imageDescriptorFromPlugin(ID, path);
+ }
+
+ /**
+ * Respects images residing in any plug-in. If path is relative,
+ * then this bundle is looked up for the image, otherwise, for absolute
+ * path, first segment is taken as id of plug-in with image
+ *
+ * @generated
+ * @param path the path to image, either absolute (with plug-in id as first segment), or relative for bundled images
+ * @return the image descriptor
+ */
+ public static ImageDescriptor findImageDescriptor(String path) {
+ final IPath p = new Path(path);
+ if (p.isAbsolute() && p.segmentCount() > 1) {
+ return AbstractUIPlugin.imageDescriptorFromPlugin(p.segment(0), p
+ .removeFirstSegments(1).makeAbsolute().toString());
+ } else {
+ return getBundledImageDescriptor(p.makeAbsolute().toString());
+ }
+ }
+
+ /**
+ * Returns an image for the image file at the given plugin relative path.
+ * Client do not need to dispose this image. Images will be disposed automatically.
+ *
+ * @generated
+ * @param path the path
+ * @return image instance
+ */
+ public Image getBundledImage(String path) {
+ Image image = getImageRegistry().get(path);
+ if (image == null) {
+ getImageRegistry().put(path, getBundledImageDescriptor(path));
+ image = getImageRegistry().get(path);
+ }
+ return image;
+ }
+
+ /**
+ * Returns string from plug-in's resource bundle
+ *