Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfiguration.java4
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/ILaunchConfigurationDelegate.java4
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java7
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RelaunchActionDelegate.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationDialog.java74
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/PerspectiveManager.java12
6 files changed, 78 insertions, 25 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfiguration.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfiguration.java
index 6bdbe9c37..cde4df66f 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfiguration.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfiguration.java
@@ -12,6 +12,7 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
/**
* Note: This interface is yet experimental.
@@ -72,6 +73,7 @@ public interface ILaunchConfiguration extends IAdaptable {
*
* @param mode the mode in which to launch, one of the mode constants
* defined by this interface - <code>RUN</code> or <code>DEBUG</code>.
+ * @param monitor progress monitor, or <code>null</code>
* @return the resulting launch object, or <code>null</code> if the
* launch is not completed.
* @exception CoreException if this method fails. Reasons include:<ul>
@@ -79,7 +81,7 @@ public interface ILaunchConfiguration extends IAdaptable {
* <li>the launch fails</code>
* </ul>
*/
- public ILaunch launch(String mode) throws CoreException;
+ public ILaunch launch(String mode, IProgressMonitor monitor) throws CoreException;
/**
* Returns whether this launch configuration supports the
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ILaunchConfigurationDelegate.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ILaunchConfigurationDelegate.java
index d8516704e..e02b9e7c8 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ILaunchConfigurationDelegate.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ILaunchConfigurationDelegate.java
@@ -6,6 +6,7 @@ package org.eclipse.debug.core.model;
*/
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
@@ -43,10 +44,11 @@ public interface ILaunchConfigurationDelegate {
* @param mode the mode in which to launch, one of the mode constants
* defined by this <code>ILaunchConfiguration</code> -
* <code>RUN</code> or <code>DEBUG</code>.
+ * @param monitor progress monitor, or <code>null</code>
* @return the resulting launch object, or <code>null</code> if the
* launch is not completed.
* @exception CoreException if launching fails
*/
- public ILaunch launch(ILaunchConfiguration configuration, String mode) throws CoreException;
+ public ILaunch launch(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException;
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java
index 83aeb35e0..3a9a6e474 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java
@@ -14,6 +14,7 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.PlatformObject;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugException;
@@ -48,10 +49,10 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
}
/**
- * @see ILaunchConfiguration#launch(String)
+ * @see ILaunchConfiguration#launch(String, IProgressMonitor)
*/
- public ILaunch launch(String mode) throws CoreException {
- ILaunch launch = getDelegate().launch(this, mode);
+ public ILaunch launch(String mode, IProgressMonitor montior) throws CoreException {
+ ILaunch launch = getDelegate().launch(this, mode, montior);
if (launch != null) {
getLaunchManager().addLaunch(launch);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RelaunchActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RelaunchActionDelegate.java
index 42daf758a..217c0de22 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RelaunchActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RelaunchActionDelegate.java
@@ -121,7 +121,7 @@ public class RelaunchActionDelegate extends AbstractDebugActionDelegate {
return;
}
try {
- config.launch(mode);
+ config.launch(mode, null);
} catch (CoreException ce) {
DebugUIPlugin.logError(ce);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationDialog.java
index f8702d6f8..166523813 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationDialog.java
@@ -16,8 +16,10 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
@@ -25,6 +27,7 @@ import org.eclipse.debug.core.ILaunchConfigurationListener;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.model.IDebugElement;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
import org.eclipse.debug.ui.DebugUITools;
@@ -34,6 +37,7 @@ import org.eclipse.debug.ui.ILaunchConfigurationTab;
import org.eclipse.jface.dialogs.ControlEnableState;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.operation.ModalContext;
@@ -998,7 +1002,8 @@ public class LaunchConfigurationDialog extends TitleAreaDialog
// Take care of any unsaved changes. If the user aborts, reset selection
// to whatever it was previously selected
- if (!canReplaceWorkingCopy()) {
+ boolean canReplaceConfig = canReplaceWorkingCopy();
+ if (!canReplaceConfig) {
StructuredSelection prevSelection;
Object selectedTreeObject = getSelectedTreeObject();
if (selectedTreeObject == null) {
@@ -1017,7 +1022,7 @@ public class LaunchConfigurationDialog extends TitleAreaDialog
setLastSavedName(config.getName());
setLaunchConfiguration(config, false);
} else if (singleSelection && firstSelectedElement instanceof ILaunchConfigurationType) {
- if (canReplaceWorkingCopy()) {
+ if (canReplaceConfig) {
clearLaunchConfiguration();
setTabsForConfigType((ILaunchConfigurationType)firstSelectedElement);
getEditArea().setVisible(false);
@@ -1252,6 +1257,9 @@ public class LaunchConfigurationDialog extends TitleAreaDialog
if (workingCopy.getOriginal() == null) {
return true;
}
+ if (!workingCopy.isDirty()) {
+ return false;
+ }
updateWorkingCopyFromPages();
ILaunchConfiguration original = workingCopy.getOriginal();
return !original.contentsEqual(workingCopy);
@@ -1643,8 +1651,9 @@ public class LaunchConfigurationDialog extends TitleAreaDialog
}
}
- // Do the launch
- ILaunch launch = fUnderlyingConfig.launch(getMode());
+
+ ILaunch launch = launchWithProgress();
+
// notify pages
if (launch != null) {
ILaunchConfigurationTab[] tabs = getTabs();
@@ -1669,6 +1678,40 @@ public class LaunchConfigurationDialog extends TitleAreaDialog
return OK;
}
+ /**
+ * @return the resulting launch, or <code>null</code> if cancelled.
+ * @exception CoreException if an exception occurrs launching
+ */
+ private ILaunch launchWithProgress() throws CoreException {
+ final ILaunch[] launchResult = new ILaunch[1];
+ // Do the launch
+ IRunnableWithProgress runnable = new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) throws InvocationTargetException {
+ try {
+ launchResult[0] = fUnderlyingConfig.launch(getMode(), monitor);
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+ };
+ try {
+ run(true, true, runnable);
+ } catch (InterruptedException e) {
+ return null;
+ } catch (InvocationTargetException e) {
+ Throwable t = e.getTargetException();
+ if (t instanceof CoreException) {
+ throw (CoreException)t;
+ } else {
+ IStatus status = new Status(IStatus.ERROR, IDebugUIConstants.PLUGIN_ID, DebugException.INTERNAL_ERROR, "Exception occurred while launching.", t);
+ throw new CoreException(status);
+ }
+ }
+
+
+ return launchResult[0];
+ }
+
protected IPreferenceStore getPreferenceStore() {
return DebugUIPlugin.getDefault().getPreferenceStore();
}
@@ -1683,15 +1726,20 @@ public class LaunchConfigurationDialog extends TitleAreaDialog
* @see IRunnableContext#run(boolean, boolean, IRunnableWithProgress)
*/
public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
- // The operation can only be canceled if it is executed in a separate thread.
- // Otherwise the UI is blocked anyway.
- Object state = aboutToStart(fork && cancelable);
- fActiveRunningOperations++;
- try {
- ModalContext.run(runnable, fork, fProgressMonitorPart, getShell().getDisplay());
- } finally {
- fActiveRunningOperations--;
- stopped(state);
+ if (isVisible()) {
+ // The operation can only be canceled if it is executed in a separate thread.
+ // Otherwise the UI is blocked anyway.
+ Object state = aboutToStart(fork && cancelable);
+ fActiveRunningOperations++;
+ try {
+ ModalContext.run(runnable, fork, fProgressMonitorPart, getShell().getDisplay());
+ } finally {
+ fActiveRunningOperations--;
+ stopped(state);
+ }
+ } else {
+ ProgressMonitorDialog dialog = new ProgressMonitorDialog(DebugUIPlugin.getShell());
+ dialog.run(fork, cancelable, runnable);
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/PerspectiveManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/PerspectiveManager.java
index 60f61464c..c864d7253 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/PerspectiveManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/PerspectiveManager.java
@@ -131,10 +131,10 @@ public class PerspectiveManager implements ILaunchListener, IDebugEventListener
* @param id perspective identifier
*/
protected void switchToPerspective(final String id) {
- final IWorkbenchWindow window = DebugUIPlugin.getActiveWorkbenchWindow();
- if (window != null) {
- async(new Runnable() {
- public void run() {
+ async(new Runnable() {
+ public void run() {
+ IWorkbenchWindow window = DebugUIPlugin.getActiveWorkbenchWindow();
+ if (window != null) {
try {
window.getWorkbench().showPerspective(id, window);
} catch (WorkbenchException e) {
@@ -144,8 +144,8 @@ public class PerspectiveManager implements ILaunchListener, IDebugEventListener
e.getStatus());
}
}
- });
- }
+ }
+ });
}
/**

Back to the top