Restricting attribute value choice [message #697945] |
Mon, 18 July 2011 08:45  |
Eclipse User |
|
|
|
Hi !
I would like to know is there is a way to filter attribute choice for a field, instead of letting user choose any value and validating his choise with a constraint after.
What i need is a kind of StateMachine owning States, and i want to be able to choose the initial State of my machine.
I managed to make a constraint to prevent to select a State owned by a different machine, but they are still in the list, and i don't know how to fix it.
Any help is welcome !
Thanks in advance,
Valerian
|
|
|
|
|
Re: Restricting attribute value choice [message #821618 is a reply to message #698291] |
Thu, 15 March 2012 12:02   |
Eclipse User |
|
|
|
Hi, I want to do exactly what this message says, that is, to restrict the choice values in a list. As far as I understand, if I type this, there should not be any option available in the list, because I have not written any "coiceOfValue.add(object);":
/**
* This adds a property descriptor for the Foo feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
protected void addFooPropertyDescriptor(Object object)
{
itemPropertyDescriptors.add
(new ItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Abc_foo_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Abc_foo_feature", "_UI_Abc_type"),
XyzPackage.Literals.ABC__FOO,
true,
false,
true,
null,
null,
null)
{
@Override
public Collection<?> getChoiceOfValues(Object object)
{
List<Object> choiceOfValues = new ArrayList<Object>(super.getChoiceOfValues(object));
// Filter the choices before returning them.
return choiceOfValues;
}
});
}
But if I type that still all the options are available, as they were before. What am I missing??
Thanks in advance!
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.77695 seconds