Results 1 to 2 of 2
  1. #1
    bulldo is offline Member
    Join Date
    Jul 2010
    Posts
    8
    Rep Power
    0

    Default [eclipse plugin ]adding a command and control visibility

    hello !

    I have added a command in the menu that appears when right clicking with the mouse
    in the package explorer view .

    I want this command to be visible in the menu only when I click on a file with a particular extention .

    I read many articles that explain how to use "visible when " but I didn't manage to figure how to do in my case
    here is the part of the plugin.xml that adds the command

    Java Code:
    <extension
             point="org.eclipse.ui.menus">
          <menuContribution
                locationURI="popup:org.eclipse.jdt.ui.PackageExplorer">
             <command
                   commandId="my id"
                   label="my label"
                   style="push">
             </command>
          </menuContribution>
       </extension>



    thanks so much for helping me

  2. #2
    bulldo is offline Member
    Join Date
    Jul 2010
    Posts
    8
    Rep Power
    0

    Default [eclipse plugin ]adding a command and control visibility

    I found the solution for this problem :D

    Java Code:
    <extension
             point="org.eclipse.ui.menus">
          <menuContribution
                locationURI="popup:org.eclipse.jdt.ui.PackageExplorer">
             <command
                   commandId="my id"
                   label="label"
                   style="push">
             <visibleWhen>
          <with variable="activeMenuSelection">
             <iterate
                   ifEmpty="false">
                <adapt type="org.eclipse.core.resources.IFile">
                   <test property="org.eclipse.core.resources.name" value="*.extension" />
                </adapt>
             </iterate>
          </with>
       </visibleWhen>
             </command>
          </menuContribution>
       </extension>

Similar Threads

  1. Problem With POST command to control the network camera
    By sri_reddy523 in forum Networking
    Replies: 3
    Last Post: 03-16-2009, 06:53 AM
  2. Adding new rules in PMD eclipse plugin
    By karuna in forum Eclipse
    Replies: 1
    Last Post: 09-28-2008, 03:29 PM
  3. Adding Plugin Dependency for Feature-based Product
    By abiieez in forum SWT / JFace
    Replies: 2
    Last Post: 05-27-2008, 08:02 PM
  4. AnyEdit Plugin For Eclipse Plugin
    By JavaForums in forum Eclipse
    Replies: 0
    Last Post: 05-18-2007, 12:28 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •