summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawel Piech2012-09-04 14:22:37 (EDT)
committer Pawel Piech2012-09-04 18:30:36 (EDT)
commit6182eb107f0f7e5ca58c5fe6117bfd0f7ff4fc8f (patch)
treefc706a8dd2a09ff51551d90c9f208eb79b84d8d8
parente1e09712b4a7dfb58bd8ffe1e33294f6bdb28df9 (diff)
downloadorg.eclipse.cdt-6182eb107f0f7e5ca58c5fe6117bfd0f7ff4fc8f.zip
org.eclipse.cdt-6182eb107f0f7e5ca58c5fe6117bfd0f7ff4fc8f.tar.gz
org.eclipse.cdt-6182eb107f0f7e5ca58c5fe6117bfd0f7ff4fc8f.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>
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/ExternalToolAction.java29
1 files changed, 26 insertions, 3 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 16a683c..47c6845 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,22 +30,46 @@ 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$
- @Override
- public IStatus execute(IBreakpoint breakpoint, IAdaptable context, IProgressMonitor monitor) {
+ @Override
+ 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 {