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.IField; 20 import org.eclipse.jdt.core.IJavaElement; 21 import org.eclipse.jdt.core.IType; 22 import org.eclipse.jdt.debug.core.IJavaWatchpoint; 23 import org.eclipse.jdt.internal.debug.ui.BreakpointUtils; 24 25 30 public class BreakpointRenameFieldParticipant extends BreakpointRenameParticipant { 31 32 35 protected boolean accepts(IJavaElement element) { 36 return element instanceof IField; 37 } 38 39 42 protected void gatherChanges(IMarker[] markers, List changes, String destFieldName) throws CoreException, OperationCanceledException { 43 IField originalField = (IField) getOriginalElement(); 44 for (int i = 0; i < markers.length; i++) { 45 IMarker marker = markers[i]; 46 IBreakpoint breakpoint = getBreakpoint(marker); 47 if (breakpoint instanceof IJavaWatchpoint) { 48 IJavaWatchpoint watchpoint = (IJavaWatchpoint) breakpoint; 49 IType breakpointType = BreakpointUtils.getType(watchpoint); 50 if (breakpointType != null && originalField.getDeclaringType().equals(breakpointType)) { 51 IField destField = originalField.getDeclaringType().getField(destFieldName); 52 changes.add(new WatchpointFieldChange(watchpoint, destField)); 53 } 54 } 55 } 56 } 57 58 59 } 60 | Popular Tags |