Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » editor area dynamically hiding/showing
editor area dynamically hiding/showing [message #635365] Tue, 26 October 2010 15:01 Go to next message
Luca Ferrari is currently offline Luca FerrariFriend
Messages: 159
Registered: November 2009
Senior Member
Hi all,
don't know if possible, but I'd like to have the editor area of a perspective to be not visible when the perspective is opened, to be shown when it needs and to disappear again when the editor is closed. Actually, if I set layout.setEditorAreaVisible(false); in the perspective factory I obtain the first two steps: the editor area is not visible until the user explicitly opens it, but when the editor is closed, the editor area remains visible. Is it possible to hide again the editor area and resize the views accordingly?
Re: editor area dynamically hiding/showing [message #635572 is a reply to message #635365] Wed, 27 October 2010 11:33 Go to previous messageGo to next message
Devi Vara Prasad Bandaru is currently offline Devi Vara Prasad BandaruFriend
Messages: 98
Registered: March 2010
Location: Hyderabad
Member

Add a part listener(org.eclipse.ui.IPartListener) to your workbench page . Implement this method org.eclipse.ui.IPartListener.partClosed(IWorkbenchPart)

	public void partClosed(IWorkbenchPart part) {
		IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
		if (activePage.getEditorReferences().length == 0) {
			activePage.setEditorAreaVisible(false);
		}
	}








Re: editor area dynamically hiding/showing [message #635842 is a reply to message #635572] Thu, 28 October 2010 10:49 Go to previous message
Luca Ferrari is currently offline Luca FerrariFriend
Messages: 159
Registered: November 2009
Senior Member
Great! Even if I changed the code to avoid null pointer exception on workbench exit:

public void partClosed(IWorkbenchPart part) {
	
	IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
	if( activePage != null )
	    activePage.setEditorAreaVisible( (activePage.getEditorReferences().length > 0 ) );


    }
Previous Topic:Problem with RCP app and os.name property
Next Topic:Extension Point Schema Definition Question
Goto Forum:
  


Current Time: Sat Dec 20 15:53:27 GMT 2014

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

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