diff options
author | Eugene Tarassov | 2015-04-30 02:36:59 +0000 |
---|---|---|
committer | Eugene Tarassov | 2015-04-30 02:36:59 +0000 |
commit | 37a044c9d72df50775bcb186e00cf3c2bb5c384c (patch) | |
tree | 5168d0331618ad82691810d8da58a612f0e60e56 /plugins/org.eclipse.tcf.debug | |
parent | d57a570757a9b6ae3ecc8c96701b53745546def7 (diff) | |
download | org.eclipse.tcf-37a044c9d72df50775bcb186e00cf3c2bb5c384c.tar.gz org.eclipse.tcf-37a044c9d72df50775bcb186e00cf3c2bb5c384c.tar.xz org.eclipse.tcf-37a044c9d72df50775bcb186e00cf3c2bb5c384c.zip |
Bug 465756 - TCFModelManager does not register its workbench listener
Diffstat (limited to 'plugins/org.eclipse.tcf.debug')
-rw-r--r-- | plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/launch/TCFLaunchDelegate.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/launch/TCFLaunchDelegate.java b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/launch/TCFLaunchDelegate.java index fbfec6d34..7c062f549 100644 --- a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/launch/TCFLaunchDelegate.java +++ b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/launch/TCFLaunchDelegate.java @@ -24,6 +24,7 @@ import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunch; @@ -40,6 +41,7 @@ import org.eclipse.tcf.services.IMemoryMap; import org.eclipse.tcf.services.IPathMap; import org.eclipse.tcf.util.TCFPathMapRule; import org.eclipse.tcf.util.TCFTask; +import org.osgi.framework.Bundle; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; @@ -84,6 +86,9 @@ public class TCFLaunchDelegate extends LaunchConfigurationDelegate { FILES_SET_PC = "SetPC", FILES_ENABLE_OSA = "EnableOSA"; + private static Boolean is_headless; + private static boolean ui_activation_done; + public static class PathMapRule extends TCFPathMapRule { public PathMapRule(Map<String,Object> props) { @@ -334,6 +339,23 @@ public class TCFLaunchDelegate extends LaunchConfigurationDelegate { return new TCFTask<ILaunch>() { int cnt; public void run() { + if (is_headless == null) { + Bundle b = Platform.getBundle("org.eclipse.ui.workbench"); + is_headless = new Boolean(b == null || b.getState() != Bundle.ACTIVE); + } + + if (!is_headless && !ui_activation_done) { + /* Make sure UI bundle is activated and is listening for launch events */ + try { + Bundle bundle = Platform.getBundle("org.eclipse.tcf.debug.ui"); + bundle.start(Bundle.START_TRANSIENT); + } + catch (Throwable x) { + Protocol.log("TCF debugger UI startup error", x); //$NON-NLS-1$ + } + ui_activation_done = true; + } + // Need to delay at least one dispatch cycle to work around // a possible racing between thread that calls getLaunch() and // the process of activation of other TCF plug-ins. |