Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawel Piech2012-08-30 17:22:54 +0000
committerPawel Piech2012-08-30 17:22:54 +0000
commita7933cebb9008430f78cb0a48e66007178723c95 (patch)
treeb2bef3064249fc4116dd40a4dccdeb156a97de9f
parent612faf0826c2d2c33aa15adbd8893faf51585ca0 (diff)
downloadeclipse.platform.debug-a7933cebb9008430f78cb0a48e66007178723c95.tar.gz
eclipse.platform.debug-a7933cebb9008430f78cb0a48e66007178723c95.tar.xz
eclipse.platform.debug-a7933cebb9008430f78cb0a48e66007178723c95.zip
Bug 388238 - NPE when calling DebugUIPlugin.launchInBackground() from non-UI thread
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.java1
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.properties1
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java17
3 files changed, 14 insertions, 5 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.java
index 4f2ad1628..44e4033ab 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.java
@@ -28,6 +28,7 @@ public class DebugUIMessages extends NLS {
public static String DebugUIPlugin_0;
public static String DebugUIPlugin_25;
+ public static String DebugUIPlugin_showProgressJob_label;
public static String DebugUIPlugin_Build_error__Check_log_for_details__2;
public static String DebugUIPlugin_Run_Debug_1;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.properties
index 8068829d2..4a5060340 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.properties
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.properties
@@ -14,6 +14,7 @@
DebugUIPlugin_23=Build in Progress
DebugUIPlugin_24=Wait for build to finish?
DebugUIPlugin_25=Launching {0}
+DebugUIPlugin_showProgressJob_label=Show progress for launch
DebugUIPlugin_0=\ (waiting for build...)
DebugUIPlugin_Build_error__Check_log_for_details__2=Build error. Check log for details.
DebugUIPlugin_Run_Debug_1=Run/Debug
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java
index 963cd7551..ff5e84d84 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java
@@ -108,6 +108,7 @@ import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.ui.progress.IProgressConstants2;
import org.eclipse.ui.progress.IProgressService;
+import org.eclipse.ui.progress.WorkbenchJob;
import org.eclipse.ui.services.IEvaluationService;
import org.eclipse.ui.themes.IThemeManager;
import org.osgi.framework.Bundle;
@@ -1179,7 +1180,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
}
}
final boolean waitInJob = wait;
- Job job = new Job(MessageFormat.format(DebugUIMessages.DebugUIPlugin_25, new Object[] {configuration.getName()})) {
+ final Job job = new Job(MessageFormat.format(DebugUIMessages.DebugUIPlugin_25, new Object[] {configuration.getName()})) {
public IStatus run(final IProgressMonitor monitor) {
/* Setup progress monitor
* - Waiting for jobs to finish (2)
@@ -1246,15 +1247,21 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
}
};
- IWorkbench workbench = DebugUIPlugin.getDefault().getWorkbench();
- IProgressService progressService = workbench.getProgressService();
-
job.setPriority(Job.INTERACTIVE);
job.setProperty(IProgressConstants2.SHOW_IN_TASKBAR_ICON_PROPERTY, Boolean.TRUE);
job.setName(MessageFormat.format(DebugUIMessages.DebugUIPlugin_25, new Object[] {configuration.getName()}));
if (wait) {
- progressService.showInDialog(workbench.getActiveWorkbenchWindow().getShell(), job);
+ new WorkbenchJob(DebugUIMessages.DebugUIPlugin_showProgressJob_label) {
+ { setPriority(INTERACTIVE); }
+
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ IWorkbench workbench = DebugUIPlugin.getDefault().getWorkbench();
+ IProgressService progressService = workbench.getProgressService();
+ progressService.showInDialog(null, job);
+ return Status.OK_STATUS;
+ }
+ }.schedule();
}
job.schedule();
}

Back to the top