1 11 package org.eclipse.jdt.internal.debug.core.refactoring; 12 13 import java.util.HashMap ; 14 import java.util.Map ; 15 16 import org.eclipse.core.resources.IResource; 17 import org.eclipse.core.runtime.CoreException; 18 import org.eclipse.core.runtime.IProgressMonitor; 19 import org.eclipse.jdt.core.IType; 20 import org.eclipse.jdt.debug.core.IJavaExceptionBreakpoint; 21 import org.eclipse.jdt.debug.core.JDIDebugModel; 22 import org.eclipse.jdt.internal.debug.ui.BreakpointUtils; 23 import org.eclipse.ltk.core.refactoring.Change; 24 25 import com.ibm.icu.text.MessageFormat; 26 27 31 public class ExceptionBreakpointTypeChange extends ExceptionBreakpointChange { 32 33 private IType fDestType; 34 35 public ExceptionBreakpointTypeChange(IJavaExceptionBreakpoint breakpoint, IType destType) throws CoreException { 36 super(breakpoint); 37 fDestType = destType; 38 } 39 40 43 public String getName() { 44 return MessageFormat.format(RefactoringMessages.ExceptionBreakpointTypeChange_0, 45 new String [] {getBreakpointLabel(getOriginalBreakpoint()), fDestType.getElementName()}); 46 } 47 48 51 public Change perform(IProgressMonitor pm) throws CoreException { 52 Map map = new HashMap (); 53 BreakpointUtils.addJavaBreakpointAttributes(map, fDestType); 54 IResource resource = BreakpointUtils.getBreakpointResource(fDestType); 55 IJavaExceptionBreakpoint breakpoint = JDIDebugModel.createExceptionBreakpoint( 56 resource, 57 fDestType.getFullyQualifiedName(), 58 isCaught(), 59 isUncaught(), 60 isChecked(), 61 true, 62 map); 63 apply(breakpoint); 64 getOriginalBreakpoint().delete(); 65 return new DeleteBreakpointChange(breakpoint); 66 } 67 68 } 69 | Popular Tags |