summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCurtis Windatt2013-04-12 15:39:07 (EDT)
committerCurtis Windatt2013-04-12 15:39:07 (EDT)
commitd5d6a3a875237970fee0272486680bff5ee9eb94 (patch)
tree85431f0f616ad20b6ace78ac19576a0e0e1159cd
parent4973329668fd3eca1360e1581ef302e020cba395 (diff)
downloadeclipse.pde.ui-d5d6a3a875237970fee0272486680bff5ee9eb94.zip
eclipse.pde.ui-d5d6a3a875237970fee0272486680bff5ee9eb94.tar.gz
eclipse.pde.ui-d5d6a3a875237970fee0272486680bff5ee9eb94.tar.bz2
Bug 405578 - Eclipse4 prevents second app from starting when mixingI20130416-0800
-rw-r--r--ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/LaunchArgumentsHelper.java27
-rw-r--r--ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/LauncherUtils.java23
-rw-r--r--ui/org.eclipse.pde.launching/src/org/eclipse/pde/launching/EclipseApplicationLaunchConfiguration.java4
-rw-r--r--ui/org.eclipse.pde.launching/src/org/eclipse/pde/launching/JUnitLaunchConfigurationDelegate.java4
-rw-r--r--ui/org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/EclipseApplicationLaunchConfiguration.java4
5 files changed, 41 insertions, 21 deletions
diff --git a/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/LaunchArgumentsHelper.java b/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/LaunchArgumentsHelper.java
index 414adcd..216c073 100644
--- a/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/LaunchArgumentsHelper.java
+++ b/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/LaunchArgumentsHelper.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 2013 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,9 +10,6 @@
*******************************************************************************/
package org.eclipse.pde.internal.launching.launcher;
-import org.eclipse.pde.core.target.ITargetHandle;
-import org.eclipse.pde.core.target.ITargetPlatformService;
-
import java.io.File;
import java.io.IOException;
import java.net.URL;
@@ -28,6 +25,8 @@ import org.eclipse.jdt.core.*;
import org.eclipse.jdt.launching.ExecutionArguments;
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
import org.eclipse.pde.core.plugin.*;
+import org.eclipse.pde.core.target.ITargetHandle;
+import org.eclipse.pde.core.target.ITargetPlatformService;
import org.eclipse.pde.internal.build.IPDEBuildConstants;
import org.eclipse.pde.internal.core.*;
import org.eclipse.pde.internal.launching.ILaunchingPreferenceConstants;
@@ -38,14 +37,24 @@ import org.osgi.framework.Bundle;
public class LaunchArgumentsHelper {
/**
- * Returns the location that will be used as the workspace when launching. Will
- * replace variables, so this method should only be called
- * when variable substitution (may prompt the user) is appropriate.
+ * Returns the location that will be used as the workspace when launching or
+ * an empty string if the user has specified the <code>-data &#64none</code>
+ * argument for no workspace. Will replace variables, so this method should
+ * only be called when variable substitution (may prompt the user) is appropriate.
+ *
* @param configuration the launch configuration to get the workspace value for
- * @return workspace location path as a string
+ * @return workspace location path as a string or an empty if no workspace will be used
* @throws CoreException if there is a problem with the configuration
*/
public static String getWorkspaceLocation(ILaunchConfiguration configuration) throws CoreException {
+ // Check if -data @none is specified
+ String[] userArgs = getUserProgramArgumentArray(configuration);
+ for (int i = 0; i < userArgs.length; i++) {
+ if (userArgs[i].equals("-data") && (i + 1) < userArgs.length && userArgs[i + 1].equals("@none")) { //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+ }
+
String location = configuration.getAttribute(IPDELauncherConstants.LOCATION, (String) null);
if (location == null) {
// backward compatibility
@@ -190,7 +199,7 @@ public class LaunchArgumentsHelper {
return map;
}
- public static String getTracingFileArgument(ILaunchConfiguration config, String optionsFileName) throws CoreException {
+ public static String getTracingFileArgument(ILaunchConfiguration config, String optionsFileName) {
try {
TracingOptionsManager mng = PDECore.getDefault().getTracingOptionsManager();
Map options = config.getAttribute(IPDELauncherConstants.TRACING_OPTIONS, (Map) null);
diff --git a/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/LauncherUtils.java b/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/LauncherUtils.java
index e808633..9951fa3 100644
--- a/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/LauncherUtils.java
+++ b/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/LauncherUtils.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2012 IBM Corporation and others.
+ * Copyright (c) 2003, 2013 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
@@ -48,13 +48,24 @@ public class LauncherUtils {
*/
private static String fLastLaunchMode;
- public static boolean clearWorkspace(ILaunchConfiguration configuration, String workspace, IProgressMonitor monitor) throws CoreException {
+ /**
+ * Checks if the workspace being launched is already in use or needs to be cleared
+ * before launching. The provided workspace should already have any variables replaced.
+ * This method will not check if no workspace is being used (<code>-data &#64;none</code>
+ * added as a program argument). The caller should check for this possibility.
+ *
+ * @param configuration launch configuration used to lookup workspace clear settings
+ * @param workspace the absolute workspace location to be checked with all variables replaced or the empty string for no workspace
+ * @param monitor progress monitor
+ * @return whether to continue launching
+ * @throws CoreException
+ */
+ public static boolean checkWorkspace(ILaunchConfiguration configuration, String workspace, IProgressMonitor monitor) throws CoreException {
// If the workspace is not defined, there is no workspace to clear
- // What will happen is that the workspace chooser dialog will be
- // brought up because no -data parameter will be specified on the
- // launch
- if (workspace.length() == 0) {
+ // Unless the user has added the -data program arugment themselves,
+ // the workspace chooser dialog will be brought up.
+ if (workspace == null || workspace.length() == 0) {
if (monitor != null) {
monitor.done();
}
diff --git a/ui/org.eclipse.pde.launching/src/org/eclipse/pde/launching/EclipseApplicationLaunchConfiguration.java b/ui/org.eclipse.pde.launching/src/org/eclipse/pde/launching/EclipseApplicationLaunchConfiguration.java
index 8c3e187..7bd9c05 100644
--- a/ui/org.eclipse.pde.launching/src/org/eclipse/pde/launching/EclipseApplicationLaunchConfiguration.java
+++ b/ui/org.eclipse.pde.launching/src/org/eclipse/pde/launching/EclipseApplicationLaunchConfiguration.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2012 IBM Corporation and others.
+ * Copyright (c) 2005, 2013 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
@@ -234,7 +234,7 @@ public class EclipseApplicationLaunchConfiguration extends AbstractPDELaunchConf
SubMonitor subMon = SubMonitor.convert(monitor, 50);
// Clear workspace and prompt, if necessary
- if (!LauncherUtils.clearWorkspace(configuration, fWorkspaceLocation, subMon.newChild(25)))
+ if (!LauncherUtils.checkWorkspace(configuration, fWorkspaceLocation, subMon.newChild(25)))
throw new CoreException(Status.CANCEL_STATUS);
subMon.setWorkRemaining(25);
diff --git a/ui/org.eclipse.pde.launching/src/org/eclipse/pde/launching/JUnitLaunchConfigurationDelegate.java b/ui/org.eclipse.pde.launching/src/org/eclipse/pde/launching/JUnitLaunchConfigurationDelegate.java
index 9b189f0..eec7007 100644
--- a/ui/org.eclipse.pde.launching/src/org/eclipse/pde/launching/JUnitLaunchConfigurationDelegate.java
+++ b/ui/org.eclipse.pde.launching/src/org/eclipse/pde/launching/JUnitLaunchConfigurationDelegate.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 IBM Corporation and others.
+ * Copyright (c) 2006, 2013 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
@@ -470,7 +470,7 @@ public class JUnitLaunchConfigurationDelegate extends org.eclipse.jdt.junit.laun
SubMonitor subMon = SubMonitor.convert(monitor, 50);
// Clear workspace and prompt, if necessary
- if (!LauncherUtils.clearWorkspace(configuration, fWorkspaceLocation, subMon.newChild(25))) {
+ if (!LauncherUtils.checkWorkspace(configuration, fWorkspaceLocation, subMon.newChild(25))) {
throw new CoreException(Status.CANCEL_STATUS);
}
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/EclipseApplicationLaunchConfiguration.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/EclipseApplicationLaunchConfiguration.java
index 25d6650..1086b5c 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/EclipseApplicationLaunchConfiguration.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/EclipseApplicationLaunchConfiguration.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2012 IBM Corporation and others.
+ * Copyright (c) 2005, 2013 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
@@ -234,7 +234,7 @@ public class EclipseApplicationLaunchConfiguration extends AbstractPDELaunchConf
SubMonitor subMon = SubMonitor.convert(monitor, 50);
// Clear workspace and prompt, if necessary
- if (!LauncherUtils.clearWorkspace(configuration, fWorkspaceLocation, subMon.newChild(25)))
+ if (!LauncherUtils.checkWorkspace(configuration, fWorkspaceLocation, subMon.newChild(25)))
throw new CoreException(Status.CANCEL_STATUS);
subMon.setWorkRemaining(25);