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 | |
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')
3 files changed, 26 insertions, 4 deletions
diff --git a/plugins/org.eclipse.tcf.debug.ui/plugin.xml b/plugins/org.eclipse.tcf.debug.ui/plugin.xml index 10ce7735f..705d94a37 100644 --- a/plugins/org.eclipse.tcf.debug.ui/plugin.xml +++ b/plugins/org.eclipse.tcf.debug.ui/plugin.xml @@ -18,8 +18,6 @@ <extension-point id="presentation_provider" name="TCF Presentation Provider" schema="schema/presentation_provider.exsd"/> <extension-point id="pretty_expression_provider" name="TCF Pretty Expression Provider" schema="schema/pretty_expression_provider.exsd"/> - <extension point="org.eclipse.tcf.startup"/> - <extension id="org.eclipse.tcf.debug.ui.adapters" point="org.eclipse.core.runtime.adapters"> diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFModelManager.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFModelManager.java index 17b4f846f..1df6f12b6 100644 --- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFModelManager.java +++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFModelManager.java @@ -156,7 +156,8 @@ public class TCFModelManager { assert Protocol.isDispatchThread(); try { PlatformUI.getWorkbench().addWorkbenchListener(workbench_listener); - } catch (IllegalStateException e) { + } + catch (IllegalStateException e) { // In headless environments the plug-in load can be still triggered. // Should not trigger an "Unhandled exception in TCF event dispatch thread" } @@ -168,7 +169,8 @@ public class TCFModelManager { assert Protocol.isDispatchThread(); try { PlatformUI.getWorkbench().removeWorkbenchListener(workbench_listener); - } catch (IllegalStateException e) { + } + catch (IllegalStateException e) { // In headless environments the plug-in load can be still triggered. // Should not trigger an "Unhandled exception in TCF event dispatch thread" } 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. |