Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to hide a menu button when user switches to Navigator from Editor
How to hide a menu button when user switches to Navigator from Editor [message #551176] Thu, 05 August 2010 14:00 Go to next message
Geejay is currently offline Geejay
Messages: 160
Registered: February 2010
Senior Member
Hi

I have set up a command, and a menu for that command, that displays when an
editor of a certain type is opened. This works. When I open the editor, I
see the enabled command, when I close the editor, the command disappears.

When I click away from the editor and focus on another area of the
workbench, I want the button to disappear or be disabled. This isn't
happening at the moment.

I am controlling the visibility through the visibleWhen on the menu, to an
activeEditorId.
Re: How to hide a menu button when user switches to Navigator from Editor [message #551335 is a reply to message #551176] Fri, 06 August 2010 04:56 Go to previous messageGo to next message
Prakash G.R. is currently offline Prakash G.R.
Messages: 621
Registered: July 2009
Senior Member
On 05/08/10 7:30 PM, geejay wrote:
> I have set up a command, and a menu for that command, that displays when
> an editor of a certain type is opened. This works. When I open the
> editor, I see the enabled command, when I close the editor, the command
> disappears.
>
> When I click away from the editor and focus on another area of the
> workbench, I want the button to disappear or be disabled. This isn't
> happening at the moment.
>
> I am controlling the visibility through the visibleWhen on the menu, to
> an activeEditorId.

What you have done seems to be right. Please raise a bug with a sample
code to reproduce it: http://bit.ly/NewBugInPlatformUI

--
- Prakash
Platform UI Team, IBM

www.eclipse-tips.com
Re: How to hide a menu button when user switches to Navigator from Editor [message #553158 is a reply to message #551176] Mon, 16 August 2010 15:06 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

geejay wrote:
> Hi
>
> I have set up a command, and a menu for that command, that displays when
> an editor of a certain type is opened. This works. When I open the
> editor, I see the enabled command, when I close the editor, the command
> disappears.
>
> When I click away from the editor and focus on another area of the
> workbench, I want the button to disappear or be disabled. This isn't
> happening at the moment.
>
> I am controlling the visibility through the visibleWhen on the menu, to
> an activeEditorId.

You probably want activePartId (which will only be the editor ID when
the editor has focus).

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: How to hide a menu button when user switches to Navigator from Editor [message #555270 is a reply to message #553158] Thu, 26 August 2010 07:21 Go to previous message
Geejay is currently offline Geejay
Messages: 160
Registered: February 2010
Senior Member
Perfect. That was the problem. Thank you.

"Paul Webster" <pwebster@ca.ibm.com> wrote in message
news:i4bjua$dq5$4@build.eclipse.org...
> geejay wrote:
>> Hi
>>
>> I have set up a command, and a menu for that command, that displays when
>> an editor of a certain type is opened. This works. When I open the
>> editor, I see the enabled command, when I close the editor, the command
>> disappears.
>>
>> When I click away from the editor and focus on another area of the
>> workbench, I want the button to disappear or be disabled. This isn't
>> happening at the moment.
>>
>> I am controlling the visibility through the visibleWhen on the menu, to
>> an activeEditorId.
>
> You probably want activePartId (which will only be the editor ID when the
> editor has focus).
>
> 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
Previous Topic:Remembering the last directory from which a user opened a file
Next Topic:How to Convert java projects into plugin projects
Goto Forum:
  


Current Time: Thu Sep 18 22:03:12 GMT 2014

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

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