Skip to content

Commit 0f94aa8

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

File tree

4 files changed

+24
-1
lines changed

4 files changed

+24
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
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, "Create/Show Exception breakpoint on clicking exceptions", null, true, 1); //$NON-NLS-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
}
@@ -299,7 +303,8 @@ protected void performDefaults() {
299303
fShowStepResultRemote.setSelection(prefs.getBoolean(JDIDebugModel.PREF_SHOW_STEP_RESULT_REMOTE, true));
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)));
302-
fFilterUnrelatedBreakpoints.setSelection(prefs.getBoolean(JDIDebugModel.PREF_FILTER_BREAKPOINTS_FROM_UNRELATED_SOURCES, true));
306+
fFilterUnrelatedBreakpoints.setSelection(prefs.getBoolean(JDIDebugModel.PREF_CREATE_EXCEPTION_BREAKPOINTS_ON_CLICK, 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: 8 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;
@@ -61,6 +63,8 @@ public JavaExceptionHyperLink(TextConsole console, String exceptionName) {
6163
@Override
6264
public void linkActivated() {
6365
try {
66+
Platform.getPreferencesService().getBoolean(JDIDebugPlugin.getUniqueIdentifier(), JDIDebugModel.PREF_CREATE_EXCEPTION_BREAKPOINTS_ON_CLICK, false, null);
67+
6468
// check for an existing breakpoint
6569
IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(JDIDebugModel.getPluginIdentifier());
6670
for (int i = 0; i < breakpoints.length; i++) {
@@ -98,6 +102,10 @@ private void showProperties(IJavaExceptionBreakpoint breakpoint) {
98102
*/
99103
@Override
100104
protected void processSearchResult(Object source, String typeName, int lineNumber) {
105+
if (!Platform.getPreferencesService().getBoolean(JDIDebugPlugin.getUniqueIdentifier(), JDIDebugModel.PREF_CREATE_EXCEPTION_BREAKPOINTS_ON_CLICK, true, null)) {
106+
super.processSearchResult(source, typeName, lineNumber);
107+
return;
108+
}
101109
try {
102110
source = JavaDebugUtils.getJavaElement(source);
103111
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)