How to add condition checks in eclipse plugin.xml file?

274 Views Asked by At

I need to hide a menu item (File -> Exit) that is not relevant to me. I could do this using org.eclipse.ui.activities extension. The following code works great:

<activity
         description="Capability to filter all menus not relevant to the product"
         id="com.xxx.productspecific.filter.menus"
         name="Common UI Filter for menus">
   </activity>
   <activityPatternBinding
         activityId="com.xxx.productspecific.filter.menus"
         isEqualityPattern="true"
         pattern="org.eclipse.ui.file.exit">
   </activityPatternBinding>`

Now I need to make this work based on some condition. I have a program argument (or command-line argument) "targetEnv=FDK". The menu should be hidden only when this argument is available. I tried the below snippet, but the menu items continue to be hidden no matter what I provide in the argument.

 <activity
     description="Capability to filter all menus not relevant to the product"
     id="com.xxx.productspecific.filter.menus"
     name="Common UI Filter for menus">
  <enabledWhen>
     <with
           variable="%targetEnv">
        <equals
              value="FDK">
        </equals>
     </with>
  </enabledWhen>

Is this the right way to use a program argument in plugin.xml?

0

There are 0 best solutions below