Skip to content
This repository has been archived by the owner on Apr 3, 2018. It is now read-only.

Commit

Permalink
LANG: start debug plugin only when editor loaded.
Browse files Browse the repository at this point in the history
  • Loading branch information
bruno-medeiros committed Oct 27, 2015
1 parent 53ce44a commit ec7df84
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
Expand Up @@ -48,7 +48,11 @@ public static IWorkspace getWorkspace() {
public static void startOtherPlugin(String pluginId) {
try {
Bundle debugPlugin = Platform.getBundle(pluginId);
if(debugPlugin != null && debugPlugin.getState() != Bundle.STARTING) {
if(debugPlugin == null) {
LangCore.logError("Error trying to start plugin `" + pluginId + "`: plugin not found.");
return;
}
if(debugPlugin.getState() != Bundle.STARTING) {
debugPlugin.start(Bundle.START_TRANSIENT);
}
} catch (BundleException e) {
Expand Down
11 changes: 8 additions & 3 deletions plugin_ide.ui/src-lang/melnorme/lang/ide/ui/LangUIPlugin.java
Expand Up @@ -81,9 +81,14 @@ protected void doCustomStart_initialStage(BundleContext context) {

/** Start twined plugins after initial stage. */
protected void doCustomStart_startTwinPlugins() {
// Force start of debug plugin, if present, so that UI contributions will be fully active.
// ATM, some UI contributions that dynamically manipulate enablement and state don't work correctly
// unless underlying plugin is started.
// Commented out, editor is now the one that starting the debug plugin
// startDebugPlugin();
}

// Force start of debug plugin, if present, so that UI contributions will be fully active.
// ATM, some UI contributions that dynamically manipulate enablement and state don't work correctly
// unless underlying plugin is started.
public static void startDebugPlugin() {
EclipseUtils.startOtherPlugin(LangUIPlugin_Actual.DEBUG_PLUGIN_ID);
}

Expand Down
Expand Up @@ -52,6 +52,10 @@ public abstract class AbstractLangEditor extends TextEditorExt {

public AbstractLangEditor() {
super();

// Force start debug plugin to ensure action contributions are propagated.
// XXX: Definitely there should be a better way to achieve the above, but it's tricky.
LangUIPlugin.startDebugPlugin();
}

@Override
Expand Down

0 comments on commit ec7df84

Please sign in to comment.