Community
Participate
Working Groups
Build Identifier: I20100520-1744 If you open a xmxl file, select some lines , press <CTRL>+P and select "Selected Text" at the printer dialog, the hole xml file will be printed. This is especially annoying if you print at a network printer (in separate room) and the xml file has a size of about 2MB. Reproducible: Always Steps to Reproduce: 1. open a xml file 2. select several lines 3. goto print and select "Selection"
It appears to be a problem in org.eclipse.jface.text.TextViewer.It is happening in general text file also.
Redirecting to platform based on Rakesh's observations.
Regression compared to 3.5.2. For a proper fix we need bug 297957 to get fixed, otherwise we need to block printing in parallel.
Created attachment 171425 [details] Fix in case no parallel printing takes place This patch fixes the case where no parallel printing is done. Blocking parallel printing in 3.6.1 is no option.
*** Bug 316290 has been marked as a duplicate of this bug. ***
Can be fixed in SWT, see bug 297957 comment 19.
Created attachment 171558 [details] patch in StyledText
Felipe, this fix should go into 3.6.1. The patch is in StyledText.Printing, and it is very simple. I can walk you through the reason it is needed. Dani, can you review also, please?
The patch is fine. So, is the application (indirectly, via Printer#getData()) sharing the PrinterData object (and changing the scope) between jobs (running in different threads) ?
Note: if it is allowed the share PrintData objects between Printers (which are allowed to run in different threads). Then the right fix is in Printer, it needs to save a copy of the PrinterData object passed in the constructor. This only way Printer#getData() will always return the PrinterData object with the "correct/unchanged" data in it. Other clients can have the same bug as StyledText.
Regarding comment 10: yes you're right but the main problem is that the Javadoc doesn't say anything clearly when it comes to printing: - Does Printer take a copy or fetch most recent values from PrinterData? - Does PrintDialog.open() return a new object or the one set in setPrinterData? - Do the setter methods modify my object that I provided via setPrinterData? The attached patch completes the existing code pattern in org.eclipse.swt.custom.StyledText.Printing and it fixes our case because before printing we always go via PrintDialog, which - though not clearly specified - always returns a new PrinterData instance. For 3.6.1 this is definitely the right fix. For 3.7 the Javadoc should be clarified and implemented accordingly. Note that the following line is no longer needed and should be removed: #442: PrinterData data = printer.getPrinterData(); I also verified that the patch fixes our problem. +1 for 3.6.1. BTW: Could you mention in the Javadoc of PrintDialog.open() that it always returns a new object? Thanks! ;-)
I made a note in bug 297957 to make sure that the implementation and the doc are consistent. I am reluctant to change the PrintDialog.open doc for 3.6.1 because it may change in 3.7. Please make any further comments in that bug.
Oh, by the way, re comment 9: > So, is the application (indirectly, via Printer#getData()) sharing the > PrinterData object (and changing the scope) between jobs (running in different > threads) ? yep :)
Created attachment 173654 [details] same patch with unused variable removed This patch is the same as the one above, with the following line removed: PrinterData data = printer.getPrinterData(); (it was originally needed for data.scope, but it is no longer needed because scope is cached in the constructor).
Fixed > 20100707 in 3.7 (HEAD).
Fixed > 20100707 in 3.6.1 branch.
Verified for 3.7 in N20100707-2000.
*** Bug 337356 has been marked as a duplicate of this bug. ***