/** * Print the file listing for this disk. */ protected void print() { PrintDialog printDialog = new PrintDialog(shell); PrinterData printerData = printDialog.open(); if (printerData == null) { // cancelled return; } final Printer printer = new Printer(printerData); new Thread() { public void run() { new Printing(printer).run(); printer.dispose(); } }.start(); }
/** * Display the Print dialog helper method. */ public static Printer showPrintDialog(Control control) { PrintDialog dialog = new PrintDialog(control.getShell()); PrinterData printerData = dialog.open(); if (printerData == null) return null; return new Printer(printerData); }
protected void startPrintJob(Composite elementToPrint, PrinterData printerData) { Printer printer = new Printer(printerData); try { printer.startJob(jobName); GC gc = new GC(printer); try { Rectangle printArea = getPrintableArea(printer, BORDER); printer.startPage(); printComposite(elementToPrint, gc, printArea); printer.endPage(); } finally { gc.dispose(); } printer.endJob(); } finally { printer.dispose(); } }
void print( Shell shell){ PrintDialog printDialog = new PrintDialog(shell, SWT.NONE); printDialog.setText("Print Http Packets"); PrinterData printerData = printDialog.open(); if (!(printerData == null)) { final Printer printer = new Printer(printerData); Thread printingThread = new Thread("Printing") { public void run(){ try { new PrinterFacade(getTextToPrint(), printer).print(); } catch (Exception e) { ExceptionHandler.handle(e); } finally { printer.dispose(); } } }; printingThread.start(); } }
protected void processAction(TGActionContext context){ PrintStyles styles = context.getAttribute(ATTRIBUTE_STYLES); if( styles == null ) { this.configureStyles(context); return; } PrinterData printerData = context.getAttribute(ATTRIBUTE_DATA); if( printerData == null ) { this.configurePrinterData(context); return; } TGSongManager manager = new TGSongManager(new TGFactoryImpl()); TGSong sourceSong = context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_SONG); TGSong targetSong = sourceSong.clone(manager.getFactory()); Printer printer = new Printer(printerData); PrintController controller = new PrintController(targetSong, manager, new TGResourceFactoryImpl(printer)); PrintLayout printLayout = new PrintLayout(controller, styles); printLayout.loadStyles(getPrinterScale(printer), 1f); printLayout.updateSong(); printLayout.makeDocument(new PrintDocumentImpl(printLayout, printer, printerData, getPrinterArea(printer, 0.5f))); printLayout.getResourceBuffer().disposeAllResources(); }
/** * {@inheritDoc} */ @Override public void run() { GraphicalViewer viewer; viewer = getWorkbenchPart().getAdapter(GraphicalViewer.class); final PrintDialog dialog = new PrintDialog(viewer.getControl().getShell(), SWT.NULL); final PrinterData data = dialog.open(); if (data != null) { final Printer printer = new Printer(data); final PrintGraphicalViewerOperation op = new PrintERDiagramOperation(printer, viewer); op.run(getWorkbenchPart().getTitle()); } }
private void onPrint() { PrintDialog printDialog = new PrintDialog(shell); PrinterData printerData = printDialog.open(); if (printerData == null) { return; } Printer printer = new Printer(printerData); editText.print(printer).run(); printer.dispose(); }
public void print() { JaretTablePrinter jtp = new JaretTablePrinter(null, _table); JaretTablePrintDialog pDialog = new JaretTablePrintDialog(Display.getCurrent().getActiveShell(), null, jtp, null); pDialog.open(); if (pDialog.getReturnCode() == Dialog.OK) { PrinterData pdata = pDialog.getPrinterData(); JaretTablePrintConfiguration conf = pDialog.getConfiguration(); Printer printer = new Printer(pdata); jtp.setPrinter(printer); jtp.print(conf); printer.dispose(); } jtp.dispose(); }
private Printer setupPrinter(final Shell shell) { Printer defaultPrinter = new Printer(); Point pageCount = getPageCount(defaultPrinter); defaultPrinter.dispose(); final PrintDialog printDialog = new PrintDialog(shell); printDialog.setStartPage(1); printDialog.setEndPage(pageCount.x * pageCount.y); printDialog.setScope(PrinterData.ALL_PAGES); PrinterData printerData = printDialog.open(); if(printerData == null){ return null; } return new Printer(printerData); }
/** * Expand the client area of the grid such that * all the contents fit in the viewport. This ensures that when the grid prints * we print the <i>entire</i> table. * @param printer */ private void setGridLayerSize(PrinterData printerData) { if (printerData.scope == PrinterData.SELECTION) { gridLayer.setClientAreaProvider(originalClientAreaProvider); return; } final Rectangle fullGridSize = getTotalGridArea(); gridLayer.setClientAreaProvider(new IClientAreaProvider(){ public Rectangle getClientArea() { return fullGridSize; } }); gridLayer.doCommand(new PrintEntireGridCommand()); }
/** * {@inheritDoc} */ @Override 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) { Printer printer = new Printer(data); PrintGraphicalViewerOperation op = new PrintERDiagramOperation( printer, viewer); op.run(getWorkbenchPart().getTitle()); } }
/** * @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) { PrintGraphicalViewerOperation op = new PrintGraphicalViewerOperation( new Printer(data), viewer); op.run(getWorkbenchPart().getTitle()); } }
@Override public void run() { final Shell shell = viewer.getControl().getShell(); final PrintDialog dialog = new PrintDialog(shell, SWT.NULL); final PrinterData data = dialog.open(); if (data != null) { final PrintGraphicalViewerOperation operation = new PrintGraphicalViewerOperation( new Printer(data), (GraphicalViewer) viewer); // here you can set the Print Mode // operation.setPrintMode(PrintFigureOperation.FIT_PAGE); operation.run("Printing..."); } // Set the Text and register that to your toolbar…. // printAction.setText("Print"); // getEditorSite().getActionBars().getToolBarManager().add(printAction); }
protected void print() { if (mainfolder.getSelection() != null && mainfolder.getSelection().getControl() instanceof TabTextView) { PrintDialog dialog = new PrintDialog(shell); PrinterData data = dialog.open(); if (data != null) { StyledTextPrintOptions options = new StyledTextPrintOptions(); options.footer = "\t\t<page>"; options.jobName = "RepDev - " + mainfolder.getSelection().getText(); options.printLineBackground = false; options.printTextFontStyle = true; options.printTextForeground = true; options.printTextBackground = true; Runnable runnable = ((TabTextView) mainfolder.getSelection().getControl()).getStyledText().print(new Printer(data), options); runnable.run(); } } }
protected int execute(TypedEvent e){ try{ final PrintStyles data = PrintStylesDialog.open(TuxGuitar.instance().getShell()); if(data != null){ PrintDialog dialog = new PrintDialog(TuxGuitar.instance().getShell(), SWT.NULL); PrinterData printerData = dialog.open(); if (printerData != null) { TuxGuitar.instance().loadCursor(SWT.CURSOR_WAIT); this.print(printerData, data); } } }catch(Throwable throwable ){ MessageDialog.errorMessage(throwable); } return 0; }
protected void print(final Printer printer,final PrinterData printerData ,final PrinterViewLayout layout, final Rectangle bounds){ new Thread(new Runnable() { public void run() { try{ layout.getTablature().updateTablature(); layout.makeDocument(new PrintDocumentImpl(layout,printer, printerData, bounds)); //new SyncThread(new Runnable() { // public void run() { // try{ // layout.makeDocument(new PrintDocumentImpl(layout,printer, bounds)); // }catch(Throwable throwable ){ // MessageDialog.errorMessage(throwable); // } // } //}).start(); }catch(Throwable throwable ){ MessageDialog.errorMessage(throwable); } } }).start(); }
@Override public boolean performOk(){ CoreHub.localCfg.set("Drucker/Etiketten/Name", tEtiketten.getText()); //$NON-NLS-1$ CoreHub.localCfg.set("Drucker/Etiketten/Schacht", tEtikettenschacht.getText()); //$NON-NLS-1$ CoreHub.localCfg.set("Drucker/Etiketten/Choose", cEtiketten.getSelection()); //$NON-NLS-1$ Object data = tEtiketten.getData(); if (data instanceof PrinterData) { PrinterData pdata = (PrinterData) data; CoreHub.localCfg.set("Drucker/Etiketten/Driver", pdata.driver); //$NON-NLS-1$ } else { CoreHub.localCfg.set("Drucker/Etiketten/Driver", StringTool.leer); //$NON-NLS-1$ } CoreHub.localCfg.set("Drucker/A4ESR/Name", tA4ESR.getText()); //$NON-NLS-1$ CoreHub.localCfg.set("Drucker/A4ESR/Schacht", tA4ESRSchacht.getText()); //$NON-NLS-1$ CoreHub.localCfg.set("Drucker/A4/Name", tA4.getText()); //$NON-NLS-1$ CoreHub.localCfg.set("Drucker/A4/Schacht", tA4Schacht.getText()); //$NON-NLS-1$ CoreHub.localCfg.set("Drucker/A5/Name", tA5.getText()); //$NON-NLS-1$ CoreHub.localCfg.set("Drucker/A5/Schacht", tA5Schacht.getText()); //$NON-NLS-1$ CoreHub.localCfg.set("Drucker/Einzelblatt/Name", tEinzelblatt.getText()); //$NON-NLS-1$ CoreHub.localCfg.set("Drucker/Einzelblatt/Schacht", tEinzelblattSchacht.getText()); //$NON-NLS-1$ return super.performOk(); }
private void printQuery ( final AbstractQueryBuffer query ) { final List<ValueInformation> vis = query.getValueInformation (); final Map<String, List<Double>> values = query.getValues (); final PrintDialog dlg = new PrintDialog ( getWorkbenchWindow ().getShell () ); final PrinterData printerData = dlg.open (); if ( printerData == null ) { return; } printerData.orientation = PrinterData.LANDSCAPE; final Printer printer = new Printer ( printerData ); try { final PrintProcessor processor = new PrintProcessor ( vis, values ); processor.print ( printer ); } finally { printer.dispose (); } }
/** * Prints the specified element. * * @param elementToPrint the {@link Composite} to be printed. */ public void print(Composite elementToPrint) { PrintDialog dialog = new PrintDialog(elementToPrint.getShell()); PrinterData printerData = dialog.open(); if (printerData == null) { return; // Anwender hat abgebrochen. } startPrintJob(elementToPrint, printerData); }
public void show(final TGViewContext context) { TGPrinterDataHandler handler = context.getAttribute(ATTRIBUTE_HANDLER); Shell parent = context.getAttribute(TGViewContext.ATTRIBUTE_PARENT); PrintDialog dialog = new PrintDialog(parent, SWT.NULL); PrinterData printerData = dialog.open(); if( printerData != null ) { handler.updatePrinterData(printerData); } }
public void configurePrinterData(final TGActionContext context) { context.setAttribute(TGOpenViewAction.ATTRIBUTE_CONTROLLER, new TGPrinterDataDialogController()); context.setAttribute(TGPrinterDataDialog.ATTRIBUTE_HANDLER, new TGPrinterDataHandler() { public void updatePrinterData(PrinterData printerData) { context.setAttribute(ATTRIBUTE_DATA, printerData); executeActionInNewThread(TGPrintAction.NAME, context); } }); executeActionInNewThread(TGOpenViewAction.NAME, context); }
public PrintDocumentImpl(PrintLayout layout, Printer printer,PrinterData printerData, TGRectangle bounds){ this.layout = layout; this.printer = printer; this.printerData = printerData; this.bounds = bounds; this.painter = new TGPainterImpl(); }
public boolean isPaintable(int page){ if(this.printerData.scope == PrinterData.PAGE_RANGE){ if(this.printerData.startPage > 0 && this.printerData.startPage > page){ return false; } if(this.printerData.endPage > 0 && this.printerData.endPage < page){ return false; } } return true; }
public PrintAction(final Shell shell, final Scene scene) { super(Messages.Print, PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_ETOOL_PRINT_EDIT)); this.shell = shell; this.scene = scene; // Skip printer check on GTK because of hangups: // https://bugs.eclipse.org/bugs/show_bug.cgi?id=153936, // -Dorg.eclipse.swt.internal.gtk.disablePrinting if there are no printers, // https://github.com/ControlSystemStudio/cs-studio/issues/83 if (! SWT.getPlatform().equals("gtk")) { // Only enable if printing is supported. final PrinterData[] printers = Printer.getPrinterList(); if (printers != null) { logger.fine("Available printers:"); for (PrinterData p : printers) logger.fine("Printer: " + p.name + " (" + p.driver + ")"); setEnabled(printers.length > 0); } else { logger.fine("No available printers"); setEnabled(false); } } }
/** Initialize * @param shell Parent shell * @param graph Graph to print */ public PrintAction(final Shell shell, final RTTimePlot graph) { super(Messages.PrintSnapshot, PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_ETOOL_PRINT_EDIT)); this.shell = shell; this.graph = graph; this.media_pool = new SWTMediaPool(shell); // Skip printer check on GTK because of hangups: // https://bugs.eclipse.org/bugs/show_bug.cgi?id=153936, // -Dorg.eclipse.swt.internal.gtk.disablePrinting if there are no printers, // https://github.com/ControlSystemStudio/cs-studio/issues/83 if (! SWT.getPlatform().equals("gtk")) { // Only enable if printing is supported. final PrinterData[] printers = Printer.getPrinterList(); final Logger logger = Logger.getLogger(getClass().getName()); if (printers != null) { logger.fine("Available printers:"); for (PrinterData p : printers) logger.fine("Printer: " + p.name + " (" + p.driver + ")"); setEnabled(printers.length > 0); } else { logger.fine("No available printers"); setEnabled(false); } } }
/************************************************************************************ * ***********************************************************************************/ public PrintJob( PrinterData printerData, IProcedure model, PrintMode mode ) { m_printerData = printerData; m_mode = mode; m_printer = new Printer(printerData); m_model = model; m_asrun = null; m_log = null; }
/************************************************************************************ * ***********************************************************************************/ public PrintJob( PrinterData printerData, IProcedure model, AsRunFile asrun, PrintMode mode ) { m_printerData = printerData; m_mode = mode; m_printer = new Printer(printerData); m_model = model; m_asrun = asrun; m_log = null; }
/************************************************************************************ * ***********************************************************************************/ public PrintJob( PrinterData printerData, IProcedure model, LogFile log, PrintMode mode ) { m_printerData = printerData; m_mode = mode; m_printer = new Printer(printerData); m_model = model; m_asrun = null; m_log = log; }