Dear Jody,
Thanks a lot for your help!
As you expected, I tried to use the menu
extension point.
In my plugin.xml, I add the
menuContribution, then my own menu and a visibleWhen condition.
<menuContribution
locationURI="menu:net.refractions.udig.project.ui.layerManager">
<menu
commandId="mycommand.exportKML"
label="Export
KML"
tooltip="Exporter
en KML pour les recherches Internet">
<visibleWhen
checkEnabled="false">
<with
variable="activeLayerMenuSelection">
<iterate
ifEmpty="false"
operator="and">
<test
forcePluginActivation="true"
property="mypropertyTester.isZonageSourcesLayer"
value="true">
</test>
</iterate>
</with>
</visibleWhen>
</menu>
</menuContribution>
In my property tester, the return value
is true when expected but my "Export KML" menu is not shown.
I've tried to add a command :
<menuContribution
locationURI="menu:net.refractions.udig.project.ui.layerManager">
<menu
label="Export
KML"
tooltip="Exporter
en KML pour les recherches Internet">
<command
commandId="mycommand.exportKML"
label="Export KML Cmd"
style="push">
</command>
<visibleWhen
checkEnabled="false">
<with
variable="activeMenuSelection">
<iterate
ifEmpty="false"
operator="and">
<test
forcePluginActivation="true"
property="mypropertyTester.isZonageSourcesLayer"
value="true">
</test>
</iterate>
</with>
</visibleWhen>
</menu>
</menuContribution>
and set the visibleWhen condition in
this command but it doesn't work better…
<menuContribution
locationURI="menu:net.refractions.udig.project.ui.layerManager">
<menu
label="Export
KML"
tooltip="Exporter
en KML pour les recherches Internet">
<command
commandId="mycommand.exportKML"
label="Export KML Cmd"
style="push">
<visibleWhen
checkEnabled="false">
<with
variable="activeMenuSelection">
<iterate
ifEmpty="false"
operator="and">
<test
forcePluginActivation="true"
property="mypropertyTester.isZonageSourcesLayer"
value="true">
</test>
</iterate>
</with>
</visibleWhen>
</command>
</menu>
</menuContribution>
Could you help me a bit more?
Thank you.
Virginie BERRE - Ingénieur d'études et de développement
+33 (0)1 30 15 40
58
virginie.berre@xxxxxxxxxxxx
Pensez environnement ! N'imprimez ce mail
que si c'est vraiment nécessaire !
There
are couple of ways to do this:
Operations
are the easiest - if you want to define an operation that works against a
specific kind of layer; or layer content. The nice thing is that uDig will use
them in the context menu of the layer view and a few other places in the
application (such as the edit menu). You can also define the menu path to
contribute an operation to a specific menu.
Back
to your question I am going to assume you are looking to use the menu extension
point...
Looking
in the LayersView class there is a static constant which is the ID of the
layers view (for handy reference):
public static final String ID = "net.refractions.udig.project.ui.layerManager"; //$NON-NLS-1$
The
blog post linked to from the developers guide is a good introduction:
And
the eclipse help is always the best:
I
have updated the example on this page to list a few more example locationURI
examples using uDig views.
On
23/06/2010, at 1:10 AM, Virginie BERRE wrote:
I would like to ad a menu item in the menu of a layer
in the layer list when the user right click on it.
I know it's possible to add in my plugin's extensions
a menu to another plugin menuContribution but I need the locationURI of it.
Virginie BERRE - Ingénieur d'études et de
développement
+33 (0)1 30 15
40 58 (n° direct)
|
ZA Les Erables
- bâtiment 4
66, route de
Sartrouville
78230 Le Pecq
Tel: +33 (0)1 30 15 40 50 (standard)
Fax: +33 (0)1 30 15 40 60
www.magellium.fr
|
<image001.gif>
|
<image002.gif>Pensez environnement ! N'imprimez ce mail que si c'est
vraiment nécessaire !
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel