diff options
author | Andrew Ferrazzutti | 2014-07-22 15:07:31 +0000 |
---|---|---|
committer | Jeff Johnston | 2014-08-15 22:29:00 +0000 |
commit | 74a99f1c9f3ee6aba26a31063a0ee23a8d2f5cb3 (patch) | |
tree | bc4e6e8404c8973233150ad0d567f6fb50a5b784 /systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/structures/TapsetLibrary.java | |
parent | 931bda546c3e30a7a42f24ca2c810479cfe98662 (diff) | |
download | org.eclipse.linuxtools-74a99f1c9f3ee6aba26a31063a0ee23a8d2f5cb3.tar.gz org.eclipse.linuxtools-74a99f1c9f3ee6aba26a31063a0ee23a8d2f5cb3.tar.xz org.eclipse.linuxtools-74a99f1c9f3ee6aba26a31063a0ee23a8d2f5cb3.zip |
Systemtap: Implement selective tapset loading.
When the list of imported tapsets is changed (with
Preferences->SystemTap->IDE->Tapsets), instead of
triggering a new tapset load operation to re-load
all tapset contents, only load in the newly-added
tapsets and delete the ones that were removed.
Change-Id: I3dac162704f2bee5fc30217c3578a098c66aa724
Signed-off-by: Andrew Ferrazzutti <aferrazz@redhat.com>
Reviewed-on: https://git.eclipse.org/r/31464
Tested-by: Hudson CI
Reviewed-by: Jeff Johnston <jjohnstn@redhat.com>
Tested-by: Jeff Johnston <jjohnstn@redhat.com>
Diffstat (limited to 'systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/structures/TapsetLibrary.java')
-rw-r--r-- | systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/structures/TapsetLibrary.java | 26 |
1 files changed, 22 insertions, 4 deletions
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 1902b5d5ba..e3a96c7b83 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 @@ -12,6 +12,9 @@ package org.eclipse.linuxtools.internal.systemtap.ui.ide.structures; import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import org.eclipse.core.runtime.jobs.IJobChangeEvent; import org.eclipse.core.runtime.jobs.Job; @@ -29,8 +32,6 @@ import org.eclipse.linuxtools.systemtap.ui.consolelog.internal.ConsoleLogPlugin; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.PlatformUI; - - /** * This class is used for obtaining all probes and functions from the tapsets. * If stored tapsets are in use, it will try to obtain the list from the TreeSettings memento. @@ -94,8 +95,9 @@ public final class TapsetLibrary { @Override public void propertyChange(PropertyChangeEvent event) { String property = event.getProperty(); - if (property.equals(IDEPreferenceConstants.P_TAPSETS) - || property.equals(PreferenceConstants.P_ENV.SYSTEMTAP_TAPSET.toPrefKey()) + if (property.equals(IDEPreferenceConstants.P_TAPSETS)) { + applyTapsetChanges((String) event.getOldValue(), (String) event.getNewValue()); + } else if (property.equals(PreferenceConstants.P_ENV.SYSTEMTAP_TAPSET.toPrefKey()) || property.equals(IDEPreferenceConstants.P_REMOTE_PROBES)) { runStapParser(); } else if (property.equals(IDEPreferenceConstants.P_STORED_TREE)) { @@ -155,6 +157,22 @@ public final class TapsetLibrary { probeParser.schedule(); } + private static void applyTapsetChanges(String oldTapsets, String newTapsets) { + List<String> oldList = Arrays.asList(oldTapsets.split(File.pathSeparator)); + List<String> newList = Arrays.asList(newTapsets.split(File.pathSeparator)); + List<String> additions = new ArrayList<>(newList); + additions.removeAll(oldList); + additions.remove(""); //$NON-NLS-1$ + List<String> deletions = new ArrayList<>(oldList); + deletions.removeAll(newList); + deletions.remove(""); //$NON-NLS-1$ + String[] additionArray = additions.toArray(new String[additions.size()]); + String[] deletionArray = deletions.toArray(new String[deletions.size()]); + SharedParser.getInstance().clearTapsetContents(); + probeParser.runUpdate(additionArray, deletionArray); + functionParser.runUpdate(additionArray, deletionArray); + } + private static void clearTrees() { if (functionTree != null) { functionTree.dispose(); |