[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools] visibility (action filters) seriously flawed(?)

I created a simple plugin with a popup menu.  The object contribution is
for IJavaElement.  I have a visibility filter so that I can do some
additional tests.  The popup menu part of the xml looks like this:

<extension
          point="org.eclipse.ui.popupMenus">
       <objectContribution
             objectClass="org.eclipse.jdt.core.IJavaElement"
             id="com.rational.filtertest.contribution1">
          <menu
                label="MyFilterActions"
                path="additions"
                id="com.rational.filtertest.menu1">
             <separator
                   name="group1">
             </separator>
          </menu>
          <action
                label="New Action"
                class="com.rational.filtertest.actions.NewAction"
                menubarPath="com.rational.filtertest.menu1/group1"
                enablesFor="1"
                id="com.rational.filtertest.newAction">
          </action>
          <visibility>
             <objectState
                   name="willThisShowUp"
                   value="true">
             </objectState>
          </visibility>
       </objectContribution>
    </extension>

I've added the following lines to my FilterTestPlugin.java startup routine:

         IAdapterManager manager= Platform.getAdapterManager();
         IAdapterFactory factory = new MyFilter1();
         manager.registerAdapters(factory, IField.class);
         manager.registerAdapters(factory, IMethod.class);

I then open a java file and in the outline view are fields and methods.
  I right-click on a field and see my contribution in the popup menu.  I
right-click on a method and my contribution is NOT visible.  I tracked
it down to a filter in the JDIDebugUIPlugin, which has this line in its
startup method:

   manager.registerAdapters(new MethodAdapterFactory(), IMethod.class);

and the following filter in its plugin.xml:

      <objectContribution
      	id="org.eclipse.jdt.debug.ui.MethodBreakpointActions"
      	objectClass="org.eclipse.jdt.core.IMethod">
      	<filter name="MethodActionFilter" value="isBinaryMethod"/>
	  <action id="org.eclipse.jdt.debug.ui.MethodBreakpoint"
		label="%manageMethodBreakpointAction.label"
		helpContextId="manage_method_breakpoint_action_context"
		menubarPath="additions"

class="org.eclipse.jdt.internal.debug.ui.actions.ManageMethodBreakpointActionDelegate"
	 	enablesFor="1">
	  </action>
   	</objectContribution>

It appears that having two (or more)adapter factories registered on the
same class doesn't work - only one of them will ever get called.  Am I
missing something?  Am I using the (visibility) filter incorrectly?

Thank you in advance for any help,
-=b=-