Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Johnson2018-10-10 16:24:07 -0400
committerAndrew Johnson2018-10-10 16:24:07 -0400
commit376ee81468a2ecf099259e19aa944c218b3c33c5 (patch)
tree3e7275e835767c7bde0ad6fd1b725624523b4a50
parent7eb90381df434f529e60ced481ed9ddfc85fadb3 (diff)
downloadorg.eclipse.mat-376ee81468a2ecf099259e19aa944c218b3c33c5.tar.gz
org.eclipse.mat-376ee81468a2ecf099259e19aa944c218b3c33c5.tar.xz
org.eclipse.mat-376ee81468a2ecf099259e19aa944c218b3c33c5.zip
[539751] Unhandled event loop exception
Use actions for copy on the history view Change-Id: If96d9261d0f656d43adced6a5dff5652500dbbc2
-rw-r--r--plugins/org.eclipse.mat.ui/src/org/eclipse/mat/ui/Messages.java3
-rw-r--r--plugins/org.eclipse.mat.ui/src/org/eclipse/mat/ui/internal/views/SnapshotHistoryView.java58
-rw-r--r--plugins/org.eclipse.mat.ui/src/org/eclipse/mat/ui/messages.properties5
3 files changed, 41 insertions, 25 deletions
diff --git a/plugins/org.eclipse.mat.ui/src/org/eclipse/mat/ui/Messages.java b/plugins/org.eclipse.mat.ui/src/org/eclipse/mat/ui/Messages.java
index 0d8488b0..0aa04fbf 100644
--- a/plugins/org.eclipse.mat.ui/src/org/eclipse/mat/ui/Messages.java
+++ b/plugins/org.eclipse.mat.ui/src/org/eclipse/mat/ui/Messages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010,2017 SAP AG, IBM Corporation and others.
+ * Copyright (c) 2010,2018 SAP AG, IBM Corporation 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
@@ -303,6 +303,7 @@ public class Messages extends NLS
public static String SnapshotHistoryService_SnapshotsDoNotExist;
public static String SnapshotHistoryView_AreYouSure4ManyFiles;
public static String SnapshotHistoryView_AreYouSure4OneFile;
+ public static String SnapshotHistoryView_CopyFilename;
public static String SnapshotHistoryView_ConfirmDeletion;
public static String SnapshotHistoryView_DeleteFile;
public static String SnapshotHistoryView_DeleteFromHistory;
diff --git a/plugins/org.eclipse.mat.ui/src/org/eclipse/mat/ui/internal/views/SnapshotHistoryView.java b/plugins/org.eclipse.mat.ui/src/org/eclipse/mat/ui/internal/views/SnapshotHistoryView.java
index 063cb450..5824c4d4 100644
--- a/plugins/org.eclipse.mat.ui/src/org/eclipse/mat/ui/internal/views/SnapshotHistoryView.java
+++ b/plugins/org.eclipse.mat.ui/src/org/eclipse/mat/ui/internal/views/SnapshotHistoryView.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2013 SAP AG and IBM Corporation.
+ * Copyright (c) 2008, 2018 SAP AG and IBM Corporation.
* 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
@@ -63,6 +63,7 @@ import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorRegistry;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.part.ViewPart;
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
@@ -191,6 +192,7 @@ public class SnapshotHistoryView extends ViewPart implements org.eclipse.mat.ui.
private Action actionDelete;
private Action actionOpenFileInFileSystem;
private Action actionDeleteIndeces;
+ private Action actionCopy;
@Override
public void createPartControl(Composite parent)
@@ -228,27 +230,6 @@ public class SnapshotHistoryView extends ViewPart implements org.eclipse.mat.ui.
{
actionRemoveFromList.run();
}
- else if (e.stateMask == SWT.CTRL && e.keyCode == 'c')
- {
- StringBuilder selectedItems = new StringBuilder();
- for (TableItem selected : table.getSelection())
- {
- if (selectedItems.length() > 0)
- {
- selectedItems.append(' ');
- }
- String path = selected.getText();
- if (path.indexOf(' ') != -1)
- {
- path = '\"' + path + '\"';
- }
- selectedItems.append(path);
- }
- if (selectedItems.length() > 0)
- {
- Copy.copyToClipboard(selectedItems.toString(), table.getDisplay());
- }
- }
}
});
@@ -531,6 +512,37 @@ public class SnapshotHistoryView extends ViewPart implements org.eclipse.mat.ui.
}
}
};
+
+ actionCopy = new Action()
+ {
+ public void run()
+ {
+ StringBuilder selectedItems = new StringBuilder();
+ for (TableItem selected : table.getSelection())
+ {
+ if (selectedItems.length() > 0)
+ {
+ selectedItems.append(' ');
+ }
+ String path = selected.getText();
+ if (path.indexOf(' ') != -1)
+ {
+ path = '\"' + path + '\"';
+ }
+ selectedItems.append(path);
+ }
+ if (selectedItems.length() > 0)
+ {
+ Copy.copyToClipboard(selectedItems.toString(), table.getDisplay());
+ }
+ }
+ };
+ actionCopy.setText(Messages.SnapshotHistoryView_CopyFilename);
+ actionCopy.setImageDescriptor(MemoryAnalyserPlugin.getImageDescriptor(ISharedImages.COPY));
+ getViewSite().getActionBars().setGlobalActionHandler(ActionFactory.COPY.getId(), actionCopy);
+ // No paste action, try to avoid org.eclipse.core.commands.NotHandledException
+ getViewSite().getActionBars().setGlobalActionHandler(ActionFactory.PASTE.getId(), null);
+ getViewSite().getActionBars().updateActionBars();
}
private void hookContextMenu()
@@ -560,6 +572,8 @@ public class SnapshotHistoryView extends ViewPart implements org.eclipse.mat.ui.
actionOpenFileInFileSystem.setEnabled(selection.length == 1);
manager.add(actionOpenFileInFileSystem);
+ manager.add(actionCopy);
+
manager.add(actionDelete);
manager.add(actionDeleteIndeces);
}
diff --git a/plugins/org.eclipse.mat.ui/src/org/eclipse/mat/ui/messages.properties b/plugins/org.eclipse.mat.ui/src/org/eclipse/mat/ui/messages.properties
index f3bb7953..cc2779ce 100644
--- a/plugins/org.eclipse.mat.ui/src/org/eclipse/mat/ui/messages.properties
+++ b/plugins/org.eclipse.mat.ui/src/org/eclipse/mat/ui/messages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2010,2017 SAP AG, IBM Corporation and others.
+# Copyright (c) 2010,2018 SAP AG, IBM Corporation 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
@@ -54,7 +54,7 @@ CheckBoxEditor_asRetainedSetAdditional=Specifies that the retained set of the de
CheckBoxEditor_includeClassInstance=include class instance (if defined by a pattern)
CheckBoxEditor_includeLoadedObjects=include loaded objects (if specified object is a classloader)
#CheckBoxEditor_includeLoadedObjectsAdditional=If specified together with <object address> the address will be interpet as address of a classloader
-CheckBoxEditor_includeLoadedObjectsAdditional=If specified together with <object address> the address will be interpret as address of a classloader
+CheckBoxEditor_includeLoadedObjectsAdditional=If specified together with <object address> the address will be interpreted as the address of a classloader
CheckBoxEditor_includeSubclasses=include subclasses (if object is a class)
CheckBoxEditor_includeSubclassesAdditional=If specified together with <pattern> the subclasses of the classes matching the pattern will also be included
CheckBoxEditor_verbose=verbose
@@ -325,6 +325,7 @@ SnapshotHistoryService_NonExistingSnapshotsWillBeDeleted=The following snapshots
SnapshotHistoryService_SnapshotsDoNotExist=Some snapshots from the history list do not exist anymore
SnapshotHistoryView_AreYouSure4ManyFiles=Are you sure you want to delete these {0,number} files?
SnapshotHistoryView_AreYouSure4OneFile=Are you sure you want to delete ''{0}''?
+SnapshotHistoryView_CopyFilename=Copy Filename
SnapshotHistoryView_ConfirmDeletion=Confirm Deletion
SnapshotHistoryView_DeleteFile=Delete File
SnapshotHistoryView_DeleteFromHistory=Delete only from history

Back to the top