Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDani Megert2009-12-16 14:40:02 +0000
committerDani Megert2009-12-16 14:40:02 +0000
commitfd284690e339ca458ed7f6bc91a9c7b458073cf9 (patch)
treee818d17a4f785780225cadecafbb4ed710695bc0
parentd3516375193bd5798387dd165412e800e9150184 (diff)
downloadeclipse.platform.text-fd284690e339ca458ed7f6bc91a9c7b458073cf9.tar.gz
eclipse.platform.text-fd284690e339ca458ed7f6bc91a9c7b458073cf9.tar.xz
eclipse.platform.text-fd284690e339ca458ed7f6bc91a9c7b458073cf9.zip
Fixed bug 267427: [printing] File -> Print... should use new PrintDialog.setPrinterData() API
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewer.java21
1 files changed, 21 insertions, 0 deletions
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewer.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewer.java
index 8674c83af99..189cdcfbab9 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewer.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewer.java
@@ -1512,6 +1512,14 @@ public class TextViewer extends Viewer implements
* @since 3.1
*/
private static final String SELECTION_POSITION_CATEGORY= "_textviewer_selection_category"; //$NON-NLS-1$
+
+ /**
+ * The shared printer data.
+ *
+ * @since 3.6
+ */
+ private static PrinterData fgPrinterData= null;
+
/** The viewer's text widget */
private StyledText fTextWidget;
/** The viewer's input document */
@@ -4504,6 +4512,7 @@ public class TextViewer extends Viewer implements
}
final PrintDialog dialog= new PrintDialog(shell, SWT.PRIMARY_MODAL);
+ dialog.setPrinterData(fgPrinterData);
final PrinterData data= dialog.open();
if (data != null) {
@@ -4517,6 +4526,18 @@ public class TextViewer extends Viewer implements
}
};
printingThread.start();
+
+ /*
+ * FIXME:
+ * Should copy the printer data to avoid threading issues,
+ * but this is currently not possible, see:
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=297957
+ */
+ fgPrinterData= data;
+ fgPrinterData.startPage= 1;
+ fgPrinterData.endPage= 1;
+ fgPrinterData.scope= PrinterData.ALL_PAGES;
+ fgPrinterData.copyCount= 1;
}
}

Back to the top