Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to Make Main App Window Resized to Show All Widgets?
How to Make Main App Window Resized to Show All Widgets? [message #458610] Thu, 23 November 2006 09:24 Go to next message
TH Lim is currently offline TH LimFriend
Messages: 8
Registered: July 2009
Junior Member
Hi,

I like to set my RCP application main window resized to show all the widgets after it is launched instead of hardcoded using IWorkbenchWindowConfigurer.setInitialSize(...) e.g. IWorkbenchWindowConfigurer.setInitialSize(new Point(445, 355));

Does RCP or SWT has APIs to allow me to something Swing's pack() method where JFrame.pack() will resized JFrame according to the components layout contains within?

Thanks

/lim/
Re: How to Make Main App Window Resized to Show All Widgets? [message #458630 is a reply to message #458610] Thu, 23 November 2006 12:37 Go to previous messageGo to next message
Alex Blewitt is currently offline Alex BlewittFriend
Messages: 946
Registered: July 2009
Senior Member
You mean like Shell.pack()?
Re: How to Make Main App Window Resized to Show All Widgets? [message #458645 is a reply to message #458630] Thu, 23 November 2006 14:47 Go to previous messageGo to next message
TH Lim is currently offline TH LimFriend
Messages: 8
Registered: July 2009
Junior Member
Yes, like Shell.pack(). Sorry, I guess I am missing something here. If I would do a SWT application, a Shell.pack() would do it nicely for me. Now I'm in RCP, wat should I do if I want the RCP framework to "pack" for me like Shell.pack(). Thanks
Re: How to Make Main App Window Resized to Show All Widgets? [message #458730 is a reply to message #458645] Thu, 23 November 2006 16:37 Go to previous messageGo to next message
Alex Blewitt is currently offline Alex BlewittFriend
Messages: 946
Registered: July 2009
Senior Member
configurer.getWindow().getShell().pack()? You'd probably want to do this in your postStartup(), after they've been shown, though.

The other approach in your advisor is to have a preWindowOpen() or postWindowOpen() do the work for each window. I'm not sure on the effect of a pack() prior to the shell being displayed, though.

Alex.
Re: How to Make Main App Window Resized to Show All Widgets? [message #458772 is a reply to message #458730] Fri, 24 November 2006 10:43 Go to previous messageGo to next message
TH Lim is currently offline TH LimFriend
Messages: 8
Registered: July 2009
Junior Member
I dig thru the sources and I found that the RCP has set the shell layout to org.eclipse.ui.internal.layout.TrimLayout which I suspect pack() has no effect to its layout like GridLayout. One way I could do is create the window content myself which includes menu bar, status line, fast view and others. In short, quite a handful. Can you think of any workaround? Or I take some time to understand how TrimLayout works.

Thanks
Re: How to Make Main App Window Resized to Show All Widgets? [message #458775 is a reply to message #458772] Fri, 24 November 2006 11:38 Go to previous messageGo to next message
Alex Blewitt is currently offline Alex BlewittFriend
Messages: 946
Registered: July 2009
Senior Member
Ah, I think I see what you mean. You've got some views, and you want the views to be resized so they fit to the minium, then you want the RCP window to be resized so that the views don't have scrollbars?

Most of the perspectives are specified by ratios (e.g. this takes up 1/3 of the width, or 1/2 of the height), so it's difficult to know how to get the sizes of individual elements or to be able to resize them appropriately.

You might want to have a look at LayoutPart (org.eclipse.ui.internal) and its subclasses (PartPane,ViewPane,EditorPane) since those have the sizes of the individual areas. They've also got a computePreferredSize as well as a getControl() which you might be able to do setSize on. But this is all internal stuff, and might not be a good way of doing it. Maybe the SWT newsgroup would be able to offer specific advice.

Alex.
Re: How to Make Main App Window Resized to Show All Widgets? [message #458777 is a reply to message #458775] Fri, 24 November 2006 11:47 Go to previous messageGo to next message
Alex Blewitt is currently offline Alex BlewittFriend
Messages: 946
Registered: July 2009
Senior Member
You might want to consider adding yourself as a Cc: to

https://bugs.eclipse.org/bugs/show_bug.cgi?id=51580

which discusses being able to resize views programmatically.

Alex.
Re: How to Make Main App Window Resized to Show All Widgets? [message #458801 is a reply to message #458775] Fri, 24 November 2006 16:42 Go to previous message
TH Lim is currently offline TH LimFriend
Messages: 8
Registered: July 2009
Junior Member
Yes, you are correct. Actually, my app is much simpler than you described. I have a single view with a menu bar. This view alone represent the whole RCP application. To illustration, say, all my widgets in the view require a width of 300 and height of 400 but the default RCP window has the size of 1024 in width and 768 in height. It makes my application looks "empty".

Thanks for the tips, Alex. I will look at bug you have included in the thread.
Previous Topic:Converting RCP app to use workbench projects?
Next Topic:Perspective docking question
Goto Forum:
  


Current Time: Thu Mar 28 23:15:13 GMT 2024

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

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

Back to the top