Skip to content

Commit 8359e3e

Browse files
committed
Improve Paste Expressions context
Enhance Expressions View paste functionality with context menu entry, multi-line paste prompt, and a Run/Debug preference for paste behavior
1 parent 81910d7 commit 8359e3e

File tree

11 files changed

+151
-24
lines changed

11 files changed

+151
-24
lines changed

debug/org.eclipse.debug.ui/plugin.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1597,15 +1597,15 @@
15971597
icon="$nl$/icons/full/elcl16/rem_all_co.svg"
15981598
helpContextId="remove_all_expressions_action_context"
15991599
class="org.eclipse.debug.internal.ui.actions.expressions.RemoveAllExpressionsAction"
1600-
menubarPath="expressionGroup"
1600+
menubarPath="expressionRemoveGroup"
16011601
id="org.eclipse.debug.ui.debugview.popupMenu.removeAllExpressionsAction">
16021602
</action>
16031603
<action
16041604
label="%RemoveAction.label"
16051605
icon="$nl$/icons/full/elcl16/rem_co.svg"
16061606
helpContextId="remove_expression_action_context"
16071607
class="org.eclipse.debug.internal.ui.actions.expressions.RemoveExpressionAction"
1608-
menubarPath="expressionGroup"
1608+
menubarPath="expressionRemoveGroup"
16091609
id="org.eclipse.debug.ui.debugview.popupMenu.removeExpressionAction">
16101610
<selection
16111611
class="org.eclipse.debug.core.model.IExpression">

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2004, 2025 IBM Corporation and others.
2+
* Copyright (c) 2004, 2026 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -58,6 +58,8 @@ public void initializeDefaultPreferences() {
5858
prefs.setDefault(IDebugPreferenceConstants.PREF_PROMPT_DISABLE_ALL_BREAKPOINTS, true);
5959
prefs.setDefault(IDebugPreferenceConstants.PREF_PROMPT_ENABLE_ALL_BREAKPOINTS, true);
6060
prefs.setDefault(IInternalDebugUIConstants.PREF_SKIP_ALL_BREAKPOINTS_PROMPT, true);
61+
prefs.setDefault(IDebugPreferenceConstants.PREF_PROMPT_PASTE_MULTILINE_EXPRESSIONS,
62+
IInternalDebugUIConstants.EXPRESSION_PASTE_PROMPT);
6163

6264
/**
6365
* Context launching preferences. Appear on the the Launching preference page

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2025 IBM Corporation and others.
2+
* Copyright (c) 2000, 2026 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -465,4 +465,22 @@ public interface IInternalDebugUIConstants {
465465
*/
466466
String PREF_SKIP_ALL_BREAKPOINTS_PROMPT = IDebugUIConstants.PLUGIN_ID + ".DisableSkipAllBreakpointsOnLaunch"; //$NON-NLS-1$
467467

468+
/**
469+
* String indicating always prompt on pasting multi-line expression
470+
*
471+
*/
472+
String EXPRESSION_PASTE_PROMPT = "org.eclipse.debug.ui.expression.paste.prompt"; //$NON-NLS-1$
473+
474+
/**
475+
* String indicating always paste as combined single expression
476+
*
477+
*/
478+
String EXPRESSION_PASTE_AS_SINGLE = "org.eclipse.debug.ui.expression.paste.single"; //$NON-NLS-1$
479+
480+
/**
481+
* String indicating always paste as multiple expressions
482+
*
483+
*/
484+
String EXPRESSION_PASTE_AS_MULTI = "org.eclipse.debug.ui.expression.paste.multi"; //$NON-NLS-1$
485+
468486
}

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2025 IBM Corporation and others.
2+
* Copyright (c) 2000, 2026 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -254,5 +254,12 @@ public class ActionMessages extends NLS {
254254
public static String EnableAllBreakpointsAction_3;
255255
public static String BreakpointLabelDialog;
256256
public static String RemoveFromFavoritesAction;
257+
public static String PasteWatchExpressionsActionLabel;
258+
public static String ExpressionPasteTitle;
259+
public static String ExpressionPasteMultiButton;
260+
public static String ExpressionPasteSingleButton;
261+
public static String ExpressionPasteDialog;
262+
public static String ExpressionPasteRemember;
263+
public static String ExpressionPastePromptButton;
257264

258265
}

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
###############################################################################
2-
# Copyright (c) 2000, 2025 IBM Corporation and others.
2+
# Copyright (c) 2000, 2026 IBM Corporation and others.
33
#
44
# This program and the accompanying materials
55
# are made available under the terms of the Eclipse Public License 2.0
66
# which accompanies this distribution, and is available at
77
# https://www.eclipse.org/legal/epl-2.0/
88
#
99
# SPDX-License-Identifier: EPL-2.0
10-
#
10+
#
1111
# Contributors:
1212
# IBM Corporation - initial API and implementation
1313
# Mike Morearty - Bug 271411
@@ -99,7 +99,7 @@ RelaunchLastAction_Error_encountered_attempting_to_relaunch_4=Error encountered
9999
# @see Bug 105733 TVT 3.1 - TCT 531 - Poor grammar in "Run Eclipse Application" and "Profile Eclipse Application"
100100
# - the following string is used to display the tooltip for run/debug/profile buttons and is
101101
# the concatenation of "{mode} {configuration name}", for example "Run HelloWorld". In some languages
102-
# this may need to be reversed to be translated properly.
102+
# this may need to be reversed to be translated properly.
103103
##
104104
AbstractLaunchHistoryAction_0={0} {1}
105105
AbstractLaunchHistoryAction_1=Run
@@ -164,8 +164,8 @@ ModifyWatchpointAction_0=Error
164164
ModifyWatchpointAction_1=Failed to modify watchpoint
165165
LaunchShortcutsAction_1=(none applicable)
166166
##
167-
# The following string is used to display launch histories using an integer mnemonic - i.e.
168-
# "{number} {configuration name}". For example "1 HelloWorld".
167+
# The following string is used to display launch histories using an integer mnemonic - i.e.
168+
# "{number} {configuration name}". For example "1 HelloWorld".
169169
##
170170
LaunchConfigurationAction_0=&{0} {1}
171171
FindDialog_1=&Specify an element to select (? = any character, * = any String):
@@ -227,8 +227,9 @@ RunLastAction_0=&Run Last Launched
227227
RunLastAction_1=&Run
228228
RunLastAction_2=Run the selected resource or active editor
229229
RunLastAction_3=Run the previously launched application
230+
PasteWatchExpressionsActionLabel=&Paste Expressions
230231
##
231-
# The following string is used to display actions to open the launch dialog for
232+
# The following string is used to display actions to open the launch dialog for
232233
# a specific mode - for example "Debug Configurations..."
233234
##
234235
OpenLaunchDialogAction_1={0} Configurations...
@@ -237,4 +238,11 @@ VirtualFindAction_1=Unable to locate {0} in viewer
237238

