Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 106770

Summary: [Contributions] Action <enablement> does not support objectState
Product: [Eclipse Project] Platform Reporter: Richard Kulp <richkulp>
Component: UIAssignee: Paul Webster <pwebster>
Status: RESOLVED DUPLICATE QA Contact:
Severity: major    
Priority: P5 CC: markus.kell.r, martin.jaeger
Version: 3.1Keywords: helpwanted
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on: 111778    
Bug Blocks:    

Description Richard Kulp CLA 2005-08-11 14:18:59 EDT
The help indictates <enablement> in the plugin.xml for a popup menu will support
<objectState>, but it doesn't. objectState is supported by <visibility> though. 

From the help:



<!ELEMENT enablement (and | or | not | objectClass | objectState | pluginState |
systemProperty)>


This element is used to define the enablement for the extension.




This kind of action contribution should work.

      <objectContribution
           
objectClass="org.eclipse.ve.internal.java.core.IJavaBeanContextMenuContributor"
           
id="org.eclipse.ve.internal.jfc.core.editorpart.setlabelaction.popup.object">
         <filter
               name="BEANTYPE"
               value="java.awt.Component">
         </filter>
         <filter
               name="PROPERTY"
               value="label">
         </filter>
         <enablement>
            <objectState
                  name="CHANGEABLE"
                  value="true"/>
         </enablement>
         <action
               label="%PopupMenus.SetLabelAction.Label  Set Label"
               class="org.eclipse.ve.internal.jfc.core.SetLabelObjectActionDelegate"
               id="org.eclipse.ve.internal.jfc.core.setlabelaction">
         </action>
      </objectContribution>
Comment 1 martin.jaeger CLA 2005-11-18 10:20:52 EST
In my opinion the enablement with objectState does not work in an RCP
application without the "org.eclipse.core.resources"-plugin. This is because of
a Legacy Class (LegacyResourceSupport.getRessourceClass) that is called from the
ObjectStateExpression.isEnabledFor(Object object) method.

I wanted to enable a menu based on the objectstate over a registered
AdapterFactory. But the Adapter is never created, because the
"LegacyResourceSupport.getRessourceClass"-method returns null when I have no
"org.eclipse.core.resources"-plugin in my application.
I used a viewerContribution
Comment 2 Michael Van Meekeren CLA 2006-04-21 13:56:11 EDT
Moving Dougs bugs
Comment 3 Paul Webster CLA 2007-04-05 19:04:32 EDT
Assigning to component owner
PW
Comment 4 Paul Webster CLA 2007-04-24 08:32:30 EDT
*** Bug 141984 has been marked as a duplicate of this bug. ***
Comment 5 Paul Webster CLA 2007-04-24 08:34:59 EDT
<objectContribution>/<enablement> should support objectClass, and <objectContribution>/<action>/<enablement> should support the core expressions.

PW
Comment 6 Paul Webster CLA 2007-06-22 06:55:53 EDT
(In reply to comment #5)
> <objectContribution>/<enablement> should support objectClass, and
> <objectContribution>/<action>/<enablement> should support the core expressions.

Actually, it appears to be the other way around.

objectContribution/enablement is the only one that supports core expressions.  All other enablement elements don't.



*** This bug has been marked as a duplicate of bug 111778 ***