Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Creating a sidebar - how can I resize a view programatically?
Creating a sidebar - how can I resize a view programatically? [message #507446] Wed, 13 January 2010 14:30 Go to next message
John Ormerod is currently offline John Ormerod
Messages: 39
Registered: January 2010
Member
Hello
I want to implement a sidebar that opens and closes (Notes 8.x has such a thing).

I have experimented with a sticky view. I can use hideView() and showView() via an external toggle, to make the 'sidebar' go away and come back, but of course, this rebuilds the view each time.

What I would like to do is to shrink the view so that its width (in my case) is zero, and then restore it to its original/previous width.

Regards, John
Re: Creating a sidebar - how can I resize a view programatically? [message #507543 is a reply to message #507446] Wed, 13 January 2010 19:30 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

If you minimize the view it will go to the trim ... not open any more,
but not disposed (which is the problem you are complaining about?)

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Creating a sidebar - how can I resize a view programatically? [message #507653 is a reply to message #507446] Thu, 14 January 2010 09:32 Go to previous messageGo to next message
John Ormerod is currently offline John Ormerod
Messages: 39
Registered: January 2010
Member
Thanks Paul.

Hmmm... 'minimize', makes a lot of sense, duh!

I found a way to do this in a forum entry from 2007:
page.setPartState(myView, IWorkbenchPage.STATE_MINIMIZED);

This hides the view contents, reduces the width of the view to the same point that you can drag it to, but the leaves the view's tab showing. Same goes for a non-sticky view. (This is 3.5.1).

This is what happens when I press the minimize icon.Yet in the IDE, minimize does indeed close a view completely (and shows a list of minimised views). So, I guess there is something extra in the IDE. I'll have a search in the IDE's code, but if you know the area to look in, a pointer would be helpful - unless you actually know what I have to do.

Thanks, John
Re: Creating a sidebar - how can I resize a view programatically? [message #507816 is a reply to message #507446] Thu, 14 January 2010 18:53 Go to previous message
John Ormerod is currently offline John Ormerod
Messages: 39
Registered: January 2010
Member
Paul

I discovered what determines the minimum width of a view - by chance - when I was investigating Presentations. A StackPresentation has a (deprecated) method computeMinimumSize(), which returns a Point. (This might be invoked directly, or from computePreferredSize() ) It's the Point's 'x' value that determines the minimum width that you see when dragging a view's edge towards its opposite - and when using page.setPartState(myView, IWorkbenchPage.STATE_MINIMIZED);

I assume if this were the only variation wanted on the default Presentation, you could create a new one that subclasses the default and just change the min size.

However, I discovered an unfortunate characteristic of the sticky view. When it gets resized, that size only applies to the perspective that was visible when it was resized. Switch perspective and you see the sticky view as it was on that perspective.

I suppose this could be handled by a combination of a stickViewManager (that knows its expanded or not state) and use of a PerspectiveListener, that makes sure the sticky view is consistent.

Does that make sense - or am I inventing a wheel of a slightly different shape?

Regards, John
Previous Topic:Reload / reset perspective
Next Topic:RCP : Create custom Help (PDF file) from Menu
Goto Forum:
  


Current Time: Sat Oct 25 03:05:01 GMT 2014

Powered by FUDForum. Page generated in 0.02008 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software