Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » org.eclipse.ui.menu contribution for specific perspective
icon5.gif  org.eclipse.ui.menu contribution for specific perspective [message #507043] Mon, 11 January 2010 18:52 Go to next message
Patrick Chuong is currently offline Patrick ChuongFriend
Messages: 11
Registered: July 2009
Junior Member
Hello,

I am trying to use the the command framework and contribute toolbar and menu to the workbench window for a given perspective, but the actions are visible for all perspectives. Then I use the visibleWhen to restrict it to be visible for a given perspective. However, this does not work the same as an actionSet, by default, the actionSet can be set to be hidden and than use the perpectiveExtension to set which perspective the actionSet should be visible. User can also goto the customize perspective dialog to set the actionSet to be visible, where as the menu extension is not possible, there is no way to set the toolbar or menu to be visible if visibleWhen is used.

I am not able to figure out a way to do the same thing as the actoinSet extension point. Can some let me know whether this is possible?

Thanks,
Patrick
Re: org.eclipse.ui.menu contribution for specific perspective [message #507284 is a reply to message #507043] Tue, 12 January 2010 18:05 Go to previous messageGo to next message
Peter Nehrer is currently offline Peter NehrerFriend
Messages: 241
Registered: July 2009
Senior Member
Hey Patrick,

I don't think you can completely replace your action sets with
o.e.ui.menus extensions, unfortunately. See
http://www.eclipse.org/forums/index.php?t=tree&th=158101 &S=1fc4c39640675e1c88c920e4dc4304b0#page_top
for some context. I think the documentation for o.e.ui.menus gives the
false impression that this should be possible and should be corrected.

Is there any reason you can't use action sets to accomplish what you
need to?

--Peter

On 1/11/10 1:52 PM, Patrick Chuong wrote:
> Hello,
>
> I am trying to use the the command framework and contribute toolbar and
> menu to the workbench window for a given perspective, but the actions
> are visible for all perspectives. Then I use the visibleWhen to restrict
> it to be visible for a given perspective. However, this does not work
> the same as an actionSet, by default, the actionSet can be set to be
> hidden and than use the perpectiveExtension to set which perspective the
> actionSet should be visible. User can also goto the customize
> perspective dialog to set the actionSet to be visible, where as the menu
> extension is not possible, there is no way to set the toolbar or menu to
> be visible if visibleWhen is used.
>
> I am not able to figure out a way to do the same thing as the actoinSet
> extension point. Can some let me know whether this is possible?
>
> Thanks,
> Patrick
>
Re: org.eclipse.ui.menu contribution for specific perspective [message #507288 is a reply to message #507284] Tue, 12 January 2010 18:28 Go to previous messageGo to next message
Patrick Chuong is currently offline Patrick ChuongFriend
Messages: 11
Registered: July 2009
Junior Member
Hi Peter,

Good to see you here.

I wasn't able to use actionSet to place my action at a specific location in the toolbar or menu. The org.eclipse.ui.menu contribution allows me to do what I wanted.

Also, using command allows me to wire actions in different menu and toolbar contributions to a single handler, which is really nice.

I was able to achieved the perspective visiblility, with the exception of user can't enable/disable it in the customized dialog, and can't set the default visibility state.

Patrick
Re: org.eclipse.ui.menu contribution for specific perspective [message #507513 is a reply to message #507288] Wed, 13 January 2010 17:58 Go to previous messageGo to next message
Peter Nehrer is currently offline Peter NehrerFriend
Messages: 241
Registered: July 2009
Senior Member
Patrick, you probably figured it out by now :-P but just in case:

You can handle initial visibility by watching a system property in
visibleWhen (using systemTest). Or you can create a property tester and
use that to watch a preference setting (using test in visibleWhen). On
the editing side, you'd have to either modify the perspective
customization dialog to incorporate o.e.ui.menus contributions (which is
what the Platform should have done in the first place), maybe some
specially marked ones, or just create your own dialog or preference page
to do this.

--Peter

On 1/12/10 1:28 PM, Patrick Chuong wrote:
> Hi Peter,
>
> Good to see you here.
>
> I wasn't able to use actionSet to place my action at a specific location
> in the toolbar or menu. The org.eclipse.ui.menu contribution allows me
> to do what I wanted.
>
> Also, using command allows me to wire actions in different menu and
> toolbar contributions to a single handler, which is really nice.
>
> I was able to achieved the perspective visiblility, with the exception
> of user can't enable/disable it in the customized dialog, and can't set
> the default visibility state.
>
> Patrick
Re: org.eclipse.ui.menu contribution for specific perspective [message #507515 is a reply to message #507513] Wed, 13 January 2010 18:19 Go to previous messageGo to next message
Patrick Chuong is currently offline Patrick ChuongFriend
Messages: 11
Registered: July 2009
Junior Member
yeah, I am using the visibleWhen to detect which perspective I am in, the problem that I am facing is that you can't customize the menu if visbleWhen is false, which I have posted in my last email and you have mentioned in your last post as well. Sad

Is the customized perspective dialog extensible? If not, perhaps I should try to make the changes and contribute it back to platform.

Patrick
Re: org.eclipse.ui.menu contribution for specific perspective [message #507522 is a reply to message #507043] Wed, 13 January 2010 18:30 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

you can use visibleWhen to tie your commands to one or more perspectives
.... but then they only show up in the CustomzePerpsectiveDialog in the
ToolBar Visibility and Menu Visibility tabs, not in the mis-named
Command Group visibility tab.

You can tie commands to legacy actionSets by using the visibleWhen and
checking the activeContexts variable for an ID that matches the
actionSet ID. They will appear and disappear with their matching
actionSets. The commands will still not appear in the Commands Group
tab, though. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=174689

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: org.eclipse.ui.menu contribution for specific perspective [message #507558 is a reply to message #507522] Wed, 13 January 2010 20:27 Go to previous message
Patrick Chuong is currently offline Patrick ChuongFriend
Messages: 11
Registered: July 2009
Junior Member
thanks Paul.

After I hook the visibleWhen using the activeContexts variable with an actionSet id, it works. But now I have an empty actionSet, but it is better than before.

It is too bad that there isn't a way to set the default visible value of a command based on the perspective without pulling in the actionSet. It would be nice if there is a variable to set the initial state and let the perspective extension take care of the action initial visibility.

Regards,
Patrick
Previous Topic:Common navigator: how to show children without image and without empty space?
Next Topic:UML2 Install Failure
Goto Forum:
  


Current Time: Fri Apr 26 01:13:58 GMT 2024

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

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

Back to the top