Hello,
Here is what I am trying to do:
In a PAB type diagram, I want to be able to display a context menu on a Behavior PC to call an export function. I would like this function to be accessible only on this type of component. The ultimate goal is to retrieve the selected model element to pass it to Acceleo for code generation.
Here is where I am:
I created a classic Eclipse plugin and I can display the context menu. However, this menu is displayed on any digraph element. I tried to create a filter with a class derived from PropertyTester by calling the following code:
@Override
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
EditPart editPart = (EditPart)receiver;
System.out.println(receiver.getClass().getName()); // DNodeContainerEditPart
View gmfElement = LayerUtil.getGmfElement(editPart);
DSemanticDecorator siriusElement = LayerUtil.getSiriusElement(gmfElement);
EObject target = siriusElement.getTarget();
System.out.println(target.eClass().getInstanceClassName()); // org.polarsys.capella.core.data.cs.Part
System.out.println(target.eClass().getName()); // Part
}
Everything seems to work well when I use the contextual menu from the project explorer but not from the diagram, in which case the problem is that in output I get an object of type Part which is not specific to a Behavior PC. However, when I select this object in the diagram, the property view displays “(Physical Component) Behavior …”; there must therefore be a way.
Finaly, I think that the real question is : how to retreive the PhysicaComponent(Impl) described by the PC Behaviour diagram.
Does anyone have a solution for me?
Thank you in advance …