Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Using IWorkbenchPage#hideEditor to confine editor to a single perspective
Using IWorkbenchPage#hideEditor to confine editor to a single perspective [message #499322] Fri, 20 November 2009 19:20 Go to next message
Will Horn is currently offline Will Horn
Messages: 265
Registered: July 2009
Senior Member
I noticed the new API in 3.5 and I think it can help me fix a bug in my RCP
application. My use case confines editors to a single perspective (the
others just contain views). However, if I have open editors in the editor
perspective and switch to a non-editor perspective, I still see the editor
contributions to the toolbar and menus. I added an IPerspectiveListener to
"hide" all the editors when the editing perspective is deactivated, and
"show" them when it is activated. Two problems I've encountered:

1. Toolbar contributions always seem to be removed, but sometimes (not
always) the File menu still has Close and Close All enabled
2. When I return to the editor perspective, the "active" editor is always
the first editor instead of the one that was active when I left

Is this the right approach? Any suggestions on the above two issues?

Thanks
Will
Re: Using IWorkbenchPage#hideEditor to confine editor to a single perspective [message #499329 is a reply to message #499322] Fri, 20 November 2009 20:20 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

#1 is probably a bug. If hiding the last editor doesn't set the system to have no active editor, then I could see that happening.

https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Platform &component=UI

#2 you would have to remember the editor that was active, and then after you've added them all back call IWorkbenchPage#bringToTop(IWorkbenchPart). The hideEditor/showEditor works by doing almost all of a close and an open, but that effects the MRU list and the activation list.

PW


Re: Using IWorkbenchPage#hideEditor to confine editor to a single perspective [message #501294 is a reply to message #499329] Tue, 01 December 2009 18:52 Go to previous message
Will Horn is currently offline Will Horn
Messages: 265
Registered: July 2009
Senior Member
Thanks Paul. I filed a bug for #1 with a test case
http://bugs.eclipse.org/296600 Sorry for the delay - I wanted to test on
3.5.1 and create a reproducible test case.

Your suggestion for #2 works.

"Paul Webster" <pwebster@ca.ibm.com> wrote in message
news:he6tmo$jpn$1@build.eclipse.org...
> #1 is probably a bug. If hiding the last editor doesn't set the system to
> have no active editor, then I could see that happening.
>
> https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Platform &component=UI
>
> #2 you would have to remember the editor that was active, and then after
> you've added them all back call IWorkbenchPage#bringToTop(IWorkbenchPart).
> The hideEditor/showEditor works by doing almost all of a close and an
> open, but that effects the MRU list and the activation list.
>
> PW
>
> --
> Paul Webster
> http://wiki.eclipse.org/Platform_Command_Framework
> http://wiki.eclipse.org/Command_Core_Expressions
> http://wiki.eclipse.org/Menu_Contributions
Previous Topic:Using Automated GUI testing tools with TreeViewer columns
Next Topic:How to customize Eclipse Galileo 3.5
Goto Forum:
  


Current Time: Tue Sep 23 00:22:25 GMT 2014

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

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