Merge remote-tracking branch 'origin/master' into BETA_JAVA9
diff --git a/org.eclipse.jdt.debug.tests/test plugin/org/eclipse/jdt/debug/testplugin/JavaProjectHelper.java b/org.eclipse.jdt.debug.tests/test plugin/org/eclipse/jdt/debug/testplugin/JavaProjectHelper.java
index 5ca277a..2209400 100644
--- a/org.eclipse.jdt.debug.tests/test plugin/org/eclipse/jdt/debug/testplugin/JavaProjectHelper.java
+++ b/org.eclipse.jdt.debug.tests/test plugin/org/eclipse/jdt/debug/testplugin/JavaProjectHelper.java
@@ -37,6 +37,7 @@
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.jdt.core.IClasspathEntry;
 import org.eclipse.jdt.core.IJavaProject;
@@ -530,14 +531,19 @@
 	 */
 	public static void importFilesFromDirectory(File rootDir, IPath destPath, IProgressMonitor monitor) throws InvocationTargetException, IOException {		
 		IImportStructureProvider structureProvider = FileSystemStructureProvider.INSTANCE;
-		List<File> files = new ArrayList<File>(100);
+		List<File> files = new ArrayList<>(100);
 		addJavaFiles(rootDir, files);
 		try {
 			ImportOperation op= new ImportOperation(destPath, rootDir, structureProvider, new ImportOverwriteQuery(), files);
 			op.setCreateContainerStructure(false);
 			op.run(monitor);
+			IStatus status = op.getStatus();
+			if (!status.isOK()) {
+				CoreException e = new CoreException(status);
+				throw new InvocationTargetException(e, "Import operation encountered problems");
+			}
 		} catch (InterruptedException e) {
-			// should not happen
+			throw new InvocationTargetException(e, "Interrupted during files import");
 		}
 	}	
 	
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java
index 10a55cf..c8335ed 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java
@@ -26,6 +26,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.TimeUnit;
 
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IFolder;
@@ -582,7 +583,7 @@
 	 * @throws Exception
 	 * @since 3.8
 	 */
