use of org.eclipse.linuxtools.systemtap.structures.TreeNode in project linuxtools by eclipse.
the class ProbeParser method addOrFindProbeGroup.
/**
* Finds the appropriate parent group node for a probe alias to group probes by name.
* If it doesn't yet exist, create it and add it to the view's tree.
* @param groupName The name of the probe group.
* @param groupNode For optimization, pass an existing group node here, as it will be
* used if the probe belongs in it. Otherwise, or if <code>null</code> is passed, a new one will be created.
* @param category The parent tree node in which to put the group node.
* @return The found or created group node that will be the parent of the probe's entry item in the view.
*/
private TreeNode addOrFindProbeGroup(String groupName, TreeNode groupNode, TreeNode category) {
// probe list is sorted... mostly.
if (groupNode == null || !groupNode.toString().equals(groupName)) {
groupNode = category.getChildByName(groupName);
}
// Create a new group and add it
if (groupNode == null) {
groupNode = new TreeNode(groupName, true);
category.add(groupNode);
}
return groupNode;
}
use of org.eclipse.linuxtools.systemtap.structures.TreeNode in project linuxtools by eclipse.
the class TreeTapsetParser method run.
/**
* Prepares the parser for a run. Clients must override this method to perform
* actions during the run; a call to super.run() is necessary.
*/
@Override
protected final synchronized IStatus run(IProgressMonitor monitor) {
IStatus result;
if (forcedTree != null) {
if (isValidTree(forcedTree)) {
tree = forcedTree;
result = createStatus(IStatus.OK);
} else {
result = createStatus(IStatus.ERROR, Messages.TapsetParser_ErrorInvalidTapsetTree);
}
forcedTree = null;
} else if (tapsetChanges != null) {
result = performUpdate(monitor);
} else {
tree = new TreeNode(null, false);
result = createStatus(runAction(monitor));
}
synchronized (lock) {
return result;
}
}
use of org.eclipse.linuxtools.systemtap.structures.TreeNode in project linuxtools by eclipse.
the class BrowserView method displayMessage.
protected void displayMessage(String message) {
TreeNode tree = new TreeNode(null, false);
tree.add(new TreeNode(message, false));
setViewerInput(tree);
}
use of org.eclipse.linuxtools.systemtap.structures.TreeNode in project linuxtools by eclipse.
the class STPMetadataSingleton method getProbeCompletions.
public TreeNode[] getProbeCompletions(String prefix) {
List<TreeNode> matches = new LinkedList<>();
String groupName = extractProbeGroupName(prefix);
for (TreeNode node : TapsetLibrary.getProbeCategoryNodes()) {
TreeNode groupNode = node.getChildByName(groupName);
if (groupNode != null) {
node = groupNode;
}
matches.addAll(Arrays.asList(getMatchingChildren(node, prefix)));
}
return !matches.isEmpty() ? matches.toArray(new TreeNode[matches.size()]) : NO_MATCHES;
}
use of org.eclipse.linuxtools.systemtap.structures.TreeNode in project linuxtools by eclipse.
the class STPMetadataSingleton method getProbeAlias.
public TreeNode getProbeAlias(String probe) {
TreeNode node = TapsetLibrary.getProbeAliases();
if (node == null) {
return null;
}
node = node.getChildByName(extractProbeGroupName(probe));
if (node == null) {
return null;
}
return node.getChildByName(probe);
}
Aggregations