harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r451266 [1/2] - in /incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching: ./ src/org/apache/harmony/eclipse/jdt/launching/
Date Fri, 29 Sep 2006 12:45:09 GMT
Author: hindessm
Date: Fri Sep 29 05:45:08 2006
New Revision: 451266

URL: http://svn.apache.org/viewvc?view=rev&rev=451266
Log:
Fixed eol style so that I the re-licensing script can work.

Modified:
    incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching/.options   (contents, props changed)
    incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching/src/org/apache/harmony/eclipse/jdt/launching/HyDebugVMRunner.java   (contents, props changed)
    incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching/src/org/apache/harmony/eclipse/jdt/launching/HyLauncherMessages.java   (contents, props changed)
    incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching/src/org/apache/harmony/eclipse/jdt/launching/HyLauncherMessages.properties   (contents, props changed)
    incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching/src/org/apache/harmony/eclipse/jdt/launching/HyLaunchingPlugin.java   (contents, props changed)
    incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching/src/org/apache/harmony/eclipse/jdt/launching/HyVMInstall.java   (contents, props changed)
    incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching/src/org/apache/harmony/eclipse/jdt/launching/HyVMInstallType.java   (contents, props changed)
    incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching/src/org/apache/harmony/eclipse/jdt/launching/HyVMRunner.java   (contents, props changed)
    incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching/src/org/apache/harmony/eclipse/jdt/launching/JavaVMRunner.java   (contents, props changed)

Modified: incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching/.options
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching/.options?view=diff&rev=451266&r1=451265&r2=451266
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching/.options (original)
+++ incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching/.options Fri Sep 29 05:45:08 2006
@@ -1,28 +1,28 @@
-# Copyright 2005 The Apache Software Foundation or its licensors, as applicable
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-# 
-#     http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# Debugging options for the org.apache.harmony.eclipse.jdt.launching plugin.
-
-# Turn on debugging for the plugin.
-org.apache.harmony.eclipse.jdt.launching/debug=true
-
-# Monitor start and stop of the plugin
-org.apache.harmony.eclipse.jdt.launching/plugin=true
-
-# Monitor installations of Harmony VMs
-org.apache.harmony.eclipse.jdt.launching/vm/installing=true
-
-# Monitor launching of applications on Harmony VMs
-org.apache.harmony.eclipse.jdt.launching/application/launching=true
+# Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+#     http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Debugging options for the org.apache.harmony.eclipse.jdt.launching plugin.
+
+# Turn on debugging for the plugin.
+org.apache.harmony.eclipse.jdt.launching/debug=true
+
+# Monitor start and stop of the plugin
+org.apache.harmony.eclipse.jdt.launching/plugin=true
+
+# Monitor installations of Harmony VMs
+org.apache.harmony.eclipse.jdt.launching/vm/installing=true
+
+# Monitor launching of applications on Harmony VMs
+org.apache.harmony.eclipse.jdt.launching/application/launching=true

