1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

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>
This commit is contained in:
Pawel Piech 2012-09-04 11:22:37 -07:00
parent e1e09712b4
commit 6182eb107f

View file

@ -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 {