Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[udig-devel] How to enable menu items under 'Navigation'

Hi All,
I am trying to find out how to enable the "Zoom To Layer" utility on my navigation menubar. The problem i am facing is though this utility is present in the menubar,
it is always disabled irrespective of the layers chosen.
The Fig:1 is the listing of the utility on my Navigation bar at the top.

However right clicking on the Layer in the 'Layer View' has the "Zoom To Layer" available wherever it is applicable. For: on Selection of Layers etc
The Fig:2 is the listing of the utility in the 'Layer View'.

The below shown is the extract used in my plugin.xml at com.comp.gis.tools.edit/plugin.xml. I am assuming that this is the appropriate xml since
I am able to see the name change in the Label "Zoom To Layer" when i alter the label like  label="Zoom To Layer_abc".

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
   <extension
         point="org.eclipse.ui.menus">
      <menuContribution
            locationURI="menu:navigate">
         <command
               commandId="com.comp.gis.tools.edit.zoomToLayerCommand"
               disabledIcon="icons/dlcl16/zoom_layer_co.gif"
               icon="icons/elcl16/zoom_layer_co.gif"
               label="Zoom To Layer"
               style="push">
            <visibleWhen
                  checkEnabled="false">
               <or>
                  <iterate
                        ifEmpty="false"
                        operator="or">
                     <adapt
                           type="net.refractions.udig.project.IMap">
                     </adapt>
                     <instanceof
                           value="net.refractions.udig.project.IMap">
                     </instanceof>
                  </iterate>
                  <iterate
                        ifEmpty="false"
                        operator="or">
                     <adapt
                           type="net.refractions.udig.project.ILayer">
                     </adapt>
                     <instanceof
                           value="net.refractions.udig.project.ILayer">
                     </instanceof>
                  </iterate>
               </or>
            </visibleWhen>
         </command>
      </menuContribution>
   </extension>
 

</plugin>

Based on my limited knowledge of how menu items are seen my guess is at the 'visibleWhen' as the block responsible for its visibility.
I tried to correlate this with an "Attribute Query" utility which is similar to the zoom utility in terms of visibility. And I see options like enablement etc.
The plugin.xml for "Attribute Query" has the following code:

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
   <extension
         id="AttrributeQueryTool"
         name="%tool.name"
         point="net.refractions.udig.project.ui.tool">
      <actionTool
            categoryId="com.comp.gis.catalog.query"
            class="com.comp.gis.catalog.attributequery.ui.AttributeQueryTool"
            icon="icons/Attribute Query_1.gif"
            id="com.comp.gis.catalog.attributequery.AttributeQueryTool"
            menuPath="query/sep1"
            name="%actiontool.name"
            _onToolbar_="false"
            tooltip="%actiontool.tooltip">
         <enablement></enablement>
      </actionTool>
      <category
            id="com.comp.gis.catalog.query"
            name="Query">
      </category>
   </extension>
   <extension
         point="com.comp.gis.catalog.querysubsystem">
      <queryFactory
            ID="com.comp.gis.catalog.attributequery"
            Name="%queryfactory.name"
            Query="com.comp.gis.catalog.attributequery.AttributeQuery"
            QueryFactory="com.comp.gis.catalog.attributequery.AttributeQueryFactory">
      </queryFactory>
   </extension>
   <extension
         point="org.eclipse.ui.menus">
      <menuContribution
            locationURI="menu:query">
         <command
               commandId="com.comp.gis.tools.query.AttributeQueryCommand"
               icon="icons/querybuilder_small.PNG"
               id="attribute"
               label="Attribute Query">
         </command>
      </menuContribution>
   </extension>

</plugin>

Can you please guide me as to what setting in the plugin XML is responsible for the subjective enabling of the options. What is the importance of
'visibleWhen' and 'enablement'? How can i prevent the 'Zoom To Layer' from being disabled irrespective of any user action.

Looking forward for your support.


Regards
V


 

Attachment: Fig1.JPG
Description: JPEG image

Attachment: Fig2.JPG
Description: JPEG image


Back to the top