Bug 66150 - Slow to update RetargetWatchpointAction
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java
index d000ad7..7d4788f 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java
@@ -338,6 +338,20 @@
 			}
 			return (IField[]) fields.toArray(new IField[fields.size()]);
 		}
+	}
+	
+	private boolean isFields(IStructuredSelection selection) {
+		if (!selection.isEmpty()) {
+			Iterator iterator = selection.iterator();
+			while (iterator.hasNext()) {
+				Object thing = iterator.next();
+				if (!(thing instanceof IField || thing instanceof IJavaFieldVariable)) {
+					return false;
+				}
+			}
+			return true;
+		}
+		return false;
 	}	
 
 	/* (non-Javadoc)
@@ -560,7 +574,7 @@
 	public boolean canToggleWatchpoints(IWorkbenchPart part, ISelection selection) {
 		if (selection instanceof IStructuredSelection) {
 			IStructuredSelection ss = (IStructuredSelection) selection;
-			return getFields(ss).length > 0;
+			return isFields(ss);
 		} else {
 			return selection instanceof ITextSelection;
 		}