Bug 398027 - There should be a model tag to prevent resizing the shell
Summary: There should be a model tag to prevent resizing the shell
Status: CLOSED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: 4.4 M6   Edit
Assignee: Platform UI Triaged CLA
QA Contact: Eric Moffatt CLA
URL:
Whiteboard: c
Keywords: noteworthy
: 410787 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-01-12 16:15 EST by Joseph Carroll CLA
Modified: 2014-03-06 00:33 EST (History)
4 users (show)

See Also:


Attachments
shellNoResize Tag (1.71 KB, patch)
2013-01-12 16:16 EST, Joseph Carroll CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Carroll CLA 2013-01-12 16:15:21 EST
There should be a model tag that prevents the shell from being able to be resized.  Similar to a dialog, the shell should only have the style tags CLOSE & TITLE. Specifically when opening a workbench window with only an MPart (no stack as in the case of a login window) preventing the user from being able to resize the window would be important.
Comment 1 Joseph Carroll CLA 2013-01-12 16:16:30 EST
Created attachment 225536 [details]
shellNoResize Tag

Proposed Patch.
Comment 2 Eric Moffatt CLA 2013-01-16 14:05:32 EST
Looks good to me...Joseph, I'll be getting to these once 4.2.2 ships...
Comment 3 Eric Moffatt CLA 2013-03-18 14:20:01 EDT
Thanks Paul. Note that the expected fix will be to create the shell without the sizing trim if the tag is set. You won't be able to change this once the shell has been rendered (but it will still listen to changes in the 'x', 'y', 'width' and 'height' fields even if the tag is set.
Comment 4 Joseph Carroll CLA 2013-03-18 16:14:21 EDT
@Eric - Would it be better / easier if I pushed the patch to Gerrit for review?

Just as a note to comment 3, currently it is not possible to dynamically update the size of the window during the call to @PostConstruct.  While you are able to inject the MWinodw element and change the size, the notification event is not processed.  The model will update after the shell is set to the original size for the window, and there isn't an explicit repaint event that will trigger the resize.  If there is, it will look choppy (ie. you can see the window resize).

Moral of the story, for now, be sure to set the appropriate size in the model fragment.
Comment 5 Eric Moffatt CLA 2014-02-07 13:30:47 EST
Joseph, I'm going to re-purpose this defect in order to make it more general. Rather that a tag specific to this particular style bit I'm looking at allowing the use of a new 'persistedData' key "STYLE_OVERRIDE".

For SWT based renderers (specifically the WBWRenderer initially) the expected 'value' would be the string version of the integer you get by OR'ing the various style bits together. This should allow about as complete control over the shell's initial state as is possible.

At the same time I expect to move the tags in the WBWRenderer (ShellMaximizedTag & ShellMinimizedTag out to the IPresentationEngine, making them API so you can define the initial display state of the shell.

How does this sound ?
Comment 6 Eric Moffatt CLA 2014-02-07 13:31:45 EST
Note that going forward we may find uses in other rendering situations for STYLE_OVERRIDE....
Comment 7 Eric Moffatt CLA 2014-02-11 14:05:43 EST
*** Bug 410787 has been marked as a duplicate of this bug. ***
Comment 8 Eric Moffatt CLA 2014-02-11 14:16:33 EST
Committed:

http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=0f0fbd2062cb6980a5d333534aaa4fa6d1d72e05

This adds two new Tags and a persistentData key into the API. 

The new tags, WINDOW_MAXIMIZED_TAG & WINDOW_MINIMIZED_TAG are used to define the initial min/max state of the window.

The new persistent data key 'STYLE_OVERRIDE_KEY' allows for a contract between a renderer and someone using this key on a ui element. So far I've only implemented the code to respect the new overrides in the WBWRenderer but there you can simply define the SWT flags you want in an 'int' and store the string version in the MWindow's peristentData map.

Two things to think about:

We can use the same key on different platforms (i.e. the value/format of the string is a contract with the renderer that will generate the widget and need not be an int...).

Are there other create-time only style bits we might want to override on other widgets (Toolbars...) ?
Comment 9 Joseph Carroll CLA 2014-02-14 20:06:04 EST
The feature look good, IIRC my initial intention for the feature was to provide some kind of "dialog" type control over the window.  As far as other uses go, the style overrides could be handy with dialogs too.  Where I can create an MDialog with a style override of File | Open and it would open the native (swt) File dialog.

But then again, I don't even recall if Dialogs are in or out for 4.4.  Plus, there would have to be a way to prevent adding any child elements to the dialog.  So I'm not too sure how we could make that all jive, but it just seems goofy not have some kind of model representation for the native style dialogs. (And of course there is the issue of retrieving the user input from the dialog as well)

Moral of the story I think we will be able to find uses for the style overrides

JD