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();
}
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));
}
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());
}
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));
}
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;
}
Aggregations