Skip to content

Commit 3f5554e

Browse files
Modify existing behaviour of opening Exception Stack trace (#698)
Add option for navigating to exception types in editor instead of directly creating or modifying exception breakpoints on clicking exception types from console Fix: #670
1 parent 184b51a commit 3f5554e

File tree

6 files changed

+24
-1
lines changed

6 files changed

+24
-1
lines changed

org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/DebugUIMessages.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,4 +473,5 @@ public class DebugUIMessages extends NLS {
473473
public static String CompareObjectsFailedException;
474474

475475
public static String ListSameElementsFor2;
476+
public static String fExceptionBreakpointMsg;
476477
}

org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/DebugUIMessages.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,4 +435,5 @@ ObjectComparisonTitle_short=Comparison
435435
CompareObjectsReference=Reference Mismatch
436436
ObjectsReferenceDifferent=Different in {0}
437437
ObjectsReferenceSameAndDifferent=Same in {0}, but different in {1}
438-
ObjectsExtractedSame=Same in {0}
438+
ObjectsExtractedSame=Same in {0}
439+
fExceptionBreakpointMsg=Create/Show Exception breakpoint on clicking exception names in stacktrace

org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JavaDebugPreferencePage.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ protected void clearErrorMessage() {
101101
private Button fShowStepResult;
102102
private Button fShowStepResultRemote;
103103
private Button fAdvancedSourcelookup;
104+
private Button fExceptionBreakpoint;
104105

105106
// Timeout preference widgets
106107
private JavaDebugIntegerFieldEditor fTimeoutText;
@@ -187,6 +188,7 @@ protected Control createContents(Composite parent) {
187188
fPromptDeleteConditionalBreakpoint= SWTFactory.createCheckButton(composite, DebugUIMessages.JavaDebugPreferencePage_promptWhenDeletingCondidtionalBreakpoint, null, false, 1);
188189
fFilterUnrelatedBreakpoints = SWTFactory.createCheckButton(composite, DebugUIMessages.JavaDebugPreferencePage_filterUnrelatedBreakpoints, null, false, 1);
189190

191+
fExceptionBreakpoint = SWTFactory.createCheckButton(composite, DebugUIMessages.fExceptionBreakpointMsg, null, true, 1);
190192
SWTFactory.createVerticalSpacer(composite, 1);
191193
fOnlyIncludeExportedEntries = SWTFactory.createCheckButton(composite, DebugUIMessages.JavaDebugPreferencePage_only_include_exported_entries, null, false, 1);
192194

@@ -251,6 +253,7 @@ public boolean performOk() {
251253
prefs.putInt(JDIDebugModel.PREF_REQUEST_TIMEOUT, fTimeoutText.getIntValue());
252254
prefs.putBoolean(JDIDebugModel.PREF_FILTER_BREAKPOINTS_FROM_UNRELATED_SOURCES, fFilterUnrelatedBreakpoints.getSelection());
253255
prefs.putBoolean(JDIDebugPlugin.PREF_ENABLE_ADVANCED_SOURCELOOKUP, fAdvancedSourcelookup.getSelection());
256+
prefs.putBoolean(JDIDebugModel.PREF_CREATE_EXCEPTION_BREAKPOINTS_ON_CLICK, fExceptionBreakpoint.getSelection());
254257
try {
255258
prefs.flush();
256259
}
@@ -300,6 +303,7 @@ protected void performDefaults() {
300303
fShowStepTimeoutText.setStringValue(Integer.toString(prefs.getInt(JDIDebugModel.PREF_SHOW_STEP_RESULT, JDIDebugModel.DEF_SHOW_STEP_TIMEOUT)));
301304
fTimeoutText.setStringValue(Integer.toString(prefs.getInt(JDIDebugModel.PREF_REQUEST_TIMEOUT, JDIDebugModel.DEF_REQUEST_TIMEOUT)));
302305
fFilterUnrelatedBreakpoints.setSelection(prefs.getBoolean(JDIDebugModel.PREF_FILTER_BREAKPOINTS_FROM_UNRELATED_SOURCES, true));
306+
fExceptionBreakpoint.setSelection(prefs.getBoolean(JDIDebugModel.PREF_CREATE_EXCEPTION_BREAKPOINTS_ON_CLICK, true));
303307
fAdvancedSourcelookup.setSelection(prefs.getBoolean(JDIDebugPlugin.PREF_ENABLE_ADVANCED_SOURCELOOKUP, true));
304308
}
305309
prefs = DefaultScope.INSTANCE.getNode(LaunchingPlugin.ID_PLUGIN);
@@ -343,6 +347,7 @@ private void setValues() {
343347
fShowStepTimeoutText.setStringValue(Integer.toString(prefs.getInt(bundleId, JDIDebugModel.PREF_SHOW_STEP_TIMEOUT, JDIDebugModel.DEF_SHOW_STEP_TIMEOUT, null)));
344348
fTimeoutText.setStringValue(Integer.toString(prefs.getInt(bundleId, JDIDebugModel.PREF_REQUEST_TIMEOUT, JDIDebugModel.DEF_REQUEST_TIMEOUT, null)));
345349
fFilterUnrelatedBreakpoints.setSelection(prefs.getBoolean(bundleId, JDIDebugModel.PREF_FILTER_BREAKPOINTS_FROM_UNRELATED_SOURCES, true, null));
350+
fExceptionBreakpoint.setSelection(prefs.getBoolean(bundleId, JDIDebugModel.PREF_CREATE_EXCEPTION_BREAKPOINTS_ON_CLICK, true, null));
346351
fAdvancedSourcelookup.setSelection(prefs.getBoolean(bundleId, JDIDebugPlugin.PREF_ENABLE_ADVANCED_SOURCELOOKUP, true, null));
347352

348353
bundleId = LaunchingPlugin.ID_PLUGIN;

org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/console/JavaExceptionHyperLink.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,15 @@
1919
import org.eclipse.core.resources.IResource;
2020
import org.eclipse.core.resources.ResourcesPlugin;
2121
import org.eclipse.core.runtime.CoreException;
22+
import org.eclipse.core.runtime.Platform;
2223
import org.eclipse.debug.core.DebugPlugin;
2324
import org.eclipse.debug.core.model.IBreakpoint;
2425
import org.eclipse.jdt.core.ICompilationUnit;
2526
import org.eclipse.jdt.core.IOrdinaryClassFile;
2627
import org.eclipse.jdt.core.IType;
2728
import org.eclipse.jdt.debug.core.IJavaExceptionBreakpoint;
2829
import org.eclipse.jdt.debug.core.JDIDebugModel;
30+
import org.eclipse.jdt.internal.debug.core.JDIDebugPlugin;
2931
import org.eclipse.jdt.internal.debug.core.JavaDebugUtils;
3032
import org.eclipse.jdt.internal.debug.ui.BreakpointUtils;
3133
import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin;
@@ -98,6 +100,11 @@ private void showProperties(IJavaExceptionBreakpoint breakpoint) {
98100
*/
99101
@Override
100102
protected void processSearchResult(Object source, String typeName, int lineNumber) {
103+
boolean isCreateExceptionBreakpointDisabled = !Platform.getPreferencesService().getBoolean(JDIDebugPlugin.getUniqueIdentifier(), JDIDebugModel.PREF_CREATE_EXCEPTION_BREAKPOINTS_ON_CLICK, true, null);
104+
if (isCreateExceptionBreakpointDisabled) {
105+
super.processSearchResult(source, typeName, lineNumber);
106+
return;
107+
}
101108
try {
102109
source = JavaDebugUtils.getJavaElement(source);
103110
IResource res = ResourcesPlugin.getWorkspace().getRoot();

org.eclipse.jdt.debug/model/org/eclipse/jdt/debug/core/JDIDebugModel.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,14 @@ public class JDIDebugModel {
103103
public static final String PREF_FILTER_BREAKPOINTS_FROM_UNRELATED_SOURCES = getPluginIdentifier()
104104
+ ".do_not_install_breakpoints_from_unrelated_sources"; //$NON-NLS-1$
105105

106+
/**
107+
* Boolean preference for controlling whether an exception breakpoint should be created or managed
108+
* when clicked on an exception type in the console.
109+
*
110+
* @since 3.23
111+
*/
112+
public static final String PREF_CREATE_EXCEPTION_BREAKPOINTS_ON_CLICK = getPluginIdentifier() + ".create_exception_breakpoint_on_click"; //$NON-NLS-1$
113+
106114
/**
107115
* Preference key for specifying if the value returned or thrown should be displayed as variable after a "step return" or "step over" (if
108116
* supported by the vm)

org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/JDIDebugPluginPreferenceInitializer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,6 @@ public void initializeDefaultPreferences() {
5050
node.putBoolean(JDIDebugModel.PREF_SHOW_STEP_RESULT_REMOTE, false);
5151
node.putInt(JDIDebugModel.PREF_SHOW_STEP_TIMEOUT, JDIDebugModel.DEF_SHOW_STEP_TIMEOUT);
5252
node.putBoolean(JDIDebugPlugin.PREF_ENABLE_ADVANCED_SOURCELOOKUP, true);
53+
node.putBoolean(JDIDebugModel.PREF_CREATE_EXCEPTION_BREAKPOINTS_ON_CLICK, true);
5354
}
5455
}

0 commit comments

Comments
 (0)