Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Getting the id of a enumeration option value

Wieant Nielander wrote:
I'm implementing a custom value handler for an enumeration option which needs to filter its enumeration values. In the isEnumValueAppropriate() method I can return true/false to indicate if the value should be displayed, but the only parameter passed in is the *name* of the value (i.e. the display-name), and not its id. A quick glance in Option.java suggests that the enumeration values are not accessible outside the Option class, so I'm not too optimistic.

It seems to be that it would be rather natural to select enum values based on their id instead of their name (which can vary, and may not even contain the information needed to decide on the applicability of the value).

I agree that passing the enum id would have made more sense. But you
should be able to retreive the id using option.getEnumeratedId(enumValue).

Aha. That was what I was looking for. Since it was undocumented, I didn't try it.

I already had reported a bug for this:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=274987

--
/Jesper




Back to the top