Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Swanson2001-08-08 12:52:08 +0000
committerDarin Swanson2001-08-08 12:52:08 +0000
commit770858c3e736ce6c51832f774fb33e7224fe8fc0 (patch)
treef2df45f9ef88c9b2eb1b0244312caba34d2451e0
parenteeb50e389c24c9173c06a75773d3a017c58f0b69 (diff)
downloadeclipse.platform.debug-770858c3e736ce6c51832f774fb33e7224fe8fc0.tar.gz
eclipse.platform.debug-770858c3e736ce6c51832f774fb33e7224fe8fc0.tar.xz
eclipse.platform.debug-770858c3e736ce6c51832f774fb33e7224fe8fc0.zip
1GFMLTG: ITPDUI:WIN2000 - Copy stack only copies frame
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ControlActionDelegate.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/CopyToClipboardActionDelegate.java83
2 files changed, 71 insertions, 14 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ControlActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ControlActionDelegate.java
index 8a100e8cc..ef5ddc26e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ControlActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ControlActionDelegate.java
@@ -114,7 +114,7 @@ public abstract class ControlActionDelegate implements IWorkbenchWindowActionDel
int count= 0;
while (enum.hasNext()) {
count++;
- if (count > 1 && enableForMultiSelection()) {
+ if (count > 1 && !enableForMultiSelection()) {
return false;
}
Object element= enum.next();
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/CopyToClipboardActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/CopyToClipboardActionDelegate.java
index 94629c76a..6438e7830 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/CopyToClipboardActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/CopyToClipboardActionDelegate.java
@@ -4,19 +4,21 @@ package org.eclipse.debug.internal.ui;
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
-
+
+import java.util.*;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IDebugElement;
-import org.eclipse.jface.viewers.ContentViewer;
-import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.dnd.*;
+import org.eclipse.swt.widgets.Display;
public class CopyToClipboardActionDelegate extends ControlActionDelegate {
private ContentViewer fViewer;
private static final String PREFIX= "copy_to_clipboard_action.";
-
+
/**
* @see ControlActionDelegate
*/
@@ -42,11 +44,17 @@ public class CopyToClipboardActionDelegate extends ControlActionDelegate {
/**
* @see ControlActionDelegate
*/
- protected void doAction(final Object element) {
- StringBuffer buffer= new StringBuffer();
+ protected void doAction(Object element, StringBuffer buffer) {
IDebugElement de= (IDebugElement) element;
append(de, buffer, (ILabelProvider)fViewer.getLabelProvider(), 0);
-
+ }
+
+ /**
+ * @see ControlActionDelegate
+ */
+ protected void doAction(Object element) {
+ StringBuffer buffer= new StringBuffer();
+ doAction(element, buffer);
RTFTransfer rtfTransfer = RTFTransfer.getInstance();
TextTransfer plainTextTransfer = TextTransfer.getInstance();
Clipboard clipboard= new Clipboard(fViewer.getControl().getDisplay());
@@ -55,6 +63,7 @@ public class CopyToClipboardActionDelegate extends ControlActionDelegate {
new Transfer[]{plainTextTransfer});
}
+
/**
* Appends the representation of the specified element (using the label provider and indent)
* to the buffer. For elements down to stack frames, children representations
@@ -79,14 +88,62 @@ public class CopyToClipboardActionDelegate extends ControlActionDelegate {
}
}
+ protected String getHelpContextId() {
+ return IDebugHelpContextIds.COPY_TO_CLIPBOARD_ACTION;
+ }
+
/**
- * @see ControlActionDelegate
+ * Do the specific action using the current selection.
*/
- protected boolean enableForMultiSelection() {
- return false;
+ public void run() {
+ LaunchesView view= getLaunchesView(fMode);
+ if (view == null) {
+ return;
+ }
+ final Iterator iter= pruneSelection(view);
+ String pluginId= DebugUIPlugin.getDefault().getDescriptor().getUniqueIdentifier();
+ BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
+ public void run() {
+ StringBuffer buffer= new StringBuffer();
+ while (iter.hasNext()) {
+ doAction(iter.next(), buffer);
+ }
+ RTFTransfer rtfTransfer = RTFTransfer.getInstance();
+ TextTransfer plainTextTransfer = TextTransfer.getInstance();
+ Clipboard clipboard= new Clipboard(fViewer.getControl().getDisplay());
+ clipboard.setContents(
+ new String[]{buffer.toString()},
+ new Transfer[]{plainTextTransfer});
+ }
+ });
}
-
- protected String getHelpContextId() {
- return IDebugHelpContextIds.COPY_TO_CLIPBOARD_ACTION;
+
+ protected Iterator pruneSelection(LaunchesView view) {
+ IStructuredSelection selection= (IStructuredSelection)view.getSite().getSelectionProvider().getSelection();
+ List elements= new ArrayList(selection.size());
+ Iterator iter= selection.iterator();
+ while (iter.hasNext()) {
+ Object element= iter.next();
+ if (isEnabledFor(element)) {
+ IDebugElement de= (IDebugElement)element;
+ IDebugElement parent= de.getParent();
+ if(walkHierarchy(de, elements)) {
+ elements.add(de);
+ }
+ }
+ }
+ return elements.iterator();
+ }
+
+ protected boolean walkHierarchy(IDebugElement de, List elements) {
+ IDebugElement parent= de.getParent();
+ if (parent == null) {
+ return true;
+ }
+ if (elements.contains(parent)) {
+ return false;
+ }
+ return walkHierarchy(parent, elements);
+
}
} \ No newline at end of file

Back to the top