Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Maximize/restore a view programmatically
Maximize/restore a view programmatically [message #269795] Thu, 02 September 2004 13:02 Go to next message
Maya Barnea is currently offline Maya BarneaFriend
Messages: 6
Registered: July 2009
Junior Member
Is there a way to maximize/restore a view programmatically?
Re: Maximize/restore a view programmatically [message #269827 is a reply to message #269795] Thu, 02 September 2004 14:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by:

Maya Barnea wrote:

> Is there a way to maximize/restore a view programmatically?

Take a look at the API for the "ActionFactory" class

Here is quick example:

ActionFactory.IWorkbenchAction maximizeAction =
ActionFactory.MAXIMIZE.create(workbenchWindow);; // Will maximize the active part

Re: Maximize/restore a view programmatically [message #832803 is a reply to message #269827] Fri, 30 March 2012 15:57 Go to previous message
Chris Mooney is currently offline Chris MooneyFriend
Messages: 1
Registered: March 2012
Junior Member
I recently found a solution for doing this within the view that you are trying to control:

class MyView extends ViewPart {

	 * @param state  one of the IWorkbenchPage STATE_* values: STATE_MAXIMIZED, 
	private void setViewState(int state) {
		IWorkbenchPage page 
                    = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
		int currentState = page.getPartState(page.getReference(this));
		if(currentState != state) {
			page.setPartState(page.getReference(this), state);


Adding this method to your view class will let you maximize the view by calling:

setViewState(IWorkbenchPage STATE_MAXIMIZED)

restore it by calling:

setViewState(IWorkbenchPage STATE_RESTORED)

and of course minimize it by calling:

setViewState(IWorkbenchPage STATE_MINIMIZED)

The effect will be that if you maximize this view, all other views get minimized, restore it and all the views go back to their previous state, and minimize and the other views will fight it out for real-estate Smile

share and enjoy!
Previous Topic:javadoc generation and ${tags}
Next Topic:Eclipse freezes/hangs before Workspace selection
Goto Forum:

Current Time: Thu Jun 21 14:41:43 GMT 2018

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

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

Back to the top