Propchange: incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching/.options
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching/src/org/apache/harmony/eclipse/jdt/launching/HyDebugVMRunner.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching/src/org/apache/harmony/eclipse/jdt/launching/HyDebugVMRunner.java?view=diff&rev=451266&r1=451265&r2=451266
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching/src/org/apache/harmony/eclipse/jdt/launching/HyDebugVMRunner.java (original)
+++ incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching/src/org/apache/harmony/eclipse/jdt/launching/HyDebugVMRunner.java Fri Sep 29 05:45:08 2006
@@ -1,367 +1,367 @@
-/* Copyright 2000, 2005 The Apache Software Foundation or its licensors, as applicable
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.harmony.eclipse.jdt.launching;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InterruptedIOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.IStatusHandler;
-import org.eclipse.debug.core.model.IProcess;
-import org.eclipse.debug.core.model.IStreamsProxy;
-import org.eclipse.jdi.Bootstrap;
-import org.eclipse.jdt.debug.core.JDIDebugModel;
-import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
-import org.eclipse.jdt.launching.IVMInstall;
-import org.eclipse.jdt.launching.JavaRuntime;
-import org.eclipse.jdt.launching.SocketUtil;
-import org.eclipse.jdt.launching.VMRunnerConfiguration;
-
-import com.sun.jdi.VirtualMachine;
-import com.sun.jdi.connect.Connector;
-import com.sun.jdi.connect.IllegalConnectorArgumentsException;
-import com.sun.jdi.connect.ListeningConnector;
-
-/**
- * Used to attach to a VM in a separate thread, to allow for cancellation and
- * detect that the associated System process died before the connect occurred.
- */
-class ConnectRunnable implements Runnable {
-
-	private VirtualMachine virtualMachine = null;
-
-	private ListeningConnector connector = null;
-
-	private Map connectionMap = null;
-
-	private Exception exception = null;
-
-	/**
-	 * Constructs a runnable to connect to a VM via the given connector with the
-	 * given connection arguments.
-	 * 
-	 * @param connector
-	 *            the VM connector.
-	 * @param map
-	 *            the map of arguments
-	 */
-	public ConnectRunnable(ListeningConnector connector, Map map) {
-		this.connector = connector;
-		this.connectionMap = map;
-	}
-
-	public void run() {
-		try {
-			virtualMachine = connector.accept(connectionMap);
-		} catch (IOException e) {
-			exception = e;
-		} catch (IllegalConnectorArgumentsException e) {
-			exception = e;
-		}
-	}
-
-	/**
-	 * Returns the VM that was attached to, or <code>null</code> if none.
-	 * 
-	 * @return the VM that was attached to, or <code>null</code> if none
-	 */
-	public VirtualMachine getVirtualMachine() {
-		return virtualMachine;
-	}
-
-	/**
-	 * Returns any exception that occurred while attaching, or <code>null</code>.
-	 * 
-	 * @return IOException or IllegalConnectorArgumentsException
-	 */
-	public Exception getException() {
-		return exception;
-	}
-}
-
-public class HyDebugVMRunner extends HyVMRunner {
-
-	public HyDebugVMRunner(IVMInstall vmInstance) {
-		super(vmInstance);
-	}
-
-	protected void checkErrorMessage(IProcess process) throws CoreException {
-		IStreamsProxy streamsProxy = process.getStreamsProxy();
-		if (streamsProxy != null) {
-			String errorMessage = streamsProxy.getErrorStreamMonitor()
-					.getContents();
-			if (errorMessage.length() == 0) {
-				errorMessage = streamsProxy.getOutputStreamMonitor()
-						.getContents();
-			}
-			if (errorMessage.length() != 0) {
-				abort(errorMessage, null,
-						IJavaLaunchConfigurationConstants.ERR_VM_LAUNCH_ERROR);
-			}
-		}
-	}
-
-	/**
-	 * @see org.eclipse.jdt.launching.IVMRunner#run(VMRunnerConfiguration,
-	 *      ILaunch, IProgressMonitor)
-	 */
-	public void run(VMRunnerConfiguration config, ILaunch launch,
-			IProgressMonitor monitor) throws CoreException {
-
-		if (monitor == null) {
-			monitor = new NullProgressMonitor();
-		}
-
-		IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1);
-		subMonitor
-				.beginTask(
-						HyLauncherMessages
-								.getString("HyDebugVMRunner.Launching_virtual_machine..._1"), 5); //$NON-NLS-1$
-		subMonitor.subTask(HyLauncherMessages
-				.getString("HyDebugVMRunner.Finding_free_socket..._2")); //$NON-NLS-1$
-
-		int port = SocketUtil.findFreePort();
-		if (port == -1) {
-			abort(
-					HyLauncherMessages
-							.getString("HyDebugVMRunner.Could_not_find_a_free_socket_for_the_debugger_1"), null, IJavaLaunchConfigurationConstants.ERR_NO_SOCKET_AVAILABLE); //$NON-NLS-1$
-		}
-
-		subMonitor.worked(1);
-
-		// check for cancellation
-		if (monitor.isCanceled()) {
-			return;
-		}
-
-		subMonitor.subTask(HyLauncherMessages
-				.getString("HyDebugVMRunner.Constructing_command_line..._3")); //$NON-NLS-1$
-
-		String location = getJDKLocation();
-		String program = constructProgramString(location, config);
-
-		List arguments = new ArrayList(12);
-
-		arguments.add(program);
-
-		addArguments(config.getVMArguments(), arguments);
-
-		addBootClassPathArguments(arguments, config);
-
-		String[] cp = config.getClassPath();
-		if (cp.length > 0) {
-			arguments.add("-classpath"); //$NON-NLS-1$
-			arguments.add(convertClassPath(cp));
-		}
-		arguments.add("-Xdebug"); //$NON-NLS-1$
-		arguments
-				.add("-Xrunjdwp:transport=dt_socket,suspend=y,address=localhost:" + port); //$NON-NLS-1$
-
-		arguments.add(config.getClassToLaunch());
-		addArguments(config.getProgramArguments(), arguments);
-		String[] cmdLine = new String[arguments.size()];
-		arguments.toArray(cmdLine);
-
-		String[] envp = config.getEnvironment();
-
-		if (monitor.isCanceled()) {
-			return;
-		}
-
-		subMonitor.worked(1);
-		subMonitor.subTask(HyLauncherMessages
-				.getString("HyDebugVMRunner.Starting_virtual_machine..._4")); //$NON-NLS-1$
-
-		ListeningConnector connector = getConnector();
-		if (connector == null) {
-			abort(
-					HyLauncherMessages
-							.getString("HyDebugVMRunner.Couldn__t_find_an_appropriate_debug_connector_2"), null, IJavaLaunchConfigurationConstants.ERR_CONNECTOR_NOT_AVAILABLE); //$NON-NLS-1$
-		}
-		Map map = connector.defaultArguments();
-
-		specifyArguments(map, port);
-		Process p = null;
-		try {
-			try {
-				// check for cancellation
-				if (monitor.isCanceled()) {
-					return;
-				}
-
-				connector.startListening(map);
-
-				File workingDir = getWorkingDir(config);
-				p = exec(cmdLine, workingDir, envp);
-				if (p == null) {
-					return;
-				}
-
-				// check for cancellation
-				if (monitor.isCanceled()) {
-					p.destroy();
-					return;
-				}
-
-				IProcess process = newProcess(launch, p,
-						renderProcessLabel(cmdLine), getDefaultProcessMap());
-				process.setAttribute(IProcess.ATTR_CMDLINE,
-						renderCommandLine(cmdLine));
-				// Log the current launch command to the platform log
-				logLaunchCmd(cmdLine, true);
-				
-				if (HyLaunchingPlugin.getDefault().isDebugging()
-						&& (Platform
-								.getDebugOption(HyLaunchingPlugin.DEBUG_LAUNCHING)
-								.equalsIgnoreCase("true"))) { //$NON-NLS-1$
-					traceLaunchCmd(cmdLine, envp, true);
-				}
-				subMonitor.worked(1);
-				subMonitor
-						.subTask(HyLauncherMessages
-								.getString("HyDebugVMRunner.Establishing_debug_connection..._6")); //$NON-NLS-1$
-				boolean retry = false;
-				do {
-					try {
-						ConnectRunnable runnable = new ConnectRunnable(
-								connector, map);
-						Thread connectThread = new Thread(runnable,
-								"Listening Connector"); //$NON-NLS-1$
-						connectThread.start();
-						while (connectThread.isAlive()) {
-							if (monitor.isCanceled()) {
-								connector.stopListening(map);
-								p.destroy();
-								return;
-							}
-							try {
-								p.exitValue();
-								// process has terminated - stop waiting for a
-								// connection
-								try {
-									connector.stopListening(map);
-								} catch (IOException e) {
-									// expected
-								}
-								checkErrorMessage(process);
-							} catch (IllegalThreadStateException e) {
-								// expected while process is alive
-							}
-							try {
-								Thread.sleep(100);
-							} catch (InterruptedException e) {
-								// Ignore
-							}
-						}
-
-						Exception ex = runnable.getException();
-						if (ex instanceof IllegalConnectorArgumentsException) {
-							throw (IllegalConnectorArgumentsException) ex;
-						}
-						if (ex instanceof InterruptedIOException) {
-							throw (InterruptedIOException) ex;
-						}
-						if (ex instanceof IOException) {
-							throw (IOException) ex;
-						}
-
-						VirtualMachine vm = runnable.getVirtualMachine();
-						if (vm != null) {
-							JDIDebugModel.newDebugTarget(launch, vm,
-									renderDebugTarget(
-											config.getClassToLaunch(), port),
-									process, true, false);
-							subMonitor.worked(1);
-							subMonitor.done();
-						}
-						return;
-					} catch (InterruptedIOException e) {
-						checkErrorMessage(process);
-
-						// timeout, consult status handler if there is one
-						IStatus status = new Status(
-								IStatus.ERROR,
-								HyLaunchingPlugin.getUniqueIdentifier(),
-								IJavaLaunchConfigurationConstants.ERR_VM_CONNECT_TIMEOUT,
-								"", e); //$NON-NLS-1$
-						IStatusHandler handler = DebugPlugin.getDefault()
-								.getStatusHandler(status);
-
-						retry = false;
-						if (handler == null) {
-							// if there is no handler, throw the exception
-							throw new CoreException(status);
-						}
-						Object result = handler.handleStatus(status, this);
-						if (result instanceof Boolean) {
-							retry = ((Boolean) result).booleanValue();
-						}
-					}
-				} while (retry);
-			} finally {
-				connector.stopListening(map);
-			}
-		} catch (IOException e) {
-			abort(
-					HyLauncherMessages
-							.getString("HyDebugVMRunner.Couldn__t_connect_to_VM_4"), e, IJavaLaunchConfigurationConstants.ERR_CONNECTION_FAILED); //$NON-NLS-1$
-		} catch (IllegalConnectorArgumentsException e) {
-			abort(
-					HyLauncherMessages
-							.getString("HyDebugVMRunner.Couldn__t_connect_to_VM_5"), e, IJavaLaunchConfigurationConstants.ERR_CONNECTION_FAILED); //$NON-NLS-1$
-		}
-		if (p != null) {
-			p.destroy();
-		}
-	}
-
-	protected ListeningConnector getConnector() {
-		List connectors = Bootstrap.virtualMachineManager()
-				.listeningConnectors();
-		for (int i = 0; i < connectors.size(); i++) {
-			ListeningConnector c = (ListeningConnector) connectors.get(i);
-			if ("com.sun.jdi.SocketListen".equals(c.name())) //$NON-NLS-1$
-				return c;
-		}
-		return null;
-	}
-
-	protected void specifyArguments(Map map, int portNumber) {
-		Connector.IntegerArgument port = (Connector.IntegerArgument) map
-				.get("port"); //$NON-NLS-1$
-		port.setValue(portNumber);
-
-		Connector.IntegerArgument timeoutArg = (Connector.IntegerArgument) map
-				.get("timeout"); //$NON-NLS-1$
-		if (timeoutArg != null) {
-			int timeout = JavaRuntime.getPreferences().getInt(
-					JavaRuntime.PREF_CONNECT_TIMEOUT);
-			timeoutArg.setValue(timeout);
-		}
-	}
+/* Copyright 2000, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.harmony.eclipse.jdt.launching;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InterruptedIOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.IStatusHandler;
+import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.debug.core.model.IStreamsProxy;
+import org.eclipse.jdi.Bootstrap;
+import org.eclipse.jdt.debug.core.JDIDebugModel;
+import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.jdt.launching.SocketUtil;
+import org.eclipse.jdt.launching.VMRunnerConfiguration;
+
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.connect.Connector;
+import com.sun.jdi.connect.IllegalConnectorArgumentsException;
+import com.sun.jdi.connect.ListeningConnector;
+
+/**
+ * Used to attach to a VM in a separate thread, to allow for cancellation and
+ * detect that the associated System process died before the connect occurred.
+ */
+class ConnectRunnable implements Runnable {
+
+	private VirtualMachine virtualMachine = null;
+
+	private ListeningConnector connector = null;
+
+	private Map connectionMap = null;
+
+	private Exception exception = null;
+
+	/**
+	 * Constructs a runnable to connect to a VM via the given connector with the
+	 * given connection arguments.
+	 * 
+	 * @param connector
+	 *            the VM connector.
+	 * @param map
+	 *            the map of arguments
+	 */
+	public ConnectRunnable(ListeningConnector connector, Map map) {
+		this.connector = connector;
+		this.connectionMap = map;
+	}
+
+	public void run() {
+		try {
+			virtualMachine = connector.accept(connectionMap);
+		} catch (IOException e) {
+			exception = e;
+		} catch (IllegalConnectorArgumentsException e) {
+			exception = e;
+		}
+	}
+
+	/**
+	 * Returns the VM that was attached to, or <code>null</code> if none.
+	 * 
+	 * @return the VM that was attached to, or <code>null</code> if none
+	 */
+	public VirtualMachine getVirtualMachine() {
+		return virtualMachine;
+	}
+
+	/**
+	 * Returns any exception that occurred while attaching, or <code>null</code>.
+	 * 
+	 * @return IOException or IllegalConnectorArgumentsException
+	 */
+	public Exception getException() {
+		return exception;
+	}
+}
+
+public class HyDebugVMRunner extends HyVMRunner {
+
+	public HyDebugVMRunner(IVMInstall vmInstance) {
+		super(vmInstance);
+	}
+
+	protected void checkErrorMessage(IProcess process) throws CoreException {
+		IStreamsProxy streamsProxy = process.getStreamsProxy();
+		if (streamsProxy != null) {
+			String errorMessage = streamsProxy.getErrorStreamMonitor()
+					.getContents();
+			if (errorMessage.length() == 0) {
+				errorMessage = streamsProxy.getOutputStreamMonitor()
+						.getContents();
+			}
+			if (errorMessage.length() != 0) {
+				abort(errorMessage, null,
+						IJavaLaunchConfigurationConstants.ERR_VM_LAUNCH_ERROR);
+			}
+		}
+	}
+
+	/**
+	 * @see org.eclipse.jdt.launching.IVMRunner#run(VMRunnerConfiguration,
+	 *      ILaunch, IProgressMonitor)
+	 */
+	public void run(VMRunnerConfiguration config, ILaunch launch,
+			IProgressMonitor monitor) throws CoreException {
+
+		if (monitor == null) {
+			monitor = new NullProgressMonitor();
+		}
+
+		IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1);
+		subMonitor
+				.beginTask(
+						HyLauncherMessages
+								.getString("HyDebugVMRunner.Launching_virtual_machine..._1"), 5); //$NON-NLS-1$
+		subMonitor.subTask(HyLauncherMessages
+				.getString("HyDebugVMRunner.Finding_free_socket..._2")); //$NON-NLS-1$
+
+		int port = SocketUtil.findFreePort();
+		if (port == -1) {
+			abort(
+					HyLauncherMessages
+							.getString("HyDebugVMRunner.Could_not_find_a_free_socket_for_the_debugger_1"), null, IJavaLaunchConfigurationConstants.ERR_NO_SOCKET_AVAILABLE); //$NON-NLS-1$
+		}
+
+		subMonitor.worked(1);
+
+		// check for cancellation
+		if (monitor.isCanceled()) {
+			return;
+		}
+
+		subMonitor.subTask(HyLauncherMessages
+				.getString("HyDebugVMRunner.Constructing_command_line..._3")); //$NON-NLS-1$
+
+		String location = getJDKLocation();
+		String program = constructProgramString(location, config);
+
+		List arguments = new ArrayList(12);
+
+		arguments.add(program);
+
+		addArguments(config.getVMArguments(), arguments);
+
+		addBootClassPathArguments(arguments, config);
+
+		String[] cp = config.getClassPath();
+		if (cp.length > 0) {
+			arguments.add("-classpath"); //$NON-NLS-1$
+			arguments.add(convertClassPath(cp));
+		}
+		arguments.add("-Xdebug"); //$NON-NLS-1$
+		arguments
+				.add("-Xrunjdwp:transport=dt_socket,suspend=y,address=localhost:" + port); //$NON-NLS-1$
+
+		arguments.add(config.getClassToLaunch());
+		addArguments(config.getProgramArguments(), arguments);
+		String[] cmdLine = new String[arguments.size()];
+		arguments.toArray(cmdLine);
+
+		String[] envp = config.getEnvironment();
+
+		if (monitor.isCanceled()) {
+			return;
+		}
+
+		subMonitor.worked(1);
+		subMonitor.subTask(HyLauncherMessages
+				.getString("HyDebugVMRunner.Starting_virtual_machine..._4")); //$NON-NLS-1$
+
+		ListeningConnector connector = getConnector();
+		if (connector == null) {
+			abort(
+					HyLauncherMessages
+							.getString("HyDebugVMRunner.Couldn__t_find_an_appropriate_debug_connector_2"), null, IJavaLaunchConfigurationConstants.ERR_CONNECTOR_NOT_AVAILABLE); //$NON-NLS-1$
+		}
+		Map map = connector.defaultArguments();
+
+		specifyArguments(map, port);
+		Process p = null;
+		try {
+			try {
+				// check for cancellation
+				if (monitor.isCanceled()) {
+					return;
+				}
+
+				connector.startListening(map);
+
+				File workingDir = getWorkingDir(config);
+				p = exec(cmdLine, workingDir, envp);
+				if (p == null) {
+					return;
+				}
+
+				// check for cancellation
+				if (monitor.isCanceled()) {
+					p.destroy();
+					return;
+				}
+
+				IProcess process = newProcess(launch, p,
+						renderProcessLabel(cmdLine), getDefaultProcessMap());
+				process.setAttribute(IProcess.ATTR_CMDLINE,
+						renderCommandLine(cmdLine));
+				// Log the current launch command to the platform log
+				logLaunchCmd(cmdLine, true);
+				
+				if (HyLaunchingPlugin.getDefault().isDebugging()
+						&& (Platform
+								.getDebugOption(HyLaunchingPlugin.DEBUG_LAUNCHING)
+								.equalsIgnoreCase("true"))) { //$NON-NLS-1$
+					traceLaunchCmd(cmdLine, envp, true);
+				}
+				subMonitor.worked(1);
+				subMonitor
+						.subTask(HyLauncherMessages
+								.getString("HyDebugVMRunner.Establishing_debug_connection..._6")); //$NON-NLS-1$
+				boolean retry = false;
+				do {
+					try {
+						ConnectRunnable runnable = new ConnectRunnable(
+								connector, map);
+						Thread connectThread = new Thread(runnable,
+								"Listening Connector"); //$NON-NLS-1$
+						connectThread.start();
+						while (connectThread.isAlive()) {
+							if (monitor.isCanceled()) {
+								connector.stopListening(map);
+								p.destroy();
+								return;
+							}
+							try {
+								p.exitValue();
+								// process has terminated - stop waiting for a
+								// connection
+								try {
+									connector.stopListening(map);
+								} catch (IOException e) {
+									// expected
+								}
+								checkErrorMessage(process);
+							} catch (IllegalThreadStateException e) {
+								// expected while process is alive
+							}
+							try {
+								Thread.sleep(100);
+							} catch (InterruptedException e) {
+								// Ignore
+							}
+						}
+
+						Exception ex = runnable.getException();
+						if (ex instanceof IllegalConnectorArgumentsException) {
+							throw (IllegalConnectorArgumentsException) ex;
+						}
+						if (ex instanceof InterruptedIOException) {
+							throw (InterruptedIOException) ex;
+						}
+						if (ex instanceof IOException) {
+							throw (IOException) ex;
+						}
+
+						VirtualMachine vm = runnable.getVirtualMachine();
+						if (vm != null) {
+							JDIDebugModel.newDebugTarget(launch, vm,
+									renderDebugTarget(
+											config.getClassToLaunch(), port),
+									process, true, false);
+							subMonitor.worked(1);
+							subMonitor.done();
+						}
+						return;
+					} catch (InterruptedIOException e) {
+						checkErrorMessage(process);
+
+						// timeout, consult status handler if there is one
+						IStatus status = new Status(
+								IStatus.ERROR,
+								HyLaunchingPlugin.getUniqueIdentifier(),
+								IJavaLaunchConfigurationConstants.ERR_VM_CONNECT_TIMEOUT,
+								"", e); //$NON-NLS-1$
+						IStatusHandler handler = DebugPlugin.getDefault()
+								.getStatusHandler(status);
+
+						retry = false;
+						if (handler == null) {
+							// if there is no handler, throw the exception
+							throw new CoreException(status);
+						}
+						Object result = handler.handleStatus(status, this);
+						if (result instanceof Boolean) {
+							retry = ((Boolean) result).booleanValue();
+						}
+					}
+				} while (retry);
+			} finally {
+				connector.stopListening(map);
+			}
+		} catch (IOException e) {
+			abort(
+					HyLauncherMessages
+							.getString("HyDebugVMRunner.Couldn__t_connect_to_VM_4"), e, IJavaLaunchConfigurationConstants.ERR_CONNECTION_FAILED); //$NON-NLS-1$
+		} catch (IllegalConnectorArgumentsException e) {
+			abort(
+					HyLauncherMessages
+							.getString("HyDebugVMRunner.Couldn__t_connect_to_VM_5"), e, IJavaLaunchConfigurationConstants.ERR_CONNECTION_FAILED); //$NON-NLS-1$
+		}
+		if (p != null) {
+			p.destroy();
+		}
+	}
+
+	protected ListeningConnector getConnector() {
+		List connectors = Bootstrap.virtualMachineManager()
+				.listeningConnectors();
+		for (int i = 0; i < connectors.size(); i++) {
+			ListeningConnector c = (ListeningConnector) connectors.get(i);
+			if ("com.sun.jdi.SocketListen".equals(c.name())) //$NON-NLS-1$
+				return c;
+		}
+		return null;
+	}
+
+	protected void specifyArguments(Map map, int portNumber) {
+		Connector.IntegerArgument port = (Connector.IntegerArgument) map
+				.get("port"); //$NON-NLS-1$
+		port.setValue(portNumber);
+
+		Connector.IntegerArgument timeoutArg = (Connector.IntegerArgument) map
+				.get("timeout"); //$NON-NLS-1$
+		if (timeoutArg != null) {
+			int timeout = JavaRuntime.getPreferences().getInt(
+					JavaRuntime.PREF_CONNECT_TIMEOUT);
+			timeoutArg.setValue(timeout);
+		}
+	}
 }

