Restrict referencable objects [message #772767] |
Fri, 30 December 2011 09:29  |
Eclipse User |
|
|
|
Hello i got the following problem.
I'm using a bidirectional connection between two nodes.
The cardinality between those nodes is set to one.
The emfatic source looks like this:
class Goal {
ref AwayGoal[1]#ReferencedGoal isReferencedByAwayGoals;
attr boolean isPublic;
}
class AwayGoal {
ref Goal[1]#isReferencedByAwayGoals ReferencedGoal;
}
This results in a drop down box in the property view, where i can choose the goal/awaygoal.
Is it in anyway possible to restrict the elements shown in this dropdown box ?
In this case i only want to be able to choose Goal with the respective boolean attribute set to true.
|
|
|
Re: Restrict referencable objects [message #773664 is a reply to message #772767] |
Mon, 02 January 2012 03:17  |
Eclipse User |
|
|
|
Hi,
this is a EMF related question as the Properties View uses EMF's .edit plugin. Do do what you like to do you need to go to your xxxItemProvider class in the .edit plugin generated by EMF. The you should find a method called addXXXPropertyDescriptor. Change this code to:
itemPropertyDescriptors.add(new org.eclipse.emf.edit.provider.ItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_XXX_XXX"), getString("_UI_PropertyDescriptor_description", "_UI_XXXX_XXXX", "_UI_XXXX_XXXX"), XXXPackage.Literals.XXX_XXX, true, false, true, null, null, null) {
@Override
public Collection<?> getChoiceOfValues(Object object) {
//place your code for filtering here
}
});
Do not forget to set the method's comment to @generated NOT. If you like to get this generated by EMF you might take a look at EMF's templates and customize them.
Hope this helps.
Ralph
|
|
|
Powered by
FUDForum. Page generated in 0.03501 seconds