Skip to content

Commit 990bbce

Browse files
Modify existing behaviour of opening Exception Stack trace
Modify existing behaviour of opening Exception Stack trace Fix: #670
1 parent 184b51a commit 990bbce

File tree

6 files changed

+25
-1
lines changed

6 files changed

+25
-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 exceptions

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

Lines changed: 6 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,8 @@ 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);
192+
190193
SWTFactory.createVerticalSpacer(composite, 1);
191194
fOnlyIncludeExportedEntries = SWTFactory.createCheckButton(composite, DebugUIMessages.JavaDebugPreferencePage_only_include_exported_entries, null, false, 1);
192195

@@ -251,6 +254,7 @@ public boolean performOk() {
251254
prefs.putInt(JDIDebugModel.PREF_REQUEST_TIMEOUT, fTimeoutText.getIntValue());
252255
prefs.putBoolean(JDIDebugModel.PREF_FILTER_BREAKPOINTS_FROM_UNRELATED_SOURCES, fFilterUnrelatedBreakpoints.getSelection());
253256
prefs.putBoolean(JDIDebugPlugin.PREF_ENABLE_ADVANCED_SOURCELOOKUP, fAdvancedSourcelookup.getSelection());
257+
prefs.putBoolean(JDIDebugModel.PREF_CREATE_EXCEPTION_BREAKPOINTS_ON_CLICK, fExceptionBreakpoint.getSelection());
254258
try {
255259
prefs.flush();
256260
}
@@ -300,6 +304,7 @@ protected void performDefaults() {
300304
fShowStepTimeoutText.setStringValue(Integer.toString(prefs.getInt(JDIDebugModel.PREF_SHOW_STEP_RESULT, JDIDebugModel.DEF_SHOW_STEP_TIMEOUT)));
301305
fTimeoutText.setStringValue(Integer.toString(prefs.getInt(JDIDebugModel.PREF_REQUEST_TIMEOUT, JDIDebugModel.DEF_REQUEST_TIMEOUT)));
302306
fFilterUnrelatedBreakpoints.setSelection(prefs.getBoolean(JDIDebugModel.PREF_FILTER_BREAKPOINTS_FROM_UNRELATED_SOURCES, true));
307+
fExceptionBreakpoint.setSelection(prefs.getBoolean(JDIDebugModel.PREF_CREATE_EXCEPTION_BREAKPOINTS_ON_CLICK, true));
303308
fAdvancedSourcelookup.setSelection(prefs.getBoolean(JDIDebugPlugin.PREF_ENABLE_ADVANCED_SOURCELOOKUP, true));
304309
}
305310
prefs = DefaultScope.INSTANCE.getNode(LaunchingPlugin.ID_PLUGIN);
@@ -343,6 +348,7 @@ private void setValues() {
343348
fShowStepTimeoutText.setStringValue(Integer.toString(prefs.getInt(bundleId, JDIDebugModel.PREF_SHOW_STEP_TIMEOUT, JDIDebugModel.DEF_SHOW_STEP_TIMEOUT, null)));
344349
fTimeoutText.setStringValue(Integer.toString(prefs.getInt(bundleId, JDIDebugModel.PREF_REQUEST_TIMEOUT, JDIDebugModel.DEF_REQUEST_TIMEOUT, null)));
345350
fFilterUnrelatedBreakpoints.setSelection(prefs.getBoolean(bundleId, JDIDebugModel.PREF_FILTER_BREAKPOINTS_FROM_UNRELATED_SOURCES, true, null));
351+
fExceptionBreakpoint.setSelection(prefs.getBoolean(bundleId, JDIDebugModel.PREF_CREATE_EXCEPTION_BREAKPOINTS_ON_CLICK, true, null));
346352
fAdvancedSourcelookup.setSelection(prefs.getBoolean(bundleId, JDIDebugPlugin.PREF_ENABLE_ADVANCED_SOURCELOOKUP, true, null));
347353

348354
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 controlling whether to not install (filter) breakpoints for types existing multiple times in source projects and not related
108+
* to the current debug session.
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)