|
Lines 28-33
Link Here
|
| 28 |
import org.eclipse.swt.custom.ST; |
28 |
import org.eclipse.swt.custom.ST; |
| 29 |
import org.eclipse.swt.custom.StyleRange; |
29 |
import org.eclipse.swt.custom.StyleRange; |
| 30 |
import org.eclipse.swt.custom.StyledText; |
30 |
import org.eclipse.swt.custom.StyledText; |
|
|
31 |
import org.eclipse.swt.custom.StyledTextPrintMarginDecorator; |
| 32 |
import org.eclipse.swt.custom.StyledTextPrintOptions; |
| 31 |
import org.eclipse.swt.custom.VerifyKeyListener; |
33 |
import org.eclipse.swt.custom.VerifyKeyListener; |
| 32 |
import org.eclipse.swt.dnd.DND; |
34 |
import org.eclipse.swt.dnd.DND; |
| 33 |
import org.eclipse.swt.events.ControlEvent; |
35 |
import org.eclipse.swt.events.ControlEvent; |
|
Lines 95-101
Link Here
|
| 95 |
public class TextViewer extends Viewer implements |
97 |
public class TextViewer extends Viewer implements |
| 96 |
ITextViewer, ITextViewerExtension, ITextViewerExtension2, ITextViewerExtension4, ITextViewerExtension6, IEditingSupportRegistry, |
98 |
ITextViewer, ITextViewerExtension, ITextViewerExtension2, ITextViewerExtension4, ITextViewerExtension6, IEditingSupportRegistry, |
| 97 |
ITextOperationTarget, ITextOperationTargetExtension, |
99 |
ITextOperationTarget, ITextOperationTargetExtension, |
| 98 |
IWidgetTokenOwner, IWidgetTokenOwnerExtension, IPostSelectionProvider { |
100 |
IWidgetTokenOwner, IWidgetTokenOwnerExtension, IPostSelectionProvider, IPrintOptionsConsumer { |
| 99 |
|
101 |
|
| 100 |
/** Internal flag to indicate the debug state. */ |
102 |
/** Internal flag to indicate the debug state. */ |
| 101 |
public static final boolean TRACE_ERRORS= false; |
103 |
public static final boolean TRACE_ERRORS= false; |
|
Lines 1394-1399
Link Here
|
| 1394 |
* @since 3.1 |
1396 |
* @since 3.1 |
| 1395 |
*/ |
1397 |
*/ |
| 1396 |
private IPositionUpdater fSelectionUpdater; |
1398 |
private IPositionUpdater fSelectionUpdater; |
|
|
1399 |
/** |
| 1400 |
* Options provider for the <code>print()</code> method |
| 1401 |
* @since 3.2 |
| 1402 |
*/ |
| 1403 |
private IPrintOptionsProvider fPrintOptionsProvider; |
| 1397 |
|
1404 |
|
| 1398 |
|
1405 |
|
| 1399 |
//---- Construction and disposal ------------------ |
1406 |
//---- Construction and disposal ------------------ |
|
Lines 3908-3913
Link Here
|
| 3908 |
PrinterData[] printerList= Printer.getPrinterList(); |
3915 |
PrinterData[] printerList= Printer.getPrinterList(); |
| 3909 |
return (printerList != null && printerList.length > 0); |
3916 |
return (printerList != null && printerList.length > 0); |
| 3910 |
} |
3917 |
} |
|
|
3918 |
|
| 3919 |
/* (non-Javadoc) |
| 3920 |
* @see org.eclipse.jface.text.IPrintOptionsConsumer#setPrintOptionProvider(org.eclipse.jface.text.IPrintOptionsProvider) |
| 3921 |
*/ |
| 3922 |
public void setPrintOptionProvider(IPrintOptionsProvider provider) { |
| 3923 |
fPrintOptionsProvider = provider; |
| 3924 |
} |
| 3925 |
|
| 3926 |
/* (non-Javadoc) |
| 3927 |
* @see org.eclipse.jface.text.IPrintOptionsConsumer#getPreferredLineNumberDecorator(int) |
| 3928 |
*/ |
| 3929 |
public StyledTextPrintMarginDecorator getPreferredLineNumberDecorator() { |
| 3930 |
return null; |
| 3931 |
} |
| 3911 |
|
3932 |
|
| 3912 |
/** |
3933 |
/** |
| 3913 |
* Brings up a print dialog and calls <code>printContents(Printer)</code> which |
3934 |
* Brings up a print dialog and calls <code>printContents(Printer)</code> which |
|
Lines 3921-3927
Link Here
|
| 3921 |
if (data != null) { |
3942 |
if (data != null) { |
| 3922 |
|
3943 |
|
| 3923 |
final Printer printer= new Printer(data); |
3944 |
final Printer printer= new Printer(data); |
| 3924 |
final Runnable styledTextPrinter= fTextWidget.print(printer); |
3945 |
StyledTextPrintOptions options = null; |
|
|
3946 |
if (fPrintOptionsProvider != null) |
| 3947 |
options = fPrintOptionsProvider.getPrintOptions(); |
| 3948 |
final Runnable styledTextPrinter = |
| 3949 |
options == null |
| 3950 |
? fTextWidget.print(printer) |
| 3951 |
: fTextWidget.print(printer, options); |
| 3952 |
|
| 3925 |
|
3953 |
|
| 3926 |
Thread printingThread= new Thread("Printing") { //$NON-NLS-1$ |
3954 |
Thread printingThread= new Thread("Printing") { //$NON-NLS-1$ |
| 3927 |
public void run() { |
3955 |
public void run() { |