238239
ToggleBreakpointsTargetManager_defaultToggleTarget_name = Default
239240
ToggleBreakpointsTargetManager_defaultToggleTarget_description = Default
240-
BreakpointLabelDialog=Provide a custom label, or blank for the default label
241+
BreakpointLabelDialog=Provide a custom label, or blank for the default label
242+
243+
ExpressionPasteMultiButton=Multiple Expressions
244+
ExpressionPasteSingleButton=Single Expression
245+
ExpressionPastePromptButton=Prompt
246+
ExpressionPasteTitle=Paste Multiline Expression
247+
ExpressionPasteDialog=You are pasting a multiline expression. Choose whether to paste it as a single combined expression or as separate multiple expressions.
248+
ExpressionPasteRemember=Remember my preference next time

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/PasteWatchExpressionsAction.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2009 Adobe Systems, Inc. and others.
2+
* Copyright (c) 2009, 2026 Adobe Systems, Inc. and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -10,6 +10,7 @@
1010
*
1111
* Contributors:
1212
* Adobe Systems, Inc. - initial API and implementation
13+
* IBM Corporation - Improve paste expressions
1314
*******************************************************************************/
1415
package org.eclipse.debug.internal.ui.actions.expressions;
1516

@@ -27,8 +28,6 @@ public class PasteWatchExpressionsAction extends SelectionListenerAction {
2728
public PasteWatchExpressionsAction(ExpressionView expressionView) {
2829
super(ActionMessages.PasteWatchExpressionsAction_0);
2930
fExpressionView = expressionView;
30-
// setToolTipText(BreakpointGroupMessages.PasteWatchExpressionsAction_1);
31-
// PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.PASTE_WATCH_EXPRESSIONS_ACTION);
3231
}
3332

3433
@Override
@@ -43,6 +42,10 @@ public boolean isEnabled() {
4342
return fExpressionView.canPaste();
4443
}
4544

45+
@Override
46+
public String getText() {
47+
return ActionMessages.PasteWatchExpressionsActionLabel;
48+
}
4649

4750

4851
}

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencePage.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2020 IBM Corporation and others.
2+
* Copyright (c) 2000, 2026 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -17,11 +17,14 @@
1717
import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
1818
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
1919
import org.eclipse.debug.internal.ui.SWTFactory;
20+
import org.eclipse.debug.internal.ui.actions.ActionMessages;
2021
import org.eclipse.debug.ui.IDebugUIConstants;
2122
import org.eclipse.jface.preference.BooleanFieldEditor;
2223
import org.eclipse.jface.preference.ColorFieldEditor;
24+
import org.eclipse.jface.preference.FieldEditor;
2325
import org.eclipse.jface.preference.FieldEditorPreferencePage;
2426
import org.eclipse.jface.preference.IPreferenceStore;
27+
import org.eclipse.jface.preference.RadioGroupFieldEditor;
2528
import org.eclipse.swt.SWT;
2629
import org.eclipse.swt.widgets.Composite;
2730
import org.eclipse.ui.IWorkbench;
@@ -70,6 +73,18 @@ protected void createFieldEditors() {
7073
addField(new BooleanFieldEditor(IInternalDebugUIConstants.PREF_SKIP_ALL_BREAKPOINTS_PROMPT,
7174
DebugPreferencesMessages.DebugPreferencePage_PromptSkipBreakpoints, SWT.NONE, getFieldEditorParent()));
7275

76+
FieldEditor edit = new RadioGroupFieldEditor(IDebugPreferenceConstants.PREF_PROMPT_PASTE_MULTILINE_EXPRESSIONS,
77+
DebugPreferencesMessages.DebugPreferencePage_PromptMultiExpressions, 3,
78+
new String[][] {
79+
{ ActionMessages.ExpressionPasteMultiButton,
80+
IInternalDebugUIConstants.EXPRESSION_PASTE_AS_MULTI },
81+
{ ActionMessages.ExpressionPasteSingleButton,
82+
IInternalDebugUIConstants.EXPRESSION_PASTE_AS_SINGLE },
83+
{ ActionMessages.ExpressionPastePromptButton,
84+
IInternalDebugUIConstants.EXPRESSION_PASTE_PROMPT } },
85+
getFieldEditorParent(), true);
86+
addField(edit);
87+
7388
SWTFactory.createHorizontalSpacer(getFieldEditorParent(), 2);
7489
ColorFieldEditor mem= new ColorFieldEditor(IDebugUIConstants.PREF_CHANGED_DEBUG_ELEMENT_COLOR, DebugPreferencesMessages.DebugPreferencePage_4, getFieldEditorParent());
7590
addField(mem);

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,4 +233,6 @@ public class DebugPreferencesMessages extends NLS {
233233
public static String ConsolePreferencePage_ConsoleIconUpdate;
234234

235235
public static String ConsoleFontSettingsLink;
236+
public static String DebugPreferencePage_PromptMultiExpressions;
237+
236238
}

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ ConsolePreferencePage_12=Displayed &tab width:
3030
ConsolePreferencePage_13=Tab width must be between 1 and 100 inclusive.
3131
ConsolePreferencePage_11=Back&ground color:
3232
ConsolePreferencePage_Interpret_control_characters=Interpret ASCII &control characters
33-
ConsolePreferencePage_Interpret_cr_as_control_character=Interpret Carriage &Return (\\r) as control character
33+
ConsolePreferencePage_Interpret_cr_as_control_character=Interpret Carriage &Return (\\r) as control character
3434
ConsolePreferencePage_Enable_Word_Wrap_text=E&nable word wrap
3535
ConsoleElapsedTimeLabel=Elapsed Time Format (Choose 'None' to disable)
3636
ConsoleDefaultElapsedTimeFormat=H:MM:SS
@@ -61,6 +61,7 @@ DebugPreferencePage_32=&Prompt for confirmation when disabling all breakpoints
6161
DebugPreferencePage_5=Prompt for confirmation when deleting all e&xpressions
6262
DebugPreferencePage_showValuesInline=Show debug values &inline on text editors (Experimental)
6363
DebugPreferencePage_PromptSkipBreakpoints=Prompt when launching application in debug mode with 'Skip Breakpoints' enabled
64+
DebugPreferencePage_PromptMultiExpressions=Select how multi-line expressions should be pasted in the 'Expressions View'
6465

6566
LaunchingPreferencePage_1=&Build (if required) before launching
6667
LaunchingPreferencePage_2=Save required dirty editors before launching

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/IDebugPreferenceConstants.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2025 IBM Corporation and others.
2+
* Copyright (c) 2000, 2026 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -336,6 +336,19 @@ public interface IDebugPreferenceConstants {
336336
*/
337337
String DEBUG_VIEW_TOOLBAR_HIDDEN_PERSPECTIVES = "org.eclipse.debug.ui.Debug_view.debug_toolbar_hidden_perspectives"; //$NON-NLS-1$
338338
String CONSOLE_ELAPSED_FORMAT = "org.eclipse.console.elapsedTimeFormat"; //$NON-NLS-1$
339+
340+
/**
341+
* Stores the preference controlling how to handle pasting multi-line
342+
* expressions.
343+
* <p>
344+
* The value is stored as a {@link String} and is expected to match one of the
345+
* expression paste mode constants (for example {@code prompt}, {@code single},
346+
* or {@code multi}), such as
347+
* {@code IInternalDebugUIConstants.EXPRESSION_PASTE_PROMPT}. The default value
348+
* is {@code IInternalDebugUIConstants.EXPRESSION_PASTE_PROMPT}.
349+
* </p>
350+
*/
351+
String PREF_PROMPT_PASTE_MULTILINE_EXPRESSIONS = IDebugUIConstants.PLUGIN_ID + ".paste_multiline_exp_prompt"; //$NON-NLS-1$
339352
}
340353

341354

0 commit comments

Comments
 (0)