| Summary: | [Contributions] Action <enablement> does not support objectState | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Richard Kulp <richkulp> |
| Component: | UI | Assignee: | Paul Webster <pwebster> |
| Status: | RESOLVED DUPLICATE | QA Contact: | |
| Severity: | major | ||
| Priority: | P5 | CC: | markus.kell.r, martin.jaeger |
| Version: | 3.1 | Keywords: | helpwanted |
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
| Bug Depends on: | 111778 | ||
| Bug Blocks: | |||
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 Moving Dougs bugs Assigning to component owner PW *** Bug 141984 has been marked as a duplicate of this bug. *** <objectContribution>/<enablement> should support objectClass, and <objectContribution>/<action>/<enablement> should support the core expressions. PW (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 *** |
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>