Propchange: incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching/src/org/apache/harmony/eclipse/jdt/launching/HyDebugVMRunner.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching/src/org/apache/harmony/eclipse/jdt/launching/HyLauncherMessages.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching/src/org/apache/harmony/eclipse/jdt/launching/HyLauncherMessages.java?view=diff&rev=451266&r1=451265&r2=451266
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching/src/org/apache/harmony/eclipse/jdt/launching/HyLauncherMessages.java (original)
+++ incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching/src/org/apache/harmony/eclipse/jdt/launching/HyLauncherMessages.java Fri Sep 29 05:45:08 2006
@@ -1,39 +1,39 @@
-/* Copyright 2000, 2005 The Apache Software Foundation or its licensors, as applicable
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.harmony.eclipse.jdt.launching;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-public class HyLauncherMessages {
-
-	private static final String RESOURCE_BUNDLE = "org.apache.harmony.eclipse.jdt.launching.HyLauncherMessages"; //$NON-NLS-1$
-
-	private static ResourceBundle resourceBundle = ResourceBundle
-			.getBundle(RESOURCE_BUNDLE);
-
-	private HyLauncherMessages() {
-		super();
-	}
-
-	public static String getString(String key) {
-		try {
-			return resourceBundle.getString(key);
-		} catch (MissingResourceException e) {
-			return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
-		}
-	}
-}
+/* Copyright 2000, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.harmony.eclipse.jdt.launching;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class HyLauncherMessages {
+
+	private static final String RESOURCE_BUNDLE = "org.apache.harmony.eclipse.jdt.launching.HyLauncherMessages"; //$NON-NLS-1$
+
+	private static ResourceBundle resourceBundle = ResourceBundle
+			.getBundle(RESOURCE_BUNDLE);
+
+	private HyLauncherMessages() {
+		super();
+	}
+
+	public static String getString(String key) {
+		try {
+			return resourceBundle.getString(key);
+		} catch (MissingResourceException e) {
+			return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
+		}
+	}
+}

Propchange: incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching/src/org/apache/harmony/eclipse/jdt/launching/HyLauncherMessages.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching/src/org/apache/harmony/eclipse/jdt/launching/HyLauncherMessages.properties
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching/src/org/apache/harmony/eclipse/jdt/launching/HyLauncherMessages.properties?view=diff&rev=451266&r1=451265&r2=451266
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching/src/org/apache/harmony/eclipse/jdt/launching/HyLauncherMessages.properties (original)
+++ incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching/src/org/apache/harmony/eclipse/jdt/launching/HyLauncherMessages.properties Fri Sep 29 05:45:08 2006
@@ -1,35 +1,35 @@
-# Copyright 2000, 2005 The Apache Software Foundation or its licensors, as applicable
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-# 
-#     http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-HyDebugVMRunner.Could_not_find_a_free_socket_for_the_debugger_1=Cannot find a free socket for the debugger
-HyDebugVMRunner.Couldn__t_connect_to_VM_5=Cannot connect to VM
-HyDebugVMRunner.Couldn__t_find_an_appropriate_debug_connector_2=Cannot find an appropriate debug connector
-HyDebugVMRunner.Launching_virtual_machine..._1=Launching virtual machine...
-HyDebugVMRunner.Finding_free_socket..._2=Finding free socket...
-HyDebugVMRunner.Constructing_command_line..._3=Constructing command line...
-HyDebugVMRunner.Starting_virtual_machine..._4=Starting virtual machine...
-HyDebugVMRunner.Establishing_debug_connection..._6=Establishing debug connection...
-
-HyVMType.error.noLauncher=Not a Harmony runtime installation; executable was not found
-HyVMType.error.noBootProperties=Not a Harmony runtime installation; bootclasspath.properties was not found
-HyVMType.name=Apache Harmony VM
-
-javaVMRunner.format.dbgTarget={0} at localhost:{1}
-javaVMRunner.format.processLabel={0} ({1})
-javaVMRunner.Specified_working_directory_does_not_exist_or_is_not_a_directory__{0}_1=Specified working directory does not exist or is not a directory: {0}
-
-HyVMRunner.Launching_virtual_machine..._1=Launching virtual machine...
-HyVMRunner.Constructing_command_line..._2=Constructing command line...
-HyVMRunner.Starting_virtual_machine..._3=Starting virtual machine...
+# Copyright 2000, 2005 The Apache Software Foundation or its licensors, as applicable
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+#     http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+HyDebugVMRunner.Could_not_find_a_free_socket_for_the_debugger_1=Cannot find a free socket for the debugger
+HyDebugVMRunner.Couldn__t_connect_to_VM_5=Cannot connect to VM
+HyDebugVMRunner.Couldn__t_find_an_appropriate_debug_connector_2=Cannot find an appropriate debug connector
+HyDebugVMRunner.Launching_virtual_machine..._1=Launching virtual machine...
+HyDebugVMRunner.Finding_free_socket..._2=Finding free socket...
+HyDebugVMRunner.Constructing_command_line..._3=Constructing command line...
+HyDebugVMRunner.Starting_virtual_machine..._4=Starting virtual machine...
+HyDebugVMRunner.Establishing_debug_connection..._6=Establishing debug connection...
+
+HyVMType.error.noLauncher=Not a Harmony runtime installation; executable was not found
+HyVMType.error.noBootProperties=Not a Harmony runtime installation; bootclasspath.properties was not found
+HyVMType.name=Apache Harmony VM
+
+javaVMRunner.format.dbgTarget={0} at localhost:{1}
+javaVMRunner.format.processLabel={0} ({1})
+javaVMRunner.Specified_working_directory_does_not_exist_or_is_not_a_directory__{0}_1=Specified working directory does not exist or is not a directory: {0}
+
+HyVMRunner.Launching_virtual_machine..._1=Launching virtual machine...
+HyVMRunner.Constructing_command_line..._2=Constructing command line...
+HyVMRunner.Starting_virtual_machine..._3=Starting virtual machine...

Propchange: incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching/src/org/apache/harmony/eclipse/jdt/launching/HyLauncherMessages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching/src/org/apache/harmony/eclipse/jdt/launching/HyLaunchingPlugin.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching/src/org/apache/harmony/eclipse/jdt/launching/HyLaunchingPlugin.java?view=diff&rev=451266&r1=451265&r2=451266
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching/src/org/apache/harmony/eclipse/jdt/launching/HyLaunchingPlugin.java (original)
+++ incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching/src/org/apache/harmony/eclipse/jdt/launching/HyLaunchingPlugin.java Fri Sep 29 05:45:08 2006
@@ -1,135 +1,135 @@
-/* Copyright 2000, 2006 The Apache Software Foundation or its licensors, as applicable
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.harmony.eclipse.jdt.launching;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Status;
-import org.osgi.framework.BundleContext;
-
-public class HyLaunchingPlugin extends Plugin {
-
-	/**
-	 * Unique identifier constant.
-	 */
-	private static final String PI_Harmony_Launching = "org.apache.harmony.jdt.launching"; //$NON-NLS-1$
-
-	private static HyLaunchingPlugin plugin;
-
-	static final String DEBUG_PLUGIN = PI_Harmony_Launching + "/plugin"; //$NON-NLS-1$
-
-	static final String DEBUG_INSTALLING = PI_Harmony_Launching + "/vm/installing"; //$NON-NLS-1$
-
-	static final String DEBUG_LAUNCHING = PI_Harmony_Launching + "/application/launching"; //$NON-NLS-1$
-
-	/**
-	 * Default constructor.
-	 */
-	public HyLaunchingPlugin() {
-		super();
-		plugin = this;
-	}
-
-	public void start(BundleContext context) throws Exception {
-		super.start(context);
-
-		if (isDebugging()
-				&& (Platform.getDebugOption(DEBUG_PLUGIN)
-						.equalsIgnoreCase("true"))) { //$NON-NLS-1$
-			System.out.println(PI_Harmony_Launching + "--> Plugin started"); //$NON-NLS-1$
-		}
-	}
-
-	public void stop(BundleContext context) throws Exception {
-		if (isDebugging()
-				&& (Platform.getDebugOption(DEBUG_PLUGIN)
-						.equalsIgnoreCase("true"))) { //$NON-NLS-1$
-			System.out.println(PI_Harmony_Launching + "--> Plugin stopping"); //$NON-NLS-1$
-		}
-
-		super.stop(context);
-	}
-
-	public static HyLaunchingPlugin getDefault() {
-		return plugin;
-	}
-
-	/**
-	 * Convenience method which returns the unique identifier of this plugin.
-	 */
-	public static String getUniqueIdentifier() {
-		return PI_Harmony_Launching;
-	}
-
-	/**
-	 * Convenience method to write status information to the platform log.
-	 * 
-	 * @param msg
-	 *            information to be written to the platform log.
-	 */
-	public void log(String msg) {
-		log(msg, null);
-	}
-
-	/**
-	 * Convenience method to write problem information to the platform log.
-	 * 
-	 * @param msg
-	 *            additional information about the event
-	 * @param e
-	 *            exception encapsulating any non-fatal problem
-	 */
-	public void log(String msg, Exception e) {
-		getLog().log(
-				new Status(IStatus.INFO, getUniqueIdentifier(), IStatus.OK,
-						msg, e));
-	}
-
-	/**
-	 * Convenience method to write error information to the platform log.
-	 * 
-	 * @param msg
-	 *            additional information about the event
-	 * @param e
-	 *            exception encapsulating the error
-	 */
-	public void logError(String msg, Exception e) {
-		getLog().log(
-				new Status(IStatus.INFO, getUniqueIdentifier(), IStatus.ERROR,
-						msg, e));
-	}
-
-	/**
-	 * Convenience method that returns a boolean indication of whether or not
-	 * the plug-in is running with debug trace on <em>and</em> if the option
-	 * to allow trace messages about the VM installation activities has been
-	 * specified.
-	 * 
-	 * @return <code>true</code> if tracing of VM install activities is
-	 *         enabled, otherwise <code>false</code>.
-	 */
-	public static boolean isDebuggingInstalling() {
-		boolean result = false;
-		if (plugin.isDebugging()) {
-			String option = Platform.getDebugOption(DEBUG_INSTALLING);
-			if ((option != null) && option.equalsIgnoreCase("true")) { //$NON-NLS-1$
-				result = true;
-			}
-		}
-		return result;
-	}
-}
+/* Copyright 2000, 2006 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.harmony.eclipse.jdt.launching;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.osgi.framework.BundleContext;
+
+public class HyLaunchingPlugin extends Plugin {
+
+	/**
+	 * Unique identifier constant.
+	 */
+	private static final String PI_Harmony_Launching = "org.apache.harmony.jdt.launching"; //$NON-NLS-1$
+
+	private static HyLaunchingPlugin plugin;
+
+	static final String DEBUG_PLUGIN = PI_Harmony_Launching + "/plugin"; //$NON-NLS-1$
+
+	static final String DEBUG_INSTALLING = PI_Harmony_Launching + "/vm/installing"; //$NON-NLS-1$
+
+	static final String DEBUG_LAUNCHING = PI_Harmony_Launching + "/application/launching"; //$NON-NLS-1$
+
+	/**
+	 * Default constructor.
+	 */
+	public HyLaunchingPlugin() {
+		super();
+		plugin = this;
+	}
+
+	public void start(BundleContext context) throws Exception {
+		super.start(context);
+
+		if (isDebugging()
+				&& (Platform.getDebugOption(DEBUG_PLUGIN)
+						.equalsIgnoreCase("true"))) { //$NON-NLS-1$
+			System.out.println(PI_Harmony_Launching + "--> Plugin started"); //$NON-NLS-1$
+		}
+	}
+
+	public void stop(BundleContext context) throws Exception {
+		if (isDebugging()
+				&& (Platform.getDebugOption(DEBUG_PLUGIN)
+						.equalsIgnoreCase("true"))) { //$NON-NLS-1$
+			System.out.println(PI_Harmony_Launching + "--> Plugin stopping"); //$NON-NLS-1$
+		}
+
+		super.stop(context);
+	}
+
+	public static HyLaunchingPlugin getDefault() {
+		return plugin;
+	}
+
+	/**
+	 * Convenience method which returns the unique identifier of this plugin.
+	 */
+	public static String getUniqueIdentifier() {
+		return PI_Harmony_Launching;
+	}
+
+	/**
+	 * Convenience method to write status information to the platform log.
+	 * 
+	 * @param msg
+	 *            information to be written to the platform log.
+	 */
+	public void log(String msg) {
+		log(msg, null);
+	}
+
+	/**
+	 * Convenience method to write problem information to the platform log.
+	 * 
+	 * @param msg
+	 *            additional information about the event
+	 * @param e
+	 *            exception encapsulating any non-fatal problem
+	 */
+	public void log(String msg, Exception e) {
+		getLog().log(
+				new Status(IStatus.INFO, getUniqueIdentifier(), IStatus.OK,
+						msg, e));
+	}
+
+	/**
+	 * Convenience method to write error information to the platform log.
+	 * 
+	 * @param msg
+	 *            additional information about the event
+	 * @param e
+	 *            exception encapsulating the error
+	 */
+	public void logError(String msg, Exception e) {
+		getLog().log(
+				new Status(IStatus.INFO, getUniqueIdentifier(), IStatus.ERROR,
+						msg, e));
+	}
+
+	/**
+	 * Convenience method that returns a boolean indication of whether or not
+	 * the plug-in is running with debug trace on <em>and</em> if the option
+	 * to allow trace messages about the VM installation activities has been
+	 * specified.
+	 * 
+	 * @return <code>true</code> if tracing of VM install activities is
+	 *         enabled, otherwise <code>false</code>.
+	 */
+	public static boolean isDebuggingInstalling() {
+		boolean result = false;
+		if (plugin.isDebugging()) {
+			String option = Platform.getDebugOption(DEBUG_INSTALLING);
+			if ((option != null) && option.equalsIgnoreCase("true")) { //$NON-NLS-1$
+				result = true;
+			}
+		}
+		return result;
+	}
+}

