Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] Menus for a Layer

Well, I don't manage to add my menu without visible test…

The locationURI is good, I've tried with popup:net.refractions.udig.project.ui.layerManager without success…

I read eclipse help but I don't know my mistake.

 

If someone else could test. I've also post a message in a french forum.

Hope we could find the solution!

 

Thanks

 

Virginie BERRE - Pôle Géomatique Ile de France

+33 (0)1 30 15 40 58

virginie.berre@xxxxxxxxxxxx

MAGELLIUMPensez environnement ! N'imprimez ce mail que si c'est vraiment nécessaire !

 

De : udig-devel-bounces@xxxxxxxxxxxxxxxxxxxxx [mailto:udig-devel-bounces@xxxxxxxxxxxxxxxxxxxxx] De la part de Jody Garnett
Envoyé : mercredi 23 juin 2010 14:32
À : User-friendly Desktop Internet GIS
Objet : Re: [udig-devel] Menus for a Layer

 

I would love to - but I am not very good at the new menu extension point myself.

 

My best advice is to reproduce the steps shown in the eclipse help; and not trust what you read on google. And to check the eclipse wiki for when the eclipse help menu stops making sense.

 

Can you do a quick test and just set your menu to be always visible; to ensure it shows up in the correct location? Only after that should you start getting fancy with the enable / visible tests.

 

Jody

On Wed, Jun 23, 2010 at 8:56 PM, Virginie BERRE <virginie.berre@xxxxxxxxxxxx> wrote:

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

MAGELLIUMPensez environnement ! N'imprimez ce mail que si c'est vraiment nécessaire !

 

De : udig-devel-bounces@xxxxxxxxxxxxxxxxxxxxx [mailto:udig-devel-bounces@xxxxxxxxxxxxxxxxxxxxx] De la part de Jody Garnett
Envoyé : mercredi 23 juin 2010 01:47
À : User-friendly Desktop Internet GIS
Objet : [udig-devel] Menus for a Layer

 

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.

 

Jody

 

On 23/06/2010, at 1:10 AM, Virginie BERRE wrote:

 

Dear all,

 

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.

<image003.png>

 

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.

 

Could you help me?

Thank you.

 

Best regards,

 

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

 


_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel

 


Back to the top