Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » How to create a dynamic menu ?
How to create a dynamic menu ? [message #629552] Tue, 28 September 2010 16:36 Go to next message
Stephane Rousseau is currently offline Stephane RousseauFriend
Messages: 34
Registered: September 2010
Member
Hi everyone,

I'm trying to insert a dynamic menu in the Project Explorer View menu.
It works in Eclipse 3 but I can't make it run under Eclipse 4.
I use the org.eclipse.ui.menus extension point and extend the
ContributionItem class.

All this stuff is done with the compatibility layer with a non RCP plugin.

<extension
point="org.eclipse.ui.menus">
<menuContribution

locationURI=" popup:org.eclipse.ui.navigator.ProjectExplorer#ProjectExplor er?after=additions ">
<dynamic
class="org.eclipse.test.e4.testplugin.MyContributionItem"
id="org.eclipse.test.e4.testplugin.dynamic1">
</dynamic>
</menuContribution>
</extension>

So, do I miss something or can't it work at this point of Eclipse 4 ?
Is there an alternative way to do this ?

Thanks a lot

Stephane Rousseau
Re: How to create a dynamic menu ? [message #630003 is a reply to message #629552] Thu, 30 September 2010 09:57 Go to previous messageGo to next message
Stephane Rousseau is currently offline Stephane RousseauFriend
Messages: 34
Registered: September 2010
Member
On 28/09/2010 18:36, Stephane Rousseau wrote:
> Hi everyone,
>
> I'm trying to insert a dynamic menu in the Project Explorer View menu.
> It works in Eclipse 3 but I can't make it run under Eclipse 4.
> I use the org.eclipse.ui.menus extension point and extend the
> ContributionItem class.
>
> All this stuff is done with the compatibility layer with a non RCP plugin.
>
> <extension
> point="org.eclipse.ui.menus">
> <menuContribution
>
> locationURI=" popup:org.eclipse.ui.navigator.ProjectExplorer#ProjectExplor er?after=additions ">
>
> <dynamic
> class="org.eclipse.test.e4.testplugin.MyContributionItem"
> id="org.eclipse.test.e4.testplugin.dynamic1">
> </dynamic>
> </menuContribution>
> </extension>
>
> So, do I miss something or can't it work at this point of Eclipse 4 ?
> Is there an alternative way to do this ?
>
> Thanks a lot
>
> Stephane Rousseau

Hello

I succeeded to have my menu in ProjectExplorer using extension point
"org.eclipse.ui.navigator.navigatorContent".

But, if in my E3 plugin, I replace the locationURI
" popup:org.eclipse.ui.navigator.ProjectExplorer#PopupMenu?aft er=additions "
with "popup:org.eclipse.ui.popup.any", I can't do the same in Eclipse 4.

One another problem with my solution is that I'm using an Eclipse 3
component. I would prefer to use something from Eclipse 4 by coding in
Application.e4xmi.

So, if someone can help me, it would be great.

Thanks a lot.

Stephane Rousseau
Re: How to create a dynamic menu ? [message #630026 is a reply to message #630003] Thu, 30 September 2010 12:34 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

It sounds like an edge case that you have that is not properly
supported. Are you saying "popup:org.eclipse.ui.popup.any" doesn't work
in the ProjectExplorer in the compatibility (Eclipse SDK 4.1) layer?

You should open a bug at:
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=E4&c omponent=UI

In the e4 case, I don't think we have a good story yet on adding a
dynamic section to a menu. There would have to be some lifecycle around
it, because the specific instance responsible for that menu would need a
chance to modify the menu model just as the menu is about to show.

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
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 create a dynamic menu ? [message #630050 is a reply to message #630026] Thu, 30 September 2010 13:56 Go to previous message
Stephane Rousseau is currently offline Stephane RousseauFriend
Messages: 34
Registered: September 2010
Member
On 30/09/2010 14:34, Paul Webster wrote:
> It sounds like an edge case that you have that is not properly
> supported. Are you saying "popup:org.eclipse.ui.popup.any" doesn't work
> in the ProjectExplorer in the compatibility (Eclipse SDK 4.1) layer?
>
> You should open a bug at:
> https://bugs.eclipse.org/bugs/enter_bug.cgi?product=E4&c omponent=UI
>
> In the e4 case, I don't think we have a good story yet on adding a
> dynamic section to a menu. There would have to be some lifecycle around
> it, because the specific instance responsible for that menu would need a
> chance to modify the menu model just as the menu is about to show.
>
> PW
>
Hello,

Thank you for your answer.

I badly explained my dev.

Using popup:org.eclipse.ui.popup.any in Eclipse 3, I have the menu
everywhere as expected.

But my first solution in Eclipse 4 (using
org.eclipse.ui.navigator.navigatorContent) doesn't work in all views
(only Project Explorer view as expected).

So, it's not a bug, but it doesn't solve my migration problem. The last
part of your answer confirms my thought.

Regards

Stephane Rousseau
Previous Topic:Window icon
Next Topic:detached view
Goto Forum:
  


Current Time: Wed Apr 24 19:28:30 GMT 2024

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

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

Back to the top