How to import an UML element into a pivot model? [message #1699194] |
Mon, 22 June 2015 09:09  |
Eclipse User |
|
|
|
Hi
I have a following code based on Eclipse OCL 5.0:
public static ExpressionInOCL toExpressionInOCL(org.eclipse.uml2.uml.Constraint constraint) throws ParserException
{
org.eclipse.uml2.uml.Namespace context = constraint.getContext();
MetaModelManager mm = PivotUtil.findMetaModelManager(context);
org.eclipse.ocl.pivot.Element type = UML2Pivot.importFromUML(mm, null, context);
oclHelper.setInstanceContext(type);
if (constraint.getSpecification() instanceof OpaqueExpression) {
OpaqueExpression opaqueExpression = (OpaqueExpression)constraint.getSpecification();
int indexOfOCLBody = opaqueExpression.getLanguages().indexOf("OCL");
if (indexOfOCLBody != -1) {
String body = opaqueExpression.getBodies().get(indexOfOCLBody);
return oclHelper.createInvariant(body);
}
}
return null;
}
The code parses an UML Constraint. At first it finds an context element of the constraint. And then it imports the UML element into a pivot model.
The problem is that I can't find neither PivotUtil.findMetaModelManager(), nor UML2Pivot in the Eclipse OCL 6.0.
How should I change my code to make it work?
Also I need to convert a pivot element into an UML element:
public static org.eclipse.uml2.uml.NamedElement getETarget(org.eclipse.ocl.pivot.NamedElement el)
{
return (org.eclipse.uml2.uml.NamedElement)el.getETarget();
}
But getETarget() method seems to be obsolete. Is there an alternative approach?
Thanks!
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05113 seconds