public void print() { final Printer printer = SwtUtil.showPrintDialog(styledText); if (printer == null) return; // Print was cancelled StyledTextPrintOptions options = new StyledTextPrintOptions(); options.jobName = printJobName; options.printLineBackground = true; options.printTextBackground = true; options.printTextFontStyle = true; options.printTextForeground = true; options.footer = "\t<page>"; //$NON-NLS-1$ (for StyledText widget!) options.header = "\t" + printJobName; //$NON-NLS-1$ final Runnable runnable = styledText.print(printer, options); new Thread(new Runnable() { public void run() { runnable.run(); printer.dispose(); } }).start(); }
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(); } } }
public void print(StyledTextPrintOptions options) { viewer.print(options); }