-	void assertWelcomeScreenClosed() throws Exception {
+	protected final void assertWelcomeScreenClosed() throws Exception {
 		if(!welcomeClosed && PlatformUI.isWorkbenchRunning()) {
 			final IWorkbench wb = PlatformUI.getWorkbench();
 			if(wb != null) {
@@ -844,17 +845,25 @@
 	protected IJavaProject createJavaProjectClone(String name, String contentpath, String ee, boolean delete) throws Exception {
 		IProject pro = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
         if (pro.exists() && delete) {
-        	try {
-        		pro.delete(true, true, null);
-        	}
-        	catch(Exception e) {}
+			pro.delete(true, true, null);
+			TestUtil.waitForJobs(300, TimeUnit.MINUTES.toMillis(3));
+			TestUtil.runEventLoop();
         }
         // create project and import source
         IJavaProject jp = JavaProjectHelper.createJavaProject(name, JavaProjectHelper.BIN_DIR);
+		TestUtil.waitForJobs(100, TimeUnit.MINUTES.toMillis(3));
+		TestUtil.runEventLoop();
+
         JavaProjectHelper.addSourceContainer(jp, JavaProjectHelper.SRC_DIR);
+		TestUtil.waitForJobs(100, TimeUnit.MINUTES.toMillis(3));
+		TestUtil.runEventLoop();
+
         File root = JavaTestPlugin.getDefault().getFileInPlugin(new Path(contentpath));
         JavaProjectHelper.importFilesFromDirectory(root, jp.getPath(), null);
 
+		TestUtil.waitForJobs(100, TimeUnit.MINUTES.toMillis(3));
+		TestUtil.runEventLoop();
+
         // add the EE library
         IVMInstall vm = JavaRuntime.getDefaultVMInstall();
         assertNotNull("No default JRE", vm);
@@ -869,6 +878,8 @@
         if (!folder.exists()) {
         	folder.create(true, true, null);
         }
+		TestUtil.waitForJobs(300, TimeUnit.MINUTES.toMillis(3));
+		TestUtil.runEventLoop();
         return jp;
 	}
 	
@@ -885,15 +896,19 @@
 	protected IProject createProjectClone(String name, String contentpath, boolean delete) throws Exception {
 		IProject pro = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
         if (pro.exists() && delete) {
-        	try {
-        		pro.delete(true, true, null);
-        	}
-        	catch(Exception e) {}
+			pro.delete(true, true, null);
+			TestUtil.waitForJobs(100, TimeUnit.MINUTES.toMillis(3));
+			TestUtil.runEventLoop();
         }
         // create project and import source
         IProject pj = JavaProjectHelper.createProject(name);
+		TestUtil.waitForJobs(100, TimeUnit.MINUTES.toMillis(3));
+		TestUtil.runEventLoop();
+
         File root = JavaTestPlugin.getDefault().getFileInPlugin(new Path(contentpath));
         JavaProjectHelper.importFilesFromDirectory(root, pj.getFullPath(), null);
+		TestUtil.waitForJobs(100, TimeUnit.MINUTES.toMillis(3));
+		TestUtil.runEventLoop();
         return pj;
 	}
 	
@@ -2471,6 +2486,7 @@
 				tryAgain = false;
 			} catch (TestAgainException e) {
 				Status status = new Status(IStatus.ERROR, "org.eclipse.jdt.debug.tests", "Test failed attempt " + attempts + ". Re-testing: " + this.getName(), e); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+				TestUtil.cleanUp();
 				DebugPlugin.log(status);
 				if (attempts > 5) {
 					tryAgain = false;
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/TestUtil.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/TestUtil.java
new file mode 100644
index 0000000..7b3b088
--- /dev/null
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/TestUtil.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Google, Inc 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Stefan Xenos (Google) - Initial implementation
+ *******************************************************************************/
+package org.eclipse.jdt.debug.tests;
+
+import java.util.concurrent.TimeUnit;
+
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.swt.widgets.Display;
+import org.junit.Assert;
+
+public class TestUtil {
+	/**
+	 * Call this in the tearDown method of every test to clean up state that can
+	 * otherwise leak through SWT between tests.
+	 */
+	public static void cleanUp() {
+		// Ensure that the Thread.interrupted() flag didn't leak.
+		Assert.assertFalse("The main thread should not be interrupted at the end of a test", Thread.interrupted());
+		// Wait for any outstanding jobs to finish. Protect against deadlock by
+		// terminating the wait after a timeout.
+		boolean timedOut = waitForJobs(0, TimeUnit.MINUTES.toMillis(3));
+		Assert.assertFalse("Some Job did not terminate at the end of the test", timedOut);
+		// Wait for any pending *syncExec calls to finish
+		runEventLoop();
+		// Ensure that the Thread.interrupted() flag didn't leak.
+		Assert.assertFalse("The main thread should not be interrupted at the end of a test", Thread.interrupted());
+	}
+
+	/**
+	 * Process all queued UI events. If called from background thread, does
+	 * nothing.
+	 */
+	public static void runEventLoop() {
+		Display display = Display.getCurrent();
+		if (display != null && !display.isDisposed()) {
+			while (display.readAndDispatch()) {
+				// Keep pumping events until the queue is empty
+			}
+		}
+	}
+
+	/**
+	 * Utility for waiting until the execution of jobs of any family has
+	 * finished or timeout is reached. If no jobs are running, the method waits
+	 * given minimum wait time. While this method is waiting for jobs, UI events
+	 * are processed.
+	 *
+	 * @param minTimeMs
+	 *            minimum wait time in milliseconds
+	 * @param maxTimeMs
+	 *            maximum wait time in milliseconds
+	 * @return true if the method timed out, false if all the jobs terminated
+	 *         before the timeout
+	 */
+	public static boolean waitForJobs(long minTimeMs, long maxTimeMs) {
+		if (maxTimeMs < minTimeMs) {
+			throw new IllegalArgumentException("Max time is smaller as min time!");
+		}
+		final long start = System.currentTimeMillis();
+		while (System.currentTimeMillis() - start < minTimeMs) {
+			runEventLoop();
+			try {
+				Thread.sleep(100);
+			} catch (InterruptedException e) {
+				// Uninterruptable
+			}
+		}
+		while (!Job.getJobManager().isIdle()) {
+			if (System.currentTimeMillis() - start >= maxTimeMs) {
+				return true;
+			}
+			runEventLoop();
+			try {
+				Thread.sleep(100);
+			} catch (InterruptedException e) {
+				// Uninterruptable
+			}
+		}
+		return false;
+	}
+}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/VMInstallTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/VMInstallTests.java
index 8310356..bbbe697 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/VMInstallTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/VMInstallTests.java
@@ -21,7 +21,6 @@
 import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.Platform;
-import org.eclipse.jdt.internal.launching.JavaFxLibraryResolver;
 import org.eclipse.jdt.internal.launching.LaunchingPlugin;
 import org.eclipse.jdt.launching.ILibraryLocationResolver;
 import org.eclipse.jdt.launching.IVMInstall;
@@ -36,20 +35,6 @@
  */
 public class VMInstallTests extends AbstractDebugTest {
 
-	private static boolean isTesting = false;
-	
-	static boolean applies(IPath path) {
-		if (!isTesting)
-			return false;
-
-		for (int i = 0; i < path.segmentCount(); i++) {
-			if ("ext".equals(path.segment(i))) {
-				return !JavaFxLibraryResolver.JFXRT_JAR.equals(path.lastSegment());
-			}
-		}
-		return false;
-	}
-
 	public VMInstallTests() {
 		super("VM Install tests");
 	}
@@ -119,7 +104,7 @@
 	 * @throws Exception
 	 */
 	public void testLibraryResolver1() throws Exception {
-		isTesting = true;
+		VMInstallTestsLibraryLocationResolver.isTesting = true;
 		IVMInstall vm = JavaRuntime.getDefaultVMInstall();
 		assertNotNull("There must be a default VM", vm);
 		
@@ -133,7 +118,7 @@
 			assertResolvedLibraryLocations(locs);
 		}
 		finally {
-			isTesting = false;
+			VMInstallTestsLibraryLocationResolver.isTesting = false;
 			//force a re-compute to remove the bogus paths
 			vm.getVMInstallType().disposeVMInstall(vm.getId());
 		}
@@ -146,7 +131,7 @@
 	 * @throws Exception
 	 */
 	public void testLibraryResolver2() throws Exception {
-		isTesting = true;
+		VMInstallTestsLibraryLocationResolver.isTesting = true;
 		try {
 			String filename = "/testfiles/test-jre/bin/test-resolver.ee";
 			if(Platform.OS_WIN32.equals(Platform.getOS())) {
@@ -158,7 +143,7 @@
 			assertResolvedLibraryLocations(locs);
 		}
 		finally {
-			isTesting = false;
+			VMInstallTestsLibraryLocationResolver.isTesting = false;
 		}
 	}
 	
@@ -169,7 +154,7 @@
 	 * @throws Exception
 	 */
 	public void testLibraryResolver3() throws Exception {
-		isTesting = true;
+		VMInstallTestsLibraryLocationResolver.isTesting = true;
 		IVMInstall vm = JavaRuntime.getDefaultVMInstall();
 		assertNotNull("There must be a default VM", vm);
 		try {
@@ -182,7 +167,7 @@
 			assertResolvedLibraryLocations(locs);
 		}
 		finally {
-			isTesting = false;
+			VMInstallTestsLibraryLocationResolver.isTesting = false;
 			vm.getVMInstallType().disposeVMInstall(vm.getId());
 		}
 	}
@@ -195,7 +180,7 @@
 	 * @throws Exception
 	 */
 	public void testLibraryResolver4() throws Exception {
-		isTesting = true;
+		VMInstallTestsLibraryLocationResolver.isTesting = true;
 		try {
 			String filename = "/testfiles/test-jre/bin/test-resolver2.ee";
 			if(Platform.OS_WIN32.equals(Platform.getOS())) {
@@ -207,7 +192,7 @@
 			String locpath = null;
 			for (int i = 0; i < locs.length; i++) {
 				IPath path = locs[i].getSystemLibraryPath();
-				if(applies(path)) {
+				if(VMInstallTestsLibraryLocationResolver.applies(path)) {
 					locpath = path.toString();
 					assertTrue("The original source path should be set on the ext lib [" + locpath + "]",
 							locs[i].getSystemLibrarySourcePath().toString().indexOf("source.txt") > -1);
@@ -215,7 +200,7 @@
 			}
 		}
 		finally {
-			isTesting = false;
+			VMInstallTestsLibraryLocationResolver.isTesting = false;
 		}
 	}
 	
@@ -228,7 +213,7 @@
 		String locpath = null;
 		for (int i = 0; i < locs.length; i++) {
 			IPath path = locs[i].getSystemLibraryPath();
-			if(applies(path)) {
+			if(VMInstallTestsLibraryLocationResolver.applies(path)) {
 				locpath = path.toString();
 				assertTrue("There should be a source path ending in test_resolver_src.zip on the ext lib [" + locpath + "]",
 						locs[i].getSystemLibrarySourcePath().toString().indexOf("test_resolver_src.zip") > -1);
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/VMInstallTestsLibraryLocationResolver.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/VMInstallTestsLibraryLocationResolver.java
index e136faa..08c779a 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/VMInstallTestsLibraryLocationResolver.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/VMInstallTestsLibraryLocationResolver.java
@@ -18,10 +18,29 @@
 import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.URIUtil;
 import org.eclipse.jdt.debug.testplugin.JavaTestPlugin;
+import org.eclipse.jdt.internal.launching.JavaFxLibraryResolver;
 import org.eclipse.jdt.launching.ILibraryLocationResolver;
 
 
 public class VMInstallTestsLibraryLocationResolver implements ILibraryLocationResolver {
+
+	// This used to be in VMInstallTests. Moved here to support headless test runs,
+	// which previously failed because VMInstallTests extends a UI class.
+	static boolean isTesting = false;
+
+	static boolean applies(IPath path) {
+		if (!isTesting) {
+			return false;
+		}
+	
+		for (int i = 0; i < path.segmentCount(); i++) {
+			if ("ext".equals(path.segment(i))) {
+				return !JavaFxLibraryResolver.JFXRT_JAR.equals(path.lastSegment());
+			}
+		}
+		return false;
+	}
+
 	/*
 	 * (non-Javadoc)
 	 * 
@@ -29,7 +48,7 @@
 	 */
 	@Override
 	public IPath getPackageRoot(IPath libraryPath) {
-		if (VMInstallTests.applies(libraryPath)) {
+		if (applies(libraryPath)) {
 			return new Path("src");
 		}
 		return Path.EMPTY;
@@ -42,7 +61,7 @@
 	 */
 	@Override
 	public IPath getSourcePath(IPath libraryPath) {
-		if (VMInstallTests.applies(libraryPath)) {
+		if (applies(libraryPath)) {
 			File file = JavaTestPlugin.getDefault().getFileInPlugin(new Path("testresources/test_resolver_src.zip"));
 			if (file.isFile()) {
 				return new Path(file.getAbsolutePath());
@@ -58,7 +77,7 @@
 	 */
 	@Override
 	public URL getJavadocLocation(IPath libraryPath) {
-		if (VMInstallTests.applies(libraryPath)) {
+		if (applies(libraryPath)) {
 			File file = JavaTestPlugin.getDefault().getFileInPlugin(new Path("testresources/test_resolver_javadoc.zip"));
 			if (file.isFile()) {
 				try {
@@ -79,7 +98,7 @@
 	 */
 	@Override
 	public URL getIndexLocation(IPath libraryPath) {
-		if (VMInstallTests.applies(libraryPath)) {
+		if (applies(libraryPath)) {
 			File file = JavaTestPlugin.getDefault().getFileInPlugin(new Path("testresources/test_resolver_index.index"));
 			if (file.isFile()) {
 				try {
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/sourcelookup/JarSourceLookupTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/sourcelookup/JarSourceLookupTests.java
index 741849d..0aa7d56 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/sourcelookup/JarSourceLookupTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/sourcelookup/JarSourceLookupTests.java
@@ -10,8 +10,12 @@
  *******************************************************************************/
 package org.eclipse.jdt.debug.tests.sourcelookup;
 
+import java.nio.file.Files;
+import java.util.List;
+
 import org.eclipse.core.internal.resources.ResourceException;
 import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.debug.core.ILaunch;
@@ -25,6 +29,7 @@
 import org.eclipse.jdt.debug.core.IJavaThread;
 import org.eclipse.jdt.debug.testplugin.JavaProjectHelper;
 import org.eclipse.jdt.debug.tests.AbstractDebugTest;
+import org.eclipse.jdt.debug.tests.TestUtil;
 import org.eclipse.jdt.internal.core.ClassFile;
 import org.eclipse.jdt.internal.launching.JavaSourceLookupUtil;
 import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
@@ -36,6 +41,7 @@
  */
 public class JarSourceLookupTests extends AbstractDebugTest {
 
+	private static final String SAMPLE_JAR_PATH = "/JarProject/lib/sample.jar";
 	public static final String A_RUN_JAR = "testJar.RunJar";
 	static IJavaProject fgJarProject = null;
 	
@@ -62,30 +68,50 @@
 		}
 	}
 	
-	/* (non-Javadoc)
-	 * @see org.eclipse.jdt.debug.tests.AbstractDebugTest#getProjectContext()
-	 */
 	@Override
 	protected IJavaProject getProjectContext() {
 		return fgJarProject;
 	}
 	
-	/* (non-Javadoc)
-	 * @see org.eclipse.jdt.debug.tests.AbstractDebugTest#setUp()
-	 */
 	@Override
 	protected void setUp() throws Exception {
+		assertWelcomeScreenClosed();
+		TestUtil.runEventLoop();
+		TestUtil.cleanUp();
 		IPath testrpath = new Path("testresources");
-		createProjectClone(fJarProject, testrpath.append(fJarProject).toString(), false);
-		fgJarProject = createJavaProjectClone(RefPjName, testrpath.append(RefPjName).toString(), JavaProjectHelper.J2SE_1_4_EE_NAME, false);
+		IProject jarProject = createProjectClone(fJarProject, testrpath.append(fJarProject).toString(), true);
+
+		IFile jar = jarProject.getFile("lib/sample.jar");
+		assertTrue("lib/sample.jar is missing in project: " + jarProject.getName(), jar.exists());
+
+		fgJarProject = createJavaProjectClone(RefPjName, testrpath.append(RefPjName).toString(), JavaProjectHelper.J2SE_1_4_EE_NAME, true);
+
+		IProject jarRefProject = fgJarProject.getProject();
+		IFile cp = jarRefProject.getFile(".classpath");
+		assertTrue(".classpath is missing in project: " + jarRefProject.getName(), cp.exists());
+		java.nio.file.Path path = cp.getLocation().toFile().toPath();
+		List<String> lines = Files.readAllLines(path);
+		boolean foundJar = false;
+		for (String line : lines) {
+			if (line.contains(SAMPLE_JAR_PATH)) {
+				foundJar = true;
+				break;
+			}
+		}
+		if (!foundJar) {
+			fail("The .classpath from project " + jarRefProject + " is unexpected and does not have an entry for " + SAMPLE_JAR_PATH + ": "
+					+ new String(Files.readAllBytes(path)));
+		}
+		waitForBuild();
 	}
 	
-	/* (non-Javadoc)
-	 * @see junit.framework.TestCase#tearDown()
-	 */
 	@Override
 	protected void tearDown() throws Exception {
 		removeAllBreakpoints();
+		if (fgJarProject.exists()) {
+			fgJarProject.getProject().delete(true, null);
+		}
+		TestUtil.cleanUp();
 		super.tearDown();
 	}
 	
@@ -100,6 +126,7 @@
 		createLaunchConfiguration(fgJarProject, LAUNCHCONFIGURATIONS, A_RUN_JAR);
 		ILaunchConfiguration config = getLaunchConfiguration(fgJarProject, LAUNCHCONFIGURATIONS, A_RUN_JAR);
 		IRuntimeClasspathEntry[] entries = JavaRuntime.computeUnresolvedSourceLookupPath(config);
+		assertEquals("There should be 2 containers returned (JRE and classpath)", 2, entries.length);
 		IRuntimeClasspathEntry[] resolved = JavaRuntime.resolveSourceLookupPath(entries, config);
 		ISourceContainer[] containers = JavaSourceLookupUtil.translate(resolved);
 		try {
@@ -107,15 +134,33 @@
 			//the number of containers is M + 2, where M is unknown across JREs, 1 for the project container and 1 for the JAR we are looking for
 			assertTrue("There should be at least 2 containers returned", containers.length >= 2);
 			for (int i = 0; i < containers.length; i++) {
-				if("sample.jar".equals(containers[i].getName()) &&
-						containers[i] instanceof PackageFragmentRootSourceContainer) {
-					PackageFragmentRootSourceContainer container = (PackageFragmentRootSourceContainer) containers[i];
-					if("/JarProject/lib/sample.jar".equals(container.getPackageFragmentRoot().getPath().toString())) {
+				ISourceContainer sourceContainer = containers[i];
+				if ("sample.jar".equals(sourceContainer.getName()) && sourceContainer instanceof PackageFragmentRootSourceContainer) {
+					PackageFragmentRootSourceContainer container = (PackageFragmentRootSourceContainer) sourceContainer;
+					if (SAMPLE_JAR_PATH.equals(container.getPackageFragmentRoot().getPath().toString())) {
 						return;
 					}
 				}
 			}
-			fail("We did not find a source container that was a PackageFragmentRootSourceContainer and had the name /JarProject/lib/sample.jar");
+			StringBuilder dump = new StringBuilder();
+			for (ISourceContainer sc : containers) {
+				dump.append(sc.getName());
+				if (sc instanceof PackageFragmentRootSourceContainer) {
+					PackageFragmentRootSourceContainer pfsc = (PackageFragmentRootSourceContainer) sc;
+					dump.append(" with path: ").append(pfsc.getPath());
+				}
+				dump.append(", ");
+			}
+			dump.setLength(dump.length() - 2);
+			dump.append(".\n Those containers were resolved from: ");
+			for (IRuntimeClasspathEntry cpe : resolved) {
+				dump.append(cpe);
+				dump.append(", ");
+			}
+
+			dump.setLength(dump.length() - 2);
+			fail("We did not find a source container that was a PackageFragmentRootSourceContainer "
+					+ "and had the name " + SAMPLE_JAR_PATH + ", but found source containers: " + dump);
 		}
 		finally {
 			disposeContainers(containers);
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/breakpoints/JavaBreakpointConditionEditor.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/breakpoints/JavaBreakpointConditionEditor.java
index cb8da9e..23a09df 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/breakpoints/JavaBreakpointConditionEditor.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/breakpoints/JavaBreakpointConditionEditor.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2009, 2015 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 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
@@ -28,6 +28,7 @@
 import org.eclipse.jdt.core.ICompilationUnit;
 import org.eclipse.jdt.core.IType;
 import org.eclipse.jdt.debug.core.IJavaLineBreakpoint;
+import org.eclipse.jdt.debug.core.IJavaWatchpoint;
 import org.eclipse.jdt.internal.debug.ui.BreakpointUtils;
 import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin;
 import org.eclipse.jdt.internal.debug.ui.JDISourceViewer;
@@ -213,6 +214,8 @@
 			suppressPropertyChanges(true);
 			if (input instanceof IJavaLineBreakpoint) {
 				setBreakpoint((IJavaLineBreakpoint)input);
+			} else if (input instanceof IJavaWatchpoint) {
+				setBreakpoint((IJavaWatchpoint) input);
 			} else {
 				setBreakpoint(null);
 			}
@@ -263,6 +266,8 @@
 		IJavaDebugContentAssistContext context = null;
 		if (type == null || breakpoint == null) {
 			context = new TypeContext(null, -1);
+		} else if (breakpoint instanceof IJavaWatchpoint) {
+			context = new TypeContext(type, 0);
 		} else {
 			String source = null;
 			ICompilationUnit compilationUnit = type.getCompilationUnit();
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/BreakpointToggleUtils.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/BreakpointToggleUtils.java
index 742a797..2b3b7f5 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/BreakpointToggleUtils.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/BreakpointToggleUtils.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2016 IBM Corporation and others.
+ * Copyright (c) 2016, 2017 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
@@ -12,50 +12,9 @@
 
 
 
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IClassFile;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IMember;
-import org.eclipse.jdt.core.IPackageDeclaration;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.ITypeRoot;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.internal.corext.template.java.CompilationUnitContext;
-import org.eclipse.jdt.internal.corext.template.java.CompilationUnitContextType;
-import org.eclipse.jdt.internal.corext.template.java.JavaContextType;
-import org.eclipse.jdt.internal.debug.ui.DebugWorkingCopyManager;
 import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin;
-import org.eclipse.jdt.internal.ui.JavaPlugin;
-import org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor;
-import org.eclipse.jdt.internal.ui.text.template.contentassist.TemplateEngine;
-import org.eclipse.jdt.internal.ui.text.template.contentassist.TemplateProposal;
-import org.eclipse.jdt.ui.IWorkingCopyManager;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jdt.ui.SharedASTProvider;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.templates.Template;
-import org.eclipse.jface.text.templates.TemplateContextType;
-import org.eclipse.jface.text.templates.TemplateException;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IEditorInput;
 import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.texteditor.IDocumentProvider;
 import org.eclipse.ui.texteditor.IEditorStatusLine;
-import org.eclipse.ui.texteditor.ITextEditor;
  
 /**
  * Utility class for Java Toggle breakpoints
@@ -64,7 +23,6 @@
 	
 	private static boolean isTracepoint = false;
 
-	public static final String EMPTY_STRING = ""; //$NON-NLS-1$
 
 	public static void setUnsetTracepoints(boolean tracePoint) {
 		isTracepoint = tracePoint;
@@ -75,65 +33,6 @@
 	}
 
 	/**
-	 * Returns the package qualified name, while accounting for the fact that a source file might not have a project
-	 * 
-	 * @param type
-	 *            the type to ensure the package qualified name is created for
-	 * @return the package qualified name
-	 * @since 3.3
-	 */
-	static String createQualifiedTypeName(IType type) {
-		String tname = pruneAnonymous(type);
-		try {
-			String packName = null;
-			if (type.isBinary()) {
-				packName = type.getPackageFragment().getElementName();
-			} else {
-				IPackageDeclaration[] pd = type.getCompilationUnit().getPackageDeclarations();
-				if (pd.length > 0) {
-					packName = pd[0].getElementName();
-				}
-			}
-			if (packName != null && !packName.equals(EMPTY_STRING)) {
-				tname = packName + "." + tname; //$NON-NLS-1$
-			}
-		}
-		catch (JavaModelException e) {
-		}
-		return tname;
-	}
-
-	/**
-	 * Prunes out all naming occurrences of anonymous inner types, since these types have no names and cannot be derived visiting an AST (no positive
-	 * type name matching while visiting ASTs)
-	 * 
-	 * @param type
-	 * @return the compiled type name from the given {@link IType} with all occurrences of anonymous inner types removed
-	 * @since 3.4
-	 */
-	private static String pruneAnonymous(IType type) {
-		StringBuffer buffer = new StringBuffer();
-		IJavaElement parent = type;
-		while (parent != null) {
-			if (parent.getElementType() == IJavaElement.TYPE) {
-				IType atype = (IType) parent;
-				try {
-					if (!atype.isAnonymous()) {
-						if (buffer.length() > 0) {
-							buffer.insert(0, '$');
-						}
-						buffer.insert(0, atype.getElementName());
-					}
-				}
-				catch (JavaModelException jme) {
-				}
-			}
-			parent = parent.getParent();
-		}
-		return buffer.toString();
-	}
-
-	/**
 	 * Convenience method for printing messages to the status line
 	 * 
 	 * @param message
@@ -157,196 +56,4 @@
 		});
 	}
 
-	/**
-	 * Returns the text editor associated with the given part or <code>null</code> if none. In case of a multi-page editor, this method should be used
-	 * to retrieve the correct editor to perform the breakpoint operation on.
-	 * 
-	 * @param part
-	 *            workbench part
-	 * @return text editor part or <code>null</code>
-	 */
-	protected static ITextEditor getTextEditor(IWorkbenchPart part) {
-		if (part instanceof ITextEditor) {
-			return (ITextEditor) part;
-		}
-		return part.getAdapter(ITextEditor.class);
-	}
-
-
-	/**
-	 * Returns the compilation unit from the editor
-	 * 
-	 * @param editor
-	 *            the editor to get the compilation unit from
-	 * @return the compilation unit or <code>null</code>
-	 */
-	public static CompilationUnit parseCompilationUnit(ITextEditor editor) {
-		return parseCompilationUnit(getTypeRoot(editor.getEditorInput()));
-	}
-
-	/**
-	 * Parses the {@link ITypeRoot}.
-	 * 
-	 * @param root
-	 *            the root
-	 * @return the parsed {@link CompilationUnit}
-	 */
-	static CompilationUnit parseCompilationUnit(ITypeRoot root) {
-		if (root != null) {
-			return SharedASTProvider.getAST(root, SharedASTProvider.WAIT_YES, null);
-		}
-		return null;
-	}
-
-	/**
-	 * Returns a selection of the member in the given text selection, or the original selection if none.
-	 * 
-	 * @param part
-	 * @param selection
-	 * @return a structured selection of the member in the given text selection, or the original selection if none
-	 * @exception CoreException
-	 *                if an exception occurs
-	 */
-	protected static ISelection translateToMembers(IWorkbenchPart part, ISelection selection) throws CoreException {
-		ITextEditor textEditor = getTextEditor(part);
-		if (textEditor != null && selection instanceof ITextSelection) {
-			ITextSelection textSelection = (ITextSelection) selection;
-			IEditorInput editorInput = textEditor.getEditorInput();
-			IDocumentProvider documentProvider = textEditor.getDocumentProvider();
-			if (documentProvider == null) {
-				throw new CoreException(Status.CANCEL_STATUS);
-			}
-			IDocument document = documentProvider.getDocument(editorInput);
-			int offset = textSelection.getOffset();
-			if (document != null) {
-				try {
-					IRegion region = document.getLineInformationOfOffset(offset);
-					int end = region.getOffset() + region.getLength();
-					while (Character.isWhitespace(document.getChar(offset)) && offset < end) {
-						offset++;
-					}
-				}
-				catch (BadLocationException ex) {
-				}
-			}
-			IMember m = null;
-			ITypeRoot root = getTypeRoot(editorInput);
-			if (root instanceof ICompilationUnit) {
-				ICompilationUnit unit = (ICompilationUnit) root;
-				synchronized (unit) {
-					unit.reconcile(ICompilationUnit.NO_AST, false, null, null);
-				}
-			}
-			if (root != null) {
-				IJavaElement e = root.getElementAt(offset);
-				if (e instanceof IMember) {
-					m = (IMember) e;
-				}
-			}
-			if (m != null) {
-				return new StructuredSelection(m);
-			}
-		}
-		return selection;
-	}
-
-	/**
-	 * Returns the {@link ITypeRoot} for the given {@link IEditorInput}
-	 * 
-	 * @param input
-	 * @return the type root or <code>null</code> if one cannot be derived
-	 * @since 3.4
-	 */
-	private static ITypeRoot getTypeRoot(IEditorInput input) {
-		ITypeRoot root = input.getAdapter(IClassFile.class);
-		if (root == null) {
-			IWorkingCopyManager manager = JavaUI.getWorkingCopyManager();
-			root = manager.getWorkingCopy(input);
-		}
-		if (root == null) {
-			root = DebugWorkingCopyManager.getWorkingCopy(input, false);
-		}
-		return root;
-	}
-
-	/**
-	 * Returns the {@link ITypeRoot} for the given {@link IEditorInput}
-	 * 
-	 * @param input
-	 * @return the type root or <code>null</code> if one cannot be derived
-	 * @since 3.8
-	 */
-	public static String getCodeTemplate(ITextSelection textSelection, CompilationUnitEditor part) {
-		TemplateContextType contextType = JavaPlugin.getDefault().getTemplateContextRegistry().getContextType(JavaContextType.ID_STATEMENTS);
-		TemplateEngine fStatementEngine = new TemplateEngine(contextType);
-		fStatementEngine.reset();
-		ITextViewer viewer = part.getViewer();
-		final String[] fTemplateBuffer = new String[1];
-		fTemplateBuffer[0] = null;
-		if (viewer != null) {
-			Display.getDefault().syncExec(new Runnable() {
-			    @Override
-				public void run() {
-					ITextEditor editor = BreakpointToggleUtils.getTextEditor(part);
-					if (editor != null) {
-						IJavaElement element = getJavaElement(editor.getEditorInput());
-						ICompilationUnit cunit = null;
-						IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
-						IFile file = root.getFile(element.getPath());
-						cunit = JavaCore.createCompilationUnitFrom(file);
-						IDocumentProvider documentProvider = editor.getDocumentProvider();
-						if (documentProvider == null) {
-							return;
-						}
-						IDocument document = documentProvider.getDocument(editor.getEditorInput());
-						try {
-							IRegion line = document.getLineInformation(textSelection.getStartLine() + 1);
-							Point selectedRange = viewer.getSelectedRange();
-							viewer.setSelectedRange(selectedRange.x, 0);
-							fStatementEngine.complete(viewer, line.getOffset(), cunit);
-							viewer.setSelectedRange(selectedRange.x, selectedRange.y);
-							TemplateProposal[] templateProposals = fStatementEngine.getResults();
-							for (TemplateProposal templateProposal : templateProposals) {
-								Template template = templateProposal.getTemplate();
-								if (template.getName().equals("systrace")) { //$NON-NLS-1$
-									CompilationUnitContextType contextType = (CompilationUnitContextType) JavaPlugin.getDefault().getTemplateContextRegistry().getContextType(template.getContextTypeId());
-									CompilationUnitContext context = contextType.createContext(document, line.getOffset(), 0, cunit);
-									context.setVariable("selection", EMPTY_STRING); //$NON-NLS-1$
-									context.setForceEvaluation(true);
-									fTemplateBuffer[0] = context.evaluate(template).getString();
-									return;
-								}
-							}
-						}
-						catch (BadLocationException e) {
-							e.printStackTrace();
-						}
-						catch (TemplateException e1) {
-							e1.printStackTrace();
-						}
-
-					}
-				}
-			});
-		}
-		return fTemplateBuffer[0];
-	}
-
-	/**
-	 * gets the <code>IJavaElement</code> from the editor input
-	 * 
-	 * @param input
-	 *            the current editor input
-	 * @return the corresponding <code>IJavaElement</code>
-	 * @since 3.3
-	 */
-	public static IJavaElement getJavaElement(IEditorInput input) {
-		IJavaElement je = JavaUI.getEditorInputJavaElement(input);
-		if (je != null) {
-			return je;
-		}
-		// try to get from the working copy manager
-		return DebugWorkingCopyManager.getWorkingCopy(input, false);
-	}
-
 }
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/RetargetToggleTracepointAction.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/RetargetToggleTracepointAction.java
index 4ea7880..1ee3d01 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/RetargetToggleTracepointAction.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/RetargetToggleTracepointAction.java
@@ -12,13 +12,7 @@
 
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.debug.internal.ui.actions.breakpoints.RetargetToggleBreakpointAction;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IMember;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.internal.debug.core.breakpoints.ValidBreakpointLocationLocator;
-import org.eclipse.jface.text.ITextSelection;
 import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.ui.IWorkbenchPart;
 
 /**
@@ -49,41 +43,7 @@
 	 */
 	@Override
 	protected boolean canPerformAction(Object target, ISelection selection, IWorkbenchPart part) {
-		try {
-			ISelection sel = BreakpointToggleUtils.translateToMembers(part, selection);
-			if (sel instanceof IStructuredSelection) {
-				Object firstElement = ((IStructuredSelection) sel).getFirstElement();
-				if (firstElement instanceof IMember) {
-					IMember member = (IMember) firstElement;
-					int mtype = member.getElementType();
-					if (mtype == IJavaElement.FIELD || mtype == IJavaElement.METHOD || mtype == IJavaElement.INITIALIZER) {
-						// remove line breakpoint if present first
-						if (selection instanceof ITextSelection) {
-							ITextSelection ts = (ITextSelection) selection;
-
-							CompilationUnit unit = BreakpointToggleUtils.parseCompilationUnit(BreakpointToggleUtils.getTextEditor(part));
-							ValidBreakpointLocationLocator loc = new ValidBreakpointLocationLocator(unit, ts.getStartLine() + 1, true, true);
-							unit.accept(loc);
-							if (loc.getLocationType() == ValidBreakpointLocationLocator.LOCATION_METHOD) {
-								return true;
-							} else if (loc.getLocationType() == ValidBreakpointLocationLocator.LOCATION_FIELD) {
-								return false;
-							} else if (loc.getLocationType() == ValidBreakpointLocationLocator.LOCATION_LINE) {
-								return true;
-							}
-						}
-					}
-
-					if (member.getElementType() == IJavaElement.TYPE) {
-						return false;
-					}
-				}
-			}
-			return super.canPerformAction(target, selection, part);
-		}
-		catch (CoreException e) {
-			return false;
-		}
+		return super.canPerformAction(target, selection, part);
 	}
 
 	/*
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 f5e1e9c..94bad5a 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
@@ -19,6 +19,7 @@
 
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
@@ -42,9 +43,12 @@
 import org.eclipse.jdt.core.IJavaProject;
 import org.eclipse.jdt.core.IMember;
 import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IPackageDeclaration;
 import org.eclipse.jdt.core.ISourceRange;
 import org.eclipse.jdt.core.IType;
 import org.eclipse.jdt.core.ITypeParameter;
+import org.eclipse.jdt.core.ITypeRoot;
+import org.eclipse.jdt.core.JavaCore;
 import org.eclipse.jdt.core.JavaModelException;
 import org.eclipse.jdt.core.Signature;
 import org.eclipse.jdt.core.SourceRange;
@@ -64,22 +68,38 @@
 import org.eclipse.jdt.debug.core.IJavaType;
 import org.eclipse.jdt.debug.core.IJavaWatchpoint;
 import org.eclipse.jdt.debug.core.JDIDebugModel;
+import org.eclipse.jdt.internal.corext.template.java.CompilationUnitContext;
+import org.eclipse.jdt.internal.corext.template.java.CompilationUnitContextType;
+import org.eclipse.jdt.internal.corext.template.java.JavaContextType;
 import org.eclipse.jdt.internal.debug.core.JavaDebugUtils;
 import org.eclipse.jdt.internal.debug.core.breakpoints.ValidBreakpointLocationLocator;
 import org.eclipse.jdt.internal.debug.ui.BreakpointUtils;
+import org.eclipse.jdt.internal.debug.ui.DebugWorkingCopyManager;
 import org.eclipse.jdt.internal.debug.ui.IJDIPreferencesConstants;
 import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin;
+import org.eclipse.jdt.internal.ui.JavaPlugin;
 import org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor;
+import org.eclipse.jdt.internal.ui.text.template.contentassist.TemplateEngine;
+import org.eclipse.jdt.internal.ui.text.template.contentassist.TemplateProposal;
+import org.eclipse.jdt.ui.IWorkingCopyManager;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jdt.ui.SharedASTProvider;
 import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.jface.dialogs.MessageDialogWithToggle;
 import org.eclipse.jface.text.BadLocationException;
 import org.eclipse.jface.text.IDocument;
 import org.eclipse.jface.text.IRegion;
 import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.text.ITextViewer;
 import org.eclipse.jface.text.source.IVerticalRulerInfo;
+import org.eclipse.jface.text.templates.Template;
+import org.eclipse.jface.text.templates.TemplateContextType;
+import org.eclipse.jface.text.templates.TemplateException;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.widgets.Shell;
@@ -98,6 +118,7 @@
  */
 public class ToggleBreakpointAdapter implements IToggleBreakpointsTargetExtension2 {
 	
+	private static final String EMPTY_STRING = ""; //$NON-NLS-1$
 
 
 	/**
@@ -215,7 +236,7 @@
 					BreakpointToggleUtils.report(null, part);
                     ISelection selection = finalSelection;
                     if(!(selection instanceof IStructuredSelection)) {
-						selection = BreakpointToggleUtils.translateToMembers(part, selection);
+						selection = translateToMembers(part, selection);
                     }
                     boolean isInterface = isInterface(selection, part);
                     if (selection instanceof IStructuredSelection) {
@@ -265,7 +286,7 @@
 								IJavaMethodBreakpoint methodBreakpoint = JDIDebugModel.createMethodBreakpoint(BreakpointUtils.getBreakpointResource(members[i]), getQualifiedName(type), mname, signature, true, false, false, -1, start, end, 0, true, attributes);
 								if (BreakpointToggleUtils.isToggleTracepoints() && finalSelection instanceof ITextSelection
 										&& part instanceof CompilationUnitEditor) {
-									String pattern = BreakpointToggleUtils.getCodeTemplate((ITextSelection) finalSelection, (CompilationUnitEditor) part);
+									String pattern = getCodeTemplate((ITextSelection) finalSelection, (CompilationUnitEditor) part);
 									if (pattern != null) {
 										pattern.trim();
 										pattern = pattern.replaceAll("\\\t", ""); //$NON-NLS-1$//$NON-NLS-2$
@@ -314,7 +335,7 @@
      * @since 3.8
      */
 	IStatus doLineBreakpointToggle(ISelection selection, IWorkbenchPart part, ValidBreakpointLocationLocator locator, boolean bestMatch, IProgressMonitor monitor) {
-		ITextEditor editor = BreakpointToggleUtils.getTextEditor(part);
+		ITextEditor editor = getTextEditor(part);
         if (editor != null && selection instanceof ITextSelection) {
             if (monitor.isCanceled()) {
 				return Status.CANCEL_STATUS;
@@ -327,7 +348,7 @@
 				BreakpointToggleUtils.report(null, part);
                 ISelection sel = selection;
             	if(!(selection instanceof IStructuredSelection)) {
-					sel = BreakpointToggleUtils.translateToMembers(part, selection);
+					sel = translateToMembers(part, selection);
             	}
             	if(sel instanceof IStructuredSelection) {
                 	IMember member = (IMember) ((IStructuredSelection)sel).getFirstElement();
@@ -339,14 +360,14 @@
                 		type = member.getDeclaringType();
                 	}
 					if (locator == null && BreakpointToggleUtils.isToggleTracepoints()) {
-						CompilationUnit cUnit = BreakpointToggleUtils.parseCompilationUnit(type.getTypeRoot());
+						CompilationUnit cUnit = parseCompilationUnit(type.getTypeRoot());
 						locator = new ValidBreakpointLocationLocator(cUnit, tsel.getStartLine() + 1, true, bestMatch);
 						cUnit.accept(locator);
 					}
                 	String tname = null;
                 	IJavaProject project = type.getJavaProject();
                 	if (locator == null || (project != null && !project.isOnClasspath(type))) {
-						tname = BreakpointToggleUtils.createQualifiedTypeName(type);
+						tname = createQualifiedTypeName(type);
                 	} else {
                 		tname = locator.getFullyQualifiedTypeName();
                 	}
@@ -381,7 +402,7 @@
 					BreakpointUtils.addJavaBreakpointAttributes(attributes, type);
 					IJavaLineBreakpoint breakpoint = JDIDebugModel.createLineBreakpoint(resource, tname, lnumber, charstart, charend, 0, true, attributes);
 					if (BreakpointToggleUtils.isToggleTracepoints() && selection instanceof ITextSelection && part instanceof CompilationUnitEditor) {
-						String pattern = BreakpointToggleUtils.getCodeTemplate((ITextSelection) selection, (CompilationUnitEditor) part);
+						String pattern = getCodeTemplate((ITextSelection) selection, (CompilationUnitEditor) part);
 						if (pattern != null) {
 							pattern.trim();
 							pattern = pattern.replaceAll("\\\t", ""); //$NON-NLS-1$//$NON-NLS-2$
@@ -393,7 +414,7 @@
 						BreakpointToggleUtils.setUnsetTracepoints(false);
 					}
 					if (locator == null) {
-						new BreakpointLocationVerifierJob(document, BreakpointToggleUtils.parseCompilationUnit(type.getTypeRoot()), breakpoint, lnumber, tname, type, editor, bestMatch).schedule();
+						new BreakpointLocationVerifierJob(document, parseCompilationUnit(type.getTypeRoot()), breakpoint, lnumber, tname, type, editor, bestMatch).schedule();
 					}
 					if (BreakpointToggleUtils.isToggleTracepoints()) {
 						BreakpointToggleUtils.setUnsetTracepoints(false);
@@ -429,7 +450,7 @@
 					BreakpointToggleUtils.report(null, part);
                 	ISelection sel = selection;
                 	if(!(selection instanceof IStructuredSelection)) {
-						sel = BreakpointToggleUtils.translateToMembers(part, selection);
+						sel = translateToMembers(part, selection);
                 	}
                 	if(isInterface(sel, part)) {
 						BreakpointToggleUtils.report(ActionMessages.ToggleBreakpointAdapter_1, part);
@@ -500,7 +521,7 @@
     String getQualifiedName(IType type) throws JavaModelException {
     	IJavaProject project = type.getJavaProject();
     	if (project != null && project.isOnClasspath(type) && needsBindings(type)) {
-			CompilationUnit cuNode = BreakpointToggleUtils.parseCompilationUnit(type.getTypeRoot());
+			CompilationUnit cuNode = parseCompilationUnit(type.getTypeRoot());
     		ISourceRange nameRange = type.getNameRange();
     		if (SourceRange.isAvailable(nameRange)) {
 				ASTNode node = NodeFinder.perform(cuNode, nameRange);
@@ -521,7 +542,7 @@
 				}
     		}    		
     	}
-		return BreakpointToggleUtils.createQualifiedTypeName(type);
+		return createQualifiedTypeName(type);
     }
     
     /**
@@ -551,6 +572,76 @@
     	return false;
     }
     
+    /**
+     * Returns the package qualified name, while accounting for the fact that a source file might
+     * not have a project
+     * @param type the type to ensure the package qualified name is created for
+     * @return the package qualified name
+     * @since 3.3
+     */
+    String createQualifiedTypeName(IType type) {
+    	String tname = pruneAnonymous(type);
+    	try {
+    		String packName = null;
+    		if (type.isBinary()) {
+    			packName = type.getPackageFragment().getElementName();
+    		} else {
+    			IPackageDeclaration[] pd = type.getCompilationUnit().getPackageDeclarations();
+				if(pd.length > 0) {
+					packName = pd[0].getElementName();
+				}
+    		}
+			if(packName != null && !packName.equals(EMPTY_STRING)) {
+				tname =  packName+"."+tname; //$NON-NLS-1$
+			}
+    	} 
+    	catch (JavaModelException e) {}
+    	return tname;
+    }
+    
+    /**
+     * Prunes out all naming occurrences of anonymous inner types, since these types have no names
+     * and cannot be derived visiting an AST (no positive type name matching while visiting ASTs)
+     * @param type
+     * @return the compiled type name from the given {@link IType} with all occurrences of anonymous inner types removed
+     * @since 3.4
+     */
+    private String pruneAnonymous(IType type) {
+    	StringBuffer buffer = new StringBuffer();
+    	IJavaElement parent = type;
+    	while(parent != null) {
+    		if(parent.getElementType() == IJavaElement.TYPE){
+    			IType atype = (IType) parent;
+    			try {
+	    			if(!atype.isAnonymous()) {
+	    				if(buffer.length() > 0) {
+	    					buffer.insert(0, '$');
+	    				}
+	    				buffer.insert(0, atype.getElementName());
+	    			}
+    			}
+    			catch(JavaModelException jme) {}
+    		}
+    		parent = parent.getParent();
+    	}
+    	return buffer.toString();
+    }
+    
+    /**
+     * gets the <code>IJavaElement</code> from the editor input
+     * @param input the current editor input
+     * @return the corresponding <code>IJavaElement</code>
+     * @since 3.3
+     */
+    private IJavaElement getJavaElement(IEditorInput input) {
+    	IJavaElement je = JavaUI.getEditorInputJavaElement(input);
+    	if(je != null) {
+    		return je;
+    	}
+    	//try to get from the working copy manager
+    	return DebugWorkingCopyManager.getWorkingCopy(input, false);
+    }
+    
     /*
      * (non-Javadoc)
      * 
@@ -586,7 +677,7 @@
 				return !member.getJavaProject().getProject().exists();
 			}
 		}
-		ITextEditor editor = BreakpointToggleUtils.getTextEditor(part);
+		ITextEditor editor = getTextEditor(part);
     	if (editor != null) {
     		IEditorInput input = editor.getEditorInput();
     		Object adapter = Platform.getAdapterManager().getAdapter(input, "org.eclipse.team.core.history.IFileRevision"); //$NON-NLS-1$
@@ -596,6 +687,21 @@
     }
     
     /**
+     * Returns the text editor associated with the given part or <code>null</code>
+     * if none. In case of a multi-page editor, this method should be used to retrieve
+     * the correct editor to perform the breakpoint operation on.
+     * 
+     * @param part workbench part
+     * @return text editor part or <code>null</code>
+     */
+    protected ITextEditor getTextEditor(IWorkbenchPart part) {
+    	if (part instanceof ITextEditor) {
+    		return (ITextEditor) part;
+    	}
+    	return part.getAdapter(ITextEditor.class);
+    }
+
+    /**
      * Returns the methods from the selection, or an empty array
      * @param selection the selection to get the methods from
      * @return an array of the methods from the selection or an empty array
@@ -659,9 +765,9 @@
      * @return true if the selection is a valid method, false otherwise
      */
 	private boolean isMethod(ITextSelection selection, IWorkbenchPart part) {
-		ITextEditor editor = BreakpointToggleUtils.getTextEditor(part);
+		ITextEditor editor = getTextEditor(part);
 		if (editor != null) {
-			IJavaElement element = BreakpointToggleUtils.getJavaElement(editor.getEditorInput());
+			IJavaElement element = getJavaElement(editor.getEditorInput());
 			if (element != null) {
 				try {
 					if (element instanceof ICompilationUnit) {
@@ -727,7 +833,7 @@
 		try {
 			ISelection sel = selection;
 			if(!(sel instanceof IStructuredSelection)) {
-				sel = BreakpointToggleUtils.translateToMembers(part, selection);
+				sel = translateToMembers(part, selection);
 			}
 			if(sel instanceof IStructuredSelection) {
 				Object obj = ((IStructuredSelection)sel).getFirstElement();
@@ -757,9 +863,9 @@
      * @since 3.3
      */
     private boolean isField(ITextSelection selection, IWorkbenchPart part) {
-		ITextEditor editor = BreakpointToggleUtils.getTextEditor(part);
+		ITextEditor editor = getTextEditor(part);
     	if(editor != null) {
-			IJavaElement element = BreakpointToggleUtils.getJavaElement(editor.getEditorInput());
+			IJavaElement element = getJavaElement(editor.getEditorInput());
     		if(element != null) {
     			try {
 	    			if(element instanceof ICompilationUnit) {
@@ -822,7 +928,7 @@
 					BreakpointToggleUtils.report(null, part);
                     ISelection selection = finalSelection;
                     if(!(selection instanceof IStructuredSelection)) {
-						selection = BreakpointToggleUtils.translateToMembers(part, finalSelection);
+						selection = translateToMembers(part, finalSelection);
                     }
                     if(isInterface(selection, part)) {
 						BreakpointToggleUtils.report(ActionMessages.ToggleBreakpointAdapter_5, part);
@@ -994,8 +1100,8 @@
         types[1] = types[1].replace('.', '$');
         
         String resolvedElementTypeName = Signature.toQualifiedName(types);
-		String resolvedElementTypeSignature = BreakpointToggleUtils.EMPTY_STRING;
-		if (types[0].equals(BreakpointToggleUtils.EMPTY_STRING)) {
+		String resolvedElementTypeSignature = EMPTY_STRING;
+		if (types[0].equals(EMPTY_STRING)) {
         	resolvedElementTypeName = resolvedElementTypeName.substring(1);
         	resolvedElementTypeSignature = Signature.createTypeSignature(resolvedElementTypeName, true);
         }
@@ -1097,7 +1203,26 @@
         return null;
     }
 
+    /**
+     * Returns the compilation unit from the editor
+     * @param editor the editor to get the compilation unit from
+     * @return the compilation unit or <code>null</code>
+     */
+    protected CompilationUnit parseCompilationUnit(ITextEditor editor) {
+        return parseCompilationUnit(getTypeRoot(editor.getEditorInput()));
+    }
 
+    /**
+     * Parses the {@link ITypeRoot}.
+     * @param root the root
+     * @return the parsed {@link CompilationUnit}
+     */
+    CompilationUnit parseCompilationUnit(ITypeRoot root) {
+    	if(root != null) {
+    		return SharedASTProvider.getAST(root, SharedASTProvider.WAIT_YES, null);
+        }
+        return null;
+    }
     
     /*
      * (non-Javadoc)
@@ -1118,6 +1243,76 @@
     }
       
     /**
+     * Returns a selection of the member in the given text selection, or the
+     * original selection if none.
+     * 
+     * @param part
+     * @param selection
+     * @return a structured selection of the member in the given text selection,
+     *         or the original selection if none
+     * @exception CoreException
+     *                if an exception occurs
+     */
+    protected ISelection translateToMembers(IWorkbenchPart part, ISelection selection) throws CoreException {
+    	ITextEditor textEditor = getTextEditor(part);
+        if (textEditor != null && selection instanceof ITextSelection) {
+            ITextSelection textSelection = (ITextSelection) selection;
+            IEditorInput editorInput = textEditor.getEditorInput();
+            IDocumentProvider documentProvider = textEditor.getDocumentProvider();
+            if (documentProvider == null) {
+                throw new CoreException(Status.CANCEL_STATUS);
+            }
+            IDocument document = documentProvider.getDocument(editorInput);
+            int offset = textSelection.getOffset();
+            if (document != null) {
+                try {
+                    IRegion region = document.getLineInformationOfOffset(offset);
+                    int end = region.getOffset() + region.getLength();
+                    while (Character.isWhitespace(document.getChar(offset)) && offset < end) {
+                        offset++;
+                    }
+                } catch (BadLocationException e) {}
+            }
+            IMember m = null;
+            ITypeRoot root = getTypeRoot(editorInput);
+            if(root instanceof ICompilationUnit) {
+                ICompilationUnit unit = (ICompilationUnit) root;
+                synchronized (unit) {
+                    unit.reconcile(ICompilationUnit.NO_AST , false, null, null);
+                }
+            }
+            if(root != null){
+                IJavaElement e = root.getElementAt(offset);
+                if (e instanceof IMember) {
+                    m = (IMember) e;
+                }
+            }
+            if (m != null) {
+                return new StructuredSelection(m);
+            }
+        }
+        return selection;
+    }
+
+    /**
+     * Returns the {@link ITypeRoot} for the given {@link IEditorInput}
+     * @param input
+     * @return the type root or <code>null</code> if one cannot be derived
+	 * @since 3.4
+     */
+    private ITypeRoot getTypeRoot(IEditorInput input) {
+		ITypeRoot root = input.getAdapter(IClassFile.class);
+    	if(root == null) {
+    		 IWorkingCopyManager manager = JavaUI.getWorkingCopyManager();
+             root = manager.getWorkingCopy(input);
+    	}
+    	if(root == null) {
+    		root = DebugWorkingCopyManager.getWorkingCopy(input, false);
+    	}
+    	return root;
+    }
+    
+    /**
      * Return the associated IField (Java model) for the given
      * IJavaFieldVariable (JDI model)
      */
@@ -1149,7 +1344,7 @@
      */
     @Override
 	public void toggleBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
-		ISelection sel = BreakpointToggleUtils.translateToMembers(part, selection);
+		ISelection sel = translateToMembers(part, selection);
     	if(sel instanceof IStructuredSelection) {
     		IMember member = (IMember) ((IStructuredSelection)sel).getFirstElement();
     		int mtype = member.getElementType();
@@ -1169,13 +1364,18 @@
 						}
     					return;
     				}
-					CompilationUnit unit = BreakpointToggleUtils.parseCompilationUnit(BreakpointToggleUtils.getTextEditor(part));
+					CompilationUnit unit = parseCompilationUnit(getTextEditor(part));
         			ValidBreakpointLocationLocator loc = new ValidBreakpointLocationLocator(unit, ts.getStartLine()+1, true, true);
         			unit.accept(loc);
         			if(loc.getLocationType() == ValidBreakpointLocationLocator.LOCATION_METHOD) {
 						toggleMethodBreakpoints(part, ts);
         			}
         			else if(loc.getLocationType() == ValidBreakpointLocationLocator.LOCATION_FIELD) {
+						if (BreakpointToggleUtils.isToggleTracepoints()) {
+							BreakpointToggleUtils.report(ActionMessages.TracepointToggleAction_Unavailable, part);
+							BreakpointToggleUtils.setUnsetTracepoints(false);
+							return;
+						}
         				toggleWatchpoints(part, ts);
         			}
         			else if(loc.getLocationType() == ValidBreakpointLocationLocator.LOCATION_LINE) {
@@ -1184,6 +1384,11 @@
     			} 
     		}
     		else if(member.getElementType() == IJavaElement.TYPE) {
+				if (BreakpointToggleUtils.isToggleTracepoints()) {
+					BreakpointToggleUtils.report(ActionMessages.TracepointToggleAction_Unavailable, part);
+					BreakpointToggleUtils.setUnsetTracepoints(false);
+					return;
+				}
     			toggleClassBreakpoints(part, sel);
     		}
     		else {
@@ -1294,7 +1499,7 @@
 	public void toggleBreakpointsWithEvent(IWorkbenchPart part, ISelection selection, Event event) throws CoreException {
 		if(event != null) {
 			if((event.stateMask & SWT.MOD2) > 0) {
-				ITextEditor editor = BreakpointToggleUtils.getTextEditor(part);
+				ITextEditor editor = getTextEditor(part);
 				if(editor != null) {
 					IVerticalRulerInfo info = editor.getAdapter(IVerticalRulerInfo.class);
 					if(info != null) {
@@ -1307,7 +1512,7 @@
 				}
 			}
 			else if((event.stateMask & SWT.MOD1) > 0) {
-				ITextEditor editor = BreakpointToggleUtils.getTextEditor(part);
+				ITextEditor editor = getTextEditor(part);
 				if(editor != null) {
 					IVerticalRulerInfo info = editor.getAdapter(IVerticalRulerInfo.class);
 					if(info != null) {
@@ -1335,4 +1540,64 @@
 	public boolean canToggleBreakpointsWithEvent(IWorkbenchPart part, ISelection selection, Event event) {
 		return canToggleBreakpoints(part, selection);
 	}
+
+	/**
+	 * Returns the {@link ITypeRoot} for the given {@link IEditorInput}
+	 * 
+	 * @param input
+	 * @return the type root or <code>null</code> if one cannot be derived
+	 * @since 3.8
+	 */
+	private String getCodeTemplate(ITextSelection textSelection, CompilationUnitEditor part) {
+		TemplateContextType contextType = JavaPlugin.getDefault().getTemplateContextRegistry().getContextType(JavaContextType.ID_STATEMENTS);
+		TemplateEngine fStatementEngine = new TemplateEngine(contextType);
+		fStatementEngine.reset();
+		ITextViewer viewer = part.getViewer();
+		final String[] fTemplateBuffer = new String[1];
+		fTemplateBuffer[0] = null;
+		if (viewer != null) {
+			Display.getDefault().syncExec(new Runnable() {
+				@Override
+				public void run() {
+					ITextEditor editor = getTextEditor(part);
+					if (editor != null) {
+						IJavaElement element = getJavaElement(editor.getEditorInput());
+						ICompilationUnit cunit = null;
+						IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+						IFile file = root.getFile(element.getPath());
+						cunit = JavaCore.createCompilationUnitFrom(file);
+						IDocumentProvider documentProvider = editor.getDocumentProvider();
+						if (documentProvider == null) {
+							return;
+						}
+						IDocument document = documentProvider.getDocument(editor.getEditorInput());
+						try {
+							IRegion line = document.getLineInformation(textSelection.getStartLine() + 1);
+							Point selectedRange = viewer.getSelectedRange();
+							viewer.setSelectedRange(selectedRange.x, 0);
+							fStatementEngine.complete(viewer, line.getOffset(), cunit);
+							viewer.setSelectedRange(selectedRange.x, selectedRange.y);
+							TemplateProposal[] templateProposals = fStatementEngine.getResults();
+							for (TemplateProposal templateProposal : templateProposals) {
+								Template template = templateProposal.getTemplate();
+								if (template.getName().equals("systrace")) { //$NON-NLS-1$
+									CompilationUnitContextType contextType = (CompilationUnitContextType) JavaPlugin.getDefault().getTemplateContextRegistry().getContextType(template.getContextTypeId());
+									CompilationUnitContext context = contextType.createContext(document, line.getOffset(), 0, cunit);
+									context.setVariable("selection", EMPTY_STRING); //$NON-NLS-1$
+									context.setForceEvaluation(true);
+									fTemplateBuffer[0] = context.evaluate(template).getString();
+									return;
+								}
+							}
+						}
+						catch (BadLocationException | TemplateException e) {
+							// ignore
+						}
+					}
+				}
+			});
+		}
+		return fTemplateBuffer[0];
+	}
+
 }
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/WatchpointDetailPane.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/WatchpointDetailPane.java
index a84eac2..12e1713 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/WatchpointDetailPane.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/WatchpointDetailPane.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- *  Copyright (c) 2009, 2016 IBM Corporation and others.
+ *  Copyright (c) 2009, 2017 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
@@ -10,6 +10,7 @@
  *******************************************************************************/
 package org.eclipse.jdt.internal.debug.ui.breakpoints;
 
+import org.eclipse.jdt.debug.ui.breakpoints.JavaBreakpointConditionEditor;
 import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin;
 import org.eclipse.swt.widgets.Composite;
 
@@ -32,7 +33,8 @@
 				StandardJavaBreakpointEditor.PROP_SUSPEND_POLICY,
 				StandardJavaBreakpointEditor.PROP_TRIGGER_POINT,
 				WatchpointEditor.PROP_ACCESS,
-				WatchpointEditor.PROP_MODIFICATION
+				WatchpointEditor.PROP_MODIFICATION, JavaBreakpointConditionEditor.PROP_CONDITION_ENABLED,
+				JavaBreakpointConditionEditor.PROP_CONDITION_SUSPEND_POLICY
 		});
 	}
 	
@@ -41,7 +43,7 @@
 	 */
 	@Override
 	protected AbstractJavaBreakpointEditor createEditor(Composite parent) {
-		return new WatchpointEditor();
+		return new CompositeBreakpointEditor(new AbstractJavaBreakpointEditor[] { new WatchpointEditor(), new JavaBreakpointConditionEditor(null) });
 	}
 
 }
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/contentassist/CurrentFrameContext.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/contentassist/CurrentFrameContext.java
index dfe8a1b..c324eeb 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/contentassist/CurrentFrameContext.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/contentassist/CurrentFrameContext.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2005, 2015 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 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
@@ -19,6 +19,8 @@
 import org.eclipse.jdt.debug.core.IJavaStackFrame;
 import org.eclipse.jdt.debug.core.IJavaVariable;
 import org.eclipse.jdt.internal.debug.core.JavaDebugUtils;
+import org.eclipse.jdt.internal.debug.core.logicalstructures.JDIReturnValueVariable;
+import org.eclipse.jdt.internal.debug.core.model.JDIThisVariable;
 
 
 /**
@@ -60,9 +62,9 @@
         if (frame != null) {
             IVariable[] variables = frame.getVariables();
             int index = 0;
-            if (!frame.isStatic()) {
-                index = 1;
-            }
+			while (index < variables.length && (variables[index] instanceof JDIThisVariable || variables[index] instanceof JDIReturnValueVariable)) {
+				index++;
+			}
             String[][] locals = new String[2][variables.length - index];
             for (int i = 0; i < locals[0].length; i++) {
                 IJavaVariable var = (IJavaVariable) variables[index];
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/propertypages/JavaBreakpointPage.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/propertypages/JavaBreakpointPage.java
index 6942df7..7cb94d6 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/propertypages/JavaBreakpointPage.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/propertypages/JavaBreakpointPage.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 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
@@ -333,7 +333,8 @@
 			fEditor = new ExceptionBreakpointEditor();
 		} else if (JavaWatchpoint.JAVA_WATCHPOINT.equals(type)) {
 			setTitle(PropertyPageMessages.JavaLineBreakpointPage_19);
-			fEditor = new WatchpointEditor();
+				fEditor = new CompositeBreakpointEditor(new AbstractJavaBreakpointEditor[] { new WatchpointEditor(),
+						new JavaBreakpointConditionEditor(null) });
 		} else if (JavaMethodBreakpoint.JAVA_METHOD_BREAKPOINT.equals(type)) {
 			setTitle(PropertyPageMessages.JavaLineBreakpointPage_20);
 			fEditor = new CompositeBreakpointEditor(new AbstractJavaBreakpointEditor[] 
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/EvaluationSourceGenerator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/EvaluationSourceGenerator.java
index aabe54b..212cec5 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/EvaluationSourceGenerator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/EvaluationSourceGenerator.java
@@ -227,8 +227,7 @@
 			}
 		}
 		catch (InvalidInputException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
+			// ignore
 		}
 		
 		return true;
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/ArrayAccess.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/ArrayAccess.java
index b27cb48..7e78e6b 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/ArrayAccess.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/ArrayAccess.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 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
@@ -62,7 +62,13 @@
 	 *             if not available
 	 */
 	protected IJavaArray popArray() throws CoreException {
-		IJavaValue value = popValue();
+		Object popValue = popValue();
+		if (! (popValue instanceof IJavaValue)) {
+			throw new CoreException(new Status(IStatus.ERROR,
+					JDIDebugPlugin.getUniqueIdentifier(), IStatus.OK,
+					"Internal error: attempt to access non-java object", null)); //$NON-NLS-1$
+		}
+		IJavaValue value = (IJavaValue) popValue;
 		if (value instanceof IJavaArray) {
 			return (IJavaArray) value;
 		} else if (value.isNull()) {
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/ArrayInitializerInstruction.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/ArrayInitializerInstruction.java
index 95aff73..e812e51 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/ArrayInitializerInstruction.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/ArrayInitializerInstruction.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 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
@@ -13,6 +13,7 @@
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.jdt.debug.core.IJavaArray;
 import org.eclipse.jdt.debug.core.IJavaArrayType;
+import org.eclipse.jdt.debug.core.IJavaValue;
 
 public class ArrayInitializerInstruction extends ArrayInstruction {
 
@@ -46,7 +47,10 @@
 		IJavaArray array = arrayType.newInstance(fLength);
 
 		for (int i = fLength - 1; i >= 0; i--) {
-			array.setValue(i, popValue());
+			Object popValue = popValue();
+			if (popValue instanceof IJavaValue) {
+				array.setValue(i, (IJavaValue) popValue);
+			}
 		}
 
 		push(array);
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/AssignmentOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/AssignmentOperator.java
index 1a31a57..9b7f06e 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/AssignmentOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/AssignmentOperator.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 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
@@ -31,7 +31,10 @@
 	 */
 	@Override
 	public void execute() throws CoreException {
-		IJavaValue value = popValue();
+		Object popValue = popValue();
+		if (!(popValue instanceof IJavaValue))
+			return;
+		IJavaValue value = (IJavaValue) popValue;
 		IJavaVariable variable = (IJavaVariable) pop();
 
 		if (value instanceof IJavaPrimitiveValue) {
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/BinaryOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/BinaryOperator.java
index 1e70cee..70151a6 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/BinaryOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/BinaryOperator.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 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
@@ -42,7 +42,10 @@
 	}
 
 	private void executeAssignment() throws CoreException {
-		IJavaValue value = popValue();
+		Object popValue = popValue();
+		if (!(popValue instanceof IJavaValue))
+			return;
+		IJavaValue value = (IJavaValue) popValue;
 		IJavaVariable variable = (IJavaVariable) pop();
 		IJavaValue variableValue = (IJavaValue) variable.getValue();
 
@@ -80,8 +83,11 @@
 	}
 
 	private void executeBinary() throws CoreException {
-		IJavaValue right = popValue();
-		IJavaValue left = popValue();
+		Object popValue = popValue();
+		if (!(popValue instanceof IJavaValue))
+			return;
+		IJavaValue right = (IJavaValue) popValue;
+		IJavaValue left = (IJavaValue) popValue();
 
 		switch (fResultTypeId) {
 		case T_String:
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/Cast.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/Cast.java
index c3193df..3007ad7 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/Cast.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/Cast.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 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
@@ -56,7 +56,10 @@
 	 */
 	@Override
 	public void execute() throws CoreException {
-		IJavaValue value = popValue();
+		Object popValue = popValue();
+		if (!(popValue instanceof IJavaValue))
+			return;
+		IJavaValue value = (IJavaValue) popValue;
 
 		if (value instanceof IJavaPrimitiveValue) {
 			IJavaPrimitiveValue primitiveValue = (IJavaPrimitiveValue) value;
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/ConditionalJump.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/ConditionalJump.java
index 5bca4ff..c28b839 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/ConditionalJump.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/ConditionalJump.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2014 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 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
@@ -28,7 +28,10 @@
 	 */
 	@Override
 	public void execute() throws CoreException {
-		IJavaValue conditionValue = popValue();
+		Object popValue = popValue();
+		if (!(popValue instanceof IJavaValue))
+			return;
+		IJavaValue conditionValue = (IJavaValue) popValue;
 		IJavaPrimitiveValue condition = null;
 		if (conditionValue instanceof IJavaPrimitiveValue) {
 			condition = (IJavaPrimitiveValue) conditionValue;
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/Constructor.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/Constructor.java
index 92a07d3..72f4911 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/Constructor.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/Constructor.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 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
@@ -34,7 +34,10 @@
 		IJavaValue[] args = new IJavaValue[fArgCount];
 		// args are in reverse order
 		for (int i = fArgCount - 1; i >= 0; i--) {
-			args[i] = popValue();
+			Object popValue = popValue();
+			if (popValue instanceof IJavaValue) {
+				args[i] = (IJavaValue) popValue;
+			}
 		}
 		IJavaClassType clazz = (IJavaClassType) pop();
 		IJavaValue result = clazz.newInstance(fSignature, args, getContext()
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/InstanceOfOperator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/InstanceOfOperator.java
index 4697334..f4f04b4 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/InstanceOfOperator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/InstanceOfOperator.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 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
@@ -34,7 +34,10 @@
 	@Override
 	public void execute() throws CoreException {
 		IJavaType type = (IJavaType) pop();
-		IJavaValue value = popValue();
+		Object popValue = popValue();
+		if (!(popValue instanceof IJavaValue))
+			return;
+		IJavaValue value = (IJavaValue) popValue;
 		if (value instanceof JDINullValue) {
 			pushNewValue(false);
 			return;
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/Instruction.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/Instruction.java
index 3b48d11..9a9011c 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/Instruction.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/Instruction.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 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
@@ -105,12 +105,12 @@
 		return fInterpreter.pop();
 	}
 
-	protected IJavaValue popValue() throws CoreException {
+	protected Object popValue() throws CoreException {
 		Object element = fInterpreter.pop();
 		if (element instanceof IJavaVariable) {
-			return (IJavaValue) ((IJavaVariable) element).getValue();
+			return ((IJavaVariable) element).getValue();
 		}
-		return (IJavaValue) element;
+		return  element;
 	}
 
 	protected void pushNewValue(boolean value) {
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/LocalVariableCreation.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/LocalVariableCreation.java
index 04249e1..e12c865 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/LocalVariableCreation.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/LocalVariableCreation.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 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
@@ -11,6 +11,7 @@
 package org.eclipse.jdt.internal.debug.eval.ast.instructions;
 
 import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.model.IValue;
 import org.eclipse.debug.core.model.IVariable;
 import org.eclipse.jdi.internal.PrimitiveTypeImpl;
 import org.eclipse.jdi.internal.VirtualMachineImpl;
@@ -103,7 +104,9 @@
 		}
 		IVariable var = createInternalVariable(fName, type);
 		if (fHasInitializer) {
-			var.setValue(popValue());
+			Object value = popValue();
+			if (value instanceof IValue)
+				var.setValue((IValue) value);
 		}
 	}
 
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushFieldVariable.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushFieldVariable.java
index 2053618..ea7764f 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushFieldVariable.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushFieldVariable.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 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
@@ -17,6 +17,7 @@
 import org.eclipse.jdt.debug.core.IJavaObject;
 import org.eclipse.jdt.debug.core.IJavaVariable;
 import org.eclipse.jdt.internal.debug.core.JDIDebugPlugin;
+import org.eclipse.jdt.internal.debug.core.model.JDIClassType;
 import org.eclipse.jdt.internal.debug.core.model.JDINullValue;
 import org.eclipse.jdt.internal.debug.core.model.JDIObjectValue;
 import org.eclipse.jdt.internal.debug.eval.ast.engine.IRuntimeContext;
@@ -55,15 +56,17 @@
 					JDIDebugPlugin.getUniqueIdentifier(), IStatus.OK,
 					InstructionsEvaluationMessages.PushFieldVariable_0, null));
 		}
-		IJavaObject receiver = (IJavaObject) value;
-
 		IJavaVariable field = null;
-
-		if (fDeclaringTypeSignature == null) {
-			field = ((JDIObjectValue) receiver).getField(fName,
-					fSuperClassLevel);
-		} else {
-			field = receiver.getField(fName, fDeclaringTypeSignature);
+		if (value instanceof JDIClassType ) {
+			field = ((JDIClassType) value).getField(fName);
+		} else if (value instanceof IJavaObject){
+			IJavaObject receiver = (IJavaObject) value;
+			if (fDeclaringTypeSignature == null) {
+				field = ((JDIObjectValue) receiver).getField(fName,
+						fSuperClassLevel);
+			} else {
+				field = receiver.getField(fName, fDeclaringTypeSignature);
+			}
 		}
 
 		if (field == null) {
@@ -88,7 +91,7 @@
 							IStatus.OK,
 							NLS.bind(InstructionsEvaluationMessages.PushFieldVariable_Cannot_find_the_field__0__for_the_object__1__1,
 											new String[] { fName,
-													receiver.toString() }),
+													value.toString() }),
 							null)); //
 		}
 		push(field);
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/SendMessage.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/SendMessage.java
index 02811f9..cbcd065 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/SendMessage.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/SendMessage.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 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
@@ -44,7 +44,9 @@
 		IJavaValue[] args = new IJavaValue[fArgCount];
 		// args are in reverse order
 		for (int i = fArgCount - 1; i >= 0; i--) {
-			args[i] = popValue();
+			Object popValue = popValue();
+			if ((popValue instanceof IJavaValue))
+				args[i] = (IJavaValue) popValue;
 		}
 		Object receiver = pop();
 		IJavaValue result = null;
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/SendStaticMessage.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/SendStaticMessage.java
index 75925f7..a26c735 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/SendStaticMessage.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/SendStaticMessage.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 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
@@ -46,7 +46,9 @@
 		IJavaValue[] args = new IJavaValue[fArgCount];
 		// args are in reverse order
 		for (int i = fArgCount - 1; i >= 0; i--) {
-			args[i] = popValue();
+			Object popValue = popValue();
+			if ((popValue instanceof IJavaValue))
+				args[i] = (IJavaValue) popValue;
 		}
 
 		IJavaType receiver = getType(fTypeName);
diff --git a/org.eclipse.jdt.debug/jdi/org/eclipse/jdi/internal/connect/ConnectMessages.properties b/org.eclipse.jdt.debug/jdi/org/eclipse/jdi/internal/connect/ConnectMessages.properties
index d09cc7d..a10c8bd 100644
--- a/org.eclipse.jdt.debug/jdi/org/eclipse/jdi/internal/connect/ConnectMessages.properties
+++ b/org.eclipse.jdt.debug/jdi/org/eclipse/jdi/internal/connect/ConnectMessages.properties
@@ -1,5 +1,5 @@
 ###############################################################################
-# Copyright (c) 2000, 2017 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
@@ -14,9 +14,9 @@
 PacketReceiveManager_Got_IOException_from_Virtual_Machine_2=Got IOException from Virtual Machine
 PacketSendManager_Got_IOException_from_Virtual_Machine_1=Got IOException from Virtual Machine
 SocketAttachingConnectorImpl_Machine_name_to_which_to_attach_for_VM_connections_1=Machine name to which to attach for VM connections
-SocketAttachingConnectorImpl_Host_2=&Host:
+SocketAttachingConnectorImpl_Host_2=Host:
 SocketAttachingConnectorImpl_Port_number_to_which_to_attach_for_VM_connections_3=Port number to which to attach for VM connections
-SocketAttachingConnectorImpl_Port_4=Po&rt:
+SocketAttachingConnectorImpl_Port_4=Port:
 SocketAttachingConnectorImpl_1=Connection Timeout
 SocketAttachingConnectorImpl_2=Connection Timeout:
 SocketAttachingConnectorImpl_Attaches_by_socket_to_other_VMs_5=Attaches by socket to other VMs
@@ -40,14 +40,14 @@
 SocketLaunchingConnectorImpl_Necessary_connection_argument_is_null_15=Necessary connection argument is null
 SocketLaunchingConnectorImpl_Connection_argument_is_not_a_number_16=Connection argument is not a number
 SocketListeningConnectorImpl_Port_number_at_which_to_listen_for_VM_connections_1=Port number at which to listen for VM connections
-SocketListeningConnectorImpl_Port_2=Po&rt:
+SocketListeningConnectorImpl_Port_2=Port:
 SocketListeningConnectorImpl_Timeout_before_accept_returns_3=Timeout before accept returns
 SocketListeningConnectorImpl_Timeout_4=Timeout:
 SocketListeningConnectorImpl_Accepts_socket_connections_initiated_by_other_VMs_5=Accepts socket connections initiated by other VMs
 SocketListeningConnectorImpl_Connection_argument_is_not_of_the_right_type_6=Connection argument is not of the right type
 SocketListeningConnectorImpl_Necessary_connection_argument_is_null_7=Necessary connection argument is null
 SocketListeningConnectorImpl_Connection_argument_is_not_a_number_8=Connection argument is not a number
-SocketListeningConnectorImpl_Limit=Connection &limit:
+SocketListeningConnectorImpl_Limit=Connection limit:
 SocketListeningConnectorImpl_Limit_incoming_connections=Limit incoming connections (0 = no limit)
 SocketListeningConnectorImpl_ListeningConnector_Socket_Port=ListeningConnector Socket Port=
 SocketRawLaunchingConnectorImpl_Raw_command_to_start_the_debugged_application_VM_1=Raw command to start the debugged application VM
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaExceptionBreakpoint.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaExceptionBreakpoint.java
index 1bf05be..5a4ff4a 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaExceptionBreakpoint.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaExceptionBreakpoint.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 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
@@ -23,6 +23,7 @@
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.DebugPlugin;
 import org.eclipse.debug.core.model.IBreakpoint;
 import org.eclipse.jdt.debug.core.IJavaDebugTarget;
 import org.eclipse.jdt.debug.core.IJavaExceptionBreakpoint;
@@ -369,28 +370,44 @@
 			}
 			setExceptionName(name);
 			disableTriggerPoint(event);
-			if (getExclusionClassFilters().length >= 1
-					|| getInclusionClassFilters().length >= 1
-					|| filtersIncludeDefaultPackage(fInclusionClassFilters)
-					|| filtersIncludeDefaultPackage(fExclusionClassFilters)) {
-				Location location = ((ExceptionEvent) event).location();
-				String typeName = location.declaringType().name();
-				boolean defaultPackage = typeName.indexOf('.') == -1;
-				boolean included = true;
-				String[] filters = getInclusionClassFilters();
-				if (filters.length > 0) {
-					included = matchesFilters(filters, typeName, defaultPackage);
+			IBreakpoint[] allBreakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints();
+			for (IBreakpoint iBreakpoint : allBreakpoints) {
+				if (iBreakpoint instanceof JavaExceptionBreakpoint) {
+					JavaExceptionBreakpoint jExceptionBreakpoint = (JavaExceptionBreakpoint)iBreakpoint;
+					try {
+						//This Java Exception breakpoint is the  breakpoint created for catching compilation and Uncaught exception in JavaDebugOptionsManagaer initialization
+						// This does not have scope defined
+						if (jExceptionBreakpoint.getTypeName().equals(name)) {
+							if (jExceptionBreakpoint.getExclusionClassFilters().length >= 1
+						|| jExceptionBreakpoint.getInclusionClassFilters().length >= 1
+						|| filtersIncludeDefaultPackage(jExceptionBreakpoint.fInclusionClassFilters)
+						|| filtersIncludeDefaultPackage(jExceptionBreakpoint.fExclusionClassFilters)) {
+							Location location = ((ExceptionEvent) event).location();
+							String typeName = location.declaringType().name();
+							boolean defaultPackage = typeName.indexOf('.') == -1;
+							boolean included = true;
+							String[] filters = jExceptionBreakpoint.getInclusionClassFilters();
+							if (filters.length > 0) {
+								included = matchesFilters(filters, typeName, defaultPackage);
+							}
+							boolean excluded = false;
+							filters = jExceptionBreakpoint.getExclusionClassFilters();
+							if (filters.length > 0) {
+								excluded = matchesFilters(filters, typeName, defaultPackage);
+							}
+							if (included && !excluded) {
+								return !suspend(thread, suspendVote);
+							}
+							return true;
+							}
+						}
+					}
+					catch (CoreException e) {
+						e.printStackTrace();
+					}
 				}
-				boolean excluded = false;
-				filters = getExclusionClassFilters();
-				if (filters.length > 0) {
-					excluded = matchesFilters(filters, typeName, defaultPackage);
-				}
-				if (included && !excluded) {
-					return !suspend(thread, suspendVote);
-				}
-				return true;
 			}
+			
 			return !suspend(thread, suspendVote);
 		}
 		return true;
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaWatchpoint.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaWatchpoint.java
index f30dc80..56bc2bd 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaWatchpoint.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaWatchpoint.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 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
@@ -529,7 +529,7 @@
 	 */
 	@Override
 	public boolean supportsCondition() {
-		return false;
+		return true;
 	}
 
 	/**
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIThread.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIThread.java
index 19216a9..ea1d2fd 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIThread.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIThread.java
@@ -2563,7 +2563,7 @@
 							}
 							catch (IncompatibleThreadStateException e) {
 								// cannot not happen because of the enclosing isSuspended() check.
-								e.printStackTrace();
+								logError(e);
 							}
 						}
 					}