summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawel Piech2012-09-04 14:22:37 (EDT)
committer Pawel Piech2012-09-04 18:11:59 (EDT)
commit69140987c1fb3daa23cdec31fcc16f96c5367375 (patch)
tree330d09bfe89815b7529a9bc0a6a79e0559b82f02
parent2507788546f39c44598ba5b97538b960cb85f804 (diff)
downloadorg.eclipse.cdt-69140987c1fb3daa23cdec31fcc16f96c5367375.zip
org.eclipse.cdt-69140987c1fb3daa23cdec31fcc16f96c5367375.tar.gz
org.eclipse.cdt-69140987c1fb3daa23cdec31fcc16f96c5367375.tar.bz2
Bug 388238 - NPE when calling DebugUIPlugin.launchInBackground()
from non-UI thread Change-Id: Id65086ab6dcc8ec2efa1e66fb5bae48154add7cc Reviewed-on: https://git.eclipse.org/r/7602 Reviewed-by: Marc Khouzam <marc.khouzam@ericsson.com> IP-Clean: Marc Khouzam <marc.khouzam@ericsson.com> Tested-by: Marc Khouzam <marc.khouzam@ericsson.com> Conflicts: debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/ExternalToolAction.java
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/ExternalToolAction.java27
1 files changed, 25 insertions, 2 deletions
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/ExternalToolAction.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/ExternalToolAction.java
index aa5942f..e12eb69 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/ExternalToolAction.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/ExternalToolAction.java
@@ -12,7 +12,6 @@ package org.eclipse.cdt.debug.ui.breakpointactions;
import java.io.ByteArrayOutputStream;
import java.io.StringReader;
-import com.ibm.icu.text.MessageFormat;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -31,21 +30,45 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.ui.progress.WorkbenchJob;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.InputSource;
import org.xml.sax.helpers.DefaultHandler;
+import com.ibm.icu.text.MessageFormat;
+
public class ExternalToolAction extends AbstractBreakpointAction {
private String externalToolName = ""; //$NON-NLS-1$
- public IStatus execute(IBreakpoint breakpoint, IAdaptable context, IProgressMonitor monitor) {
+ public IStatus execute(final IBreakpoint breakpoint, final IAdaptable context, final IProgressMonitor monitor) {
+ Job uiJob = new WorkbenchJob("ExternalToolAction") { //$NON-NLS-1$
+ {
+ setPriority(INTERACTIVE);
+ }
+
+ @Override
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ return executeInUIThread(breakpoint, context, monitor);
+ }
+ };
+ uiJob.schedule();
+ try {
+ uiJob.join();
+ } catch (InterruptedException e) {
+ return Status.CANCEL_STATUS;
+ }
+ return uiJob.getResult();
+ }
+
+ private IStatus executeInUIThread(IBreakpoint breakpoint, IAdaptable context, IProgressMonitor monitor) {
IStatus errorStatus = null;
ILaunchManager lcm = DebugPlugin.getDefault().getLaunchManager();
try {