Bug 485741 - [Breakpoints] Can't remove method breakpoint in second

Change-Id: I38ea2c33eafb878c47148fe58ca70db5a10c1370
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 85c0e25..572c616 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
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -732,7 +732,14 @@
 					else if(element instanceof IClassFile) {
 						element = ((IClassFile) element).getElementAt(selection.getOffset());
 					}
-					return element != null && element.getElementType() == IJavaElement.METHOD;
+					if (element != null && element.getElementType() == IJavaElement.METHOD) {
+						IMethod method = (IMethod) element;
+						if (method.getDeclaringType().isAnonymous()) {
+							return false;
+						}
+						return true;
+					}
+
 				} 
     			catch (JavaModelException e) {return false;}
 			}
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/ValidBreakpointLocationLocator.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/ValidBreakpointLocationLocator.java
index 739a9b4..28c9c78 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/ValidBreakpointLocationLocator.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/ValidBreakpointLocationLocator.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2003, 2014 IBM Corporation and others.
+ * Copyright (c) 2003, 2016 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -998,6 +998,11 @@
 				// check if we are on the line which contains the method name
 				int nameOffset = node.getName().getStartPosition();
 				if (lineNumber(nameOffset) == fLineNumber) {
+					if (node.getParent() instanceof AnonymousClassDeclaration){
+						fLocationType = LOCATION_NOT_FOUND;
+						fLocationFound = true;
+						return false;
+					}
 					fMemberOffset = nameOffset;
 					fLocationType = LOCATION_METHOD;
 					fLocationFound = true;