Search in sources :

Example 1 with ICompletable

use of org.eclipse.linuxtools.internal.systemtap.ui.ide.structures.nodedata.ICompletable in project linuxtools by eclipse.

the class STPMetadataSingleton method getMatchingChildren.

private TreeNode[] getMatchingChildren(TreeNode node, String prefix) {
    ArrayList<TreeNode> matches = new ArrayList<>();
    for (int i = 0, n = node.getChildCount(); i < n; i++) {
        TreeNode childNode = node.getChildAt(i);
        String childName;
        if (childNode.getData() instanceof ICompletable) {
            childName = ((ICompletable) childNode.getData()).getCompletionText();
        } else {
            childName = childNode.toString();
        }
        if (childName.startsWith(prefix)) {
            matches.add(childNode);
        }
    }
    return matches.toArray(new TreeNode[0]);
}
Also used : ICompletable(org.eclipse.linuxtools.internal.systemtap.ui.ide.structures.nodedata.ICompletable) TreeNode(org.eclipse.linuxtools.systemtap.structures.TreeNode) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)1 ICompletable (org.eclipse.linuxtools.internal.systemtap.ui.ide.structures.nodedata.ICompletable)1 TreeNode (org.eclipse.linuxtools.systemtap.structures.TreeNode)1