use of org.eclipse.linuxtools.dataviewers.charts.actions.SaveChartAction in project linuxtools by eclipse.
the class ChartExportTest method testChartExportPNG.
@Test
public void testChartExportPNG() throws Exception {
ILaunchConfiguration config = createConfiguration(proj.getProject());
// $NON-NLS-1$
doLaunch(config, "testDefaults");
IEditorInput input = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getEditorInput();
assertTrue("input must be ChartEditorInput", input instanceof ChartEditorInput);
Composite control = ((ChartEditorInput) input).getChart().getChartControl();
if (control.getSize().x == 0 || control.getSize().y == 0) {
// Manually resize the composite to non-zero width/height so it can be saved
control.setSize(10, 10);
}
SaveChartAction saveChartAction = (SaveChartAction) getToolbarAction(MassifViewPart.SAVE_CHART_ACTION);
assertNotNull(saveChartAction);
for (IPath path : paths) {
saveAsPath(saveChartAction, path);
}
}
use of org.eclipse.linuxtools.dataviewers.charts.actions.SaveChartAction in project linuxtools by eclipse.
the class MassifViewPart method getToolbarActions.
@Override
public IAction[] getToolbarActions() {
pidAction = new MassifPidMenuAction(this);
pidAction.setId(PID_ACTION);
Action chartAction = new Action(// $NON-NLS-1$
Messages.getString("MassifViewPart.Display_Heap_Allocation"), // $NON-NLS-1$
IAction.AS_PUSH_BUTTON) {
@Override
public void run() {
ChartEditorInput input = getChartInput(pid);
if (input != null) {
displayChart(input);
}
}
};
chartAction.setId(CHART_ACTION);
chartAction.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(MassifPlugin.PLUGIN_ID, // $NON-NLS-1$
"icons/linecharticon.gif"));
chartAction.setToolTipText(Messages.getString(// $NON-NLS-1$
"MassifViewPart.Display_Heap_Allocation"));
saveChartAction = new SaveChartAction();
saveChartAction.setId(SAVE_CHART_ACTION);
treeAction = new Action(// $NON-NLS-1$
Messages.getString("MassifViewPart.Show_Heap_Tree"), // $NON-NLS-1$
IAction.AS_CHECK_BOX) {
@Override
public void run() {
if (isChecked()) {
stackLayout.topControl = treeViewer.getViewer().getControl();
top.layout();
} else {
stackLayout.topControl = viewer.getControl();
top.layout();
}
}
};
treeAction.setId(TREE_ACTION);
treeAction.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(MassifPlugin.PLUGIN_ID, // $NON-NLS-1$
"icons/call_hierarchy.gif"));
treeAction.setToolTipText(Messages.getString(// $NON-NLS-1$
"MassifViewPart.Show_Heap_Tree"));
return new IAction[] { pidAction, chartAction, saveChartAction, treeAction };
}
Aggregations