I'm currently writing my own Graphiti editor on top of my EMF model which comes from Xtext.
I'm following the documentation founded in Eclipse Help but I have a question.
I have 2 forms from now, a rectangle and a shape.
I would like to say to Graphiti "You can create a shape in a rectangle and only in a rectangle, not in the diagram."
So I'm trying something like this in AddObjectAFeature.java :
@Override
public boolean canAdd(IAddContext context) {
if (context.getNewObject() instanceof ObjectA) {
if (context.getTargetContainer().getXXXXX() instanceof ObjectB) {
return true;
}
}
return false;
}
ObjectA is the business object represented by the shape and the ObjectB is represented by the rectangle.
My problem is, I can't access to my instance of ObjectB through "context.getTargetContainer(). etc...".