use of org.eclipse.gef.print.PrintGraphicalViewerOperation in project archi by archimatetool.
the class PrintDiagramAction method run.
@Override
public void run() {
PrintModeDialog modeDialog = new PrintModeDialog(getWorkbenchPart().getSite().getShell());
modeDialog.open();
int printMode = modeDialog.getPrintMode();
if (printMode == -1) {
return;
}
PrintDialog printDialog = new PrintDialog(getWorkbenchPart().getSite().getShell(), SWT.NULL);
PrinterData data = printDialog.open();
if (data != null) {
IDiagramModel diagramModel = getWorkbenchPart().getAdapter(IDiagramModel.class);
Shell tempShell = new Shell();
GraphicalViewerImpl viewer = DiagramUtils.createViewer(diagramModel, tempShell);
PrintGraphicalViewerOperation op = new PrintGraphicalViewerOperation(new Printer(data), viewer);
// this should stop font clipping
op.setUseScaledGraphics(false);
op.setPrintMode(printMode);
op.run(getWorkbenchPart().getTitle());
tempShell.dispose();
}
}
use of org.eclipse.gef.print.PrintGraphicalViewerOperation in project archi by archimatetool.
the class PrintAction method run.
/**
* @see org.eclipse.jface.action.Action#run()
*/
@Override
public void run() {
GraphicalViewer viewer;
viewer = getWorkbenchPart().getAdapter(GraphicalViewer.class);
PrintDialog dialog = new PrintDialog(viewer.getControl().getShell(), SWT.NULL);
PrinterData data = dialog.open();
if (data != null) {
PrintGraphicalViewerOperation op = new PrintGraphicalViewerOperation(new Printer(data), viewer);
op.run(getWorkbenchPart().getTitle());
}
}
Aggregations