1 11 package org.eclipse.jdt.internal.debug.ui.propertypages; 12 13 import org.eclipse.core.runtime.CoreException; 14 import org.eclipse.jdt.debug.core.IJavaExceptionBreakpoint; 15 import org.eclipse.jdt.internal.debug.core.JDIDebugPlugin; 16 import org.eclipse.jdt.internal.debug.core.breakpoints.JavaExceptionBreakpoint; 17 import org.eclipse.jdt.internal.debug.ui.IJavaDebugHelpContextIds; 18 import org.eclipse.swt.events.SelectionAdapter; 19 import org.eclipse.swt.events.SelectionEvent; 20 import org.eclipse.swt.widgets.Button; 21 import org.eclipse.swt.widgets.Composite; 22 import org.eclipse.ui.PlatformUI; 23 24 27 public class JavaExceptionBreakpointPage extends JavaBreakpointPage { 28 29 private Button fCaughtButton; 31 private Button fUncaughtButton; 32 private Button fSuspendOnSubclasses; 33 34 private static final String fgExceptionBreakpointError= PropertyPageMessages.JavaExceptionBreakpointPage_2; 35 38 protected void doStore() throws CoreException { 39 super.doStore(); 40 IJavaExceptionBreakpoint breakpoint= (IJavaExceptionBreakpoint) getBreakpoint(); 41 boolean caught= fCaughtButton.getSelection(); 42 if (caught != breakpoint.isCaught()) { 43 breakpoint.setCaught(caught); 44 } 45 boolean uncaught= fUncaughtButton.getSelection(); 46 if (uncaught != breakpoint.isUncaught()) { 47 breakpoint.setUncaught(uncaught); 48 } 49 boolean suspend = fSuspendOnSubclasses.getSelection(); 51 if(suspend != ((JavaExceptionBreakpoint)breakpoint).isSuspendOnSubclasses()) { 52 ((JavaExceptionBreakpoint)breakpoint).setSuspendOnSubclasses(suspend); 53 } 54 } 55 56 59 protected void createTypeSpecificEditors(Composite parent) { 60 setTitle(PropertyPageMessages.JavaExceptionBreakpointPage_5); 61 IJavaExceptionBreakpoint breakpoint= (IJavaExceptionBreakpoint) getBreakpoint(); 62 SelectionAdapter exceptionBreakpointValidator= new SelectionAdapter() { 63 public void widgetSelected(SelectionEvent e) { 64 validateExceptionBreakpoint(); 65 } 66 }; 67 createLabel(parent, PropertyPageMessages.JavaExceptionBreakpointPage_3); 68 fEnabledButton.addSelectionListener(exceptionBreakpointValidator); 69 fCaughtButton= createCheckButton(parent, PropertyPageMessages.JavaExceptionBreakpointPage_0); 70 try { 71 fCaughtButton.setSelection(breakpoint.isCaught()); 72 } catch (CoreException e) { 73 JDIDebugPlugin.log(e); 74 } 75 fCaughtButton.addSelectionListener(exceptionBreakpointValidator); 76 fUncaughtButton= createCheckButton(parent, PropertyPageMessages.JavaExceptionBreakpointPage_1); 77 try { 78 fUncaughtButton.setSelection(breakpoint.isUncaught()); 79 } catch (CoreException e) { 80 JDIDebugPlugin.log(e); 81 } 82 fUncaughtButton.addSelectionListener(exceptionBreakpointValidator); 83 fSuspendOnSubclasses = createCheckButton(parent, PropertyPageMessages.JavaExceptionBreakpointPage_4); 84 try { 85 fSuspendOnSubclasses.setSelection(((JavaExceptionBreakpoint)breakpoint).isSuspendOnSubclasses()); 87 } 88 catch (CoreException ce) {JDIDebugPlugin.log(ce);} 89 } 90 91 94 private void validateExceptionBreakpoint() { 95 if (fEnabledButton.getSelection() && !(fCaughtButton.getSelection() || fUncaughtButton.getSelection())) { 96 addErrorMessage(fgExceptionBreakpointError); 97 } else { 98 removeErrorMessage(fgExceptionBreakpointError); 99 } 100 } 101 102 105 public void createControl(Composite parent) { 106 super.createControl(parent); 107 PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IJavaDebugHelpContextIds.JAVA_EXCEPTION_BREAKPOINT_PROPERTY_PAGE); 108 } 109 } 110 | Popular Tags |