Bug 526815 - Installed JREs "Search..." button does not allow to select
directory to search JREs

Change-Id: I87b5a24e2891427d54cfcae23dc06dd3fee658ad
(cherry picked from commit 3a53a2cdeb112a49f2e09329b14ed83709705810)
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/jres/InstalledJREsBlock.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/jres/InstalledJREsBlock.java
index 8929723..afad9ef 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/jres/InstalledJREsBlock.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/jres/InstalledJREsBlock.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
@@ -19,15 +19,11 @@
 import java.util.List;
 import java.util.Set;
 
-import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.ListenerList;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.SubMonitor;
 import org.eclipse.debug.internal.ui.SWTFactory;
 import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin;
-import org.eclipse.jdt.internal.launching.MacInstalledJREs;
 import org.eclipse.jdt.launching.AbstractVMInstall;
 import org.eclipse.jdt.launching.AbstractVMInstallType;
 import org.eclipse.jdt.launching.IVMInstall;
@@ -848,10 +844,6 @@
 	 * Search for installed VMs in the file system
 	 */
 	protected void search() {
-		if (Platform.OS_MACOSX.equals(Platform.getOS())) {
-			doMacSearch();
-			return;
-		}
 		// choose a root directory for the search
 		DirectoryDialog dialog = new DirectoryDialog(getShell());
 		dialog.setMessage(JREMessages.InstalledJREsBlock_9);
@@ -934,50 +926,6 @@
 		}
 	}
 
-	/**
-	 * Calls out to {@link MacVMSearch} to find all installed JREs in the standard
-	 * Mac OS location
-	 */
-	private void doMacSearch() {
-		final List<VMStandin> added = new ArrayList<>();
-		IRunnableWithProgress r = new IRunnableWithProgress() {
-			@Override
-			public void run(IProgressMonitor monitor) throws InvocationTargetException {
-				Set<String> exists = new HashSet<>();
-				for (IVMInstall vm : fVMs) {
-					exists.add(vm.getId());
-				}
-				SubMonitor localmonitor = SubMonitor.convert(monitor, JREMessages.MacVMSearch_0, 5);
-				VMStandin[] standins = null;
-				try {
-					standins = MacInstalledJREs.getInstalledJREs(localmonitor);
-					for (int i = 0; i < standins.length; i++) {
-						if (!exists.contains(standins[i].getId())) {
-							added.add(standins[i]);
-						}
-					}
-				}
-				catch(CoreException ce) {
-					JDIDebugUIPlugin.log(ce);
-				}
-				monitor.done();
-			}
-		};
-
-		try {
-            ProgressMonitorDialog progress = new ProgressMonitorDialog(getShell());
-            progress.run(true, true, r);
-		} catch (InvocationTargetException e) {
-			JDIDebugUIPlugin.log(e);
-		} catch (InterruptedException e) {
-			// canceled
-			return;
-		}
-		for(VMStandin vm: added) {
-			vmAdded(vm);
-		}
-	}
-
 	protected Shell getShell() {
 		return getControl().getShell();
 	}