Project: Eclipse_Platform_UI
Bug 111244 [Decorators] LightweightDecoratorManager does not correctly interpret 'and' and 'or' expressions with 'objectClass'
Reported: 2005-09-30 15:05:35 | Status: verified fixed

I20050923-1000 I have a lightweight decorator extension like this: <extension point="org.eclipse.ui.decorators"> <decorator label="Derived Resources" location="BOTTOM_LEFT" adaptable="false" id="org.eclipse.zrh.derivedDecorator" class="org.eclipse.zrh.derivedDecorator.DerivedDecorator" lightweight="true" state="true"> <enablement> <or> <objectClass name="org.eclipse.core.resources.IResource"> </objectClass> <objectClass name="org.eclipse.jdt.core.IJavaElement"> </objectClass> </or> </enablement> </decorator> </extension> I'd expect that the decorator applies to objects of type IResource as well as to objects of type IJavaElement. But the decorator only works for IJavaElements. The problem seems to be the assumption that each ActionExpression only contains one objectClass element. But that's not required by the extension point description. LightweightDecoratorManager#initializeEnablement() executes objectClass = expression.extractObjectClass(); and then wrongly assumes that this objectClass is the only one that needs registration, even though it has only arbitrarily been choosen in ActionExpression.CompositeExpression#extractObjectClass().

Files changed in fix:
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionExpression.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/LightweightDecoratorDefinition.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/LightweightDecoratorManager.java