Community
Participate
Working Groups
It'd be great to be able to use real enums for restrictions on string attributes in extension points. E.g., instead of <restriction base="string"> <enumeration value="something"> </enumeration> </restriction> one could do something like <restriction base="string"> <enumeration value="org.myproduct.myplugin.enums.MyEnumClass"> </enumeration> </restriction> which would restrict the allowed values to all enums in org.myproduct.myplugin.enums.MyEnumClass. I'd be happy to investigate if this is possible at all but as I've never contributed to Eclipse and don't know that part of the API at all, I'd be thankful for any pointers on where to start (or a hint if this isn't possible at all).
It's a neat idea, but I see some problems with this approach: - the Eclipse Platform generally tries to be lazy and avoid loading classes as they consume memory - the enum class or its containing bundle may not be able to be loaded (e.g., missing dependencies, failing activator) - the enum may not have a proper stringification - extension points are supposed to be declarative An alternative approach could be to add an action to the 'restrictions' section to generate the values from an enum. That action would use JDT to parse the source and populate the appropriate values based on the enum definition. Virtually identical results, but a safer approach. It looks like the relevant code is in the org.eclipse.pde.ui bundle in the org.eclipse.pde.internal.ui.editor.schema.SchemaStringAttributeDetails class. Moving to PDE.
Thanks, Brian, for the insights on the nature of extension points. Makes sense. Thanks also for moving the bug and the idea for enum generation. I'll have a look at the code and give it a shot :).
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.
This bug was marked as stalebug a while ago. Marking as wontfix. If this report is still relevant for the current release, please reopen and remove the stalebug whiteboard tag.
Perhaps instead of string with restrictions better idea would be java type attribute but instead of "implements" or "extends" add 3rd option - enum value