Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Converting an Action path into command path
Converting an Action path into command path [message #479273] Mon, 10 August 2009 13:59 Go to next message
Adam Neal is currently offline Adam NealFriend
Messages: 40
Registered: July 2009
Member
Hi,

I'm sure this should be simple, can someone please point out where I'm going
wrong... I'm migrating actions to be commands.

One action had a path of "/navigateGroup". I found that when I created a
menu contribution using org.eclipse.ui.menus and specified
locationURI=" popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContex tMenu?after=navigateGroup ">
it worked.

Now I have another action but its found with the action path:
"/navigateMenu/groupX" (which actually is a contribution to a menu found
within the same group as above)
I'm not sure how this converts into the command/handler framework...

I've tried:
locationURI=" popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContex tMenu?after=navigateMenu/groupX ">

And:
locationURI=" popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContex tMenu?after=groupX ">

And
locationURI=" popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContex tMenu?after=navigateGroup ">
<menu id="navigateMenu"...> <command ... /> </menu>

I also found in the IIDEActionConstants an id for the start of the
navigation menu: navStart. So I tried this as well:
locationURI=" popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContex tMenu?after=navStart ">

But none seem to contribute my command into the navigate menu.

Any help please?
Thanks,
Adam
Re: Converting an Action path into command path [message #479354 is a reply to message #479273] Mon, 10 August 2009 18:23 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

The syntax for the location URI is popup:<menu.id>?after=<contained.id>

navigateMenu is probably the menu id ... but where is it coming from? menuContributions cannot see objectContributions or viewerContributions. They can only see programmatic contributions and other menuContributions.

PW


Re: Converting an Action path into command path [message #479359 is a reply to message #479273] Mon, 10 August 2009 18:20 Go to previous messageGo to next message
Adam Neal is currently offline Adam NealFriend
Messages: 40
Registered: July 2009
Member
Could it be that my issue is I need to specify the navigate menu id rather
then the diagram context menu id? If this is the case, how do I get the
proper navigateMenu id?

I tried using just locationURI="popup:navigateMenu?after=groupX"
and
locationURI=" popup:org.eclipse.gmf.runtime.diagram.ui.navigateMenu?after= groupX ">

But this also didn't work. Do I need to specify the navigate menu id? or do
I need to use the default context menu, and then re-create the menu
structure (I believe I read to do this else where, but it is also not
working for me).

Thanks again,
Adam
Re: Converting an Action path into command path [message #479372 is a reply to message #479354] Mon, 10 August 2009 18:43 Go to previous messageGo to next message
Adam Neal is currently offline Adam NealFriend
Messages: 40
Registered: July 2009
Member
Looks like its contributed through GMF's DiagramContributionItemProvider as
a popupmenu
<popupmenu path="/navigateGroup" id="navigateMenu"/>

Does this mean that its not accessible via the org.eclipse.ui.menus
infrastructure?

-Adam

"Paul Webster" <pwebster@ca.ibm.com> wrote in message
news:h5pojp$ut5$1@build.eclipse.org...
> The syntax for the location URI is popup:<menu.id>?after=<contained.id>
>
> navigateMenu is probably the menu id ... but where is it coming from?
> menuContributions cannot see objectContributions or viewerContributions.
> They can only see programmatic contributions and other menuContributions.
>
> PW
>
Re: Converting an Action path into command path [message #479530 is a reply to message #479372] Tue, 11 August 2009 13:14 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Adam Neal wrote on Mon, 10 August 2009 14:43
Looks like its contributed through GMF's DiagramContributionItemProvider as
a popupmenu
<popupmenu path="/navigateGroup" id="navigateMenu"/>

Does this mean that its not accessible via the org.eclipse.ui.menus
infrastructure?



I'm not familiar with how GMF is creating its submenu, but it might not be available to o.e.ui.menus.

When you try and add the submenu using:
locationURI=" popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContex tMenu?after=navigateGroup ">
<menu id="navigateMenu"...> <command ... /> </menu>

It doesn't work? Or does it produce 2 submenus? You said that using locationURI=" popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContex tMenu?after=navigateGroup " to place a command worked, right?

PW


Re: Converting an Action path into command path [message #479636 is a reply to message #479530] Tue, 11 August 2009 19:46 Go to previous messageGo to next message
Adam Neal is currently offline Adam NealFriend
Messages: 40
Registered: July 2009
Member
It seems that the GMF navigate menu is being created first, before the
PopupMenuExtender gets its chance to add contributions. Therefore the
navigateMenu already exists by the time I try to add to it (as I have other
actions which have already been added to it).

I am again trying to re-create the Navigate menu via:
locationURI="
popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContex tMenu?after=navigateGroup
">
<menu id="navigateMenu"...> <command ... /> </menu>

If I change the id to be navigateMenu1,then I get two menus showing up. But
if I use the GMF id, my command seems to get wiped out.

Here's what I found by debugging.
In the WorkbenchMenuService::processAdditions, the idx value is found to 9
(index when using the cache...). The safe runnable is then used to add my
menu item...The expressions return true for visiblity. It gets the
ManagerPopulationRecord from the ContributionManager, and from this I can
see the menu URI is popup:navigateMenu. Eventually we find ourselves at line
599 in the SafeRunnable of the WorkbenchMenuService::processAdditions trying
to insert the command: mgr.insert(insertionIndex, ici);

At this point, the mgr has an empty contributions list!?! So this method
throws an ArrayIndexOutOfBoundsException since its asking to add at index 9
and therefore I never get added to the menu.

Does this ring a bell for you as to what might be wrong?
Thanks again,

Adam

P.S you asked: locationURI="
popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContex
tMenu?after=navigateGroup " to place a command worked, right?
Yes, this works since its an action in the root menu.

"Paul Webster" <pwebster@ca.ibm.com> wrote in message
news:h5rqrg$jg5$1@build.eclipse.org...
> Adam Neal wrote on Mon, 10 August 2009 14:43
>> Looks like its contributed through GMF's DiagramContributionItemProvider
>> as a popupmenu
>> <popupmenu path="/navigateGroup" id="navigateMenu"/>
>>
>> Does this mean that its not accessible via the org.eclipse.ui.menus
>> infrastructure?
>
>
> I'm not familiar with how GMF is creating its submenu, but it might not be
> available to o.e.ui.menus.
>
> When you try and add the submenu using:
> locationURI="
> popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContex
> tMenu?after=navigateGroup ">
> <menu id="navigateMenu"...> <command ... /> </menu>
>
> It doesn't work? Or does it produce 2 submenus? You said that using
> locationURI="
> popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContex
> tMenu?after=navigateGroup " to place a command worked, right?
>
> PW
>
Re: Converting an Action path into command path [message #479776 is a reply to message #479636] Wed, 12 August 2009 13:40 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

So the index==9, is that for the command element based on the programmatically added navigateMenu? And then it's using the empty one it created to actually do the insert?

It sounds like there's a bug in there, one way or the other. Please open a bug at https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Platform &component=UI and post the number back here and we'll have a look.

if the navigateMenu MenuManager is being added to the context menu programmatically then it should be available to your menuContributions simply using popup:navigateMenu (you don't need to add the <menu/> element yourself).

PW


Re: Converting an Action path into command path [message #479883 is a reply to message #479776] Wed, 12 August 2009 21:33 Go to previous message
Adam Neal is currently offline Adam NealFriend
Messages: 40
Registered: July 2009
Member
Thanks Paul,

This bug is tracking the issue:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=286393

Note: I did try using simply the URI popup:navigateMenu as well, but I get
the exact same issue...

Adam

"Paul Webster" <pwebster@ca.ibm.com> wrote in message
news:h5ugo7$7te$1@build.eclipse.org...
> So the index==9, is that for the command element based on the
> programmatically added navigateMenu? And then it's using the empty one it
> created to actually do the insert?
>
> It sounds like there's a bug in there, one way or the other. Please open
> a bug at
> https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Platform &component=UI
> and post the number back here and we'll have a look.
>
> if the navigateMenu MenuManager is being added to the context menu
> programmatically then it should be available to your menuContributions
> simply using popup:navigateMenu (you don't need to add the <menu/> element
> yourself).
>
> PW
>
Previous Topic:Delta lost when breakpoint change merged with breakpoint add?
Next Topic:How to override Boolean settings using ScopedPreferenceStore?
Goto Forum:
  


Current Time: Fri Apr 19 00:37:56 GMT 2024

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

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

Back to the top