1 11 package org.eclipse.jdt.internal.debug.core.refactoring; 12 13 import java.text.MessageFormat ; 14 import java.util.Map ; 15 16 import org.eclipse.core.runtime.CoreException; 17 import org.eclipse.jdt.core.IType; 18 import org.eclipse.jdt.debug.core.IJavaExceptionBreakpoint; 19 import org.eclipse.jdt.debug.core.JDIDebugModel; 20 import org.eclipse.jdt.internal.debug.ui.BreakpointUtils; 21 import org.eclipse.ltk.core.refactoring.Change; 22 23 24 27 public class JavaExceptionBreakpointTypeChange extends JavaBreakpointTypeChange { 28 29 private boolean fIsCaught; 30 private boolean fIsUncaught; 31 private boolean fIsChecked; 32 33 public JavaExceptionBreakpointTypeChange(IJavaExceptionBreakpoint classPrepareBreakpoint, Object changedElement, Object argument, int changeType) throws CoreException { 34 super(classPrepareBreakpoint, changedElement, argument, changeType); 35 fIsCaught= classPrepareBreakpoint.isCaught(); 36 fIsUncaught= classPrepareBreakpoint.isUncaught(); 37 fIsChecked= classPrepareBreakpoint.isChecked(); 38 } 39 40 43 public String getErrorMessageNoMoreExists() { 44 return MessageFormat.format(RefactoringMessages.JavaExceptionBreakpointTypeChange_0, new String [] {getDeclaringType().getElementName()}); } 46 47 50 public String getName() { 51 return MessageFormat.format(RefactoringMessages.JavaExceptionBreakpointTypeChange_1, new String [] {getDeclaringType().getElementName()}); } 53 54 57 public Change performChange(IType newType, Object undoChangedElement, Object undoArgument, int changeType) throws CoreException { 58 Map attributes= getAttributes(); 59 BreakpointUtils.addJavaBreakpointAttributes(attributes, newType); 60 IJavaExceptionBreakpoint newExceptionBreakpoint= JDIDebugModel.createExceptionBreakpoint( 62 BreakpointUtils.getBreakpointResource(newType), 63 newType.getFullyQualifiedName(), 64 fIsCaught, 65 fIsUncaught, 66 fIsChecked, 67 true, 68 attributes); 69 getBreakpoint().delete(); 71 return new JavaExceptionBreakpointTypeChange(newExceptionBreakpoint, undoChangedElement, undoArgument, changeType); 72 } 73 74 } 75 | Popular Tags |