Search in sources :

Example 1 with ITreeNode

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;
}
Also used : ITreeNode(org.talend.designer.runtime.visualization.internal.core.cpu.ITreeNode) TreeSelection(org.eclipse.jface.viewers.TreeSelection) ISelection(org.eclipse.jface.viewers.ISelection)

Example 2 with ITreeNode

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;
}
Also used : ITreeNode(org.talend.designer.runtime.visualization.internal.core.cpu.ITreeNode) ViewerType(org.talend.designer.runtime.visualization.internal.ui.properties.cpu.AbstractFilteredTree.ViewerType) ICpuModel(org.talend.designer.runtime.visualization.internal.core.cpu.ICpuModel)

Example 3 with ITreeNode

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();
}
Also used : IFindTarget(org.talend.designer.runtime.visualization.internal.ui.properties.cpu.actions.FindAction.IFindTarget) ITreeNode(org.talend.designer.runtime.visualization.internal.core.cpu.ITreeNode) TreeViewer(org.eclipse.jface.viewers.TreeViewer) ISelection(org.eclipse.jface.viewers.ISelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection)

Example 4 with ITreeNode

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;
}
Also used : ITreeNode(org.talend.designer.runtime.visualization.internal.core.cpu.ITreeNode) AbstractFilteredTree(org.talend.designer.runtime.visualization.internal.ui.properties.cpu.AbstractFilteredTree) ViewerType(org.talend.designer.runtime.visualization.internal.ui.properties.cpu.AbstractFilteredTree.ViewerType)

Aggregations

ITreeNode (org.talend.designer.runtime.visualization.internal.core.cpu.ITreeNode)4 ISelection (org.eclipse.jface.viewers.ISelection)2 ViewerType (org.talend.designer.runtime.visualization.internal.ui.properties.cpu.AbstractFilteredTree.ViewerType)2 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 TreeSelection (org.eclipse.jface.viewers.TreeSelection)1 TreeViewer (org.eclipse.jface.viewers.TreeViewer)1 ICpuModel (org.talend.designer.runtime.visualization.internal.core.cpu.ICpuModel)1 AbstractFilteredTree (org.talend.designer.runtime.visualization.internal.ui.properties.cpu.AbstractFilteredTree)1 IFindTarget (org.talend.designer.runtime.visualization.internal.ui.properties.cpu.actions.FindAction.IFindTarget)1