use of org.talend.designer.runtime.visualization.internal.core.cpu.ITreeNode in project tdi-studio-se by Talend.
the class FindDialog method getSelectedNode.
/**
* Gets the selected node.
*
* @param viewer The tree viewer
* @return The selected node
*/
private static ITreeNode getSelectedNode(TreeViewer viewer) {
ISelection selection = viewer.getSelection();
if (selection instanceof TreeSelection) {
TreeSelection treeSelection = (TreeSelection) selection;
Object element = treeSelection.getFirstElement();
if (element instanceof ITreeNode) {
return (ITreeNode) element;
}
}
return null;
}
use of org.talend.designer.runtime.visualization.internal.core.cpu.ITreeNode in project tdi-studio-se by Talend.
the class CpuSection method getTargetTreeNodes.
@Override
public ITreeNode[] getTargetTreeNodes() {
ITreeNode[] nodes = new ITreeNode[0];
if (activeFilteredTree == null) {
return nodes;
}
ViewerType viewerType = activeFilteredTree.getViewerType();
ICpuModel cpuModel = (ICpuModel) activeFilteredTree.getViewer().getInput();
if (viewerType == ViewerType.CallTree) {
nodes = cpuModel.getCallTreeRoots();
} else if (viewerType == ViewerType.HotSpots) {
nodes = cpuModel.getHotSpotRoots();
} else if (viewerType == ViewerType.Caller) {
nodes = cpuModel.getCallers();
} else if (viewerType == ViewerType.Callee) {
nodes = cpuModel.getCallees();
}
return nodes;
}
use of org.talend.designer.runtime.visualization.internal.core.cpu.ITreeNode in project tdi-studio-se by Talend.
the class FindDialog method doFind.
/**
* Finds the item with string specified in text field.
*/
void doFind() {
IFindTarget target = getFindTarget();
if (target == null) {
return;
}
TreeViewer viewer = target.getTargetTreeViewer();
ITreeNode[] rootNodes = target.getTargetTreeNodes();
if (viewer == null || rootNodes.length == 0) {
return;
}
String searchText = findText.getText();
addHistory(searchText);
ITreeNode treeNode = null;
ITreeNode selectedNode = getSelectedNode(viewer);
startSearch = (selectedNode == null);
if (forwardButton.getSelection()) {
treeNode = searchTreeNodeInForward(viewer, rootNodes, selectedNode, searchText);
} else {
treeNode = searchTreeNodeInBackward(viewer, rootNodes, selectedNode, searchText);
}
if (treeNode != null) {
ISelection newSelection = new StructuredSelection(treeNode);
viewer.setSelection(newSelection);
}
findButton.forceFocus();
}
use of org.talend.designer.runtime.visualization.internal.core.cpu.ITreeNode in project tdi-studio-se by Talend.
the class CpuDumpEditor method getTargetTreeNodes.
/*
* @see FindAction.IFindTarget#getTargetTreeNodes()
*/
@Override
public ITreeNode[] getTargetTreeNodes() {
ITreeNode[] nodes = new ITreeNode[0];
AbstractFilteredTree activeFilteredTree = getActiveFilteredTree();
if (activeFilteredTree == null) {
return nodes;
}
ViewerType viewerType = activeFilteredTree.getViewerType();
if (viewerType == ViewerType.CallTree) {
nodes = cpuModel.getCallTreeRoots();
} else if (viewerType == ViewerType.HotSpots) {
nodes = cpuModel.getHotSpotRoots();
} else if (viewerType == ViewerType.Caller) {
nodes = cpuModel.getCallers();
} else if (viewerType == ViewerType.Callee) {
nodes = cpuModel.getCallees();
}
return nodes;
}
Aggregations