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.IMethod; 20 import org.eclipse.jdt.debug.core.IJavaMethodBreakpoint; 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 MethodBreakpointMethodChange extends MethodBreakpointChange { 32 33 private IMethod fDestMethod; 34 35 public MethodBreakpointMethodChange(IJavaMethodBreakpoint breakpoint, IMethod destMethod) throws CoreException { 36 super(breakpoint); 37 fDestMethod = destMethod; 38 } 39 42 public String getName() { 43 return MessageFormat.format(RefactoringMessages.MethodBreakpointMethodChange_0, 44 new String [] {getBreakpointLabel(getOriginalBreakpoint()), fDestMethod.getElementName()}); 45 } 46 47 50 public Change perform(IProgressMonitor pm) throws CoreException { 51 Map map = new HashMap (); 52 BreakpointUtils.addJavaBreakpointAttributes(map, fDestMethod); 53 IResource resource = BreakpointUtils.getBreakpointResource(fDestMethod); 54 int range[] = getNewLineNumberAndRange(fDestMethod); 55 IJavaMethodBreakpoint breakpoint = JDIDebugModel.createMethodBreakpoint( 56 resource, 57 fDestMethod.getDeclaringType().getFullyQualifiedName(), 58 fDestMethod.getElementName(), 59 fDestMethod.getSignature(), 60 isEntry(), 61 isExit(), 62 isNativeOnly(), 63 range[0], 64 range[1], 65 range[2], 66 getHitCount(), 67 true, 68 map); 69 apply(breakpoint); 70 getOriginalBreakpoint().delete(); 71 return new DeleteBreakpointChange(breakpoint); 72 } 73 74 } 75 | Popular Tags |