Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 350035

Summary: Handle SWT dialogs style flags in the same way
Product: [RT] RAP Reporter: Ivan Furnadjiev <ivan>
Component: IncubatorAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 1.4   
Target Milestone: 2.0   
Hardware: All   
OS: All   
Whiteboard:

Description Ivan Furnadjiev CLA 2011-06-22 07:15:20 EDT
In ColorDialog and FontDialog the style flags provided in the ctor are ignored - the dialog is always created with SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL. In FileDialog from the incubator the style flags are respected. But we have to take into account that these dialogs are OS native dialogs and it's not possible to remove their titlebar (create dialog without SWT.TITLE).
Comment 1 RĂ¼diger Herrmann CLA 2011-07-08 11:13:06 EDT
Couldn't the FileDialog just call Dialog#checkStyle() to handle its style bits?
AFAIK Dialog#checkStyle() is in sync with SWT, thus everything would be in order
Comment 2 Ivan Furnadjiev CLA 2011-07-11 05:31:02 EDT
Directly calling Dialog#checkStyle() is not possible in FileDialog due to:
java.lang.IllegalAccessError: tried to access method org.eclipse.swt.widgets.Dialog.checkStyle(Lorg/eclipse/swt/widgets/Shell;I)I from class org.eclipse.swt.widgets.FileDialog
That's why we have a copy of Dialog#checkStyle method in FileDialog class iteself + some additions - force SWT.TILTLE and remove SWT.MIN styles.
In SWT, shell styles (SWT.RESIZE, SWT.MAX etc) specified in Dialog "style" ctor are ignored by OS (not filtered by Dialog#checkStyle) because these dialogs are OS native dialogs. For FontDialog and ColorDialog this is not a big problem as "style" ctor has no sense (no specific dialog styles). This is not the case with FileDialog, because we have a specific SWT.MULTI style. Based on Dialog#checkStyle implementation, the code:
new FileDialog( shell, SWT.MULTI )
will create a dialog with trimmings (titlebar + close button) in SWT, but not in RAP. And the question is: do we need to support the dialog shell configuration styles ( SWT.RESIZE, SWT.CLOSE, SWT.MAX etc) as they are not filtered by Dialog#checkStyle, but OS? At least, SWT.RESIZE and SWT.MAX make sense for MULTI FileDialog. And if we agree to support them on FileDialog (the current implementation does this), does it make sense to support them in other standard dialogs (for consistency)?
Comment 3 RĂ¼diger Herrmann CLA 2011-07-11 05:52:14 EDT
Now I got it, sorry for the confusion. 
Whatever we decide, we should handle style flags consistently for all kinds of dialogs. To me it seems the least effort to not pass the styles though to the shell (we probably would then want to filter non-Shell styles, etc.) If this is the case I would go that way. If a need for differently styled dialog shells arises we can still implement it.
Comment 4 Ivan Furnadjiev CLA 2016-01-26 05:51:00 EST
The FileDialog has been completely re-writen before it's moved to RAP core repo. The style flags for FileDialog/ColorDialog/FontDialog are now handled in the same way.