org.eclipse.swt.custom.StyledTextPrintOptions Java Examples

The following examples show how to use org.eclipse.swt.custom.StyledTextPrintOptions. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StyledTextAdapter.java    From AppleCommander with GNU General Public License v2.0 6 votes vote down vote up
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();
}
 
Example #2
Source File: MainShell.java    From RepDev with GNU General Public License v3.0 6 votes vote down vote up
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();
		}
	}
}
 
Example #3
Source File: BidiLayout.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
public Runnable print(Printer printer, StyledTextPrintOptions options) {
	return styledText.print(printer, options);
}
 
Example #4
Source File: ScriptConsoleViewerWrapper.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
public void print(StyledTextPrintOptions options) {
    viewer.print(options);
}