use of org.eclipse.swt.printing.PrintDialog in project pentaho-kettle by pentaho.
the class PrintSpool method getPrinter.
// Ask which printer to use...
public Printer getPrinter(Shell sh) {
PrintDialog pd = new PrintDialog(sh);
printerdata = pd.open();
if (printerdata != null) {
if (printer != null) {
printer.dispose();
}
printer = new Printer(printerdata);
}
return printer;
}
use of org.eclipse.swt.printing.PrintDialog 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.swt.printing.PrintDialog 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());
}
}
use of org.eclipse.swt.printing.PrintDialog in project jbosstools-hibernate by jbosstools.
the class PrintDiagramViewerAction method run.
/**
* @see org.eclipse.jface.action.Action#run()
*/
public void run() {
GraphicalViewer viewer;
viewer = (GraphicalViewer) getWorkbenchPart().getAdapter(GraphicalViewer.class);
PrintDialog dialog = new PrintDialog(viewer.getControl().getShell(), SWT.NULL);
PrinterData data = dialog.open();
if (data != null) {
PrintDiagramViewerOperation op = new PrintDiagramViewerOperation(new Printer(data), viewer);
DiagramViewer dv = (DiagramViewer) getWorkbenchPart();
op.setZoom(dv.getZoom());
if (Math.abs(dv.getZoom() - dv.getFitHeightZoomValue()) < 0.00000001) {
op.setPrintMode(PrintGraphicalViewerOperation.FIT_HEIGHT);
} else if (Math.abs(dv.getZoom() - dv.getFitWidthZoomValue()) < 0.00000001) {
op.setPrintMode(PrintGraphicalViewerOperation.FIT_WIDTH);
} else if (Math.abs(dv.getZoom() - dv.getFitPageZoomValue()) < 0.00000001) {
op.setPrintMode(PrintGraphicalViewerOperation.FIT_PAGE);
} else {
op.setPrintMode(PrintGraphicalViewerOperation.TILE);
}
op.run(getWorkbenchPart().getTitle());
}
}
Aggregations