Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Restrict referencable objects
Restrict referencable objects [message #772767] Fri, 30 December 2011 09:29 Go to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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
Previous Topic:Saving GMF Editor programmatically
Next Topic:Custom Icons in diagram product are missing
Goto Forum:
  


Current Time: Mon Jun 30 19:18:17 EDT 2025

Powered by FUDForum. Page generated in 0.03501 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top