Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 472388 - [Win32] Label with SWT.WRAP causes WizardPage to grab all the vertical screen space (Mac/Windows incompatibility)
Summary: [Win32] Label with SWT.WRAP causes WizardPage to grab all the vertical screen...
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.5   Edit
Hardware: PC Windows 7
: P3 normal with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: Patrik Suzzi CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-10 11:21 EDT by Andreas Sewe CLA
Modified: 2020-05-05 05:37 EDT (History)
3 users (show)

See Also:


Attachments
Zipped sample project (4.86 KB, application/download)
2015-07-10 11:21 EDT, Andreas Sewe CLA
no flags Details
The problematic wizard page under Windows 7 (20.28 KB, image/png)
2015-07-10 11:23 EDT, Andreas Sewe CLA
no flags Details
The problematic wizard page under Mac OS X (Yosemite) (31.70 KB, image/png)
2015-07-10 11:36 EDT, Andreas Sewe CLA
no flags Details
The problematic wizard page under Ubuntu Linux (17.23 KB, image/png)
2015-09-03 07:55 EDT, Andreas Sewe CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Sewe CLA 2015-07-10 11:21:49 EDT
Created attachment 255116 [details]
Zipped sample project

This issue has originally been raised by me in the SWT community forum [1]. While I found a workaround in the meantime, I still consider this a bug, as Mac OS X and Windows 7 render the same wizard page vastly different.

The wizard page under Mac OS X has "normal" sizes, while under Windows 7 it vertically extends all the way to the edges of the screen.

I have attached a sample project. Just start the plugin (I tested under Eclipse Mars) and select "Example Wizard" from the "Wizard" menu. That opens the single-page wizard demonstrating the problem.

Two screenshots illustrating it will follow.

[1] <https://www.eclipse.org/forums/index.php/m/1701180/#msg_1701180>
Comment 1 Andreas Sewe CLA 2015-07-10 11:23:24 EDT
Created attachment 255117 [details]
The problematic wizard page under Windows 7
Comment 2 Andreas Sewe CLA 2015-07-10 11:36:56 EDT
Created attachment 255119 [details]
The problematic wizard page under Mac OS X (Yosemite)
Comment 3 Niraj Modi CLA 2015-07-16 04:59:54 EDT
In the attached snippet(which is JFace based), size for Label with SWT.WRAP style is calculated and applied via below code:
GridDataFactory.fillDefaults().grab(true, false).hint(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT).applyTo(label);

This snippet doesn't highlight the exact problem with SWT, if possible please narrow down the problem to an SWT snippet ?

Sharing with UI team for initial investigation.
Comment 4 Andreas Sewe CLA 2015-09-03 07:55:37 EDT
Created attachment 256358 [details]
The problematic wizard page under Ubuntu Linux

FWIW, the example project also exhibits this problem under Ubuntu Linux, as illustrated by the attached screenshot (again, tested under Eclipse Mars).
Comment 5 Andreas Sewe CLA 2015-09-03 08:05:58 EDT
(In reply to Niraj Modi from comment #3)
> This snippet doesn't highlight the exact problem with SWT, if possible
> please narrow down the problem to an SWT snippet ?

Sorry, I wasn't able to produce an SWT-only sample project, carving out the relevant parts of the JFace Wizard.

The WizardPage itself, however, is rather simple:

    @Override
    public void createControl(Composite parent) {
        Composite container = new Composite(parent, SWT.NONE);
        GridLayoutFactory.fillDefaults().applyTo(container);

        Label label = new Label(container, SWT.WRAP);
        label.setText(
                "Some very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very loooooong label which should wrap.");
        GridDataFactory.fillDefaults().grab(true, false)
                .hint(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT)
                .applyTo(label);

        setControl(container);
    }

The problem goes away as soon as the vertical size hint is some value other than SWT.DEFAULT, but guessing the *vertical* size of a text with line with line wrapping is pretty much impossible. Hence, using SWT.DEFAULT for the "control's preferred size" (Javadoc of Control.hint) should work.
Comment 6 Andreas Sewe CLA 2015-09-03 08:28:00 EDT
(In reply to Andreas Sewe from comment #5)
>         GridDataFactory.fillDefaults().grab(true, false)
>                
> .hint(convertHorizontalDLUsToPixels(IDialogConstants.
> MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT)
>                 .applyTo(label);

FWIW, for Windows there exists a workaround:

        GridDataFactory.swtDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false)
                .hint(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT)
                .applyTo(label);

Unfortunately, this does not work unter Ubuntu Linux. There, I get a wizard page filling all the vertical screen space either way. :-(

Anyway, I hope this helps you guys narrowing down the issue.
Comment 7 Andreas Sewe CLA 2015-10-22 04:52:37 EDT
(In reply to Andreas Sewe from comment #6)
> (In reply to Andreas Sewe from comment #5)
> >         GridDataFactory.fillDefaults().grab(true, false)
> >                
> > .hint(convertHorizontalDLUsToPixels(IDialogConstants.
> > MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT)
> >                 .applyTo(label);
> 
> FWIW, for Windows there exists a workaround:
> 
>         GridDataFactory.swtDefaults().align(SWT.FILL,
> SWT.BEGINNING).grab(true, false)
>                
> .hint(convertHorizontalDLUsToPixels(IDialogConstants.
> MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT)
>                 .applyTo(label);
> 
> Unfortunately, this does not work unter Ubuntu Linux. There, I get a wizard
> page filling all the vertical screen space either way. :-(

Should I open a separate bug for Linux (as it may be a different issue there, given that my workaround doesn't work)?
Comment 8 Andreas Sewe CLA 2016-05-19 05:49:56 EDT
(In reply to Andreas Sewe from comment #7)
> Should I open a separate bug for Linux (as it may be a different issue
> there, given that my workaround doesn't work)?

FYI, the Linux problem still exists under Neon M7.

Could you please have a look at my example project? I know it's not a SWT-only example, but it is rather minimal.

It's just frustrating spending time to distill your code into a minimal example that reliably reproduces the problem and then being told "not minimal enough". :-(
Comment 9 Andreas Sewe CLA 2016-07-28 08:11:22 EDT
(In reply to Andreas Sewe from comment #8)
> (In reply to Andreas Sewe from comment #7)
> > Should I open a separate bug for Linux (as it may be a different issue
> > there, given that my workaround doesn't work)?

Opened Bug 498756. This bug can now be "Windows only".
Comment 10 Andreas Sewe CLA 2016-12-01 11:45:38 EST
@Patrick: FYI, this is the bug we talk about today in Darmstadt.
Comment 11 Patrik Suzzi CLA 2016-12-01 12:51:45 EST
Andreas, thanks for putting me in c/c. 
Assigning to me as I will be investigating this.
Comment 12 Eclipse Genie CLA 2020-05-05 05:37:54 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.