1 11 package org.eclipse.jdt.internal.debug.core.refactoring; 12 13 import java.util.List ; 14 15 import org.eclipse.core.resources.IMarker; 16 import org.eclipse.core.runtime.CoreException; 17 import org.eclipse.core.runtime.OperationCanceledException; 18 import org.eclipse.debug.core.model.IBreakpoint; 19 import org.eclipse.jdt.core.IJavaElement; 20 import org.eclipse.jdt.core.IMethod; 21 import org.eclipse.jdt.core.IType; 22 import org.eclipse.jdt.debug.core.IJavaMethodBreakpoint; 23 import org.eclipse.jdt.internal.debug.ui.BreakpointUtils; 24 25 30 public class BreakpointRenameMethodParticipant extends BreakpointRenameParticipant { 31 32 33 36 protected boolean accepts(IJavaElement element) { 37 return element instanceof IMethod; 38 } 39 40 43 protected void gatherChanges(IMarker[] markers, List changes, String destMethodName) throws CoreException, OperationCanceledException { 44 IMethod originalMethod = (IMethod) getOriginalElement(); 45 for (int i = 0; i < markers.length; i++) { 46 IMarker marker = markers[i]; 47 IBreakpoint breakpoint = getBreakpoint(marker); 48 if (breakpoint instanceof IJavaMethodBreakpoint) { 49 IJavaMethodBreakpoint methodBreakpoint = (IJavaMethodBreakpoint) breakpoint; 50 IType breakpointType = BreakpointUtils.getType(methodBreakpoint); 51 if (breakpointType != null && originalMethod.getDeclaringType().equals(breakpointType)) { 52 IMethod destMethod = originalMethod.getDeclaringType().getMethod(destMethodName, originalMethod.getParameterTypes()); 53 changes.add(new MethodBreakpointMethodChange(methodBreakpoint, destMethod)); 54 } 55 } 56 } 57 } 58 59 } 60 | Popular Tags |