use of org.eclipse.linuxtools.internal.systemtap.ui.ide.structures.nodedata.ProbevarNodeData in project linuxtools by eclipse.
the class STPMetadataSingleton method isVariableInProbe.
public boolean isVariableInProbe(String probe, String variable) {
TreeNode node = getProbeAlias(probe);
if (node == null) {
return false;
}
for (int i = 0, n = node.getChildCount(); i < n; i++) {
TreeNode child = node.getChildAt(i);
String nodeVar = ((ProbevarNodeData) child.getData()).getCompletionText();
if (nodeVar.equals(variable)) {
return true;
}
}
return false;
}
use of org.eclipse.linuxtools.internal.systemtap.ui.ide.structures.nodedata.ProbevarNodeData in project linuxtools by eclipse.
the class TreeSettingsTest method testStapNodeData.
@Test
public void testStapNodeData() {
TreeNode temp;
TreeNode t1 = new TreeNode(new FunctionNodeData("function ftest(x:long)", null), true);
t1.add(new TreeNode(new FuncparamNodeData("long"), "x", false));
TreeNode t2 = new TreeNode(new ProbeNodeData("ptest"), true);
t2.add(new TreeNode(new ProbevarNodeData("x:long"), false));
TreeSettings.setTrees(t1, t2);
temp = TreeSettings.getFunctionTree();
assertTrue("Improper data type - expected FunctionNodeData but was " + temp.getData().getClass().getSimpleName(), temp.getData() instanceof FunctionNodeData);
assertEquals("Function data not saved", t1.getData().toString(), temp.getData().toString());
assertEquals("Funcs has children", t1.getChildCount(), temp.getChildCount());
assertTrue("Improper data type", temp.getChildAt(0).getData() instanceof FuncparamNodeData);
assertEquals("Function parameter data not saved", t1.getChildAt(0).getData().toString(), temp.getChildAt(0).getData().toString());
temp = TreeSettings.getProbeTree();
assertTrue("Improper data type", temp.getData() instanceof ProbeNodeData);
assertEquals("Probe data not saved", t2.getData().toString(), temp.getData().toString());
assertEquals("Probs has children", t2.getChildCount(), temp.getChildCount());
assertTrue("Improper data type", temp.getChildAt(0).getData() instanceof ProbevarNodeData);
assertEquals("Probe variable data not saved", t2.getChildAt(0).getData().toString(), temp.getChildAt(0).getData().toString());
}
use of org.eclipse.linuxtools.internal.systemtap.ui.ide.structures.nodedata.ProbevarNodeData in project linuxtools by eclipse.
the class TestCreateSystemtapScript method prepareTreeSettings.
/**
* Load custom contents into the Function/Probe views.
*/
private static void prepareTreeSettings() {
TapsetLibrary.stop();
try {
probeDef = File.createTempFile("probeDef", ".stp");
funcDef = File.createTempFile("funcDef", ".stp");
probeDef.deleteOnExit();
funcDef.deleteOnExit();
} catch (IOException e) {
}
// Leave one of the files blank to test token search failures.
try (PrintWriter writer = new PrintWriter(probeDef)) {
writer.print("test file\nptest\nlast line\n");
} catch (FileNotFoundException e) {
}
TreeNode testProbNodeParent = new TreeNode(null, false);
// Have static/alias folders to comply with convention (change this later).
testProbNodeParent.add(new TreeNode(probeCategoryEmpty, true));
testProbNodeParent.add(new TreeNode(probeCategoryFull, true));
TreeNode testProbNodeGroup = new TreeNode(probeGroup, true);
String innerProbe = "probegroup.inner";
TreeNode testProbNode = new TreeDefinitionNode(new ProbeNodeData(innerProbe), innerProbe, probeDef.getPath(), true);
testProbNode.add(new TreeNode(new ProbevarNodeData("s:string"), false));
testProbNodeGroup.add(testProbNode);
testProbNodeParent.getChildAt(1).add(testProbNodeGroup);
TreeNode testProbNode2 = new TreeDefinitionNode(new ProbeNodeData(probeSingleWithoutDef), probeSingleWithoutDef, null, true);
testProbNodeParent.getChildAt(1).add(testProbNode2);
TreeNode testFuncNodeParent = new TreeNode(null, false);
TreeNode testFuncNode = new TreeDefinitionNode(new FunctionNodeData("function ftest(x:long)", null), funcNodeName, funcDef.getPath(), true);
testFuncNode.add(new TreeNode(new FuncparamNodeData("long"), "x", false));
testFuncNodeParent.add(testFuncNode);
TreeSettings.setTrees(testFuncNodeParent, testProbNodeParent);
TapsetLibrary.readTreeFile();
}
Aggregations