summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoit Maggi2014-04-15 09:57:12 (EDT)
committerBenoit Maggi2014-04-15 10:05:07 (EDT)
commit8f893505e1e8c6f3c5fdf90df95ff8853db460a7 (patch)
tree4346dcfe453a567943b03fdbb91d6b9d992c9b4b
parent397bd4458da8f9bd49965615617721163a116670 (diff)
downloadorg.eclipse.papyrus-8f893505e1e8c6f3c5fdf90df95ff8853db460a7.zip
org.eclipse.papyrus-8f893505e1e8c6f3c5fdf90df95ff8853db460a7.tar.gz
org.eclipse.papyrus-8f893505e1e8c6f3c5fdf90df95ff8853db460a7.tar.bz2
Bug 432813 - [Performance] Papyrus performs poorly (grey screen) orrefs/changes/57/25057/2
crashes when working on large profiles A copy is enable as long as there is an EObject to put in the Clipboard A paste is only available on a simple selection and with a full Clipboard Change-Id: Ifc5a700dc62b85a1c844fd390edc5b62ed4bb695 Signed-off-by: Benoit Maggi <benoit.maggi@cea.fr>
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/CopyHandler.java6
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/PasteHandler.java11
2 files changed, 12 insertions, 5 deletions
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 e8ef61e..2e7a25f 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
@@ -55,9 +55,7 @@ public class CopyHandler extends AbstractCommandHandler {
* @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);
+ public void setEnabled(Object evaluationContext) { // copy is enable as long as there is an EObject to put in the Clipboard
+ setBaseEnabled(!getSelectedElements().isEmpty());
}
}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/PasteHandler.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/PasteHandler.java
index 5ee5af0..0abbadd 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/PasteHandler.java
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/PasteHandler.java
@@ -45,7 +45,7 @@ public class PasteHandler extends AbstractCommandHandler {
CompoundCommand compoundCommand = new CompoundCommand();
for (IStrategy iStrategy : allStrategies) {
Command emfCommand = ((IPasteStrategy) iStrategy)
- .getSemanticCommand(getEditingDomain(), selection.get(0),PapyrusClipboard.getInstance());
+ .getSemanticCommand(getEditingDomain(), selection.get(0), PapyrusClipboard.getInstance());
if (emfCommand!=null) {
compoundCommand.append(emfCommand);
}
@@ -54,4 +54,13 @@ public class PasteHandler extends AbstractCommandHandler {
}
return UnexecutableCommand.INSTANCE;
}
+
+ @Override
+ public void setEnabled(Object evaluationContext) { // past is only available on a simple selection and wit ha full Clipboard
+ if (!PapyrusClipboard.getInstance().isEmpty() && getSelectedElements().size() == 1){
+ super.setEnabled(evaluationContext);
+ } else {
+ setBaseEnabled(false);
+ }
+ }
}