view action delegate with sub menu ... [message #332277] |
Thu, 16 October 2008 12:22  |
Eclipse User |
|
|
|
Hi all,
I need to implement a view action that will display, as a submenu, a list of
actions when selected ... the action comes from extension point (view action
delegate)
VIEW CONTEXT MENU
________________
- Action 1
- Action 2
- List Action
- sub action a
- sub action b
- sub action c
- sub action d
- Action 3
I'll try to describe what I need to do ...
I have a list of names that I know at runtime ...
When I select an item in my view I would like to see in the context menu my
"List Action" action with a submenu that will list the actions (each one
named with the name I read when the application when it starts ...)
I have found a way to do this via a normal action (jface.action) where I can
override the setMenuCreator (with IMenuCreator) ...
But what shall I do here ...
This action is contributed to my view from a fragment so I cannot directly
add the action to the context menu and I cannot create in the
Any suggestion, or a better approach will be appreciated.
Thanks
Kar
<fragment>
<extension
point="org.eclipse.ui.popupMenus">
<viewerContribution
id="org.eclipse.ui.articles.action.contribution.popup.navigator "
targetID="com.xxx..views.DBView">
<action
class=" org.eclipse.ui.articles.action.contribution.ViewAction1Deleg ate "
icon="icons/command.gif"
menubarPath="additions"
id=" org.eclipse.ui.articles.action.contribution.navigator.action 1 "
label="View Action 1">
</action>
<menu
id=" org.eclipse.ui.articles.action.contribution.navigator.subMen u "
label="View Sub Menu"
path="additions">
<separator
name="group1">
</separator>
</menu>
....
....
|
|
|
|
Re: view action delegate with sub menu ... [message #332291 is a reply to message #332277] |
Fri, 17 October 2008 09:43   |
Eclipse User |
|
|
|
Thanks Paul . it worked .
One more question if I can .
The example works fine when I add the dynamic actions to the context menu
but I would love to create a sub menu (SUB ACTION) that will be populated
with the dynamic actions.
I have tried:
a) Adding in the plugin C (the one that will display the dynamic actions) a
popup menu extension point that will just create a new menu separator .
I have tried to set the menu contribution uri to
"my.project.menu3/subseparator" with no luck (I can only see the the action2
in the sub menu) - the example works fine if I use additions in the uri.
b) Or shall I put the popup menus extension point in the plugin B - the one
where is present the db view .
c) I have even tried to create a sub menu ( in the bit of code that will
fill the context menu . ) but still I cannot add the dynamic action plus the
context menu start acting weirdly (separator appears and disappear each time
the context menu is displayed)
MenuManager viewMenu = new MenuManager("Local View", "locals");
viewMenu.add(new Separator("popuplactions"));
viewMenu.add (actionExecEomdbAction);
manager.add(viewMenu);
What am I doing wrong?
Thanks Kar
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
<extension
point="org.eclipse.ui.popupMenus">
<viewerContribution
id="my.project.viewerContribution2"
targetID="com.utils.views.DBView">
<menu
id="my.project.menu3"
label="SUB MENU"
path="additions">
<separator
name="subseparator">
</separator>
</menu>
<action
class="my.project.Action2"
id="my.project.action2"
label="label"
menubarPath="my.project.menu3/subseparator">
</action>
</viewerContribution>
</extension>
<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI=" popup:com.eidosmedia.eomutils.views.EomDBView?after=addition s ">
<dynamic
class="my.project.MyCompoundContributionItem"
id="my.project.myCompoundContributionItem">
</dynamic>
</menuContribution>
</extension>
<extension
point="org.eclipse.ui.commands">
<category
id="my.project.myCategory"
name="My Category">
</category>
<command
categoryId="my.project.myCategory"
id="my.project.myCommand"
name="Do Something ">
</command>
</extension>
<extension
point="org.eclipse.ui.handlers">
<handler
class="my.project.MyHandler"
commandId="my.project.myCommand">
</handler>
</extension>
</plugin>
"Kar" <carmeloscala@hotmail.com> wrote in message
news:gd7blr$fud$1@build.eclipse.org...
> Hi all,
>
> I need to implement a view action that will display, as a submenu, a list
> of actions when selected ... the action comes from extension point (view
> action delegate)
>
> VIEW CONTEXT MENU
> ________________
> - Action 1
> - Action 2
> - List Action
> - sub action a
> - sub action b
> - sub action c
> - sub action d
> - Action 3
>
> I'll try to describe what I need to do ...
>
> I have a list of names that I know at runtime ...
> When I select an item in my view I would like to see in the context menu
> my "List Action" action with a submenu that will list the actions (each
> one named with the name I read when the application when it starts ...)
>
> I have found a way to do this via a normal action (jface.action) where I
> can override the setMenuCreator (with IMenuCreator) ...
> But what shall I do here ...
>
> This action is contributed to my view from a fragment so I cannot directly
> add the action to the context menu and I cannot create in the
>
> Any suggestion, or a better approach will be appreciated.
>
> Thanks
> Kar
>
>
> <fragment>
> <extension
> point="org.eclipse.ui.popupMenus">
> <viewerContribution
>
> id="org.eclipse.ui.articles.action.contribution.popup.navigator "
> targetID="com.xxx..views.DBView">
> <action
>
> class=" org.eclipse.ui.articles.action.contribution.ViewAction1Deleg ate "
> icon="icons/command.gif"
> menubarPath="additions"
>
> id=" org.eclipse.ui.articles.action.contribution.navigator.action 1 "
> label="View Action 1">
> </action>
> <menu
>
> id=" org.eclipse.ui.articles.action.contribution.navigator.subMen u "
> label="View Sub Menu"
> path="additions">
> <separator
> name="group1">
> </separator>
> </menu>
> ...
> ...
|
|
|
|
|
|
|
|
Re: view action delegate with sub menu ... [message #332357 is a reply to message #332306] |
Mon, 20 October 2008 11:38   |
Eclipse User |
|
|
|
Hi Paul . solved problem about command parameters and selected item .
I still need to create the sub menu with the dynamic actions on the view
context menu .
I have tried adding the following bit to the main plugin (the one with the
view):
<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI="popup:com.utils.views.DBView?after=additions">
<menu
id="myid"
label="MyLocalAct">
<separator
name="Utils.separator1"
visible="true">
</separator>
</menu>
</menuContribution>
</extension>
And in the extending plugin use:
<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI="popup:com.utils.views.DBView?after=myid/Utils.separator1 ">
<dynamic
class="my.project.MyCompoundContributionItem"
id="my.project.myCompoundContributionItem">
</dynamic>
....
This did not worked . (if I use just after=myid I can see the list of
commands listed in the main level of the context menu).
-----
I did tried to put all the bit of code in the extending plugin .
<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI="popup:com.utils.views.DBView?after=addition">
<menu
id="idtest"
label="TESTTEST">
<dynamic
class="my.project.MyCompoundContributionItem"
id="my.project.myCompoundContributionItem">
</dynamic>
</menu>
</menuContribution>
</extension>
No action is displayed at all.
Could u please help me
Thanks in advance
Kar
"Kar" <carmeloscala@hotmail.com> wrote in message
news:gdabth$5mk$1@build.eclipse.org...
> could u please be more specific ...
> in the org.eclipse.ui.menus ext point I can add just MENU / WIDGET and
> Group ...
>
> ciao
> kar
>
>
>
> <extension
> point="org.eclipse.ui.menus">
> <menuContribution
>
> locationURI=" popup:com.eidosmedia.eomutils.views.EomDBView?after=addition s ">
> <dynamic
> class="my.project.MyCompoundContributionItem"
> id="my.project.myCompoundContributionItem">
> </dynamic>
>
> </menuContribution>
> </extension>
>
> "Paul Webster" <pwebster@ca.ibm.com> wrote in message
> news:gda9gp$r6b$1@build.eclipse.org...
>> Kar wrote:
>>
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <?eclipse version="3.2"?>
>>> <plugin>
>>> <extension
>>> point="org.eclipse.ui.popupMenus">
>>> <viewerContribution
>>> id="my.project.viewerContribution2"
>>> targetID="com.utils.views.DBView">
>>> <menu
>>> id="my.project.menu3"
>>> label="SUB MENU"
>>> path="additions">
>>> <separator
>>> name="subseparator">
>>> </separator>
>>> </menu>
>>
>> This needs to be in your menu contribution, since org.eclipse.ui.menus
>> can't see popupMenus
>>
>> 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/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/guide/workbench.htm
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.07795 seconds