Community
Participate
Working Groups
The JDT UI has a couple of global actions (Refactor menu) that work on both a strucutured selection and a text selection. Currently it is not possible to define enablement criterias depending on the type of the selection. I would like to write down something like this: <enablement> <if selection_class= "....ITextSelection"> <enablesFor value="1"/> </endif> <if selection_class= "...IStructuredSelection"> <enablesFor value="1"/> <objectClass name="org.eclipse.jdt.core.IMethod"/> </endif> </enablement> Any idea how to do that ?
See org.eclipse.ui/doc/actionExpressions.html. You should be able to do: <enablement> <or> <objectClass name="....ITextSelection"/> <objectClass name="....IStructuredSelection"/> </or> </enablement> The enablesFor can only be specified once since it's an attribute on the action. Alternatively, using the old mechanism, specifying two separate contributions for the same action but with different criteria would work.
From the same document: An objectClass element is used to evaluate the class of each object in the selection. The name attribute of the objectClass contains a fully qualified class name. If each object in the selection implements this class, the expression is evaluated as true. I don't want to check if elements in the selection are of a certain type. What I want to express is the following (Java pseudo code): if (selection instanceof ITextSelection) { return ((ITextSelection)selection).getLength > 0; } else if (selection instanceof IStrucuturedSelection) { return allElementsAreOfType(selection, IMethod.class) } Can you please give me a hint how to do this with the old mechanism using two different contributions. I have no idea what to do.
Forget to reopen ...
Will investigate.
Can be postponed > 2.0
Curious, how did you work around this?
We do it now in code. Since the refactoring actions are normally only present in JDT perspecitives this is not a problem. If you add them to the resource perspective all actions are enabled and you get the "Action is not available" dialog. I think we can live with that for 2.0
See bug 7750.
Marked bug 7750 as LATER. Doing the same here.
Reopened for investigation
*** Bug 7750 has been marked as a duplicate of this bug. ***
Reassigning to Platform-UI-Inbox (I left IBM 18 months ago..)
Moving Dougs bugs
Assigning to component owner PW
These will not be worked on. Please re-open if you feel the community should get a crack at them. PW