Search in sources :

Example 11 with ICpuModel

use of org.talend.designer.runtime.visualization.internal.core.cpu.ICpuModel in project tdi-studio-se by Talend.

the class FocusOnAction method aboutToShow.

/**
     * Notifies when menu is about to be shown.
     */
public void aboutToShow() {
    ICpuModel cpuModel = (ICpuModel) filteredTree.getViewer().getInput();
    boolean focused = cpuModel.getFocusTarget() != null;
    setChecked(focused);
    Object element = ((TreeSelection) filteredTree.getViewer().getSelection()).getFirstElement();
    // frame is selected on call tree
    if (element instanceof ICallTreeNode) {
        selectedNode = (ICallTreeNode) element;
        setEnabled(true);
        if (!focused) {
            updateMenu();
        }
        return;
    }
    if (filteredTree.getViewerType() == ViewerType.CallTree) {
        // thread node is selected on call tree
        selectedNode = null;
    } else {
        selectedNode = cpuModel.getFocusTarget();
    }
    setEnabled(focused);
    updateMenu();
}
Also used : ICallTreeNode(org.talend.designer.runtime.visualization.internal.core.cpu.ICallTreeNode) TreeSelection(org.eclipse.jface.viewers.TreeSelection) ICpuModel(org.talend.designer.runtime.visualization.internal.core.cpu.ICpuModel)

Example 12 with ICpuModel

use of org.talend.designer.runtime.visualization.internal.core.cpu.ICpuModel in project tdi-studio-se by Talend.

the class ShowCallersCalleesAction method run.

/*
     * @see Action#run()
     */
@Override
public void run() {
    ICpuModel cpuModel = (ICpuModel) treeViewer.getInput();
    cpuModel.setCallersCalleesTarget(callesCalleesTargetNode);
}
Also used : ICpuModel(org.talend.designer.runtime.visualization.internal.core.cpu.ICpuModel)

Example 13 with ICpuModel

use of org.talend.designer.runtime.visualization.internal.core.cpu.ICpuModel in project tdi-studio-se by Talend.

the class CpuDumpEditor method createCalleeViewer.

/**
     * Create the callee viewer.
     * 
     * @param parent The parent composite
     * @param page The page
     */
private void createCalleeViewer(Composite parent, int page) {
    final HotSpotsFilteredTree calleeFilteredTree = new HotSpotsFilteredTree(parent, getEditorSite().getActionBars()) {

        @Override
        public ViewerType getViewerType() {
            return ViewerType.Callee;
        }

        @Override
        protected String getMethodColumnName() {
            return org.talend.designer.runtime.visualization.internal.ui.properties.cpu.Messages.calleeColumnLabel;
        }

        @Override
        protected String getMethodColumnToolTip() {
            return org.talend.designer.runtime.visualization.internal.ui.properties.cpu.Messages.calleeColumnToolTip;
        }
    };
    TreeViewer calleeViewer = calleeFilteredTree.getViewer();
    calleeViewer.setContentProvider(new AbstractContentProvider() {

        @Override
        public Object[] getElements(Object inputElement) {
            if (inputElement instanceof ICpuModel) {
                return ((ICpuModel) inputElement).getCallees();
            }
            return new Object[0];
        }
    });
    calleeViewer.setLabelProvider(new HotSpotsLabelProvider(calleeFilteredTree));
    calleeViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            calleeFilteredTree.updateStatusLine((IStructuredSelection) event.getSelection());
        }
    });
    calleeViewer.setUseHashlookup(true);
    calleeViewer.setInput(cpuModel);
    calleeFilteredTree.sortColumn(calleeViewer.getTree().getColumn(1));
    trees.put(calleeFilteredTree, page);
}
Also used : HotSpotsFilteredTree(org.talend.designer.runtime.visualization.internal.ui.properties.cpu.HotSpotsFilteredTree) TreeViewer(org.eclipse.jface.viewers.TreeViewer) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) AbstractContentProvider(org.talend.designer.runtime.visualization.internal.ui.properties.cpu.AbstractContentProvider) HotSpotsLabelProvider(org.talend.designer.runtime.visualization.internal.ui.properties.cpu.HotSpotsLabelProvider) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ICpuModel(org.talend.designer.runtime.visualization.internal.core.cpu.ICpuModel)

