summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoit Maggi2014-02-25 05:36:25 (EST)
committerVincent Lorenzo2014-03-18 09:58:36 (EDT)
commite8cdcec7b368b739a9e645af8f07509a65e55e01 (patch)
tree7e2b20879249e0c795cc98e8502da2f61f4719ef
parent26443b04fa317e3a62af884db62af36ca3969553 (diff)
downloadorg.eclipse.papyrus-e8cdcec7b368b739a9e645af8f07509a65e55e01.zip
org.eclipse.papyrus-e8cdcec7b368b739a9e645af8f07509a65e55e01.tar.gz
org.eclipse.papyrus-e8cdcec7b368b739a9e645af8f07509a65e55e01.tar.bz2
[Usability] Papyrus shall provide a copy/paste/cut feature :
- init copy and past preference pages - create Strategy Editor for copy and paste strategies - init extension point for copy and past strategies Change-Id: I0dc2e817d5eb49934ba4b00d163a97a81db34e92 Signed-off-by: Benoit Maggi <benoit.maggi@cea.fr> Conflicts: plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/META-INF/MANIFEST.MF plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/META-INF/MANIFEST.MF23
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml14
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/schema/copyStrategy.exsd102
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/schema/pasteStrategy.exsd102
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/preferences/CopyPreferencesPage.java65
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/preferences/PastePreferencesPage.java60
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/strategy/IStrategy.java80
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/strategy/IStrategyManager.java19
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/strategy/StrategyEditor.java272
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/strategy/StrategyLabelProvider.java78
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/strategy/StrategyManager.java386
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/strategy/copy/CopyStrategyManager.java41
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/strategy/copy/ICopyStrategy.java77
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/strategy/paste/IPasteStrategy.java79
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/strategy/paste/PasteStrategyManager.java43
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml18
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/strategy/copy/AllContentCopyStrategy.java67
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/strategy/copy/RootOnlyCopyStrategy.java67
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/strategy/paste/ImportResourcePasteStrategy.java67
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/strategy/paste/StereotypePasteStrategy.java69
20 files changed, 1729 insertions, 0 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/META-INF/MANIFEST.MF
index ff02fc9..1088779 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/META-INF/MANIFEST.MF
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/META-INF/MANIFEST.MF
@@ -1,4 +1,27 @@
Manifest-Version: 1.0
+Export-Package: org.eclipse.papyrus.infra.gmfdiag.common,
+ org.eclipse.papyrus.infra.gmfdiag.common.adapter,
+ org.eclipse.papyrus.infra.gmfdiag.common.commands,
+ org.eclipse.papyrus.infra.gmfdiag.common.commands.requests,
+ org.eclipse.papyrus.infra.gmfdiag.common.databinding.custom,
+ org.eclipse.papyrus.infra.gmfdiag.common.decoration,
+ org.eclipse.papyrus.infra.gmfdiag.common.editpart,
+ org.eclipse.papyrus.infra.gmfdiag.common.editpolicies,
+ org.eclipse.papyrus.infra.gmfdiag.common.figure.edge,
+ org.eclipse.papyrus.infra.gmfdiag.common.figure.node,
+ org.eclipse.papyrus.infra.gmfdiag.common.handler,
+ org.eclipse.papyrus.infra.gmfdiag.common.helper,
+ org.eclipse.papyrus.infra.gmfdiag.common.listener,
+ org.eclipse.papyrus.infra.gmfdiag.common.model,
+ org.eclipse.papyrus.infra.gmfdiag.common.preferences,
+ org.eclipse.papyrus.infra.gmfdiag.common.providers,
+ org.eclipse.papyrus.infra.gmfdiag.common.service.shape,
+ org.eclipse.papyrus.infra.gmfdiag.common.snap,
+ org.eclipse.papyrus.infra.gmfdiag.common.strategy.copy,
+ org.eclipse.papyrus.infra.gmfdiag.common.strategy.paste,
+ org.eclipse.papyrus.infra.gmfdiag.common.types,
+ org.eclipse.papyrus.infra.gmfdiag.common.undocontext,
+ org.eclipse.papyrus.infra.gmfdiag.common.utils
Require-Bundle: org.eclipse.emf.edit.ui;bundle-version="2.5.0",
org.eclipse.emf.ecore.edit;bundle-version="2.5.0",
org.eclipse.papyrus.infra.core;bundle-version="1.0.0",
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml
index 9ed7596..a47ef96 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml
@@ -8,6 +8,8 @@
<extension-point id="notationTypesMapping" name="notationTypesMapping" schema="schema/notationTypesMapping.exsd"/>
<extension-point id="svgPostProcessors" name="svgPostProcessors" schema="schema/svgPostProcessors.exsd"/>
<extension-point id="pasteCommandProvider" name="pasteCommandProvider" schema="schema/pasteCommandProvider.exsd"/>
+ <extension-point id="pasteStrategy" name="pasteStrategy" schema="schema/pasteStrategy.exsd"/>
+ <extension-point id="copyStrategy" name="copyStrategy" schema="schema/copyStrategy.exsd"/>
<extension
point="org.eclipse.ui.handlers">
@@ -55,6 +57,18 @@
id="org.eclipse.papyrus.infra.gmfdiag.common.connectionTools"
name="Connection Tools">
</page>
+ <page
+ category="org.eclipse.papyrus.infra.core.sasheditor.preferences.generalcategory"
+ class="org.eclipse.papyrus.infra.gmfdiag.common.preferences.PastePreferencesPage"
+ id="org.eclipse.papyrus.infra.gmfdiag.paste.preferences"
+ name="Paste">
+ </page>
+ <page
+ category="org.eclipse.papyrus.infra.core.sasheditor.preferences.generalcategory"
+ class="org.eclipse.papyrus.infra.gmfdiag.common.preferences.CopyPreferencesPage"
+ id="org.eclipse.papyrus.infra.gmfdiag.paste.preferences"
+ name="Copy">
+ </page>
</extension>
<extension
point="org.eclipse.core.runtime.preferences">
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/schema/copyStrategy.exsd b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/schema/copyStrategy.exsd
new file mode 100644
index 0000000..7e4cdc1
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/schema/copyStrategy.exsd
@@ -0,0 +1,102 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.papyrus.infra.gmfdiag.common" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.papyrus.infra.gmfdiag.common" id="pasteStrategy" name="pasteStrategy"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="strategy" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="strategy">
+ <complexType>
+ <attribute name="strategy" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.papyrus.infra.gmfdiag.common.strategy.copy.ICopyStrategy"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/schema/pasteStrategy.exsd b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/schema/pasteStrategy.exsd
new file mode 100644
index 0000000..cac83d2
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/schema/pasteStrategy.exsd
@@ -0,0 +1,102 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.papyrus.infra.gmfdiag.common" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.papyrus.infra.gmfdiag.common" id="pasteStrategy" name="pasteStrategy"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="strategy" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="strategy">
+ <complexType>
+ <attribute name="strategy" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.papyrus.infra.gmfdiag.common.strategy.paste.IPasteStrategy"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/preferences/CopyPreferencesPage.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/preferences/CopyPreferencesPage.java
new file mode 100644
index 0000000..bc4c28c
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/preferences/CopyPreferencesPage.java
@@ -0,0 +1,65 @@
+/*****************************************************************************
+ * 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:
+ * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.common.preferences;
+
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.papyrus.infra.gmfdiag.common.Activator;
+import org.eclipse.papyrus.infra.gmfdiag.common.strategy.StrategyEditor;
+import org.eclipse.papyrus.infra.gmfdiag.common.strategy.copy.CopyStrategyManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+/**
+ * Allow to select strategies for Papyrus copy
+ */
+public class CopyPreferencesPage extends PreferencePage implements IWorkbenchPreferencePage {
+
+ private StrategyEditor editor;
+
+ /**
+ *
+ * Constructor.
+ *
+ */
+ public CopyPreferencesPage() {
+ super("Copy preferences", org.eclipse.papyrus.infra.widgets.Activator.getDefault().getImageDescriptor("/icons/papyrus.png"));
+ }
+
+ public void init(IWorkbench workbench) {
+ setPreferenceStore(Activator.getInstance().getPreferenceStore());
+ setDescription("Papyrus copy configuration.\nSelect the copy strategies you wish to activate.");
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ Composite self = new Composite(parent, SWT.NONE);
+ self.setLayout(new GridLayout(1, true));
+ editor = new StrategyEditor(self, SWT.NONE, CopyStrategyManager.getInstance());
+ editor.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ return self;
+ }
+
+ @Override
+ protected void performDefaults() {
+ if(editor != null && !editor.isDisposed()) {
+ CopyStrategyManager.getInstance().restoreDefaults();
+ editor.refresh();
+ }
+ super.performDefaults();
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/preferences/PastePreferencesPage.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/preferences/PastePreferencesPage.java
new file mode 100644
index 0000000..0183865
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/preferences/PastePreferencesPage.java
@@ -0,0 +1,60 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.common.preferences;
+
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.papyrus.infra.gmfdiag.common.Activator;
+import org.eclipse.papyrus.infra.gmfdiag.common.strategy.StrategyEditor;
+import org.eclipse.papyrus.infra.gmfdiag.common.strategy.paste.PasteStrategyManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+/**
+ * Allow to select strategies for Papyrus paste
+ */
+public class PastePreferencesPage extends PreferencePage implements IWorkbenchPreferencePage {
+
+ private StrategyEditor editor;
+
+ public PastePreferencesPage() {
+ super("Paste preferences", org.eclipse.papyrus.infra.widgets.Activator.getDefault().getImageDescriptor("/icons/papyrus.png"));
+ }
+
+ public void init(IWorkbench workbench) {
+ setPreferenceStore(Activator.getInstance().getPreferenceStore());
+ setDescription("Papyrus paste configuration.\nSelect the paste strategies you wish to activate.");
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ Composite self = new Composite(parent, SWT.NONE);
+ self.setLayout(new GridLayout(1, true));
+ editor = new StrategyEditor(self, SWT.NONE, PasteStrategyManager.getInstance());
+ editor.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ return self;
+ }
+
+ @Override
+ protected void performDefaults() {
+ if(editor != null && !editor.isDisposed()) {
+ PasteStrategyManager.getInstance().restoreDefaults();
+ editor.refresh();
+ }
+ super.performDefaults();
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/strategy/IStrategy.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/strategy/IStrategy.java
new file mode 100644
index 0000000..3de9ded
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/strategy/IStrategy.java
@@ -0,0 +1,80 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.common.strategy;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * A strategy to be applied when pasting elements
+ */
+
+public interface IStrategy {
+
+ /**
+ * A user-readable label
+ *
+ * @return
+ */
+ public String getLabel();
+
+ /**
+ * A user-readable description
+ *
+ * @return
+ */
+ public String getDescription();
+
+ /**
+ * An image to associate to this strategy
+ *
+ * @return
+ */
+ public Image getImage();
+
+ /**
+ * A unique ID for this strategy
+ *
+ * @return
+ */
+ public String getID();
+
+ /**
+ * The command to be executed when the strategy is applied.
+ * Should return null if the strategy cannot handle the request.
+ *
+ * @param request
+ * The drop request
+ * @param targetEditPart
+ * The target edit part
+ * @return
+ * A command, or null if the strategy cannot handle the request
+ */
+ public Command getCommand(Request request, EditPart targetEditPart);
+
+
+
+ // TODO Remove that
+ /**
+ * The default priority for this strategy. Might be overridden by a user
+ * preference.
+ *
+ * @return
+ * @deprecated The priority mechanism isn't used anymore
+ */
+ @Deprecated
+ public int getPriority();
+
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/strategy/IStrategyManager.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/strategy/IStrategyManager.java
new file mode 100644
index 0000000..7865221
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/strategy/IStrategyManager.java
@@ -0,0 +1,19 @@
+package org.eclipse.papyrus.infra.gmfdiag.common.strategy;
+
+import java.util.List;
+
+public interface IStrategyManager {
+
+ boolean isActive(IStrategy strategy);
+
+ void setActive(IStrategy strategy, boolean isActive);
+
+ int findPriority(IStrategy otherStrategy);
+
+ void setPriority(IStrategy strategyToMove, int newPriority);
+
+ List<IStrategy> getAllStrategies();
+
+ void restoreDefaults();
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/strategy/StrategyEditor.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/strategy/StrategyEditor.java
new file mode 100644
index 0000000..8ad5278
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/strategy/StrategyEditor.java
@@ -0,0 +1,272 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Refactor a generic StrategyEditor
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.common.strategy;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.databinding.observable.list.WritableList;
+import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.jface.window.ToolTip;
+import org.eclipse.papyrus.infra.widgets.editors.MultipleReferenceEditor;
+import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
+import org.eclipse.papyrus.infra.widgets.providers.StaticContentProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.TreeEditor;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.TreeColumn;
+import org.eclipse.swt.widgets.TreeItem;
+
+// TODO : make drag&dropEditor extends it
+public class StrategyEditor extends MultipleReferenceEditor {
+
+ private static final String STRATEGIES = "Strategies";
+
+ public static final int ACTIVATION_COLUMN = 0;
+
+ public static final int LABEL_COLUMN = 1;
+
+ protected /*final*/ Map<IStrategy, Button> checkboxes;
+
+
+ protected IStrategyManager instance;
+
+ public StrategyEditor(Composite parent, int style, IStrategyManager instance2) {
+ super(parent, style, true, true, STRATEGIES);
+ instance = instance2;
+
+ List<IStrategy> values = getStrategyManager().getAllStrategies();
+
+ IStaticContentProvider provider = new StaticContentProvider(values.toArray());
+ ColumnViewerToolTipSupport.enableFor(treeViewer, ToolTip.NO_RECREATE);
+ setProviders(provider, new StrategyLabelProvider(getStrategyManager()));// FIXME
+ setModelObservable(new StrategyObservableList(values));
+
+ TableLayout layout = new TableLayout();
+
+ new TreeColumn(tree, SWT.LEFT);
+ layout.addColumnData(new ColumnWeightData(10, 25, false));
+
+ new TreeColumn(tree, SWT.LEFT);
+ layout.addColumnData(new ColumnWeightData(100, 250, true));
+
+ tree.setLayout(layout);
+ tree.setHeaderVisible(false);
+
+ setToolTipText(STRATEGIES);
+
+ treeViewer.refresh();
+
+ //Adds a checkbox for each PasteStrategy, to toggle it
+ checkboxes = new HashMap<IStrategy, Button>();
+
+ for(TreeItem item : tree.getItems()) {
+ if(item.getData() instanceof IStrategy) {
+ TreeEditor editor = new TreeEditor(tree);
+ final Button button = new Button(tree, SWT.CHECK);
+ final TreeItem currentItem = item;
+
+ final IStrategy strategy = (IStrategy)currentItem.getData();
+ button.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ updateStrategy(strategy, button);
+ treeViewer.refresh();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ //Nothing
+ }
+
+ });
+
+ checkboxes.put(strategy, button);
+
+ button.setSelection(getStrategyManager().isActive(strategy));
+
+ editor.setEditor(button, item, ACTIVATION_COLUMN);
+ editor.horizontalAlignment = SWT.CENTER;
+ editor.grabHorizontal = true;
+ }
+ }
+
+ //Adds a space-key listener to edit a list of selected checkboxes
+ tree.addKeyListener(new KeyListener() {
+
+ public void keyReleased(KeyEvent e) {
+ if(e.keyCode == SWT.SPACE) {
+ ISelection selection = treeViewer.getSelection();
+ if(selection instanceof IStructuredSelection && !selection.isEmpty()) {
+ IStructuredSelection structuredSelection = (IStructuredSelection)selection;
+
+ Boolean isActive = findIsActive(structuredSelection);
+
+ Iterator<?> iterator = structuredSelection.iterator();
+ while(iterator.hasNext()) {
+ Object element = iterator.next();
+ if(element instanceof IStrategy) {
+ IStrategy strategy = (IStrategy)element;
+ Button button = checkboxes.get(strategy);
+
+ updateStrategy(strategy, button, isActive);
+ }
+ }
+
+ treeViewer.refresh();
+ }
+ }
+ }
+
+ public void keyPressed(KeyEvent e) {
+ //Nothing
+ }
+ });
+ }
+
+
+ public IStrategyManager getStrategyManager() {
+ return instance;
+ }
+
+ //Returns the new status of the first PasteStrategy in the selection.
+ //Returns null if the selection doesn't contain any PasteStrategy
+ private Boolean findIsActive(IStructuredSelection selection) {
+ Iterator<?> iterator = selection.iterator();
+ while(iterator.hasNext()) {
+ Object element = iterator.next();
+ if(element instanceof IStrategy) {
+ boolean isActive = getStrategyManager().isActive((IStrategy)element); //Current status
+ return !isActive; //New status (Toggle)
+ }
+ }
+ return null; //No PasteStrategy found in the selection
+ }
+
+ protected void updateStrategy(IStrategy strategy, Button button, boolean isActive) {
+ getStrategyManager().setActive((IStrategy) strategy, isActive);
+ button.setSelection(isActive);
+ }
+
+ protected void updateStrategy(IStrategy strategy, Button button) {
+ boolean isActive = getStrategyManager().isActive(strategy);
+ updateStrategy(strategy, button, !isActive);
+ }
+
+ @Override
+ public void createListControls() {
+ super.createListControls();
+ edit.dispose();
+ remove.dispose();
+ add.dispose();
+ up.dispose();
+ down.dispose();
+
+ // toggle = new Button(controlsSection, SWT.TOGGLE);
+ // toggle.setImage(org.eclipse.papyrus.infra.widgets.Activator.getDefault().getImage("/icons/Add_12x12.gif"));
+ // toggle.addSelectionListener(this);
+ // toggle.setToolTipText("Toggle the selected strategies");
+
+ treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ updateControls();
+ }
+ });
+ }
+
+ protected Object[] getSelectedElements() {
+ IStructuredSelection selection = (IStructuredSelection)treeViewer.getSelection();
+ return selection.toArray();
+ }
+
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ // if(event.widget == toggle) {
+ // toggleAction(toggle.getSelection());
+ // } else {
+ super.widgetSelected(event);
+ // }
+ }
+
+ protected void toggleAction(boolean activate) {
+ Object[] selectedElements = getSelectedElements();
+ for(Object selected : selectedElements) {
+ if(selected instanceof IStrategy) {
+ getStrategyManager().setActive((IStrategy)selected, activate);
+ }
+ }
+ treeViewer.refresh();
+ }
+
+ @Override
+ protected void updateControls() {
+ //Skip super.updateControls ; this is not configurable. Avoids a widget disposed exception
+
+ }
+
+
+
+ /**
+ * Refreshes the widget's contents, based on the PasteStrategyManager's current values
+ */
+ public void refresh() {
+ for(Map.Entry<IStrategy, Button> entry : checkboxes.entrySet()) {
+ boolean isActive = getStrategyManager().isActive(entry.getKey());
+ updateStrategy(entry.getKey(), entry.getValue(), isActive);
+ }
+ treeViewer.refresh();
+ }
+
+
+ private class StrategyObservableList extends WritableList {
+
+ public StrategyObservableList(List<IStrategy> values) {
+ super();
+ addAll(values);
+ }
+
+ @Override
+ public Object move(int oldIndex, int newIndex) {
+ Object objectToMove = get(oldIndex);
+ Object other = get(newIndex);
+
+ if(objectToMove instanceof IStrategy && other instanceof IStrategy) {
+ IStrategy strategyToMove = (IStrategy)objectToMove;
+ IStrategy otherStrategy = (IStrategy)other;
+
+ int priority = getStrategyManager().findPriority(otherStrategy);
+ int newPriority = (newIndex > oldIndex) ? priority + 1 : priority - 1;
+
+ getStrategyManager().setPriority(strategyToMove, newPriority);
+ }
+
+ return super.move(oldIndex, newIndex);
+ }
+
+ }
+
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/strategy/StrategyLabelProvider.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/strategy/StrategyLabelProvider.java
new file mode 100644
index 0000000..f4ff46c
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/strategy/StrategyLabelProvider.java
@@ -0,0 +1,78 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Refactor a generic StrategyLabelProvider
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.common.strategy;
+
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * A LabelProvider for a Strategy
+ */
+public class StrategyLabelProvider extends ColumnLabelProvider {
+
+ IStrategyManager instance;
+
+ public StrategyLabelProvider(IStrategyManager abstractStrategyManager) {
+ instance = abstractStrategyManager;
+ }
+
+ @Override
+ public String getText(Object element) {
+ if(element instanceof IStrategy) {
+ return ((IStrategy)element).getLabel();
+ }
+ return super.getText(element);
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ if(element instanceof IStrategy) {
+ return ((IStrategy)element).getImage();
+ }
+ return super.getImage(element);
+ }
+
+ @Override
+ public String getToolTipText(Object element) {
+ if(element instanceof IStrategy) {
+ return ((IStrategy)element).getDescription();
+ }
+ return null;
+ }
+
+
+ @Override
+ public void update(ViewerCell cell) {
+ Object element = cell.getElement();
+
+ if(element instanceof IStrategy) {
+ IStrategy strategy = (IStrategy)element;
+ if(cell.getColumnIndex() == StrategyEditor.LABEL_COLUMN) {
+ cell.setImage(strategy.getImage());
+
+ int foreground;
+
+ if(instance.isActive(strategy)) {
+ foreground = SWT.COLOR_BLACK;
+ } else {
+ foreground = SWT.COLOR_GRAY;
+ }
+ cell.setForeground(Display.getCurrent().getSystemColor(foreground));
+ cell.setText(strategy.getLabel());
+ }
+ }
+ }
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/strategy/StrategyManager.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/strategy/StrategyManager.java
new file mode 100644
index 0000000..47779c8
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/strategy/StrategyManager.java
@@ -0,0 +1,386 @@
+/*****************************************************************************
+ * 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.common.strategy;
+
+import java.text.Collator;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.common.Activator;
+//import org.eclipse.papyrus.infra.gmfdiag.dnd.strategy.DropStrategy;
+import org.osgi.service.prefs.BackingStoreException;
+
+/**
+ * Singleton instance. This class is used to read and manage the various
+ * DropStrategies: activation, order (priority)
+ *
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class StrategyManager implements IStrategyManager {
+
+
+ /**
+ * The priority property suffix (For preferences)
+ */
+ public static final String PRIORITY_KEY = "priority"; //$NON-NLS-1$
+
+ /**
+ * The isActive property suffix (For preferences)
+ */
+ public static final String IS_ACTIVE_KEY = "isActive"; //$NON-NLS-1$
+
+ /**
+ * The default strategy property suffix (For preferences)
+ */
+ public static final String DEFAULT_STRATEGY_KEY = "defaultStrategy"; //$NON-NLS-1$
+
+
+ /**
+ * The drop strategy extension point
+ */
+ protected /*static final*/ String EXTENSION_ID = ""; //Activator.ID + ".dropStrIStrategy";
+
+
+ /**
+ * All DropStrategies, defined through an extension point
+ * The values are grouped by priority.
+ *
+ * (Including the DefaultDropStrategy)
+ */
+ protected /*final*/ SortedMap<Integer, List<IStrategy>> allAvailableStrategies;
+
+ /**
+ * A map to indicate whether each IStrategy is active
+ */
+ protected /*final*/ Map<IStrategy, Boolean> activeStrategies;
+
+ /**
+ * The map of default strategies for each known conflicting case
+ */
+ protected /*final*/ Map<Set<IStrategy>, IStrategy> defaultStrategies;
+
+ /**
+ * Stores a map of String/Integer (Strategy id / priority)
+ * and String/Boolean (Strategy id / boolean)
+ *
+ * The ids are suffixed by the property name, e.g. :
+ *
+ * oep.myStrategy.isActive=true
+ * oep.myStrategy.priority=12
+ */
+ protected /*final*/ IPreferenceStore preferences;
+
+ protected StrategyManager(String extensionId ) {
+ EXTENSION_ID = extensionId;
+ allAvailableStrategies = new TreeMap<Integer, List<IStrategy>>();
+ activeStrategies = new HashMap<IStrategy, Boolean>();
+ defaultStrategies = new HashMap<Set<IStrategy>, IStrategy>();
+ preferences = Activator.getInstance().getPreferenceStore();
+ init();
+ }
+
+ protected StrategyManager() {
+ allAvailableStrategies = new TreeMap<Integer, List<IStrategy>>();
+ activeStrategies = new HashMap<IStrategy, Boolean>();
+ defaultStrategies = new HashMap<Set<IStrategy>, IStrategy>();
+ preferences = Activator.getInstance().getPreferenceStore();
+ init();
+ }
+
+ protected void init() {
+ initStrategies(); //Init all available strategies, reads the priorities
+ initActiveStrategies(); //Reads whether each available strategy is active
+ initDefaultPreferences(); //Inits the preference store's default values (priority + isActive)
+ initDefaultDropStrategies(); //Inits the default drop strategies
+ }
+
+ protected void initStrategies() {
+ IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID);
+
+ //Loads all strategies from the extension point.
+ for(IConfigurationElement e : config) {
+ try {
+ if("strategy".equals(e.getName())) {
+ IStrategy strategy = (IStrategy)e.createExecutableExtension("strategy"); //$NON-NLS-1$
+ int priority = findPriority(strategy);
+ getStrategies(priority).add(strategy);
+ }
+ } catch (Exception ex) {
+ Activator.log.error("The plugin " + e.getContributor() + " contributed an invalid extension for " + EXTENSION_ID, ex); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ }
+
+ private void initActiveStrategies() {
+ for(List<IStrategy> strategies : allAvailableStrategies.values()) {
+ for(IStrategy strategy : strategies) {
+ activeStrategies.put(strategy, isActive(strategy));
+ }
+ }
+ }
+
+ private void initDefaultPreferences() {
+ for(Collection<IStrategy> strategies : allAvailableStrategies.values()) {
+ for(IStrategy strategy : strategies) {
+ preferences.setDefault(getPriorityKey(strategy), strategy.getPriority());
+ preferences.setDefault(getIsActiveKey(strategy), true);
+ }
+ }
+ }
+
+ private void initDefaultDropStrategies() {
+ try {
+ for(String key : InstanceScope.INSTANCE.getNode(Activator.ID).keys()) {
+ if(key.endsWith(DEFAULT_STRATEGY_KEY)) {
+ parseDefaultDropStrategy(key);
+ }
+ }
+ } catch (BackingStoreException ex) {
+ Activator.log.error("Could not initialize the default Drag & Drop strategy choices", ex);
+ }
+ }
+
+ public IStrategy findStrategy(String id) {
+ for(IStrategy strategy : getAllStrategies()) {
+ if(strategy.getID().equals(id)) {
+ return strategy;
+ }
+ }
+ return null;
+ }
+
+ private void parseDefaultDropStrategy(String key) {
+ String[] strategyIds = key.substring(0, key.lastIndexOf(":")).split(":");
+
+ Set<IStrategy> strategies = new HashSet<IStrategy>();
+ for(String strategyId : strategyIds) {
+ IStrategy strategy = findStrategy(strategyId);
+ if(strategy == null) {
+ return; //Invalid preference ; skip
+ }
+ strategies.add(strategy);
+ }
+
+ if(strategies.size() > 1) {
+ defaultStrategies.put(strategies, findStrategy(preferences.getString(key)));
+ }
+ }
+
+ /**
+ * Returns a collection of all DropStrategy with the given priority.
+ * Never returns null
+ *
+ * @param priority
+ * @return
+ */
+ private List<IStrategy> getStrategies(int priority) {
+ if(!allAvailableStrategies.containsKey(priority)) {
+ allAvailableStrategies.put(priority, new LinkedList<IStrategy>());
+ }
+ return allAvailableStrategies.get(priority);
+ }
+
+ /**
+ * Returns a list of all active IStrategy, ordered by priority. Never returns null.
+ *
+ * @return
+ */
+ public List<IStrategy> getActiveStrategies() {
+ List<IStrategy> orderedActiveStrategies = new LinkedList<IStrategy>();
+ for(List<IStrategy> strategies : allAvailableStrategies.values()) {
+ for(IStrategy strategy : strategies) {
+ if(isActive(strategy)) {
+ orderedActiveStrategies.add(strategy);
+ }
+ }
+ }
+ return orderedActiveStrategies;
+ }
+
+ /**
+ * All DropStrategies
+ * The values are grouped by priority.
+ *
+ * (Including the DefaultIStrategy)
+ */
+ public Map<Integer, List<IStrategy>> getAllAvailableStrategies() {
+ return allAvailableStrategies;
+ }
+
+ public static String getPriorityKey(IStrategy strategy) {
+ return strategy.getID() + "." + PRIORITY_KEY;
+ }
+
+ public static String getIsActiveKey(IStrategy strategy) {
+ return strategy.getID() + "." + IS_ACTIVE_KEY;
+ }
+
+ public static String getDefaultStrategyKey(Collection<IStrategy> conflict) {
+ List<IStrategy> orderedStrategies = new LinkedList<IStrategy>(conflict);
+
+ Collections.sort(orderedStrategies, new Comparator<IStrategy>() {
+
+ public int compare(IStrategy strategy1, IStrategy strategy2) {
+ return Collator.getInstance().compare(strategy1.getID(), strategy2.getID());
+ }
+
+ });
+
+ String key = ""; //$NON-NLS-1$
+ for(IStrategy strategy : conflict) {
+ key += strategy.getID() + ":";
+ }
+ key += DEFAULT_STRATEGY_KEY;
+
+ return key;
+ }
+
+ public int findPriority(IStrategy strategy) {
+ String preferenceKey = getPriorityKey(strategy);
+ if(preferences.contains(preferenceKey)) {
+ return preferences.getInt(preferenceKey);
+ }
+
+ return strategy.getPriority(); //Default
+ }
+
+ public boolean isActive(IStrategy strategy) {
+ String preferenceKey = getIsActiveKey(strategy);
+ if(preferences.contains(preferenceKey)) {
+ return preferences.getBoolean(preferenceKey);
+ }
+
+ return true; //Default
+ }
+
+ public void setActive(IStrategy strategy, boolean active) {
+ preferences.setValue(getIsActiveKey(strategy), active);
+ activeStrategies.put(strategy, active);
+ }
+
+ public void setPriority(IStrategy strategy, int priority) {
+ //Remove the IStrategy from its previous priority
+ getStrategies(findPriority(strategy)).remove(strategy);
+
+ //Add it again at the right priority
+ preferences.setValue(getPriorityKey(strategy), priority);
+ getStrategies(priority).add(strategy);
+ }
+
+ // TODO make private
+ public static final StrategyManager instance = new StrategyManager();
+
+ /**
+ * Returns a flat list of all available strategies.
+ *
+ * The strategies are ordered by priority
+ *
+ * @return
+ */
+ public List<IStrategy> getAllStrategies() {
+ List<IStrategy> result = new LinkedList<IStrategy>();
+ for(List<IStrategy> strategies : allAvailableStrategies.values()) {
+ result.addAll(strategies);
+ }
+ return result;
+ }
+
+ /**
+ * Restores the default preferences
+ */
+ public void restoreDefaults() {
+ try {
+ IEclipsePreferences preferenceStore = InstanceScope.INSTANCE.getNode(Activator.ID);
+ preferenceStore.clear();
+ preferenceStore.flush();
+ } catch (BackingStoreException ex) {
+ Activator.log.error(ex);
+ }
+ activeStrategies.clear();
+ allAvailableStrategies.clear();
+ defaultStrategies.clear();
+ initStrategies();
+ initActiveStrategies();
+ initDefaultDropStrategies();
+ }
+
+ /**
+ * Returns the default drop strategy among the given list, or null if there is
+ * no default.
+ *
+ * @param strategies
+ * @return
+ */
+ // TODO : Rename
+ public IStrategy getDefaultDropStrategy(Collection<IStrategy> strategies) {
+ if(strategies.isEmpty()) {
+ return null;
+ }
+
+ IStrategy defaultStrategy;
+
+ if(strategies.size() == 1) {
+ defaultStrategy = strategies.iterator().next();
+ } else {
+ Set<IStrategy> conflictingStrategies = new HashSet<IStrategy>(strategies);
+ defaultStrategy = defaultStrategies.get(conflictingStrategies);
+ }
+
+ if(defaultStrategy == null) {
+ return null;
+ }
+
+ return isActive(defaultStrategy) ? defaultStrategy : null;
+ }
+
+ /**
+ * Sets the default drop strategy for a set of conflicting strategies
+ *
+ * @param conflictingStrategies
+ * @param defaultStrategy
+ */
+ public void setDefaultDropStrategy(Collection<IStrategy> conflictingStrategies, IStrategy defaultStrategy) {
+ if(conflictingStrategies.size() < 2) {
+ return;
+ }
+
+ Set<IStrategy> conflict = new HashSet<IStrategy>(conflictingStrategies);
+ defaultStrategies.put(conflict, defaultStrategy);
+ preferences.putValue(getDefaultStrategyKey(conflict), defaultStrategy.getID());
+
+ //Save the preferences
+ IEclipsePreferences preferenceStore = InstanceScope.INSTANCE.getNode(Activator.ID);
+ try {
+ preferenceStore.flush();
+ } catch (BackingStoreException ex) {
+ Activator.log.error(ex);
+ }
+ }
+
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/strategy/copy/CopyStrategyManager.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/strategy/copy/CopyStrategyManager.java
new file mode 100644
index 0000000..66db723
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/strategy/copy/CopyStrategyManager.java
@@ -0,0 +1,41 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.common.strategy.copy;
+
+import org.eclipse.papyrus.infra.gmfdiag.common.Activator;
+import org.eclipse.papyrus.infra.gmfdiag.common.strategy.StrategyManager;
+import org.eclipse.papyrus.infra.gmfdiag.common.strategy.IStrategyManager;
+
+/**
+ * Singleton instance. This class is used to read and manage the various Copy Strategies
+ */
+public class CopyStrategyManager extends StrategyManager {
+
+ /**
+ * The copy strategy extension point
+ */
+ public static final String EXTENSION_ID = Activator.ID + ".copyStrategy";
+
+ public static final CopyStrategyManager instance = new CopyStrategyManager(EXTENSION_ID);
+
+ private CopyStrategyManager(String todo) {
+ super(EXTENSION_ID);
+ }
+
+ public static IStrategyManager getInstance() {
+ return instance;
+ }
+
+
+
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/strategy/copy/ICopyStrategy.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/strategy/copy/ICopyStrategy.java
new file mode 100644
index 0000000..e8f8eea
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/strategy/copy/ICopyStrategy.java
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.common.strategy.copy;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.papyrus.infra.gmfdiag.common.strategy.IStrategy;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * A strategy to be applied when copying elements
+ */
+public interface ICopyStrategy extends IStrategy{
+
+ /**
+ * A user-readable label
+ *
+ * @return
+ */
+ public String getLabel();
+
+ /**
+ * A user-readable description
+ *
+ * @return
+ */
+ public String getDescription();
+
+ /**
+ * An image to associate to this strategy
+ *
+ * @return
+ */
+ public Image getImage();
+
+ /**
+ * A unique ID for this strategy
+ *
+ * @return
+ */
+ public String getID();
+
+ /**
+ * The command to be executed when the strategy is applied.
+ * Should return null if the strategy cannot handle the request.
+ *
+ * @param request
+ * The drop request
+ * @param targetEditPart
+ * The target edit part
+ * @return
+ * A command, or null if the strategy cannot handle the request
+ */
+ public Command getCommand(Request request, EditPart targetEditPart);
+
+ /**
+ * The default priority for this strategy. Might be overridden by a user
+ * preference.
+ *
+ * @return
+ * @deprecated The priority mechanism isn't used anymore
+ */
+ @Deprecated
+ public int getPriority();
+
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/strategy/paste/IPasteStrategy.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/strategy/paste/IPasteStrategy.java
new file mode 100644
index 0000000..975a311
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/strategy/paste/IPasteStrategy.java
@@ -0,0 +1,79 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.common.strategy.paste;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.papyrus.infra.gmfdiag.common.strategy.IStrategy;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * A strategy to be applied when pasting elements
+ */
+
+// TODO Extract a super interface for merging with drop
+public interface IPasteStrategy extends IStrategy{
+
+ /**
+ * A user-readable label
+ *
+ * @return
+ */
+ public String getLabel();
+
+ /**
+ * A user-readable description
+ *
+ * @return
+ */
+ public String getDescription();
+
+ /**
+ * An image to associate to this strategy
+ *
+ * @return
+ */
+ public Image getImage();
+
+ /**
+ * A unique ID for this strategy
+ *
+ * @return
+ */
+ public String getID();
+
+ /**
+ * The command to be executed when the strategy is applied.
+ * Should return null if the strategy cannot handle the request.
+ *
+ * @param request
+ * The drop request
+ * @param targetEditPart
+ * The target edit part
+ * @return
+ * A command, or null if the strategy cannot handle the request
+ */
+ public Command getCommand(Request request, EditPart targetEditPart);
+
+ /**
+ * The default priority for this strategy. Might be overridden by a user
+ * preference.
+ *
+ * @return
+ * @deprecated The priority mechanism isn't used anymore
+ */
+ @Deprecated
+ public int getPriority();
+
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/strategy/paste/PasteStrategyManager.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/strategy/paste/PasteStrategyManager.java
new file mode 100644
index 0000000..ece3ecf
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/strategy/paste/PasteStrategyManager.java
@@ -0,0 +1,43 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.common.strategy.paste;
+
+import org.eclipse.papyrus.infra.gmfdiag.common.Activator;
+import org.eclipse.papyrus.infra.gmfdiag.common.strategy.StrategyManager;
+import org.eclipse.papyrus.infra.gmfdiag.common.strategy.IStrategyManager;
+
+/**
+ * Singleton instance. This class is used to read and manage the various
+ * Drop Strategies
+ */
+public class PasteStrategyManager extends StrategyManager {
+
+
+ /**
+ * The paste strategy extension point
+ */
+ public static final String EXTENSION_ID = Activator.ID + ".pasteStrategy";
+
+ public static final PasteStrategyManager instance = new PasteStrategyManager(EXTENSION_ID);
+
+ private PasteStrategyManager(String todo) {
+ super(EXTENSION_ID);
+ }
+
+ public static IStrategyManager getInstance() {
+ return instance;
+ }
+
+
+
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml
index 759817f..ade614c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml
@@ -592,4 +592,22 @@
</Priority>
</editpolicyProvider>
</extension>
+<extension
+ point="org.eclipse.papyrus.infra.gmfdiag.common.pasteStrategy">
+ <strategy
+ strategy="org.eclipse.papyrus.uml.diagram.common.strategy.paste.StereotypePasteStrategy">
+ </strategy>
+ <strategy
+ strategy="org.eclipse.papyrus.uml.diagram.common.strategy.paste.ImportResourcePasteStrategy">
+ </strategy>
+</extension>
+<extension
+ point="org.eclipse.papyrus.infra.gmfdiag.common.copyStrategy">
+ <strategy
+ strategy="org.eclipse.papyrus.uml.diagram.common.strategy.copy.AllContentCopyStrategy">
+ </strategy>
+ <strategy
+ strategy="org.eclipse.papyrus.uml.diagram.common.strategy.copy.RootOnlyCopyStrategy">
+ </strategy>
+</extension>
</plugin>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/strategy/copy/AllContentCopyStrategy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/strategy/copy/AllContentCopyStrategy.java
new file mode 100644
index 0000000..c9344a2
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/strategy/copy/AllContentCopyStrategy.java
@@ -0,0 +1,67 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.strategy.copy;
+
+import java.util.Map;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.papyrus.infra.gmfdiag.common.strategy.copy.ICopyStrategy;
+import org.eclipse.papyrus.uml.diagram.common.Activator;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ *
+ */
+public class AllContentCopyStrategy implements ICopyStrategy {
+
+ public String getLabel() {
+ return "AllContentCopyStrategy"; //$NON-NLS-1$
+ }
+
+ public String getID() {
+ return Activator.ID + ".AllContentCopyStrategy";//".ClassifierToStructureCompDrop"; //$NON-NLS-1$
+ }
+
+ public String getDescription() {
+ return "Drops a classifier into the structure compartment of a class."; //$NON-NLS-1$
+ }
+
+ public String getCategoryID() {
+ return "org.eclipse.papyrus.strategy.copy"; //$NON-NLS-1$
+ }
+
+ public String getCategoryLabel() {
+ return "Select elements to copy"; //$NON-NLS-1$
+ }
+
+ public Image getImage() {
+ return null;
+ }
+
+ public int getPriority() {
+ return 0;
+ }
+
+ public void setOptions(Map<String, Object> options) {
+ //Nothing
+ }
+
+ @Override
+ public Command getCommand(Request request, EditPart targetEditPart) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/strategy/copy/RootOnlyCopyStrategy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/strategy/copy/RootOnlyCopyStrategy.java
new file mode 100644
index 0000000..e4abe2f
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/strategy/copy/RootOnlyCopyStrategy.java
@@ -0,0 +1,67 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.strategy.copy;
+
+import java.util.Map;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.papyrus.infra.gmfdiag.common.strategy.copy.ICopyStrategy;
+import org.eclipse.papyrus.uml.diagram.common.Activator;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ *
+ */
+public class RootOnlyCopyStrategy implements ICopyStrategy {
+
+ public String getLabel() {
+ return "RootOnlyCopyStrategy"; //$NON-NLS-1$
+ }
+
+ public String getID() {
+ return Activator.ID + ".RootOnlyCopyStrategy";//".ClassifierToStructureCompDrop"; //$NON-NLS-1$
+ }
+
+ public String getDescription() {
+ return "Copopy only root of the selected element"; //$NON-NLS-1$
+ }
+
+ public String getCategoryID() {
+ return "org.eclipse.papyrus.strategy.copy"; //$NON-NLS-1$
+ }
+
+ public String getCategoryLabel() {
+ return "Select elements to copy"; //$NON-NLS-1$
+ }
+
+ public Image getImage() {
+ return null;
+ }
+
+ public int getPriority() {
+ return 0;
+ }
+
+ public void setOptions(Map<String, Object> options) {
+ //Nothing
+ }
+
+ @Override
+ public Command getCommand(Request request, EditPart targetEditPart) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/strategy/paste/ImportResourcePasteStrategy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/strategy/paste/ImportResourcePasteStrategy.java
new file mode 100644
index 0000000..b22ddaf
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/strategy/paste/ImportResourcePasteStrategy.java
@@ -0,0 +1,67 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.strategy.paste;
+
+import java.util.Map;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.papyrus.infra.gmfdiag.common.strategy.paste.IPasteStrategy;
+import org.eclipse.papyrus.uml.diagram.common.Activator;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ *
+ */
+public class ImportResourcePasteStrategy implements IPasteStrategy {
+
+ public String getLabel() {
+ return "ImportResourcePasteStrategy"; //$NON-NLS-1$
+ }
+
+ public String getID() {
+ return Activator.ID + ".ImportResourcePasteStrategy"; //".ClassifierToStructureCompDrop"; //$NON-NLS-1$
+ }
+
+ public String getDescription() {
+ return "Import required ressources for paste."; //$NON-NLS-1$
+ }
+
+ public String getCategoryID() {
+ return "org.eclipse.papyrus.strategy.paste"; //$NON-NLS-1$
+ }
+
+ public String getCategoryLabel() {
+ return "Paste all copied elements"; //$NON-NLS-1$
+ }
+
+ public Image getImage() {
+ return null;
+ }
+
+ public int getPriority() {
+ return 0;
+ }
+
+ public void setOptions(Map<String, Object> options) {
+ //Nothing
+ }
+
+ @Override
+ public Command getCommand(Request request, EditPart targetEditPart) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/strategy/paste/StereotypePasteStrategy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/strategy/paste/StereotypePasteStrategy.java
new file mode 100644
index 0000000..780129e
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/strategy/paste/StereotypePasteStrategy.java
@@ -0,0 +1,69 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.strategy.paste;
+
+import java.util.Map;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.papyrus.infra.gmfdiag.common.strategy.paste.IPasteStrategy;
+import org.eclipse.papyrus.infra.gmfdiag.common.strategy.paste.TransactionalPasteStrategy;
+import org.eclipse.papyrus.uml.diagram.common.Activator;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ *
+ */
+public class StereotypePasteStrategy implements IPasteStrategy {
+
+ public String getLabel() {
+ return "StereotypeStrategy"; //$NON-NLS-1$
+ }
+
+ public String getID() {
+ return Activator.ID + ".StereotypeStrategy"; //".ClassifierToStructureCompDrop"; //$NON-NLS-1$
+ }
+
+ public String getDescription() {
+ return "Paste stereotype elements"; //$NON-NLS-1$
+ }
+
+ public String getCategoryID() {
+ return "org.eclipse.papyrus.strategy.paste"; //$NON-NLS-1$
+ }
+
+ public String getCategoryLabel() {
+ return "Paste all copied elements"; //$NON-NLS-1$
+ }
+
+ public Image getImage() {
+ return null;
+ }
+
+ public int getPriority() {
+ return 0;
+ }
+
+ public void setOptions(Map<String, Object> options) {
+ //Nothing
+ }
+
+ @Override
+ public Command getCommand(Request request, EditPart targetEditPart) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+
+}