Search in sources :

Example 6 with ICpuModel

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

the class FocusOnAction method run.

/*
     * @see Action#run()
     */
@Override
public void run() {
    ICpuModel cpuModel = (ICpuModel) filteredTree.getViewer().getInput();
    boolean focused = cpuModel.getFocusTarget() != null;
    if (!focused) {
        cpuModel.setFocusTarget(selectedNode);
    } else {
        cpuModel.setFocusTarget(null);
        updateMenu();
    }
    filteredTree.getViewer().refresh();
}
Also used : ICpuModel(org.talend.designer.runtime.visualization.internal.core.cpu.ICpuModel)

Example 7 with ICpuModel

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

the class CallerCalleeTabPage method createCalleeViewer.

/**
     * Creates the callee viewer.
     * 
     * @param parent The parent composite
     * @param propertySheet The property sheet
     */
private void createCalleeViewer(Composite parent, PropertySheet propertySheet) {
    calleeFilteredTree = new HotSpotsFilteredTree(parent, propertySheet.getViewSite().getActionBars()) {

        @Override
        protected void addMenus(IMenuManager manager) {
            manager.add(new Separator());
            manager.add(new ConfigureCpuProfilerAction(cpuSection));
        }

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

        @Override
        protected String getMethodColumnName() {
            return Messages.calleeColumnLabel;
        }

        @Override
        protected String getMethodColumnToolTip() {
            return 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());
        }
    });
    calleeFilteredTree.sortColumn(calleeViewer.getTree().getColumn(1));
}
Also used : TreeViewer(org.eclipse.jface.viewers.TreeViewer) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ICpuModel(org.talend.designer.runtime.visualization.internal.core.cpu.ICpuModel) ConfigureCpuProfilerAction(org.talend.designer.runtime.visualization.internal.ui.properties.cpu.actions.ConfigureCpuProfilerAction) IMenuManager(org.eclipse.jface.action.IMenuManager) Separator(org.eclipse.jface.action.Separator)

Example 8 with ICpuModel

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

the class CallerCalleeTabPage method refreshContentDescription.

/**
     * Refreshes the content description.
     */
private void refreshContentDescription() {
    if (jvm == null) {
        return;
    }
    StringBuilder description = new StringBuilder();
    IMethodNode callersCalleesTarget = jvm.getCpuProfiler().getCpuModel().getCallersCalleesTarget();
    if (callersCalleesTarget != null) {
        description.append(NLS.bind(Messages.callersCalleesTargetIndicator, callersCalleesTarget.getName()));
    }
    ICpuModel cpuModel = jvm.getCpuProfiler().getCpuModel();
    ICallTreeNode focusedNode = cpuModel.getFocusTarget();
    if (focusedNode != null) {
        if (callersCalleesTarget != null) {
            description.append(NLS.bind(Messages.focusTargetIndicator, focusedNode.getNonqualifiedName()));
        }
    }
    String thread = null;
    if (focusedNode != null) {
        thread = focusedNode.getThread();
    } else if (callersCalleesTarget != null) {
        thread = callersCalleesTarget.getThread();
    }
    if (description.length() > 0 && thread != null) {
        description.append(NLS.bind(Messages.threadIndicator, thread));
    }
    setContentDescription(description.toString());
}
Also used : IMethodNode(org.talend.designer.runtime.visualization.internal.core.cpu.IMethodNode) ICallTreeNode(org.talend.designer.runtime.visualization.internal.core.cpu.ICallTreeNode) ICpuModel(org.talend.designer.runtime.visualization.internal.core.cpu.ICpuModel)

Example 9 with ICpuModel

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

the class CallerCalleeTabPage method createCallerViewer.

/**
     * Creates the caller viewer.
     * 
     * @param parent The parent composite
     * @param propertySheet The property sheet
     */
private void createCallerViewer(Composite parent, PropertySheet propertySheet) {
    callerFilteredTree = new HotSpotsFilteredTree(parent, propertySheet.getViewSite().getActionBars()) {

        @Override
        protected void addMenus(IMenuManager manager) {
            manager.add(new Separator());
            manager.add(new ConfigureCpuProfilerAction(cpuSection));
        }

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

        @Override
        protected String getMethodColumnName() {
            return Messages.callerColumnLabel;
        }

        @Override
        protected String getMethodColumnToolTip() {
            return Messages.calleeColumnToolTip;
        }
    };
    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());
        }
    });
    callerFilteredTree.sortColumn(callerViewer.getTree().getColumn(1));
}
Also used : TreeViewer(org.eclipse.jface.viewers.TreeViewer) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ICpuModel(org.talend.designer.runtime.visualization.internal.core.cpu.ICpuModel) ConfigureCpuProfilerAction(org.talend.designer.runtime.visualization.internal.ui.properties.cpu.actions.ConfigureCpuProfilerAction) IMenuManager(org.eclipse.jface.action.IMenuManager) Separator(org.eclipse.jface.action.Separator)

Example 10 with ICpuModel

use of org.talend.designer.runtime.visualization.internal.core.cpu.ICpuModel 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)

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