Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 19602 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditor.java (+51 lines)
Lines 15-20 Link Here
15
import org.eclipse.osgi.util.NLS;
15
import org.eclipse.osgi.util.NLS;
16
16
17
import org.eclipse.swt.SWT;
17
import org.eclipse.swt.SWT;
18
import org.eclipse.swt.custom.StyledTextPrintOptions;
18
import org.eclipse.swt.graphics.Color;
19
import org.eclipse.swt.graphics.Color;
19
import org.eclipse.swt.graphics.RGB;
20
import org.eclipse.swt.graphics.RGB;
20
import org.eclipse.swt.layout.GridData;
21
import org.eclipse.swt.layout.GridData;
Lines 49-54 Link Here
49
50
50
import org.eclipse.jface.text.BadLocationException;
51
import org.eclipse.jface.text.BadLocationException;
51
import org.eclipse.jface.text.IDocument;
52
import org.eclipse.jface.text.IDocument;
53
import org.eclipse.jface.text.IPrintOptionsConsumer;
54
import org.eclipse.jface.text.IPrintOptionsProvider;
52
import org.eclipse.jface.text.ITextViewerExtension6;
55
import org.eclipse.jface.text.ITextViewerExtension6;
53
import org.eclipse.jface.text.Position;
56
import org.eclipse.jface.text.Position;
54
import org.eclipse.jface.text.revisions.IRevisionRulerColumn;
57
import org.eclipse.jface.text.revisions.IRevisionRulerColumn;
Lines 162-167 Link Here
162
			AbstractDecoratedTextEditor.this.gotoMarker(marker);
165
			AbstractDecoratedTextEditor.this.gotoMarker(marker);
163
		}
166
		}
164
	}
167
	}
168
	
169
	/**
170
	 * This implementation of <code>IPrintOptionsProvider</code> returns a set
171
	 * of options appropriate to the current state of the line number ruler.
172
	 * Subclasses of {@link AbstractDecoratedTextEditor} may create subclasses
173
	 * of this class or define completely new implementations of the
174
	 * <code>IPrintOptionsProvider</code>. See
175
	 * {@link AbstractDecoratedTextEditor#createPrintOptionsProvider()} for
176
	 * information.
177
	 */
178
	protected class PrintOptionsProvider implements IPrintOptionsProvider {
179
		public StyledTextPrintOptions getPrintOptions() {
180
			StyledTextPrintOptions options = null;
181
			if (isLineNumberRulerVisible()) {
182
				options = new StyledTextPrintOptions();
183
				options.printTextForeground = true;
184
				options.printTextBackground = true;
185
				options.printTextFontStyle = true;
186
				options.printLineBackground = true;
187
				ISourceViewer sourceViewer = AbstractDecoratedTextEditor.super
188
						.getSourceViewer();
189
				if (sourceViewer instanceof IPrintOptionsConsumer) {
190
					options.printLeadMarginDecorator = ((IPrintOptionsConsumer) sourceViewer)
191
							.getPreferredLineNumberDecorator();
192
				}
193
			}
194
			return options;
195
		}
196
	}
165
197
166
	/**
198
	/**
167
	 * The annotation preferences.
199
	 * The annotation preferences.
Lines 352-357 Link Here
352
			getSourceViewer().removeRangeIndication();
384
			getSourceViewer().removeRangeIndication();
353
			getSourceViewer().setRangeIndicator(null);
385
			getSourceViewer().setRangeIndicator(null);
354
		}
386
		}
387
		
388
		ISourceViewer sourceViewer = getSourceViewer();
389
		if (sourceViewer instanceof IPrintOptionsConsumer) {
390
			((IPrintOptionsConsumer) sourceViewer)
391
					.setPrintOptionProvider(createPrintOptionsProvider());
392
		}
355
	}
393
	}
356
394
357
395
Lines 406-411 Link Here
406
//
444
//
407
		return composite;
445
		return composite;
408
	}
446
	}
447
	
448
	/**
449
	 * Creates the print options provider. This implementation creates an
450
	 * instance of the inner class <code>PrintOptionsProvider</code>.
451
	 * Subclasses may override this method to create a different provider. A
452
	 * return value of <code>null</code> is permissible.
453
	 * 
454
	 * @return the provider
455
	 * @since 3.2
456
	 */
457
	protected IPrintOptionsProvider createPrintOptionsProvider() {
458
		return new PrintOptionsProvider();
459
	}
409
460
410
	/**
461
	/**
411
	 * Tells whether the overview ruler is visible.
462
	 * Tells whether the overview ruler is visible.

Return to bug 19602