Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.debug.ui')
-rw-r--r--org.eclipse.debug.ui/plugin.xml2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/CopyExpressionsToClipboardActionDelegate.java35
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/VirtualCopyToClipboardActionDelegate.java19
3 files changed, 53 insertions, 3 deletions
diff --git a/org.eclipse.debug.ui/plugin.xml b/org.eclipse.debug.ui/plugin.xml
index d5bf76fd1..b301161db 100644
--- a/org.eclipse.debug.ui/plugin.xml
+++ b/org.eclipse.debug.ui/plugin.xml
@@ -1582,7 +1582,7 @@
icon="$nl$/icons/full/elcl16/copy_edit_co.png"
definitionId="org.eclipse.ui.edit.copy"
helpContextId="copy_variables_to_clipboard_action_context"
- class="org.eclipse.debug.internal.ui.viewers.model.VirtualCopyToClipboardActionDelegate"
+ class="org.eclipse.debug.internal.ui.actions.expressions.CopyExpressionsToClipboardActionDelegate"
menubarPath="expressionGroup"
id="org.eclipse.debug.ui.debugview.popupMenu.copyVariablesToClipboard">
<selection
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/CopyExpressionsToClipboardActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/CopyExpressionsToClipboardActionDelegate.java
new file mode 100644
index 000000000..e5621fe36
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/CopyExpressionsToClipboardActionDelegate.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Bachmann electronic GmbH 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:
+ * Bachmann electronic GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.actions.expressions;
+
+import org.eclipse.debug.internal.ui.viewers.model.VirtualCopyToClipboardActionDelegate;
+
+public class CopyExpressionsToClipboardActionDelegate extends VirtualCopyToClipboardActionDelegate {
+
+ private static final String QUOTE = "\""; //$NON-NLS-1$
+
+ @Override
+ protected String trimLabel(String rawLabel) {
+ String label = super.trimLabel(rawLabel);
+ if (label == null) {
+ return null;
+ }
+ if (label.startsWith(QUOTE)) {
+ label = label.substring(1);
+ }
+ if (label.endsWith(QUOTE)) {
+ label = label.substring(0, label.length() - 1);
+ }
+ return label;
+ }
+
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/VirtualCopyToClipboardActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/VirtualCopyToClipboardActionDelegate.java
index be623e7d4..688ac3f63 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/VirtualCopyToClipboardActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/VirtualCopyToClipboardActionDelegate.java
@@ -144,8 +144,8 @@ public class VirtualCopyToClipboardActionDelegate extends AbstractDebugActionDel
String[] labels = (String[]) item.getData(VirtualItem.LABEL_KEY);
if(labels != null && labels.length > 0) {
for (int i = 0; i < labels.length; i++) {
- String text = labels[i];
- if(text != null && !text.trim().equals(IInternalDebugCoreConstants.EMPTY_STRING)) {
+ String text = trimLabel(labels[i]);
+ if (text != null && !text.equals(IInternalDebugCoreConstants.EMPTY_STRING)) {
buffer.append(text+TAB);
}
}
@@ -153,6 +153,21 @@ public class VirtualCopyToClipboardActionDelegate extends AbstractDebugActionDel
}
}
+ /**
+ * Trims the given String. Subclasses might want to cut off additional
+ * things from the given label retrieved by the label provider by overriding
+ * this method.
+ *
+ * @param label the label that should be trimmed (might be null)
+ * @return the trimmed label or null if label is null
+ */
+ protected String trimLabel(String label) {
+ if (label == null) {
+ return null;
+ }
+ return label.trim();
+ }
+
private class ItemsToCopyVirtualItemValidator implements IVirtualItemValidator {
Set<VirtualItem> fItemsToCopy = Collections.EMPTY_SET;

Back to the top