Propchange: incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching/src/org/apache/harmony/eclipse/jdt/launching/HyLaunchingPlugin.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching/src/org/apache/harmony/eclipse/jdt/launching/HyVMInstall.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching/src/org/apache/harmony/eclipse/jdt/launching/HyVMInstall.java?view=diff&rev=451266&r1=451265&r2=451266
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching/src/org/apache/harmony/eclipse/jdt/launching/HyVMInstall.java (original)
+++ incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching/src/org/apache/harmony/eclipse/jdt/launching/HyVMInstall.java Fri Sep 29 05:45:08 2006
@@ -1,128 +1,128 @@
-/* Copyright 2005, 2006 The Apache Software Foundation or its licensors, as applicable
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.harmony.eclipse.jdt.launching;
-
-import java.util.List;
-
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.jdt.launching.AbstractVMInstall;
-import org.eclipse.jdt.launching.IVMInstallType;
-import org.eclipse.jdt.launching.IVMRunner;
-import org.eclipse.jdt.launching.LibraryLocation;
-
-public class HyVMInstall extends AbstractVMInstall {
-
-	/*
-	 * Constructor for a VM install.
-	 */
-	HyVMInstall(IVMInstallType type, String id) {
-		super(type, id);
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.eclipse.jdt.launching.IVMInstall#getVMRunner(java.lang.String)
-	 */
-	public IVMRunner getVMRunner(String mode) {
-		if (ILaunchManager.RUN_MODE.equals(mode)) {
-			return new HyVMRunner(this);
-		} else if (ILaunchManager.DEBUG_MODE.equals(mode)) {
-			return new HyDebugVMRunner(this);
-		}
-		return null;
-	}
-
-	public void setLibraryLocations(LibraryLocation[] locations) {
-		// If the libs are being explicitly set, then don't monkey with them
-		if (locations != null) {
-			super.setLibraryLocations(locations);
-			return;
-		}
-
-		if (locations == null) {
-			super.setLibraryLocations(locations);
-			return;
-		}
-
-		// 'null' means use the default locations, which for us depends
-		// upon the argument list.
-
-		// find the vm subdir and VMI name
-		String subdir = "default"; //$NON-NLS-1$
-		String vminame = "harmonyvm"; //$NON-NLS-1$
-		String[] args = getVMArguments();
-		if (args != null) {
-			for (int i = 0; i < args.length; i++) {
-				if (args[i].startsWith("-vmdir:")) { //$NON-NLS-1$
-					subdir = args[i].substring("-vmdir:".length()); //$NON-NLS-1$
-				}
-				if (args[i].startsWith("-vm:")) { //$NON-NLS-1$
-					vminame = args[i].substring("-vm:".length()); //$NON-NLS-1$
-				}
-			}
-		}
-
-		// Build a library location for the kernel classes
-		LibraryLocation[] kernel = kernelLocation(subdir, vminame);
-		LibraryLocation[] stdDefaults = getVMInstallType()
-				.getDefaultLibraryLocations(getInstallLocation());
-
-		// Ensure we don't duplicate the kernel
-		boolean found = false;
-		for (int i = 0; i < stdDefaults.length; i++) {
-			LibraryLocation location = stdDefaults[i];
-			if (location.getSystemLibraryPath().equals(
-					kernel[0].getSystemLibraryPath())) {
-				found = true;
-				break;
-			}
-		}
-
-		if (found) {
-			super.setLibraryLocations(null);
-		} else {
-			LibraryLocation[] allLibs = new LibraryLocation[kernel.length + stdDefaults.length];
-			System.arraycopy(kernel, 0, allLibs, 0, kernel.length);
-			System.arraycopy(stdDefaults, 0, allLibs, kernel.length, stdDefaults.length);
-			super.setLibraryLocations(allLibs);
-		}
-	}
-
-	private LibraryLocation[] kernelLocation(String subdir, String vmname) {
-		List kernelLibraries = ((HyVMInstallType) getVMInstallType()).getKernelLibraries(
-				getInstallLocation(), subdir, vmname);
-
-		LibraryLocation[] kernelLibrariesLocation = new LibraryLocation[kernelLibraries.size()];
-		for (int i = 0; i < kernelLibraries.size(); i++) {
-			kernelLibrariesLocation[i] = (LibraryLocation) kernelLibraries.get(i);
-		}
-		
-		return kernelLibrariesLocation;
-	}
-
-	/*
-	 * (non-Javadoc) The setVMArgs does not cause an event change, so we have to
-	 * subclass here to (potentially) change our library path based on changes
-	 * to the -vmdir argument.
-	 * 
-	 * @see org.eclipse.jdt.launching.IVMInstall#setVMArgs(java.lang.String)
-	 */
-	public void setVMArgs(String vmArgs) {
-		super.setVMArgs(vmArgs);
-		setLibraryLocations(getLibraryLocations());
-	}
-}
+/* Copyright 2005, 2006 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.harmony.eclipse.jdt.launching;
+
+import java.util.List;
+
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.jdt.launching.AbstractVMInstall;
+import org.eclipse.jdt.launching.IVMInstallType;
+import org.eclipse.jdt.launching.IVMRunner;
+import org.eclipse.jdt.launching.LibraryLocation;
+
+public class HyVMInstall extends AbstractVMInstall {
+
+	/*
+	 * Constructor for a VM install.
+	 */
+	HyVMInstall(IVMInstallType type, String id) {
+		super(type, id);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jdt.launching.IVMInstall#getVMRunner(java.lang.String)
+	 */
+	public IVMRunner getVMRunner(String mode) {
+		if (ILaunchManager.RUN_MODE.equals(mode)) {
+			return new HyVMRunner(this);
+		} else if (ILaunchManager.DEBUG_MODE.equals(mode)) {
+			return new HyDebugVMRunner(this);
+		}
+		return null;
+	}
+
+	public void setLibraryLocations(LibraryLocation[] locations) {
+		// If the libs are being explicitly set, then don't monkey with them
+		if (locations != null) {
+			super.setLibraryLocations(locations);
+			return;
+		}
+
+		if (locations == null) {
+			super.setLibraryLocations(locations);
+			return;
+		}
+
+		// 'null' means use the default locations, which for us depends
+		// upon the argument list.
+
+		// find the vm subdir and VMI name
+		String subdir = "default"; //$NON-NLS-1$
+		String vminame = "harmonyvm"; //$NON-NLS-1$
+		String[] args = getVMArguments();
+		if (args != null) {
+			for (int i = 0; i < args.length; i++) {
+				if (args[i].startsWith("-vmdir:")) { //$NON-NLS-1$
+					subdir = args[i].substring("-vmdir:".length()); //$NON-NLS-1$
+				}
+				if (args[i].startsWith("-vm:")) { //$NON-NLS-1$
+					vminame = args[i].substring("-vm:".length()); //$NON-NLS-1$
+				}
+			}
+		}
+
+		// Build a library location for the kernel classes
+		LibraryLocation[] kernel = kernelLocation(subdir, vminame);
+		LibraryLocation[] stdDefaults = getVMInstallType()
+				.getDefaultLibraryLocations(getInstallLocation());
+
+		// Ensure we don't duplicate the kernel
+		boolean found = false;
+		for (int i = 0; i < stdDefaults.length; i++) {
+			LibraryLocation location = stdDefaults[i];
+			if (location.getSystemLibraryPath().equals(
+					kernel[0].getSystemLibraryPath())) {
+				found = true;
+				break;
+			}
+		}
+
+		if (found) {
+			super.setLibraryLocations(null);
+		} else {
+			LibraryLocation[] allLibs = new LibraryLocation[kernel.length + stdDefaults.length];
+			System.arraycopy(kernel, 0, allLibs, 0, kernel.length);
+			System.arraycopy(stdDefaults, 0, allLibs, kernel.length, stdDefaults.length);
+			super.setLibraryLocations(allLibs);
+		}
+	}
+
+	private LibraryLocation[] kernelLocation(String subdir, String vmname) {
+		List kernelLibraries = ((HyVMInstallType) getVMInstallType()).getKernelLibraries(
+				getInstallLocation(), subdir, vmname);
+
+		LibraryLocation[] kernelLibrariesLocation = new LibraryLocation[kernelLibraries.size()];
+		for (int i = 0; i < kernelLibraries.size(); i++) {
+			kernelLibrariesLocation[i] = (LibraryLocation) kernelLibraries.get(i);
+		}
+		
+		return kernelLibrariesLocation;
+	}
+
+	/*
+	 * (non-Javadoc) The setVMArgs does not cause an event change, so we have to
+	 * subclass here to (potentially) change our library path based on changes
+	 * to the -vmdir argument.
+	 * 
+	 * @see org.eclipse.jdt.launching.IVMInstall#setVMArgs(java.lang.String)
+	 */
+	public void setVMArgs(String vmArgs) {
+		super.setVMArgs(vmArgs);
+		setLibraryLocations(getLibraryLocations());
+	}
+}

Propchange: incubator/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching/src/org/apache/harmony/eclipse/jdt/launching/HyVMInstall.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message