Bug 160697 - Printed diagrams use 'default' preferencesHint instead of their own.
Summary: Printed diagrams use 'default' preferencesHint instead of their own.
Status: RESOLVED FIXED
Alias: None
Product: GMF-Runtime
Classification: Modeling
Component: General (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows XP
: P3 normal
Target Milestone: 1.0.2   Edit
Assignee: Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2006-10-12 12:01 EDT by Syed Atif CLA
Modified: 2010-07-19 12:28 EDT (History)
0 users

See Also:


Attachments
patch (1.49 KB, patch)
2006-10-12 13:24 EDT, Syed Atif CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Syed Atif CLA 2006-10-12 12:01:48 EDT
This is a regression. When diagrams are printed, they use the default preferences hint and mapping mode instead of the one that is supplied in the contructor for DiagramPrinter. The following code in DiagramPrinter#run() seems to be the problem:

-------------------------------------------
DiagramEditPart dgrmEP = PrintHelper.createDiagramEditPart((Diagram) obj, null);
            
RootEditPart rep = dgrmEP.getRoot();
if (rep instanceof DiagramRootEditPart) 
    this.mm = ((DiagramRootEditPart)rep).getMapMode();
if (rep instanceof IDiagramPreferenceSupport)
    this.preferencesHint = ((IDiagramPreferenceSupport)rep).getPreferencesHint();
-------------------------------------------

This code assumes that the OffscreenEditPartFactory has obtained the correct preferences hint and mapping mode, when in effect it uses the default ones. The fix:

-------------------------------------------
DiagramEditPart dgrmEP = PrintHelper.createDiagramEditPart((Diagram) obj, preferencesHint);
-------------------------------------------

The reason for this goes back to trying to get all open GMF diagrams in list in the print dialog...since different _types_ of diagrams will have different preferences. See bug 144771.

Even after this fix, the Bug 160696 needs to be looked into.
Comment 1 Syed Atif CLA 2006-10-12 13:24:38 EDT
Created attachment 51874 [details]
patch

please note that the mapping mode used for each diagram is correct, it turns out that when creating a new DiagramRootEditPart, the measurementUnit from the Diagram itself is used.
Comment 2 Anthony Hunter CLA 2006-10-17 20:03:45 EDT
Committed to R1_0_maintenance 
Comment 3 Eclipse Webmaster CLA 2010-07-19 12:28:53 EDT
[GMF Restructure] Bug 319140 : product GMF and component
Runtime Diagram was the original product and component for this bug