diff options
author | Andrew Ferrazzutti | 2014-05-29 14:28:09 +0000 |
---|---|---|
committer | Jeff Johnston | 2014-05-29 19:25:20 +0000 |
commit | 0d8ba5a29e4a80cd005e33003c9d37a24fee3c43 (patch) | |
tree | d1d655e3d0a8d11c40149a7fe43d150413f82104 | |
parent | cd2199e57810987ec949fb04369a17e62917d40a (diff) | |
download | org.eclipse.linuxtools-0d8ba5a29e4a80cd005e33003c9d37a24fee3c43.tar.gz org.eclipse.linuxtools-0d8ba5a29e4a80cd005e33003c9d37a24fee3c43.tar.xz org.eclipse.linuxtools-0d8ba5a29e4a80cd005e33003c9d37a24fee3c43.zip |
Systemtap: Restore public TapsetLibrary.init().
Restore the public initialization method for TapsetLibrary,
so that tapset contents can be loaded as soon as the Systemtap
plugin is loaded. Also implement a better means of forbidding
multiple initializations than what was done before.
Resolves EBZ #436169.
Change-Id: I7a771c78698d32cb24f94403fb4f9c648085a5b6
Signed-off-by: Andrew Ferrazzutti <aferrazz@redhat.com>
Reviewed-on: https://git.eclipse.org/r/27533
Tested-by: Hudson CI
Reviewed-by: Jeff Johnston <jjohnstn@redhat.com>
Tested-by: Jeff Johnston <jjohnstn@redhat.com>
2 files changed, 23 insertions, 17 deletions
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/IDEPlugin.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/IDEPlugin.java index bf9eeea4c0..6510dfd054 100644 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/IDEPlugin.java +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/IDEPlugin.java @@ -55,6 +55,7 @@ public class IDEPlugin extends AbstractUIPlugin { workbenchListener = new IDECloseMonitor(); plugin.getWorkbench().addWorkbenchListener(workbenchListener); + TapsetLibrary.init(); } /** diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/structures/TapsetLibrary.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/structures/TapsetLibrary.java index 833722a394..8cdcc4c87e 100644 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/structures/TapsetLibrary.java +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/structures/TapsetLibrary.java @@ -50,6 +50,8 @@ public final class TapsetLibrary { private static final IUpdateListener functionCompletionListener = new ParseCompletionListener(functionParser); private static final IUpdateListener probeCompletionListener = new ParseCompletionListener(probeParser); + private static boolean initialized = false; + public static TreeNode getProbes() { return probeTree; } @@ -139,19 +141,26 @@ public final class TapsetLibrary { return documentation; } - private static void init() { - IPreferenceStore preferenceStore = IDEPlugin.getDefault().getPreferenceStore(); - preferenceStore.addPropertyChangeListener(propertyChangeListener); - ConsoleLogPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(credentialChangeListener); - - functionParser.addListener(functionCompletionListener); - probeParser.addListener(probeCompletionListener); - - if (preferenceStore.getBoolean(IDEPreferenceConstants.P_STORED_TREE) - && isTreeFileCurrent()) { - readTreeFile(); - } else { - runStapParser(); + /** + * Initialize all listeners associated with loading tapset contents, and perform + * the first tapset load operation. Note that subsequent calls to this method will have no effect. + */ + public synchronized static void init() { + if (!initialized) { + initialized = true; + IPreferenceStore preferenceStore = IDEPlugin.getDefault().getPreferenceStore(); + preferenceStore.addPropertyChangeListener(propertyChangeListener); + ConsoleLogPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(credentialChangeListener); + + functionParser.addListener(functionCompletionListener); + probeParser.addListener(probeCompletionListener); + + if (preferenceStore.getBoolean(IDEPreferenceConstants.P_STORED_TREE) + && isTreeFileCurrent()) { + readTreeFile(); + } else { + runStapParser(); + } } } @@ -448,8 +457,4 @@ public final class TapsetLibrary { cacheProbeManpages.join(); } catch (InterruptedException e) {} } - - static { - init(); - } } |