Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoit Maggi2014-04-25 15:16:00 +0000
committerBenoit Maggi2014-04-25 15:29:57 +0000
commit104b0f1d1bc9402290b04c79bb14d90c5b795508 (patch)
tree7c0da1ff325c2925046c27b8b372dd3a56f9681c
parentdaa58dcc2af907ccb6dffe132cd699c94fcf9988 (diff)
downloadorg.eclipse.papyrus-104b0f1d1bc9402290b04c79bb14d90c5b795508.tar.gz
org.eclipse.papyrus-104b0f1d1bc9402290b04c79bb14d90c5b795508.tar.xz
org.eclipse.papyrus-104b0f1d1bc9402290b04c79bb14d90c5b795508.zip
Bug 290261 - [Usability] Papyrus shall provide a copy/paste/cut feature
- swap command ids to have the default papyrus copy/paste/cut override the org.eclipse.ui.edit.copy/paste/cut - add menus for graphical copy/paste Change-Id: Ic0769df6c97ba7aefb42e6a0861a05b0dd8fbfce Signed-off-by: Benoit Maggi <benoit.maggi@cea.fr>
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/plugin.xml104
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/src/org/eclipse/papyrus/infra/gmfdiag/menu/handlers/CopyInDiagramHandler.java2
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/src/org/eclipse/papyrus/infra/gmfdiag/menu/handlers/CutInDiagramHandler.java35
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/plugin.xml4
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/CopyHandler.java10
5 files changed, 127 insertions, 28 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/plugin.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/plugin.xml
index 20bd41e1abb..12f86d94d1e 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/plugin.xml
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/plugin.xml
@@ -34,9 +34,17 @@
style="push">
</command>
<command
- commandId="org.eclipse.ui.edit.paste.diagram"
+ commandId="org.eclipse.papyrus.paste.diagram" label="Graphical Paste"
style="push">
</command>
+ <command
+ commandId="org.eclipse.papyrus.copy.diagram" label="Graphical Copy"
+ style="push">
+ </command>
+ <command
+ commandId="org.eclipse.papyrus.cut.diagram" label="Graphical Cut"
+ style="push">
+ </command>
<separator
name="edit_actions_separator"
visible="true">
@@ -52,7 +60,7 @@
point="org.eclipse.ui.handlers">
<handler
class="org.eclipse.papyrus.infra.gmfdiag.menu.handlers.GraphicalCutInDiagramHandler"
- commandId="org.eclipse.ui.edit.cut">
+ commandId="org.eclipse.papyrus.cut.diagram">
<activeWhen>
<and>
<with
@@ -75,7 +83,7 @@
</handler>
<handler
class="org.eclipse.papyrus.infra.gmfdiag.menu.handlers.GraphicalCopyInDiagramHandler"
- commandId="org.eclipse.ui.edit.copy">
+ commandId="org.eclipse.papyrus.copy.diagram">
<activeWhen>
<and>
<with
@@ -96,9 +104,9 @@
</and>
</activeWhen>
</handler>
- <handler
+ <handler
class="org.eclipse.papyrus.infra.gmfdiag.menu.handlers.GraphicalPasteInDiagramHandler"
- commandId="org.eclipse.ui.edit.paste">
+ commandId="org.eclipse.papyrus.paste.diagram">
<activeWhen>
<and>
<with
@@ -121,7 +129,7 @@
</handler>
<handler
class="org.eclipse.papyrus.infra.gmfdiag.menu.handlers.PasteInDiagramHandler"
- commandId="org.eclipse.ui.edit.paste.diagram">
+ commandId="org.eclipse.ui.edit.paste">
<activeWhen>
<and>
<with
@@ -138,21 +146,21 @@
property="org.eclipse.papyrus.infra.gmfdiag.common.diagram.tester.isDiagramEditor"
value="true">
</test>
- </with>
- <with
+ </with>
+ <!--<with
variable="activeShell">
<test
forcePluginActivation="true"
property="org.eclipse.papyrus.infra.gmfdiag.common.diagram.tester.isTextZone"
value="false">
</test>
- </with>
+ </with> -->
</and>
</activeWhen>
</handler>
<handler
class="org.eclipse.papyrus.infra.gmfdiag.menu.handlers.CopyInDiagramHandler"
- commandId="org.eclipse.papyrus.copy.diagram">
+ commandId="org.eclipse.ui.edit.copy">
<activeWhen>
<and>
<with
@@ -163,24 +171,55 @@
</test>
</with>
<with
- variable="selection">
+ variable="selection" >
<test
forcePluginActivation="true"
property="org.eclipse.papyrus.infra.gmfdiag.common.diagram.tester.isDiagramEditor"
value="true">
</test>
</with>
+ <!--<with
+ variable="activeShell">
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.papyrus.infra.gmfdiag.common.diagram.tester.isTextZone"
+ value="false">
+ </test>
+ </with> -->
+ </and>
+ </activeWhen>
+ </handler>
+ <handler
+ class="org.eclipse.papyrus.infra.gmfdiag.menu.handlers.CutInDiagramHandler"
+ commandId="org.eclipse.ui.edit.cut">
+ <activeWhen>
+ <and>
+ <with
+ variable="activeContexts">
+ <test
+ property="org.eclipse.papyrus.infra.gmfdiag.common.diagram.context.tester.isGmfDiagramContextActive"
+ value="true">
+ </test>
+ </with>
<with
+ variable="selection">
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.papyrus.infra.gmfdiag.common.diagram.tester.isDiagramEditor"
+ value="true">
+ </test>
+ </with>
+ <!--<with
variable="activeShell">
<test
forcePluginActivation="true"
property="org.eclipse.papyrus.infra.gmfdiag.common.diagram.tester.isTextZone"
value="false">
</test>
- </with>
+ </with> -->
</and>
</activeWhen>
- </handler>
+ </handler>
</extension>
<extension
point="org.eclipse.ui.commands">
@@ -193,18 +232,25 @@
</command>
<command
categoryId="org.eclipse.papyrus.editor.category"
- defaultHandler="org.eclipse.papyrus.infra.gmfdiag.menu.handlers.PasteInDiagramHandler"
+ defaultHandler="org.eclipse.papyrus.infra.gmfdiag.menu.handlers.GraphicalPasteInDiagramHandler"
description="Paste the elements in the current diagram"
- id="org.eclipse.ui.edit.paste.diagram"
- name="Paste Elements">
+ id="org.eclipse.papyrus.paste.diagram"
+ name="Graphical Paste ">
</command>
<command
categoryId="org.eclipse.papyrus.editor.category"
- defaultHandler="org.eclipse.papyrus.infra.gmfdiag.menu.handlers.CopyInDiagramHandler"
+ defaultHandler="org.eclipse.papyrus.infra.gmfdiag.menu.handlers.GraphicalCopyInDiagramHandler"
description="Copy the elements in the current diagram"
id="org.eclipse.papyrus.copy.diagram"
- name="Copy Elements">
- </command>
+ name="Graphical Copy">
+ </command>
+ <command
+ categoryId="org.eclipse.papyrus.editor.category"
+ defaultHandler="org.eclipse.papyrus.infra.gmfdiag.menu.handlers.GraphicalCopyInDiagramHandler"
+ description="Cut the elements in the current diagram"
+ id="org.eclipse.papyrus.cut.diagram"
+ name="Graphical Cut">
+ </command>
</extension>
<extension
point="org.eclipse.ui.bindings">
@@ -218,32 +264,38 @@
commandId="org.eclipse.ui.edit.copy"
contextId="org.eclipse.gmf.runtime.diagram.ui.diagramContext"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
- sequence="M1+M2+C">
+ sequence="M1+C">
</key>
<key
commandId="org.eclipse.ui.edit.cut"
contextId="org.eclipse.gmf.runtime.diagram.ui.diagramContext"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
- sequence="M1+M2+X">
+ sequence="M1+X">
</key>
<key
commandId="org.eclipse.ui.edit.paste"
contextId="org.eclipse.gmf.runtime.diagram.ui.diagramContext"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
- sequence="M1+M2+V">
+ sequence="M1+V">
</key>
<key
- commandId="org.eclipse.ui.edit.paste.diagram"
+ commandId="org.eclipse.papyrus.paste.diagram"
contextId="org.eclipse.gmf.runtime.diagram.ui.diagramContext"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
- sequence="M1+V">
+ sequence="M1+M2+V">
</key>
<key
commandId="org.eclipse.papyrus.copy.diagram"
contextId="org.eclipse.gmf.runtime.diagram.ui.diagramContext"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
- sequence="M1+C">
- </key>
+ sequence="M1+M2+C">
+ </key>
+ <key
+ commandId="org.eclipse.papyrus.cut.diagram"
+ contextId="org.eclipse.gmf.runtime.diagram.ui.diagramContext"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="M1+M2+X">
+ </key>
</extension>
</plugin>
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/src/org/eclipse/papyrus/infra/gmfdiag/menu/handlers/CopyInDiagramHandler.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/src/org/eclipse/papyrus/infra/gmfdiag/menu/handlers/CopyInDiagramHandler.java
index 5786fcc37a5..3fdfc14daf4 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/src/org/eclipse/papyrus/infra/gmfdiag/menu/handlers/CopyInDiagramHandler.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/src/org/eclipse/papyrus/infra/gmfdiag/menu/handlers/CopyInDiagramHandler.java
@@ -113,7 +113,9 @@ public class CopyInDiagramHandler extends AbstractGraphicalCommandHandler {
if(activeFocusControl instanceof StyledText || focusControl instanceof Text) { // true if the focus is on an internal xtext editor or a text edit
setBaseEnabled(false);
} else {
+ PapyrusClipboard<Object> instance = PapyrusClipboard.getInstance();
super.setEnabled(evaluationContext);
+ PapyrusClipboard.setInstance(instance);
}
}
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/src/org/eclipse/papyrus/infra/gmfdiag/menu/handlers/CutInDiagramHandler.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/src/org/eclipse/papyrus/infra/gmfdiag/menu/handlers/CutInDiagramHandler.java
new file mode 100644
index 00000000000..09086cdfe52
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/src/org/eclipse/papyrus/infra/gmfdiag/menu/handlers/CutInDiagramHandler.java
@@ -0,0 +1,35 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 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.menu.handlers;
+
+import org.eclipse.gef.commands.Command;
+
+/**
+ * Handler for the Copy Action in Diagram
+ */
+public class CutInDiagramHandler extends AbstractGraphicalCommandHandler {
+
+
+ @Override
+ protected boolean computeEnabled() {
+ return false;
+ }
+
+ @Override
+ protected Command getCommand() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/plugin.xml
index 9340cd40a9f..b0caae4320d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/plugin.xml
@@ -4342,10 +4342,10 @@
<menuContribution
allPopups="false"
locationURI="popup:org.eclipse.papyrus.infra.gmfdiag.menu.editmenu?after=edit_actions_separator">
- <command
+ <!-- <command
commandId="org.eclipse.papyrus.infra.gmfdiag.menu.pastewithmodel"
style="push">
- </command>
+ </command>-->
<command
commandId="org.eclipse.papyrus.infra.gmfdiag.menu.cleandiagram"
style="push">
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/CopyHandler.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/CopyHandler.java
index 4e223669af6..93240f017a7 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/CopyHandler.java
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/CopyHandler.java
@@ -59,4 +59,14 @@ public class CopyHandler extends AbstractCommandHandler {
return !getSelectedElements().isEmpty();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.papyrus.views.modelexplorer.handler.AbstractCommandHandler#setEnabled(java.lang.Object)
+ */
+ @Override
+ public void setEnabled(Object evaluationContext) {
+ PapyrusClipboard<Object> instance = PapyrusClipboard.getInstance();
+ super.setEnabled(evaluationContext); // setenabled should'nt clear/modify the clipboard
+ PapyrusClipboard.setInstance(instance);
+ }
+
}

Back to the top