Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'examples/uml')
-rw-r--r--examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/.classpath7
-rw-r--r--examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/.project28
-rw-r--r--examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/META-INF/MANIFEST.MF29
-rw-r--r--examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/about.html28
-rw-r--r--examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/build.properties9
-rw-r--r--examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/icons/texteditorv2.bmpbin0 -> 822 bytes
-rw-r--r--examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/plugin.properties12
-rw-r--r--examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/plugin.xml67
-rw-r--r--examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/pom.xml13
-rw-r--r--examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/Activator.java67
-rw-r--r--examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/editor/PapyrusCommentEditor.java220
-rw-r--r--examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/factory/CommentEditorFactory.java211
-rw-r--r--examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/handler/CommentEditorHandler.java177
-rw-r--r--examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/modelresource/TextEditorModelCommentResource.java102
-rw-r--r--examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/.classpath7
-rw-r--r--examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/.project28
-rw-r--r--examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/META-INF/MANIFEST.MF29
-rw-r--r--examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/about.html28
-rw-r--r--examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/build.properties8
-rw-r--r--examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/icons/texteditor.bmpbin0 -> 1078 bytes
-rw-r--r--examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/plugin.properties12
-rw-r--r--examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/plugin.xml67
-rw-r--r--examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/pom.xml13
-rw-r--r--examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/Activator.java67
-rw-r--r--examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/editor/PapyrusCommentEditor.java221
-rw-r--r--examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/factory/CommentEditorFactory.java211
-rw-r--r--examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/handler/CommentEditorHandler.java177
-rw-r--r--examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/modelresource/TextEditorModelSharedResource.java102
-rw-r--r--examples/uml/org.eclipse.papyrus.thousandcreation/pom.xml7
-rw-r--r--examples/uml/org.eclipse.papyrus.thousandcreation/test/thousandcreation/HugeModelGenerationAction.java204
-rw-r--r--examples/uml/org.eclipse.papyrus.uml.diagram.emftree/.classpath7
-rw-r--r--examples/uml/org.eclipse.papyrus.uml.diagram.emftree/.project52
-rw-r--r--examples/uml/org.eclipse.papyrus.uml.diagram.emftree/.settings/org.eclipse.jdt.core.prefs291
-rw-r--r--examples/uml/org.eclipse.papyrus.uml.diagram.emftree/.settings/org.eclipse.jdt.ui.prefs68
-rw-r--r--examples/uml/org.eclipse.papyrus.uml.diagram.emftree/.settings/org.eclipse.pde.api.tools.prefs98
-rw-r--r--examples/uml/org.eclipse.papyrus.uml.diagram.emftree/META-INF/MANIFEST.MF17
-rw-r--r--examples/uml/org.eclipse.papyrus.uml.diagram.emftree/about.html28
-rw-r--r--examples/uml/org.eclipse.papyrus.uml.diagram.emftree/build.properties7
-rw-r--r--examples/uml/org.eclipse.papyrus.uml.diagram.emftree/icons/EmfTree.gifbin0 -> 369 bytes
-rw-r--r--examples/uml/org.eclipse.papyrus.uml.diagram.emftree/plugin.properties12
-rw-r--r--examples/uml/org.eclipse.papyrus.uml.diagram.emftree/plugin.xml66
-rw-r--r--examples/uml/org.eclipse.papyrus.uml.diagram.emftree/pom.xml12
-rw-r--r--examples/uml/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/uml/diagram/emftree/Activator.java71
-rw-r--r--examples/uml/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/uml/diagram/emftree/CreateEMFTreeDiagramHandler.java29
-rw-r--r--examples/uml/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/uml/diagram/emftree/EmfTreeDiagramEditorFactory.java227
-rw-r--r--examples/uml/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/uml/diagram/emftree/UMLEditor.java225
-rw-r--r--examples/uml/org.eclipse.papyrus.uml.diagram.example.programmaticcreation/META-INF/MANIFEST.MF1
-rw-r--r--examples/uml/org.eclipse.papyrus.uml.diagram.example.programmaticcreation/pom.xml7
-rw-r--r--examples/uml/org.eclipse.papyrus.uml.diagram.example.programmaticcreation/src/org/eclipse/papyrus/uml/diagram/example/programmaticcreation/CreateCompositeDiagramElementsCommand.java15
-rw-r--r--examples/uml/org.eclipse.papyrus.uml.diagram.example.programmaticcreation/src/org/eclipse/papyrus/uml/diagram/example/programmaticcreation/CreateSequenceDiagramElementsCommand.java16
-rw-r--r--examples/uml/org.eclipse.papyrus.uml.textual.editors.example/pom.xml7
-rw-r--r--examples/uml/pom.xml19
54 files changed, 3309 insertions, 131 deletions
diff --git a/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/.classpath b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/.project b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/.project
new file mode 100644
index 00000000000..8a94e000222
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.example.uml.comment.editor.newresource</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/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/.settings/org.eclipse.jdt.core.prefs b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..44217f8c068
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+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/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/META-INF/MANIFEST.MF b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..35871a92f13
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/META-INF/MANIFEST.MF
@@ -0,0 +1,29 @@
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.papyrus.infra.core.log;bundle-version="1.1.0",
+ 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.1.0",
+ org.eclipse.uml2.uml;bundle-version="4.0.0",
+ org.eclipse.papyrus.infra.core;bundle-version="1.1.0",
+ 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.1.0",
+ org.eclipse.gmf.runtime.common.core,
+ org.eclipse.gmf.runtime.emf.type.core,
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.1.0",
+ org.eclipse.ui.ide;bundle-version="3.10.0"
+Bundle-Vendor: Eclipse Modeling Project
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 1.1.0.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
+Bundle-Description: %pluginDescription
diff --git a/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/about.html b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/build.properties b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/build.properties
new file mode 100644
index 00000000000..274b1327ea1
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/build.properties
@@ -0,0 +1,9 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ icons/,\
+ build.properties,\
+ about.html
+src.includes = about.html
diff --git a/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/icons/texteditorv2.bmp b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/icons/texteditorv2.bmp
new file mode 100644
index 00000000000..1376f03a47e
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/icons/texteditorv2.bmp
Binary files differ
diff --git a/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/plugin.properties b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/plugin.properties
new file mode 100644
index 00000000000..0bf1dafb010
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/plugin.properties
@@ -0,0 +1,12 @@
+#################################################################################
+# Copyright (c) 2015 CEA LIST.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License 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 - initial API and implementation
+##################################################################################)
+
+pluginDescription=This plugin provides a editor for uml.Comment. The informations are stored in a new file : .comment \ No newline at end of file
diff --git a/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/plugin.xml b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/plugin.xml
new file mode 100644
index 00000000000..c0e4f5d6e0d
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/plugin.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.papyrus.infra.core.model">
+ <model
+ classname="org.eclipse.papyrus.example.uml.comment.editor.newresource.modelresource.TextEditorModelCommentResource">
+ </model>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ description="Open a Comment Editor (Comment Resource)"
+ id="org.eclipse.papyrus.example.uml.comment.editor.command.newresource"
+ name="Open a Comment Editor (Comment Resource)">
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.handlers">
+ <handler
+ class="org.eclipse.papyrus.example.uml.comment.editor.newresource.handler.CommentEditorHandler"
+ commandId="org.eclipse.papyrus.example.uml.comment.editor.command.newresource">
+ <activeWhen>
+ <and>
+ <with
+ variable="activeEditorId">
+ <equals
+ value="org.eclipse.papyrus.infra.core.papyrusEditor">
+ </equals>
+ </with>
+ </and>
+ </activeWhen>
+ </handler>
+ </extension>
+ <extension
+ point="org.eclipse.papyrus.infra.ui.papyrusDiagram">
+ <editorDiagram
+ factoryClass="org.eclipse.papyrus.example.uml.comment.editor.newresource.factory.CommentEditorFactory"
+ icon="icons/texteditorv2.bmp">
+ </editorDiagram>
+ </extension>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ allPopups="false"
+ locationURI="popup:org.eclipse.papyrus.views.modelexplorer.modelexplorer.popup">
+ <command
+ commandId="org.eclipse.papyrus.example.uml.comment.editor.command.newresource"
+ icon="icons/texteditorv2.bmp"
+ style="push">
+ <visibleWhen
+ checkEnabled="false">
+ <and>
+ <with
+ variable="activeEditorId">
+ <equals
+ value="org.eclipse.papyrus.infra.core.papyrusEditor">
+ </equals>
+ </with>
+ </and>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+ </extension>
+
+
+</plugin>
diff --git a/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/pom.xml b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/pom.xml
new file mode 100644
index 00000000000..4b1742ab2ba
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/pom.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.papyrus</groupId>
+ <artifactId>org.eclipse.papyrus.examples.uml</artifactId>
+ <version>1.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.papyrus.example.uml.comment.editor.newresource</artifactId>
+ <groupId>org.eclipse.papyrus</groupId>
+ <version>1.1.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project> \ No newline at end of file
diff --git a/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/Activator.java b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/Activator.java
new file mode 100644
index 00000000000..5f975ee9b57
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/Activator.java
@@ -0,0 +1,67 @@
+/*****************************************************************************
+ * 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;
+
+import org.eclipse.papyrus.infra.core.log.LogHelper;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.example.uml.comment.editor.newresource"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ public static LogHelper log;
+
+ /**
+ * 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;
+ log = new LogHelper(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;
+ }
+
+}
diff --git a/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/editor/PapyrusCommentEditor.java b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/editor/PapyrusCommentEditor.java
new file mode 100644
index 00000000000..f6e6e894653
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/editor/PapyrusCommentEditor.java
@@ -0,0 +1,220 @@
+/*****************************************************************************
+ * 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.editor;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+
+import org.eclipse.core.resources.IStorage;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.text.ITextListener;
+import org.eclipse.jface.text.TextEvent;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jface.text.source.IVerticalRuler;
+import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance;
+import org.eclipse.papyrus.example.uml.comment.editor.newresource.Activator;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IPersistableElement;
+import org.eclipse.ui.IStorageEditorInput;
+import org.eclipse.ui.editors.text.TextEditor;
+import org.eclipse.uml2.uml.Comment;
+
+public class PapyrusCommentEditor extends TextEditor {
+
+ /** the service registry */
+ protected final ServicesRegistry registry;
+
+ /** the papyrus text instance */
+ protected final PapyrusTextInstance papyrusTextInstance;
+
+ /** the text listener */
+ protected ITextListener listener;
+
+ /** the editing domain */
+ protected TransactionalEditingDomain domain;
+
+ public static final String EDITOR_DEFAULT_NAME = "Comment Editor New Resource";
+
+ public static final String EDITOR_TYPE = "CommentEditorNewResource";
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param registry
+ * @param papyrusTextInstance
+ */
+ public PapyrusCommentEditor(final ServicesRegistry registry, final PapyrusTextInstance papyrusTextInstance) {
+ super();
+ this.registry = registry;
+ this.papyrusTextInstance = papyrusTextInstance;
+ try {
+ domain = ServiceUtils.getInstance().getTransactionalEditingDomain(registry);
+ } catch (ServiceException e) {
+ Activator.log.error(e);
+ }
+ }
+
+
+ /**
+ *
+ * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#createSourceViewer(org.eclipse.swt.widgets.Composite,
+ * org.eclipse.jface.text.source.IVerticalRuler, int)
+ *
+ * @param parent
+ * @param ruler
+ * @param styles
+ * @return
+ */
+ @Override
+ protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) {
+ ISourceViewer viewer = super.createSourceViewer(parent, ruler, styles);
+ //we add a listener on the viewer to be notified when the text is edited
+ //TODO try to improve, because we execute a command for each character
+ listener = new ITextListener() {
+
+ //we edit the uml.Comment
+ public void textChanged(TextEvent event) {
+ String currentText = getSourceViewer().getTextWidget().getText();
+ Comment cmt = (Comment)papyrusTextInstance.getEditedObject();
+ EStructuralFeature feature = cmt.eClass().getEStructuralFeature("body");
+ IElementEditService elementEditService = ElementEditServiceUtils.getCommandProvider(cmt);
+ SetRequest request = new SetRequest(domain, cmt, feature, currentText);
+ ICommand command = elementEditService.getEditCommand(request);
+ if(command.canExecute()) {
+ domain.getCommandStack().execute(new GMFtoEMFCommandWrapper(command));
+ }
+ }
+ };
+
+ viewer.addTextListener(listener);
+
+ return viewer;
+ }
+
+ /**
+ * We override this method because setInput can't be overriden for TextEditor.
+ * We replace the default papyrus input by our input for Comment
+ *
+ * @see org.eclipse.ui.editors.text.TextEditor#doSetInput(org.eclipse.ui.IEditorInput)
+ *
+ * @param input
+ * @throws CoreException
+ */
+ @Override
+ protected void doSetInput(IEditorInput input) throws CoreException {
+ String string = ((Comment)papyrusTextInstance.getEditedObject()).getBody();
+ if(string == null) {
+ string = "";
+ }
+ IStorage storage = new TextStorage(string);
+ super.doSetInput(new TextInput(storage));
+ }
+
+ /**
+ *
+ * @see org.eclipse.ui.editors.text.TextEditor#dispose()
+ *
+ */
+ @Override
+ public void dispose() {
+ //we remove the listener
+ getSourceViewer().removeTextListener(listener);
+ super.dispose();
+ }
+
+
+ //for this classes , see : http://wiki.eclipse.org/FAQ_How_do_I_open_an_editor_on_something_that_is_not_a_file%3F
+ class TextStorage implements IStorage {
+
+ private String string;
+
+ TextStorage(String input) {
+ this.string = input;
+ }
+
+ public InputStream getContents() throws CoreException {
+ return new ByteArrayInputStream(string.getBytes());
+ }
+
+ public IPath getFullPath() {
+ return null;
+ }
+
+ public Object getAdapter(Class adapter) {
+ return null;
+ }
+
+ public String getName() {
+ int len = Math.min(5, string.length());
+ return string.substring(0, len).concat("..."); //$NON-NLS-1$
+ }
+
+ public boolean isReadOnly() {
+ return false;
+ }
+ }
+
+ //for this classes , see : http://wiki.eclipse.org/FAQ_How_do_I_open_an_editor_on_something_that_is_not_a_file%3F
+ class TextInput implements IStorageEditorInput {
+
+ private IStorage storage;
+
+ TextInput(IStorage storage) {
+ this.storage = storage;
+ }
+
+ public boolean exists() {
+ return true;
+ }
+
+ public ImageDescriptor getImageDescriptor() {
+ return null;
+ }
+
+ public String getName() {
+ return storage.getName();
+ }
+
+ public IPersistableElement getPersistable() {
+ return null;
+ }
+
+ public IStorage getStorage() {
+ return storage;
+ }
+
+ public String getToolTipText() {
+ return "String-based file: " + storage.getName();
+ }
+
+ public Object getAdapter(Class adapter) {
+ return null;
+ }
+ }
+
+}
diff --git a/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/factory/CommentEditorFactory.java b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/factory/CommentEditorFactory.java
new file mode 100644
index 00000000000..251d18c11b7
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/factory/CommentEditorFactory.java
@@ -0,0 +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.newresource.factory;
+
+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.ui.extension.diagrameditor.AbstractEditorFactory;
+import org.eclipse.papyrus.infra.ui.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/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/handler/CommentEditorHandler.java b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/handler/CommentEditorHandler.java
new file mode 100644
index 00000000000..9c568b671eb
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/handler/CommentEditorHandler.java
@@ -0,0 +1,177 @@
+/*****************************************************************************
+ * 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.handler;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.workspace.AbstractEMFOperation;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.commands.CheckedOperationHistory;
+import org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance;
+import org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrustextinstanceFactory;
+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.example.uml.comment.editor.newresource.modelresource.TextEditorModelCommentResource;
+import org.eclipse.papyrus.infra.core.resource.NotFoundException;
+import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
+import org.eclipse.papyrus.infra.ui.util.ServiceUtilsForActionHandlers;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Comment;
+
+
+public class CommentEditorHandler extends AbstractHandler {
+
+
+ public CommentEditorHandler(){
+ }
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#isEnabled()
+ *
+ * @return
+ */
+ @Override
+ public boolean isEnabled() {
+ return getSelection().size() == 1;
+ }
+
+ /**
+ *
+ * @return
+ * the current selection
+ */
+ protected List<EObject> getSelection() {
+ ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
+ List<EObject> currentSelection = new ArrayList<EObject>();
+ Iterator<?> iter = ((IStructuredSelection)selection).iterator();
+ while(iter.hasNext()) {
+ Object current = iter.next();
+ if(current instanceof IAdaptable){
+ EObject tmp = (EObject)((IAdaptable)current).getAdapter(EObject.class);
+ if(tmp!=null){
+ if(tmp instanceof Comment){
+ currentSelection.add(tmp);
+ }
+ }
+ }
+ }
+ return currentSelection;
+ }
+
+ /**
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ *
+ * @param event
+ * @return
+ * @throws ExecutionException
+ */
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
+ try {
+
+ runAsTransaction();
+ } catch (ServiceException e) {
+ throw new ExecutionException("I can't create CompareEditor", e); //$NON-NLS-1$
+ }
+ return null;
+ }
+
+ /**
+ * Run the command as a transaction.
+ * Create a Transaction and delegate the command to {@link #doExecute(ServicesRegistry)}.
+ *
+ * @throws ServiceException
+ *
+ */
+ public void runAsTransaction() throws ServiceException {
+ final ServicesRegistry serviceRegistry = ServiceUtilsForActionHandlers.getInstance().getServiceRegistry();
+ TransactionalEditingDomain domain = ServiceUtils.getInstance().getTransactionalEditingDomain(serviceRegistry);
+
+ //Create the transactional command
+ AbstractEMFOperation command = new AbstractEMFOperation(domain, "Create CompareEditor") { //$NON-NLS-1$
+
+ @Override
+ protected IStatus doExecute(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ try {
+ CommentEditorHandler.this.doExecute(serviceRegistry);
+ } catch (ServiceException e) {
+ Activator.log.error(e);
+ return Status.CANCEL_STATUS;
+ } catch (NotFoundException e) {
+ Activator.log.error(e);
+ return Status.CANCEL_STATUS;
+ }
+ return Status.OK_STATUS;
+ }
+ };
+
+ // Execute the command
+ try {
+ CheckedOperationHistory.getInstance().execute(command, new NullProgressMonitor(), null);
+ } catch (ExecutionException e) {
+ Activator.log.error("I can't create CompareEditor", e); //$NON-NLS-1$
+ }
+
+ }
+
+
+ /**
+ * Do the execution of the command.
+ *
+ * @param serviceRegistry
+ * @throws ServiceException
+ * @throws NotFoundException
+ */
+ public void doExecute(final ServicesRegistry serviceRegistry) throws ServiceException, NotFoundException {
+ Object editorModel = createEditorModel(serviceRegistry);
+ // Get the mngr allowing to add/open new editor.
+ IPageManager pageMngr = ServiceUtils.getInstance().getIPageManager(serviceRegistry);
+ // add the new editor model to the sash.
+ pageMngr.openPage(editorModel);
+
+ }
+
+ /**
+ * Create a model identifying the editor. This model will be saved with the sash
+ *
+ * @return
+ * @throws ServiceException
+ * @throws NotFoundException
+ * The model where to save the TableInstance is not found.
+ */
+ protected Object createEditorModel(final ServicesRegistry serviceRegistry) throws ServiceException, NotFoundException {
+ PapyrusTextInstance editorModel = PapyrustextinstanceFactory.eINSTANCE.createPapyrusTextInstance();
+ editorModel.setEditedObject(getSelection().get(0));
+ editorModel.setType(PapyrusCommentEditor.EDITOR_TYPE);
+ editorModel.setName(PapyrusCommentEditor.EDITOR_DEFAULT_NAME);
+ TextEditorModelCommentResource model = (TextEditorModelCommentResource)ServiceUtils.getInstance().getModelSet(serviceRegistry).getModelChecked(TextEditorModelCommentResource.MODEL_ID);
+ model.addPapyrusTextInstance(editorModel);
+ return editorModel;
+ }
+}
diff --git a/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/modelresource/TextEditorModelCommentResource.java b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/modelresource/TextEditorModelCommentResource.java
new file mode 100644
index 00000000000..3df157f7cc5
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/modelresource/TextEditorModelCommentResource.java
@@ -0,0 +1,102 @@
+/*****************************************************************************
+ * 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.modelresource;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance;
+import org.eclipse.papyrus.infra.core.resource.AbstractDynamicModel;
+import org.eclipse.papyrus.infra.core.resource.IModel;
+
+
+public class TextEditorModelCommentResource extends AbstractDynamicModel<PapyrusTextInstance> implements IModel {
+
+ /**
+ * File extension used for comment.
+ */
+ public static final String COMMENT_FILE_EXTENSION = "comment"; //$NON-NLS-1$
+
+ /**
+ * Model ID.
+ */
+ public static final String MODEL_ID = "org.eclipse.papyrus.example.text.TextEditorModelCommentResource"; //$NON-NLS-1$
+
+
+ /**
+ *
+ * Constructor.
+ *
+ */
+ public TextEditorModelCommentResource() {
+
+ }
+
+
+ /**
+ * Get the file extension used for this model.
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.AbstractBaseModel#getModelFileExtension()
+ *
+ * @return
+ */
+ @Override
+ protected String getModelFileExtension() {
+ return COMMENT_FILE_EXTENSION;
+ }
+
+ /**
+ * Get the identifier used to register this model.
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.AbstractBaseModel#getIdentifier()
+ *
+ * @return
+ */
+ @Override
+ public String getIdentifier() {
+ return MODEL_ID;
+ }
+
+
+ /**
+ * Add a new initialized {@link PapyrusEMFCompareInstance} to the model.
+ *
+ * @param compareInstance
+ * The compareInstance to add.
+ */
+ public void addPapyrusTextInstance(PapyrusTextInstance compareInstance) {
+ addModelRoot(compareInstance);
+ }
+
+ /**
+ * Add a new initialized {@link PapyrusEMFCompareInstance} to the model.
+ *
+ * @param compareInstance
+ * The compareInstance to add.
+ */
+ public void removePapyrusTextInstance(PapyrusTextInstance compareInstance) {
+ getResource().getContents().remove(compareInstance);
+ }
+
+
+ public boolean canPersist(EObject object) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+
+ public void persist(EObject object) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/.classpath b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/.project b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/.project
new file mode 100644
index 00000000000..fc3da8cd541
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.example.uml.comment.editor.sharedresource</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/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/.settings/org.eclipse.jdt.core.prefs b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..44217f8c068
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+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/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/META-INF/MANIFEST.MF b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..e3c5f28a918
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/META-INF/MANIFEST.MF
@@ -0,0 +1,29 @@
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.papyrus.infra.core.log;bundle-version="1.1.0",
+ 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.1.0",
+ org.eclipse.uml2.uml;bundle-version="4.0.0",
+ org.eclipse.papyrus.infra.core;bundle-version="1.1.0",
+ 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.1.0",
+ org.eclipse.gmf.runtime.common.core,
+ org.eclipse.gmf.runtime.emf.type.core,
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.1.0",
+ org.eclipse.ui.ide;bundle-version="3.10.0"
+Bundle-Vendor: Eclipse Modeling Project
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 1.1.0.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
+Bundle-Description: %pluginDescription
diff --git a/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/about.html b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/build.properties b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/build.properties
new file mode 100644
index 00000000000..1bf7b240421
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/build.properties
@@ -0,0 +1,8 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ about.html,\
+ build.properties,\
+ icons/
diff --git a/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/icons/texteditor.bmp b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/icons/texteditor.bmp
new file mode 100644
index 00000000000..79df55de06b
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/icons/texteditor.bmp
Binary files differ
diff --git a/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/plugin.properties b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/plugin.properties
new file mode 100644
index 00000000000..239f4eed2c8
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/plugin.properties
@@ -0,0 +1,12 @@
+#################################################################################
+# Copyright (c) 2015 CEA LIST.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License 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 - initial API and implementation
+##################################################################################)
+
+pluginDescription=This plugin provides a editor for uml.Comment. The informations are stored in the .notation \ No newline at end of file
diff --git a/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/plugin.xml b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/plugin.xml
new file mode 100644
index 00000000000..4595bebec0a
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/plugin.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.papyrus.infra.core.model">
+ <model
+ classname="org.eclipse.papyrus.example.uml.comment.editor.sharedresource.modelresource.TextEditorModelSharedResource">
+ </model>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ description="Open a Comment Editor (Shared Resource)"
+ id="org.eclipse.papyrus.example.uml.comment.editor.command.sharedresource"
+ name="Open a Comment Editor (Shared Resource)">
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.handlers">
+ <handler
+ class="org.eclipse.papyrus.example.uml.comment.editor.sharedresource.handler.CommentEditorHandler"
+ commandId="org.eclipse.papyrus.example.uml.comment.editor.command.sharedresource">
+ <activeWhen>
+ <and>
+ <with
+ variable="activeEditorId">
+ <equals
+ value="org.eclipse.papyrus.infra.core.papyrusEditor">
+ </equals>
+ </with>
+ </and>
+ </activeWhen>
+ </handler>
+ </extension>
+ <extension
+ point="org.eclipse.papyrus.infra.ui.papyrusDiagram">
+ <editorDiagram
+ factoryClass="org.eclipse.papyrus.example.uml.comment.editor.sharedresource.factory.CommentEditorFactory"
+ icon="icons/texteditor.bmp">
+ </editorDiagram>
+ </extension>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ allPopups="false"
+ locationURI="popup:org.eclipse.papyrus.views.modelexplorer.modelexplorer.popup">
+ <command
+ commandId="org.eclipse.papyrus.example.uml.comment.editor.command.sharedresource"
+ icon="icons/texteditor.bmp"
+ style="push">
+ <visibleWhen
+ checkEnabled="false">
+ <and>
+ <with
+ variable="activeEditorId">
+ <equals
+ value="org.eclipse.papyrus.infra.core.papyrusEditor">
+ </equals>
+ </with>
+ </and>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+ </extension>
+
+
+</plugin>
diff --git a/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/pom.xml b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/pom.xml
new file mode 100644
index 00000000000..e3c1fa27640
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/pom.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.papyrus</groupId>
+ <artifactId>org.eclipse.papyrus.examples.uml</artifactId>
+ <version>1.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.papyrus.example.uml.comment.editor.sharedresource</artifactId>
+ <groupId>org.eclipse.papyrus</groupId>
+ <version>1.1.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project> \ No newline at end of file
diff --git a/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/Activator.java b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/Activator.java
new file mode 100644
index 00000000000..0195681d372
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/Activator.java
@@ -0,0 +1,67 @@
+/*****************************************************************************
+ * 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;
+
+import org.eclipse.papyrus.infra.core.log.LogHelper;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.example.uml.comment.editor.sharedresource"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ public static LogHelper log;
+
+ /**
+ * 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;
+ log = new LogHelper(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;
+ }
+
+}
diff --git a/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/editor/PapyrusCommentEditor.java b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/editor/PapyrusCommentEditor.java
new file mode 100644
index 00000000000..90faad4d747
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/editor/PapyrusCommentEditor.java
@@ -0,0 +1,221 @@
+/*****************************************************************************
+ * 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.editor;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+
+import org.eclipse.core.resources.IStorage;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.emf.ecore.EStructuralFeature;
+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.emf.type.core.requests.SetRequest;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.text.ITextListener;
+import org.eclipse.jface.text.TextEvent;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jface.text.source.IVerticalRuler;
+import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance;
+import org.eclipse.papyrus.example.uml.comment.editor.sharedresource.Activator;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IPersistableElement;
+import org.eclipse.ui.IStorageEditorInput;
+import org.eclipse.ui.editors.text.TextEditor;
+import org.eclipse.uml2.uml.Comment;
+
+public class PapyrusCommentEditor extends TextEditor {
+
+ /** the service registry */
+ protected final ServicesRegistry registry;
+
+ /** the papyrus text instance */
+ protected final PapyrusTextInstance papyrusTextInstance;
+
+ /** the text listener */
+ protected ITextListener listener;
+
+ /** the editing domain */
+ protected TransactionalEditingDomain domain;
+
+ public static final String EDITOR_DEFAULT_NAME = "Comment Editor Shared Resource";
+
+ public static final String EDITOR_TYPE = "CommentEditorSharedResource";
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param registry
+ * @param papyrusTextInstance
+ */
+ public PapyrusCommentEditor(final ServicesRegistry registry, final PapyrusTextInstance papyrusTextInstance) {
+ super();
+ this.registry = registry;
+ this.papyrusTextInstance = papyrusTextInstance;
+ try {
+ domain = ServiceUtils.getInstance().getTransactionalEditingDomain(registry);
+ } catch (ServiceException e) {
+ Activator.log.error(e);
+ }
+ }
+
+
+ /**
+ *
+ * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#createSourceViewer(org.eclipse.swt.widgets.Composite,
+ * org.eclipse.jface.text.source.IVerticalRuler, int)
+ *
+ * @param parent
+ * @param ruler
+ * @param styles
+ * @return
+ */
+ @Override
+ protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) {
+ ISourceViewer viewer = super.createSourceViewer(parent, ruler, styles);
+ //we add a listener on the viewer to be notified when the text is edited
+ //TODO try to improve, because we execute a command for each character
+ listener = new ITextListener() {
+
+ //we edit the uml.Comment
+ public void textChanged(TextEvent event) {
+ String currentText = getSourceViewer().getTextWidget().getText();
+ Comment cmt = (Comment)papyrusTextInstance.getEditedObject();
+ EStructuralFeature feature = cmt.eClass().getEStructuralFeature("body");
+ IElementEditService elementEditService = ElementEditServiceUtils.getCommandProvider(cmt);
+ SetRequest request = new SetRequest(domain, cmt, feature, currentText);
+ ICommand command = elementEditService.getEditCommand(request);
+ if(command.canExecute()) {
+ domain.getCommandStack().execute(new GMFtoEMFCommandWrapper(command));
+ }
+ }
+ };
+
+ viewer.addTextListener(listener);
+
+ return viewer;
+ }
+
+ /**
+ * We override this method because setInput can't be overriden for TextEditor.
+ * We replace the default papyrus input by our input for Comment
+ *
+ * @see org.eclipse.ui.editors.text.TextEditor#doSetInput(org.eclipse.ui.IEditorInput)
+ *
+ * @param input
+ * @throws CoreException
+ */
+ @Override
+ protected void doSetInput(IEditorInput input) throws CoreException {
+ String string = ((Comment)papyrusTextInstance.getEditedObject()).getBody();
+ if(string == null) {
+ string = "";
+ }
+ IStorage storage = new TextStorage(string);
+ super.doSetInput(new TextInput(storage));
+ }
+
+ /**
+ *
+ * @see org.eclipse.ui.editors.text.TextEditor#dispose()
+ *
+ */
+ @Override
+ public void dispose() {
+ //we remove the listener
+ getSourceViewer().removeTextListener(listener);
+ super.dispose();
+ }
+
+
+ //for this classes , see : http://wiki.eclipse.org/FAQ_How_do_I_open_an_editor_on_something_that_is_not_a_file%3F
+ class TextStorage implements IStorage {
+
+ private String string;
+
+ TextStorage(String input) {
+ this.string = input;
+ }
+
+ public InputStream getContents() throws CoreException {
+ return new ByteArrayInputStream(string.getBytes());
+ }
+
+ public IPath getFullPath() {
+ return null;
+ }
+
+ public Object getAdapter(Class adapter) {
+ return null;
+ }
+
+ public String getName() {
+ int len = Math.min(5, string.length());
+ return string.substring(0, len).concat("..."); //$NON-NLS-1$
+ }
+
+ public boolean isReadOnly() {
+ return false;
+ }
+ }
+
+ //for this classes , see : http://wiki.eclipse.org/FAQ_How_do_I_open_an_editor_on_something_that_is_not_a_file%3F
+ class TextInput implements IStorageEditorInput {
+
+ private IStorage storage;
+
+ TextInput(IStorage storage) {
+ this.storage = storage;
+ }
+
+ public boolean exists() {
+ return true;
+ }
+
+ public ImageDescriptor getImageDescriptor() {
+ return null;
+ }
+
+ public String getName() {
+ return storage.getName();
+ }
+
+ public IPersistableElement getPersistable() {
+ return null;
+ }
+
+ public IStorage getStorage() {
+ return storage;
+ }
+
+ public String getToolTipText() {
+ return "String-based file: " + storage.getName();
+ }
+
+ public Object getAdapter(Class adapter) {
+ return null;
+ }
+ }
+
+}
diff --git a/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/factory/CommentEditorFactory.java b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/factory/CommentEditorFactory.java
new file mode 100644
index 00000000000..bce2f93e84e
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/factory/CommentEditorFactory.java
@@ -0,0 +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.ui.extension.diagrameditor.AbstractEditorFactory;
+import org.eclipse.papyrus.infra.ui.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/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/handler/CommentEditorHandler.java b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/handler/CommentEditorHandler.java
new file mode 100644
index 00000000000..b34859ca5eb
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/handler/CommentEditorHandler.java
@@ -0,0 +1,177 @@
+/*****************************************************************************
+ * 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.handler;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.workspace.AbstractEMFOperation;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.commands.CheckedOperationHistory;
+import org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance;
+import org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrustextinstanceFactory;
+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.example.uml.comment.editor.sharedresource.modelresource.TextEditorModelSharedResource;
+import org.eclipse.papyrus.infra.core.resource.NotFoundException;
+import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
+import org.eclipse.papyrus.infra.ui.util.ServiceUtilsForActionHandlers;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Comment;
+
+
+public class CommentEditorHandler extends AbstractHandler {
+
+
+ public CommentEditorHandler(){
+ }
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#isEnabled()
+ *
+ * @return
+ */
+ @Override
+ public boolean isEnabled() {
+ return getSelection().size() == 1;
+ }
+
+ /**
+ *
+ * @return
+ * the current selection
+ */
+ protected List<EObject> getSelection() {
+ ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
+ List<EObject> currentSelection = new ArrayList<EObject>();
+ Iterator<?> iter = ((IStructuredSelection)selection).iterator();
+ while(iter.hasNext()) {
+ Object current = iter.next();
+ if(current instanceof IAdaptable){
+ EObject tmp = (EObject)((IAdaptable)current).getAdapter(EObject.class);
+ if(tmp!=null){
+ if(tmp instanceof Comment){
+ currentSelection.add(tmp);
+ }
+ }
+ }
+ }
+ return currentSelection;
+ }
+
+ /**
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ *
+ * @param event
+ * @return
+ * @throws ExecutionException
+ */
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
+ try {
+
+ runAsTransaction();
+ } catch (ServiceException e) {
+ throw new ExecutionException("I can't create CompareEditor", e); //$NON-NLS-1$
+ }
+ return null;
+ }
+
+ /**
+ * Run the command as a transaction.
+ * Create a Transaction and delegate the command to {@link #doExecute(ServicesRegistry)}.
+ *
+ * @throws ServiceException
+ *
+ */
+ public void runAsTransaction() throws ServiceException {
+ final ServicesRegistry serviceRegistry = ServiceUtilsForActionHandlers.getInstance().getServiceRegistry();
+ TransactionalEditingDomain domain = ServiceUtils.getInstance().getTransactionalEditingDomain(serviceRegistry);
+
+ //Create the transactional command
+ AbstractEMFOperation command = new AbstractEMFOperation(domain, "Create CompareEditor") { //$NON-NLS-1$
+
+ @Override
+ protected IStatus doExecute(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ try {
+ CommentEditorHandler.this.doExecute(serviceRegistry);
+ } catch (ServiceException e) {
+ Activator.log.error(e);
+ return Status.CANCEL_STATUS;
+ } catch (NotFoundException e) {
+ Activator.log.error(e);
+ return Status.CANCEL_STATUS;
+ }
+ return Status.OK_STATUS;
+ }
+ };
+
+ // Execute the command
+ try {
+ CheckedOperationHistory.getInstance().execute(command, new NullProgressMonitor(), null);
+ } catch (ExecutionException e) {
+ Activator.log.error("I can't create CompareEditor", e); //$NON-NLS-1$
+ }
+
+ }
+
+
+ /**
+ * Do the execution of the command.
+ *
+ * @param serviceRegistry
+ * @throws ServiceException
+ * @throws NotFoundException
+ */
+ public void doExecute(final ServicesRegistry serviceRegistry) throws ServiceException, NotFoundException {
+ Object editorModel = createEditorModel(serviceRegistry);
+ // Get the mngr allowing to add/open new editor.
+ IPageManager pageMngr = ServiceUtils.getInstance().getIPageManager(serviceRegistry);
+ // add the new editor model to the sash.
+ pageMngr.openPage(editorModel);
+
+ }
+
+ /**
+ * Create a model identifying the editor. This model will be saved with the sash
+ *
+ * @return
+ * @throws ServiceException
+ * @throws NotFoundException
+ * The model where to save the TableInstance is not found.
+ */
+ protected Object createEditorModel(final ServicesRegistry serviceRegistry) throws ServiceException, NotFoundException {
+ PapyrusTextInstance editorModel = PapyrustextinstanceFactory.eINSTANCE.createPapyrusTextInstance();
+ editorModel.setEditedObject(getSelection().get(0));
+ editorModel.setType(PapyrusCommentEditor.EDITOR_TYPE);
+ editorModel.setName(PapyrusCommentEditor.EDITOR_DEFAULT_NAME);
+ TextEditorModelSharedResource model = (TextEditorModelSharedResource)ServiceUtils.getInstance().getModelSet(serviceRegistry).getModelChecked(TextEditorModelSharedResource.MODEL_ID);
+ model.addPapyrusTextInstance(editorModel);
+ return editorModel;
+ }
+}
diff --git a/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/modelresource/TextEditorModelSharedResource.java b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/modelresource/TextEditorModelSharedResource.java
new file mode 100644
index 00000000000..608e4b0e868
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/modelresource/TextEditorModelSharedResource.java
@@ -0,0 +1,102 @@
+/*****************************************************************************
+ * 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.modelresource;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance;
+import org.eclipse.papyrus.infra.core.resource.AbstractModelWithSharedResource;
+import org.eclipse.papyrus.infra.core.resource.IModel;
+
+
+public class TextEditorModelSharedResource extends AbstractModelWithSharedResource<PapyrusTextInstance> implements IModel {
+
+
+ /**
+ * File extension used for notation.
+ */
+ public static final String NOTATION_FILE_EXTENSION = "notation"; //$NON-NLS-1$
+
+ /**
+ * Model ID.
+ */
+ public static final String MODEL_ID = "org.eclipse.papyrus.example.text.TextEditorModelSharedResource"; //$NON-NLS-1$
+
+
+ /**
+ *
+ * Constructor.
+ *
+ */
+ public TextEditorModelSharedResource() {
+
+ }
+
+
+ /**
+ * Get the file extension used for this model.
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.AbstractBaseModel#getModelFileExtension()
+ *
+ * @return
+ */
+ @Override
+ protected String getModelFileExtension() {
+ return NOTATION_FILE_EXTENSION;
+ }
+
+ /**
+ * Get the identifier used to register this model.
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.AbstractBaseModel#getIdentifier()
+ *
+ * @return
+ */
+ @Override
+ public String getIdentifier() {
+ return MODEL_ID;
+ }
+
+
+ /**
+ * Add a new initialized {@link PapyrusEMFCompareInstance} to the model.
+ *
+ * @param compareInstance
+ * The compareInstance to add.
+ */
+ public void addPapyrusTextInstance(PapyrusTextInstance compareInstance) {
+ getResource().getContents().add(compareInstance);
+ }
+
+ /**
+ * Add a new initialized {@link PapyrusEMFCompareInstance} to the model.
+ *
+ * @param compareInstance
+ * The compareInstance to add.
+ */
+ public void removePapyrusTextInstance(PapyrusTextInstance compareInstance) {
+ getResource().getContents().remove(compareInstance);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.AbstractModelWithSharedResource#isModelRoot(org.eclipse.emf.ecore.EObject)
+ *
+ * @param object
+ * @return
+ */
+ @Override
+ protected boolean isModelRoot(EObject object) {
+ return false;
+ }
+
+}
diff --git a/examples/uml/org.eclipse.papyrus.thousandcreation/pom.xml b/examples/uml/org.eclipse.papyrus.thousandcreation/pom.xml
index 2a8ce92c66e..f4f7262ecd8 100644
--- a/examples/uml/org.eclipse.papyrus.thousandcreation/pom.xml
+++ b/examples/uml/org.eclipse.papyrus.thousandcreation/pom.xml
@@ -2,13 +2,12 @@
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
- <artifactId>org.eclipse.papyrus</artifactId>
<groupId>org.eclipse.papyrus</groupId>
- <version>1.2.0-SNAPSHOT</version>
- <relativePath>../../../releng/top-pom-main.xml</relativePath>
+ <artifactId>org.eclipse.papyrus.examples.uml</artifactId>
+ <version>1.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.papyrus.thousandcreation</artifactId>
<groupId>org.eclipse.papyrus</groupId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.1.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project> \ No newline at end of file
diff --git a/examples/uml/org.eclipse.papyrus.thousandcreation/test/thousandcreation/HugeModelGenerationAction.java b/examples/uml/org.eclipse.papyrus.thousandcreation/test/thousandcreation/HugeModelGenerationAction.java
index 5c348eea1e1..3f0fefe7d47 100644
--- a/examples/uml/org.eclipse.papyrus.thousandcreation/test/thousandcreation/HugeModelGenerationAction.java
+++ b/examples/uml/org.eclipse.papyrus.thousandcreation/test/thousandcreation/HugeModelGenerationAction.java
@@ -1,102 +1,102 @@
-/*****************************************************************************
- * 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 thousandcreation;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
-import org.eclipse.ui.IActionDelegate;
-import org.eclipse.uml2.uml.Package;
-
-
-public class HugeModelGenerationAction implements IActionDelegate {
-
- protected Package selectedPackage;
- protected final static int packageNumber=200;
- protected final static int classNumber=1000;
- protected final static String chars = "abcdefghijklmnopqrstuvwxyz";
- protected final static String mchars="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
-
- public HugeModelGenerationAction() {
- // TODO Auto-generated constructor stub
- }
-
-/**
- * generate a string
- * @param length the length of the string
- * @return a string
- */
- public static String generateName(int length)
- {
-
- String pass = "";
- for(int i=0;i<length;i++)
- {
- if( i==0){
- int integer = (int)Math.floor(Math.random() * 26);
- pass += mchars.charAt(integer);
- }
- else{
- int integer = (int)Math.floor(Math.random() * 26);
- pass += chars.charAt(integer);
- }
- }
- return pass;
- }
-
-
- public void run(IAction action) {
- TransactionalEditingDomain editingDomain = EditorUtils
- .getTransactionalEditingDomain();
- if (editingDomain != null && selectedPackage!=null) {
- Command command = new RecordingCommand(editingDomain) {
-
- @Override
- protected void doExecute() {
- for(int i=0; i<packageNumber;i++){
- //create packages
- Package currentPackage=selectedPackage.createNestedPackage(generateName(10));
- for( int j=0; j<classNumber;j++){
- //create classes
- currentPackage.createOwnedClass(generateName(10), false);
- }
- System.out.println("package "+i +"/"+packageNumber+" done.");
- }
- }
- };
- editingDomain.getCommandStack().execute(command);
- }
-
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- if (selection instanceof IStructuredSelection){
- if( ((IStructuredSelection)selection).getFirstElement() instanceof IAdaptable){
- EObject eObject=(EObject)((IAdaptable)((IStructuredSelection)selection).getFirstElement()).getAdapter(EObject.class);
- if( eObject instanceof Package){
- selectedPackage=(org.eclipse.uml2.uml.Package)eObject;
- }
- }
-
- }
-
- }
-
-}
+/*****************************************************************************
+ * 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 thousandcreation;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.infra.ui.util.EditorUtils;
+import org.eclipse.ui.IActionDelegate;
+import org.eclipse.uml2.uml.Package;
+
+
+public class HugeModelGenerationAction implements IActionDelegate {
+
+ protected Package selectedPackage;
+ protected final static int packageNumber=200;
+ protected final static int classNumber=1000;
+ protected final static String chars = "abcdefghijklmnopqrstuvwxyz";
+ protected final static String mchars="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+
+ public HugeModelGenerationAction() {
+ // TODO Auto-generated constructor stub
+ }
+
+/**
+ * generate a string
+ * @param length the length of the string
+ * @return a string
+ */
+ public static String generateName(int length)
+ {
+
+ String pass = "";
+ for(int i=0;i<length;i++)
+ {
+ if( i==0){
+ int integer = (int)Math.floor(Math.random() * 26);
+ pass += mchars.charAt(integer);
+ }
+ else{
+ int integer = (int)Math.floor(Math.random() * 26);
+ pass += chars.charAt(integer);
+ }
+ }
+ return pass;
+ }
+
+
+ public void run(IAction action) {
+ TransactionalEditingDomain editingDomain = EditorUtils
+ .getTransactionalEditingDomain();
+ if (editingDomain != null && selectedPackage!=null) {
+ Command command = new RecordingCommand(editingDomain) {
+
+ @Override
+ protected void doExecute() {
+ for(int i=0; i<packageNumber;i++){
+ //create packages
+ Package currentPackage=selectedPackage.createNestedPackage(generateName(10));
+ for( int j=0; j<classNumber;j++){
+ //create classes
+ currentPackage.createOwnedClass(generateName(10), false);
+ }
+ System.out.println("package "+i +"/"+packageNumber+" done.");
+ }
+ }
+ };
+ editingDomain.getCommandStack().execute(command);
+ }
+
+ }
+
+ public void selectionChanged(IAction action, ISelection selection) {
+ if (selection instanceof IStructuredSelection){
+ if( ((IStructuredSelection)selection).getFirstElement() instanceof IAdaptable){
+ EObject eObject=(EObject)((IAdaptable)((IStructuredSelection)selection).getFirstElement()).getAdapter(EObject.class);
+ if( eObject instanceof Package){
+ selectedPackage=(org.eclipse.uml2.uml.Package)eObject;
+ }
+ }
+
+ }
+
+ }
+
+}
diff --git a/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/.classpath b/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/.project b/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/.project
new file mode 100644
index 00000000000..515b3812d81
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/.project
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.uml.diagram.emftree</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.oomph.version.VersionBuilder</name>
+ <arguments>
+ <dictionary>
+ <key>check.maven.pom</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>ignore.lower.bound.dependency.ranges</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>release.path</key>
+ <value>org.eclipse.papyrus.releng.main.release/release.xml</value>
+ </dictionary>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.oomph.version.VersionNature</nature>
+ <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
diff --git a/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/.settings/org.eclipse.jdt.core.prefs b/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..4759947300a
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,291 @@
+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
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
+org.eclipse.jdt.core.formatter.comment.line_length=260
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=false
+org.eclipse.jdt.core.formatter.join_wrapped_lines=false
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=260
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=5
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
diff --git a/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/.settings/org.eclipse.jdt.ui.prefs b/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 00000000000..954281dbc31
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,68 @@
+cleanup.add_default_serial_version_id=true
+cleanup.add_generated_serial_version_id=false
+cleanup.add_missing_annotations=true
+cleanup.add_missing_deprecated_annotations=true
+cleanup.add_missing_methods=false
+cleanup.add_missing_nls_tags=false
+cleanup.add_missing_override_annotations=true
+cleanup.add_missing_override_annotations_interface_methods=true
+cleanup.add_serial_version_id=false
+cleanup.always_use_blocks=true
+cleanup.always_use_parentheses_in_expressions=false
+cleanup.always_use_this_for_non_static_field_access=false
+cleanup.always_use_this_for_non_static_method_access=false
+cleanup.convert_functional_interfaces=false
+cleanup.convert_to_enhanced_for_loop=false
+cleanup.correct_indentation=false
+cleanup.format_source_code=false
+cleanup.format_source_code_changes_only=false
+cleanup.insert_inferred_type_arguments=false
+cleanup.make_local_variable_final=true
+cleanup.make_parameters_final=false
+cleanup.make_private_fields_final=true
+cleanup.make_type_abstract_if_missing_method=false
+cleanup.make_variable_declarations_final=false
+cleanup.never_use_blocks=false
+cleanup.never_use_parentheses_in_expressions=true
+cleanup.organize_imports=false
+cleanup.qualify_static_field_accesses_with_declaring_class=false
+cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+cleanup.qualify_static_member_accesses_with_declaring_class=true
+cleanup.qualify_static_method_accesses_with_declaring_class=false
+cleanup.remove_private_constructors=true
+cleanup.remove_redundant_type_arguments=true
+cleanup.remove_trailing_whitespaces=true
+cleanup.remove_trailing_whitespaces_all=true
+cleanup.remove_trailing_whitespaces_ignore_empty=false
+cleanup.remove_unnecessary_casts=true
+cleanup.remove_unnecessary_nls_tags=true
+cleanup.remove_unused_imports=true
+cleanup.remove_unused_local_variables=false
+cleanup.remove_unused_private_fields=true
+cleanup.remove_unused_private_members=false
+cleanup.remove_unused_private_methods=true
+cleanup.remove_unused_private_types=true
+cleanup.sort_members=false
+cleanup.sort_members_all=false
+cleanup.use_anonymous_class_creation=false
+cleanup.use_blocks=true
+cleanup.use_blocks_only_for_return_and_throw=false
+cleanup.use_lambda=true
+cleanup.use_parentheses_in_expressions=false
+cleanup.use_this_for_non_static_field_access=false
+cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+cleanup.use_this_for_non_static_method_access=false
+cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+cleanup.use_type_arguments=false
+cleanup_profile=_Papyrus
+cleanup_settings_version=2
+eclipse.preferences.version=1
+formatter_profile=_Papyrus
+formatter_settings_version=12
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=java;javax;org;com;
+org.eclipse.jdt.ui.javadoc=true
+org.eclipse.jdt.ui.ondemandthreshold=99
+org.eclipse.jdt.ui.staticondemandthreshold=99
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="false" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * Constructor.\n *\n * ${tags}\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*****************************************************************************\n * Copyright (c) ${year} CEA LIST and others.\n * \n * All rights reserved. This program and the accompanying materials\n * are made available under the terms of the Eclipse Public License v1.0\n * which accompanies this distribution, and is available at\n * http\://www.eclipse.org/legal/epl-v10.html\n *\n * Contributors\:\n * CEA LIST - Initial API and implementation\n * \n *****************************************************************************/\n</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/**\n * ${see_to_overridden}\n *\n * ${tags}\n */</template><template autoinsert\="false" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${see_to_target}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
diff --git a/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/.settings/org.eclipse.pde.api.tools.prefs b/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/.settings/org.eclipse.pde.api.tools.prefs
new file mode 100644
index 00000000000..23fb95e120f
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/.settings/org.eclipse.pde.api.tools.prefs
@@ -0,0 +1,98 @@
+ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error
+ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error
+API_USE_SCAN_FIELD_SEVERITY=Error
+API_USE_SCAN_METHOD_SEVERITY=Error
+API_USE_SCAN_TYPE_SEVERITY=Error
+CLASS_ELEMENT_TYPE_ADDED_METHOD=Error
+CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error
+CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error
+CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error
+CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error
+ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error
+ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error
+ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+FIELD_ELEMENT_TYPE_ADDED_VALUE=Error
+FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error
+FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error
+FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error
+FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error
+ILLEGAL_EXTEND=Warning
+ILLEGAL_IMPLEMENT=Warning
+ILLEGAL_INSTANTIATE=Warning
+ILLEGAL_OVERRIDE=Warning
+ILLEGAL_REFERENCE=Warning
+INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Ignore
+INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+INVALID_ANNOTATION=Ignore
+INVALID_JAVADOC_TAG=Ignore
+INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Ignore
+LEAK_EXTEND=Warning
+LEAK_FIELD_DECL=Warning
+LEAK_IMPLEMENT=Warning
+LEAK_METHOD_PARAM=Warning
+LEAK_METHOD_RETURN_TYPE=Warning
+METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error
+METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+MISSING_EE_DESCRIPTIONS=Error
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
+UNUSED_PROBLEM_FILTERS=Warning
+automatically_removed_unused_problem_filters=Enabled
+eclipse.preferences.version=1
+incompatible_api_component_version=Error
+incompatible_api_component_version_include_major_without_breaking_change=Disabled
+incompatible_api_component_version_include_minor_without_api_change=Disabled
+invalid_since_tag_version=Error
+malformed_since_tag=Error
+missing_since_tag=Warning
+report_api_breakage_when_major_version_incremented=Disabled
+report_resolution_errors_api_component=Warning
diff --git a/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/META-INF/MANIFEST.MF b/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..d331539e3e0
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/META-INF/MANIFEST.MF
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0
+Export-Package: org.eclipse.papyrus.uml.diagram.emftree
+Require-Bundle: org.eclipse.uml2.uml.editor;bundle-version="[5.2.0,6.0.0)";visibility:=reexport,
+ org.eclipse.gmf.runtime.notation;bundle-version="[1.8.0,2.0.0)";visibility:=reexport,
+ org.eclipse.papyrus.infra.emf.diagram.common;bundle-version="[1.2.0,2.0.0)";visibility:=reexport,
+ org.eclipse.papyrus.infra.ui;bundle-version="[2.0.0,3.0.0)";visibility:=reexport,
+ org.eclipse.papyrus.infra.core.sasheditor
+Bundle-Vendor: %providerName
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 1.2.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-Activator: org.eclipse.papyrus.uml.diagram.emftree.Activator
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.emftree;singleton:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Import-Package: org.eclipse.papyrus.infra.ui.extension.diagrameditor
diff --git a/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/about.html b/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/build.properties b/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/build.properties
new file mode 100644
index 00000000000..87464c141b5
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/build.properties
@@ -0,0 +1,7 @@
+#
+#Mon Sep 12 09:29:46 CEST 2011
+bin.includes=META-INF/,.,plugin.xml,icons/,about.html,plugin.properties
+output..=bin/
+src.includes = about.html
+source..=src/
+bin..=bin/
diff --git a/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/icons/EmfTree.gif b/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/icons/EmfTree.gif
new file mode 100644
index 00000000000..d07712589ae
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/icons/EmfTree.gif
Binary files differ
diff --git a/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/plugin.properties b/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/plugin.properties
new file mode 100644
index 00000000000..906e7b71ec0
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/plugin.properties
@@ -0,0 +1,12 @@
+#################################################################################
+# 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:
+# CEA LIST - initial API and implementation
+##################################################################################
+pluginName=Papyrus EMF Tree
+providerName=Eclipse Modeling Project
diff --git a/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/plugin.xml b/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/plugin.xml
new file mode 100644
index 00000000000..1a42a4f00f2
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/plugin.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ description="Create an UML 2 Tree (EMF Tree)"
+ id="com.cea.papyrus.ui.emftree.createTree"
+ name="Create Tree">
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.handlers">
+ <handler
+ class="org.eclipse.papyrus.uml.diagram.emftree.CreateEMFTreeDiagramHandler"
+ commandId="com.cea.papyrus.ui.emftree.createTree">
+ <enabledWhen>
+ <with
+ variable="activeEditorId">
+ <equals
+ value="org.eclipse.papyrus.infra.core.papyrusEditor">
+ </equals>
+ </with>
+ </enabledWhen>
+ </handler>
+ </extension>
+
+ <extension
+ point="org.eclipse.papyrus.infra.ui.papyrusDiagram">
+ <editorDiagram
+ actionBarContributorId="org.eclipse.papyrus.uml.diagram.common.part.UMLDiagramActionBarContributor"
+ contextId="defaultContext"
+ factoryClass="org.eclipse.papyrus.uml.diagram.emftree.EmfTreeDiagramEditorFactory">
+ </editorDiagram>
+ </extension>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ locationURI="menu:org.eclipse.papyrus.ui.menu">
+ <menu
+ id="org.eclipse.papyrus.uml.diagram.ui.menu.diagrams"
+ label="Diagrams">
+ <command
+ commandId="com.cea.papyrus.ui.emftree.createTree"
+ icon="icons/EmfTree.gif"
+ label="Create a new EMF Tree"
+ style="push"
+ tooltip="Create a new EMF Tree">
+ </command>
+ </menu>
+ </menuContribution>
+ <menuContribution
+ locationURI="toolbar:org.eclipse.ui.main.toolbar">
+ <toolbar
+ id="org.eclipse.papyrus.ui.toolbar">
+ <command
+ commandId="com.cea.papyrus.ui.emftree.createTree"
+ icon="icons/EmfTree.gif"
+ label="Create a new EMF Tree"
+ style="push"
+ tooltip="Create a new EMF Tree">
+ </command>
+ </toolbar>
+ </menuContribution>
+ </extension>
+</plugin>
diff --git a/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/pom.xml b/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/pom.xml
new file mode 100644
index 00000000000..1cc885d3352
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/pom.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.papyrus</groupId>
+ <artifactId>org.eclipse.papyrus.examples.uml</artifactId>
+ <version>1.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.papyrus.uml.diagram.emftree</artifactId>
+ <version>1.2.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project>
diff --git a/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/uml/diagram/emftree/Activator.java b/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/uml/diagram/emftree/Activator.java
new file mode 100644
index 00000000000..699b363b9a4
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/uml/diagram/emftree/Activator.java
@@ -0,0 +1,71 @@
+/*****************************************************************************
+ * 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
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.emftree;
+
+import org.eclipse.papyrus.infra.core.log.LogHelper;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.uml.diagram.emftree";
+
+ // The shared instance
+ private static Activator plugin;
+
+ public static LogHelper log;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ log = new LogHelper(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ 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;
+ }
+
+}
diff --git a/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/uml/diagram/emftree/CreateEMFTreeDiagramHandler.java b/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/uml/diagram/emftree/CreateEMFTreeDiagramHandler.java
new file mode 100644
index 00000000000..7594893fe91
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/uml/diagram/emftree/CreateEMFTreeDiagramHandler.java
@@ -0,0 +1,29 @@
+/*****************************************************************************
+ * 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
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.emftree;
+
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.emf.diagram.common.handler.CreateDiagramHandler;
+
+public class CreateEMFTreeDiagramHandler extends CreateDiagramHandler {
+
+ @Override
+ protected void addNewDiagram(ServicesRegistry registry) {
+ addNewDiagram("Emf Tree", EmfTreeDiagramEditorFactory.EMF_DIAGRAM_TYPE, null, registry);
+ }
+
+ public void createDiagram(ServicesRegistry registry) {
+ addNewDiagram(registry);
+ }
+}
diff --git a/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/uml/diagram/emftree/EmfTreeDiagramEditorFactory.java b/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/uml/diagram/emftree/EmfTreeDiagramEditorFactory.java
new file mode 100644
index 00000000000..ed4e8ae6085
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/uml/diagram/emftree/EmfTreeDiagramEditorFactory.java
@@ -0,0 +1,227 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - initial API and implementation
+ * Christian W. Damus (CEA) - bug 392301
+ *
+ *******************************************************************************/
+package org.eclipse.papyrus.uml.diagram.emftree;
+
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.papyrus.infra.core.editor.BackboneException;
+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.papyrus.infra.ui.extension.diagrameditor.IPluggableEditorFactory;
+import org.eclipse.papyrus.infra.ui.multidiagram.actionbarcontributor.ActionBarContributorRegistry;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.papyrus.infra.ui.extension.diagrameditor.EditorDescriptor;
+import org.eclipse.ui.part.EditorActionBarContributor;
+
+/**
+ * @author Cedric Dumoulin
+ * @author Remi Schnekenburger
+ * @author Patrick Tessier
+ */
+public class EmfTreeDiagramEditorFactory implements IPluggableEditorFactory {
+
+ /**
+ * Descriptor of the editor. Values come from the declaration in the extension point. The
+ * descriptor is set by the EditorFactory.
+ */
+ private EditorDescriptor editorDescriptor;
+
+ /**
+ * ServiceRegistry that can be provided to created editors.
+ */
+ private ServicesRegistry serviceRegistry;
+
+ /** name of the emf diagram in Di2 type diagram */
+ public static final String EMF_DIAGRAM_TYPE = "emftree";
+
+ public EmfTreeDiagramEditorFactory() {
+ }
+
+ /**
+ * Initialize the factory with useful Classes.
+ *
+ * @see IPluggableEditorFactory#init(ServicesRegistry, EditorDescriptor)
+ *
+ * @param serviceRegistry
+ * Service registry that will be provided to created editor.
+ * @param editorDescriptor
+ * Descriptor containing data from the Eclipse Extension.
+ */
+ public void init(ServicesRegistry serviceRegistry, EditorDescriptor editorDescriptor) {
+ this.editorDescriptor = editorDescriptor;
+ this.serviceRegistry = serviceRegistry;
+
+ }
+
+ /**
+ * TODO Implements next methods
+ *
+ * @see org.eclipse.papyrus.infra.ui.extension.diagrameditor.IPluggableEditorFactory#createIPageModel(java.lang.Object)
+ * @param pageIdentifier
+ * @return
+ *
+ */
+ public IPageModel createIPageModel(Object pageIdentifier) {
+ return new EmfTreeEditorModel((Diagram) pageIdentifier, serviceRegistry);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.ui.extension.diagrameditor.IPluggableEditorFactory#isPageModelFactoryFor(java.lang.Object)
+ * @param pageIdentifier
+ * @return
+ *
+ */
+ public boolean isPageModelFactoryFor(Object pageIdentifier) {
+ if (pageIdentifier instanceof Diagram) {
+ Diagram diagram = (Diagram) pageIdentifier;
+
+ if (EMF_DIAGRAM_TYPE.equals(diagram.getType())) {
+ return true;
+ }
+ }
+ // no
+ return false;
+ }
+
+ /**
+ * Model used to describe an instance of this editor in the SashSystem.
+ *
+ * @author dumoulin
+ *
+ */
+ public class EmfTreeEditorModel implements IEditorModel {
+
+ /**
+ * The object used as page identifier and rawModel.
+ */
+ private Diagram pageIdentifier;
+
+ private ServicesRegistry servicesRegistry;
+
+ private Image tabIcon;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param pageIdentifier
+ * @param servicesRegistry
+ */
+ public EmfTreeEditorModel(Diagram pageIdentifier, ServicesRegistry servicesRegistry) {
+ this.pageIdentifier = pageIdentifier;
+ this.servicesRegistry = servicesRegistry;
+ }
+
+ /**
+ * Create the instance of the editor.
+ *
+ * @see org.eclipse.papyrus.sasheditor.contentprovider.IEditorModel#createIEditorPart()
+ * @return
+ * @throws PartInitException
+ *
+ */
+ public IEditorPart createIEditorPart() throws PartInitException {
+ try {
+ return new UMLEditor(servicesRegistry);
+ } catch (ServiceException e) {
+ throw new PartInitException("Can't create Di2Editor.", e);//$NON-NLS-1$
+ } catch (BackboneException e) {
+ throw new PartInitException("Can't create Di2Editor.", e); //$NON-NLS-1$
+ }
+ }
+
+ 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
+ ActionBarContributorRegistry registry;
+ try {
+ registry = servicesRegistry
+ .getService(ActionBarContributorRegistry.class);
+ } catch (ServiceException e) {
+ // Service not found
+ // TODO Log the error
+ e.printStackTrace();
+ return null;
+ }
+
+ try {
+ return registry.getActionBarContributor(actionBarId);
+ } catch (BackboneException e) {
+ // TODO Log the error and throw an exception instead
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.sasheditor.contentprovider.IPageModel#getRawModel()
+ * @return
+ *
+ */
+ public Object getRawModel() {
+ return pageIdentifier;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.sasheditor.contentprovider.IPageModel#getTabIcon()
+ * @return
+ *
+ */
+ public Image getTabIcon() {
+ if (tabIcon == null) {
+ ImageDescriptor imageDescriptor = editorDescriptor.getIcon();
+ if (imageDescriptor != null) {
+ tabIcon = imageDescriptor.createImage();
+ }
+ }
+
+ return tabIcon;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.sasheditor.contentprovider.IPageModel#getTabTitle()
+ * @return
+ *
+ */
+ public String getTabTitle() {
+ return "EmfTree";
+ }
+
+ public void dispose() {
+ if (tabIcon != null) {
+ tabIcon.dispose();
+ tabIcon = null;
+ }
+ }
+
+ }
+
+}
diff --git a/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/uml/diagram/emftree/UMLEditor.java b/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/uml/diagram/emftree/UMLEditor.java
new file mode 100644
index 00000000000..9e4d085a03d
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/uml/diagram/emftree/UMLEditor.java
@@ -0,0 +1,225 @@
+/*****************************************************************************
+ * Copyright (c) 2008, 2013 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
+ * Christian W. Damus (CEA) - Adapt to EMF codegen changes for bug 331055
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.emftree;
+
+import java.util.EventObject;
+import java.util.Iterator;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CommandStack;
+import org.eclipse.emf.common.command.CommandStackListener;
+import org.eclipse.emf.common.ui.viewer.IViewerProvider;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.edit.domain.IEditingDomainProvider;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.papyrus.infra.core.editor.BackboneException;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.ide.IGotoMarker;
+import org.eclipse.ui.views.properties.IPropertySheetPage;
+import org.eclipse.ui.views.properties.PropertySheetPage;
+
+/**
+ * This is an example of a EMF UML model editor. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+public class UMLEditor extends org.eclipse.uml2.uml.editor.presentation.UMLEditor implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker {
+
+ /**
+ * ServiceRegistry used to retrieve needed services. This registry is provided by the multieditor.
+ */
+ protected ServicesRegistry servicesRegistry;
+
+ protected CommandStackListener commandStackListener;
+
+ /**
+ *
+ * Constructor. Create an DiEditor using the {@link ServicesRegistry}.
+ *
+ * @param servicesRegistry
+ */
+ public UMLEditor(ServicesRegistry servicesRegistry) throws ServiceException, BackboneException {
+ this.servicesRegistry = servicesRegistry;
+ initEditor();
+ }
+
+ /**
+ * Init the editor from the specified context.
+ *
+ * @param editorContext
+ * @throws ServiceException
+ */
+ private void initEditor() throws ServiceException {
+
+ TransactionalEditingDomain papyrusEditingDomain = servicesRegistry.getService(TransactionalEditingDomain.class);
+ CommandStack commandStack = papyrusEditingDomain.getCommandStack();
+
+ // Add a listener to set the most recent command's affected objects to be the selection of
+ // the viewer with focus.
+ //
+
+ commandStackListener = new CommandStackListener() {
+
+ public void commandStackChanged(final EventObject event) {
+ if (getContainer().isDisposed()) {
+ return;
+ }
+ getContainer().getDisplay().asyncExec(new Runnable() {
+
+ public void run() {
+ firePropertyChange(IEditorPart.PROP_DIRTY);
+
+ // Try to select the affected objects.
+ //
+ Command mostRecentCommand = ((CommandStack) event.getSource()).getMostRecentCommand();
+ if (mostRecentCommand != null) {
+ setSelectionToViewer(mostRecentCommand.getAffectedObjects());
+ }
+
+ for (Iterator<PropertySheetPage> i = propertySheetPages
+ .iterator(); i.hasNext();) {
+
+ PropertySheetPage propertySheetPage = i.next();
+
+ if ((propertySheetPage.getControl() == null)
+ || propertySheetPage.getControl().isDisposed()) {
+
+ i.remove();
+ } else {
+ propertySheetPage.refresh();
+ }
+ }
+ }
+ });
+ }
+
+ };
+
+ commandStack.addCommandStackListener(commandStackListener);
+
+ // Create the editing domain with a special command stack.
+ //
+ // Set the resourceSet wth our own resourceSet.
+ // editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new
+ // HashMap<Resource, Boolean>());
+
+ ResourceSet resourceSet = papyrusEditingDomain.getResourceSet();
+ editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, resourceSet);
+
+ // editingDomain = editorContext.getTransactionalEditingDomain();
+ // editingDomain.setResourceToReadOnlyMap(new HashMap<Resource, Boolean>());
+ }
+
+ /**
+ * This is the method called to load a resource into the editing domain's resource set based on
+ * the editor's input. Put the existing model into the editingDomain. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void createModel() {
+ // model is already created and loaded. Do nothing.
+ }
+
+ /**
+ * This is for implementing {@link IEditorPart} and simply saves the model file. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void doSave(IProgressMonitor progressMonitor) {
+ }
+
+ /**
+ * This also changes the editor's input. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void doSaveAs() {
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void doSaveAs(URI uri, IEditorInput editorInput) {
+ }
+
+ @Override
+ public void init(IEditorSite site, IEditorInput editorInput) {
+ super.init(site, editorInput);
+ setPartName("emf tree");
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public IActionBars getActionBars() {
+ try {
+ return getActionBarContributor().getActionBars();
+ } catch (NullPointerException e) {
+ // If we are nested, we have not access to ActionBarContributor()
+ return null;
+ }
+ }
+
+ @Override
+ public void dispose() {
+ // super.dispose(); //FIXME: Fails on a ClassCastException: The ActionBarContributor is not accessible
+ try {
+ TransactionalEditingDomain papyrusEditingDomain = servicesRegistry.getService(TransactionalEditingDomain.class);
+ CommandStack commandStack = papyrusEditingDomain.getCommandStack();
+ commandStack.removeCommandStackListener(commandStackListener);
+ } catch (ServiceException e) {
+ Activator.log.error(e);
+ }
+ }
+
+ /**
+ * Has we have no actionBarContributor, we can't get the status line. So skip this method.
+ */
+ @Override
+ public void setStatusLineManager(ISelection selection) {
+
+ }
+
+ /**
+ * Disable the native property sheet page.
+ */
+ @Override
+ public IPropertySheetPage getPropertySheetPage() {
+
+ return null;
+ }
+}
diff --git a/examples/uml/org.eclipse.papyrus.uml.diagram.example.programmaticcreation/META-INF/MANIFEST.MF b/examples/uml/org.eclipse.papyrus.uml.diagram.example.programmaticcreation/META-INF/MANIFEST.MF
index a0685ac1aba..0656075699f 100644
--- a/examples/uml/org.eclipse.papyrus.uml.diagram.example.programmaticcreation/META-INF/MANIFEST.MF
+++ b/examples/uml/org.eclipse.papyrus.uml.diagram.example.programmaticcreation/META-INF/MANIFEST.MF
@@ -7,6 +7,7 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.emf.ecore;bundle-version="2.9.0",
org.eclipse.papyrus.infra.emf;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.ui,
org.eclipse.papyrus.uml.diagram.composite;bundle-version="1.1.0",
org.eclipse.papyrus.uml.diagram.sequence;bundle-version="1.1.0",
org.eclipse.uml2.uml;bundle-version="4.1.0",
diff --git a/examples/uml/org.eclipse.papyrus.uml.diagram.example.programmaticcreation/pom.xml b/examples/uml/org.eclipse.papyrus.uml.diagram.example.programmaticcreation/pom.xml
index d774667f25b..1bde7c09627 100644
--- a/examples/uml/org.eclipse.papyrus.uml.diagram.example.programmaticcreation/pom.xml
+++ b/examples/uml/org.eclipse.papyrus.uml.diagram.example.programmaticcreation/pom.xml
@@ -2,13 +2,12 @@
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
- <artifactId>org.eclipse.papyrus</artifactId>
<groupId>org.eclipse.papyrus</groupId>
- <version>1.2.0-SNAPSHOT</version>
- <relativePath>../../../releng/top-pom-main.xml</relativePath>
+ <artifactId>org.eclipse.papyrus.examples.uml</artifactId>
+ <version>1.0.1-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.papyrus</groupId>
<artifactId>org.eclipse.papyrus.uml.diagram.example.programmaticcreation</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.1.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project> \ No newline at end of file
diff --git a/examples/uml/org.eclipse.papyrus.uml.diagram.example.programmaticcreation/src/org/eclipse/papyrus/uml/diagram/example/programmaticcreation/CreateCompositeDiagramElementsCommand.java b/examples/uml/org.eclipse.papyrus.uml.diagram.example.programmaticcreation/src/org/eclipse/papyrus/uml/diagram/example/programmaticcreation/CreateCompositeDiagramElementsCommand.java
index 5beaccdd388..61fad175c9c 100644
--- a/examples/uml/org.eclipse.papyrus.uml.diagram.example.programmaticcreation/src/org/eclipse/papyrus/uml/diagram/example/programmaticcreation/CreateCompositeDiagramElementsCommand.java
+++ b/examples/uml/org.eclipse.papyrus.uml.diagram.example.programmaticcreation/src/org/eclipse/papyrus/uml/diagram/example/programmaticcreation/CreateCompositeDiagramElementsCommand.java
@@ -26,7 +26,7 @@ import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer;
import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef;
import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForHandlers;
+import org.eclipse.papyrus.infra.ui.util.ServiceUtilsForHandlers;
import org.eclipse.papyrus.uml.diagram.composite.providers.UMLViewProvider;
import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
import org.eclipse.uml2.uml.Class;
@@ -52,9 +52,9 @@ public class CreateCompositeDiagramElementsCommand extends AbstractEMFOperation
protected IStatus doExecute(IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
- try {
- ISashWindowsContainer windowsContainer =
- ServiceUtilsForHandlers.getInstance().getISashWindowsContainer(m_event);
+
+ ISashWindowsContainer windowsContainer = null;
+ //ServiceUtilsForHandlers.getInstance().getISashWindowsContainer(m_event);
Object model = windowsContainer.getActiveSashWindowsPage().getRawModel();
if(model instanceof PageRef) {
EObject diagramEObj = ((PageRef)model).getEmfPageIdentifier();
@@ -73,10 +73,7 @@ public class CreateCompositeDiagramElementsCommand extends AbstractEMFOperation
addCuToCompositeDiagram((Class) m_context, (Class) m_context, cu, view, diagram);
}
}
- }
- catch (ServiceException svcE) {
- System.err.println(svcE.toString());
- }
+
return Status.OK_STATUS;
}
@@ -84,7 +81,7 @@ public class CreateCompositeDiagramElementsCommand extends AbstractEMFOperation
{
// add CU to compartment
Object compartment = view.getChildren().get(1);
- View roleBindingView = compViewProvider.createCollaborationUse_3071(cu, (BasicCompartment)compartment, -1, true,
+ View roleBindingView = compViewProvider.createCollaborationUse_Shape(cu, (BasicCompartment)compartment, -1, true,
UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
Location location = NotationFactory.eINSTANCE.createLocation();
location.setX(50);
diff --git a/examples/uml/org.eclipse.papyrus.uml.diagram.example.programmaticcreation/src/org/eclipse/papyrus/uml/diagram/example/programmaticcreation/CreateSequenceDiagramElementsCommand.java b/examples/uml/org.eclipse.papyrus.uml.diagram.example.programmaticcreation/src/org/eclipse/papyrus/uml/diagram/example/programmaticcreation/CreateSequenceDiagramElementsCommand.java
index 9880ef8edc6..dfc4263ecef 100644
--- a/examples/uml/org.eclipse.papyrus.uml.diagram.example.programmaticcreation/src/org/eclipse/papyrus/uml/diagram/example/programmaticcreation/CreateSequenceDiagramElementsCommand.java
+++ b/examples/uml/org.eclipse.papyrus.uml.diagram.example.programmaticcreation/src/org/eclipse/papyrus/uml/diagram/example/programmaticcreation/CreateSequenceDiagramElementsCommand.java
@@ -31,7 +31,7 @@ import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer;
import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef;
import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForHandlers;
+import org.eclipse.papyrus.infra.ui.util.ServiceUtilsForHandlers;
import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
import org.eclipse.papyrus.uml.diagram.sequence.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLViewProvider;
@@ -61,9 +61,9 @@ public class CreateSequenceDiagramElementsCommand extends AbstractEMFOperation {
protected IStatus doExecute(IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
- try {
- ISashWindowsContainer windowsContainer =
- ServiceUtilsForHandlers.getInstance().getISashWindowsContainer(m_event);
+ //try {
+ ISashWindowsContainer windowsContainer = null;
+ //ServiceUtilsForHandlers.getInstance().getISashWindowsContainer(m_event);
Object model = windowsContainer.getActiveSashWindowsPage().getRawModel();
if(model instanceof PageRef) {
EObject diagramEObj = ((PageRef)model).getEmfPageIdentifier();
@@ -109,10 +109,10 @@ public class CreateSequenceDiagramElementsCommand extends AbstractEMFOperation {
addMessage(message, diagram, lifelineV1, lifelineV2);
}
}
- }
+ /*}
catch (ServiceException svcE) {
System.err.println(svcE.toString());
- }
+ }*/
return Status.OK_STATUS;
}
@@ -158,7 +158,7 @@ public class CreateSequenceDiagramElementsCommand extends AbstractEMFOperation {
{
// get first compartment of view
Object compartment = interactionView.getChildren().get(1);
- Node lifelineView = sequenceDiagViewProvider.createDurationConstraint_3021(durationContraint, (View) compartment, -1, true,
+ Node lifelineView = sequenceDiagViewProvider.createDurationConstraint_Shape(durationContraint, (View) compartment, -1, true,
UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
Bounds location = NotationFactory.eINSTANCE.createBounds();
location.setX(x);
@@ -178,7 +178,7 @@ public class CreateSequenceDiagramElementsCommand extends AbstractEMFOperation {
*/
public void addMessage(Message message, Diagram diagram, View lifelineSrcV, View lifelineDstV)
{
- View messageView = sequenceDiagViewProvider.createMessage_4004(message, diagram, -1, true,
+ View messageView = sequenceDiagViewProvider.createMessage_AsynchEdge(message, diagram, -1, true,
UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
if(messageView instanceof Edge) {
Edge messageEdge = (Edge) messageView;
diff --git a/examples/uml/org.eclipse.papyrus.uml.textual.editors.example/pom.xml b/examples/uml/org.eclipse.papyrus.uml.textual.editors.example/pom.xml
index cf605599461..0160e8208af 100644
--- a/examples/uml/org.eclipse.papyrus.uml.textual.editors.example/pom.xml
+++ b/examples/uml/org.eclipse.papyrus.uml.textual.editors.example/pom.xml
@@ -2,13 +2,12 @@
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
- <artifactId>org.eclipse.papyrus</artifactId>
<groupId>org.eclipse.papyrus</groupId>
- <version>1.2.0-SNAPSHOT</version>
- <relativePath>../../../releng/top-pom-main.xml</relativePath>
+ <artifactId>org.eclipse.papyrus.examples.uml</artifactId>
+ <version>1.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.papyrus.uml.textual.editors.example</artifactId>
<groupId>org.eclipse.papyrus</groupId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.1.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project> \ No newline at end of file
diff --git a/examples/uml/pom.xml b/examples/uml/pom.xml
new file mode 100644
index 00000000000..3c40b40dd88
--- /dev/null
+++ b/examples/uml/pom.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.papyrus</groupId>
+ <artifactId>org.eclipse.papyrus.examples</artifactId>
+ <version>1.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.papyrus.examples.uml</artifactId>
+ <packaging>pom</packaging>
+ <modules>
+ <module>org.eclipse.papyrus.example.uml.comment.editor.newresource</module>
+ <module>org.eclipse.papyrus.example.uml.comment.editor.sharedresource</module>
+ <module>org.eclipse.papyrus.uml.diagram.emftree</module>
+ <module>org.eclipse.papyrus.thousandcreation</module>
+ <module>org.eclipse.papyrus.uml.diagram.example.programmaticcreation</module>
+ <!-- module>org.eclipse.papyrus.uml.textual.editors.example</module-->
+ </modules>
+</project> \ No newline at end of file

Back to the top