Search in sources :

Example 6 with TreeNode

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;
}
Also used : TreeNode(org.eclipse.linuxtools.systemtap.structures.TreeNode)

Example 7 with TreeNode

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;
    }
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) TreeNode(org.eclipse.linuxtools.systemtap.structures.TreeNode)

Example 8 with TreeNode

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);
}
Also used : TreeNode(org.eclipse.linuxtools.systemtap.structures.TreeNode)

Example 9 with TreeNode

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;
}
Also used : TreeNode(org.eclipse.linuxtools.systemtap.structures.TreeNode) LinkedList(java.util.LinkedList)

Example 10 with TreeNode

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);
}
Also used : TreeNode(org.eclipse.linuxtools.systemtap.structures.TreeNode)

Aggregations

TreeNode (org.eclipse.linuxtools.systemtap.structures.TreeNode)34 Test (org.junit.Test)15 TreeDefinitionNode (org.eclipse.linuxtools.systemtap.structures.TreeDefinitionNode)4 Scanner (java.util.Scanner)3 ICompletionProposal (org.eclipse.jface.text.contentassist.ICompletionProposal)3 ProbevarNodeData (org.eclipse.linuxtools.internal.systemtap.ui.ide.structures.nodedata.ProbevarNodeData)3 ArrayList (java.util.ArrayList)2 IFileStore (org.eclipse.core.filesystem.IFileStore)2 FuncparamNodeData (org.eclipse.linuxtools.internal.systemtap.ui.ide.structures.nodedata.FuncparamNodeData)2 FunctionNodeData (org.eclipse.linuxtools.internal.systemtap.ui.ide.structures.nodedata.FunctionNodeData)2 ProbeNodeData (org.eclipse.linuxtools.internal.systemtap.ui.ide.structures.nodedata.ProbeNodeData)2 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 PrintWriter (java.io.PrintWriter)1 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1 Map (java.util.Map)1 StringTokenizer (java.util.StringTokenizer)1 Matcher (java.util.regex.Matcher)1 IStatus (org.eclipse.core.runtime.IStatus)1