Example 14 with ICpuModel

use of org.talend.designer.runtime.visualization.internal.core.cpu.ICpuModel in project tdi-studio-se by Talend.

the class CpuDumpEditor method createCallerViewer.

/**
     * Creates the caller viewer.
     * 
     * @param parent The parent composite
     * @param page The page
     */
private void createCallerViewer(Composite parent, int page) {
    final HotSpotsFilteredTree callerFilteredTree = new HotSpotsFilteredTree(parent, getEditorSite().getActionBars()) {

        @Override
        public ViewerType getViewerType() {
            return ViewerType.Caller;
        }

        @Override
        protected String getMethodColumnName() {
            return org.talend.designer.runtime.visualization.internal.ui.properties.cpu.Messages.callerColumnLabel;
        }

        @Override
        protected String getMethodColumnToolTip() {
            return org.talend.designer.runtime.visualization.internal.ui.properties.cpu.Messages.callerColumnToolTip;
        }
    };
    TreeViewer callerViewer = callerFilteredTree.getViewer();
    callerViewer.setContentProvider(new AbstractContentProvider() {

        @Override
        public Object[] getElements(Object inputElement) {
            if (inputElement instanceof ICpuModel) {
                return ((ICpuModel) inputElement).getCallers();
            }
            return new Object[0];
        }
    });
    callerViewer.setLabelProvider(new HotSpotsLabelProvider(callerFilteredTree));
    callerViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            callerFilteredTree.updateStatusLine((IStructuredSelection) event.getSelection());
        }
    });
    callerViewer.setUseHashlookup(true);
    callerViewer.setInput(cpuModel);
    callerFilteredTree.sortColumn(callerViewer.getTree().getColumn(1));
    trees.put(callerFilteredTree, page);
}
Also used : HotSpotsFilteredTree(org.talend.designer.runtime.visualization.internal.ui.properties.cpu.HotSpotsFilteredTree) TreeViewer(org.eclipse.jface.viewers.TreeViewer) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) AbstractContentProvider(org.talend.designer.runtime.visualization.internal.ui.properties.cpu.AbstractContentProvider) HotSpotsLabelProvider(org.talend.designer.runtime.visualization.internal.ui.properties.cpu.HotSpotsLabelProvider) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ICpuModel(org.talend.designer.runtime.visualization.internal.core.cpu.ICpuModel)

Aggregations

ICpuModel (org.talend.designer.runtime.visualization.internal.core.cpu.ICpuModel)14 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)6 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)6 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)6 TreeViewer (org.eclipse.jface.viewers.TreeViewer)6 ICallTreeNode (org.talend.designer.runtime.visualization.internal.core.cpu.ICallTreeNode)4 IMenuManager (org.eclipse.jface.action.IMenuManager)3 Separator (org.eclipse.jface.action.Separator)3 AbstractContentProvider (org.talend.designer.runtime.visualization.internal.ui.properties.cpu.AbstractContentProvider)3 HotSpotsFilteredTree (org.talend.designer.runtime.visualization.internal.ui.properties.cpu.HotSpotsFilteredTree)3 HotSpotsLabelProvider (org.talend.designer.runtime.visualization.internal.ui.properties.cpu.HotSpotsLabelProvider)3 ConfigureCpuProfilerAction (org.talend.designer.runtime.visualization.internal.ui.properties.cpu.actions.ConfigureCpuProfilerAction)3 IMethodNode (org.talend.designer.runtime.visualization.internal.core.cpu.IMethodNode)2 TreeSelection (org.eclipse.jface.viewers.TreeSelection)1 FillLayout (org.eclipse.swt.layout.FillLayout)1 Composite (org.eclipse.swt.widgets.Composite)1 IThreadNode (org.talend.designer.runtime.visualization.internal.core.cpu.IThreadNode)1 ITreeNode (org.talend.designer.runtime.visualization.internal.core.cpu.ITreeNode)1 ViewerType (org.talend.designer.runtime.visualization.internal.ui.properties.cpu.AbstractFilteredTree.ViewerType)1