コード例 #1
0
ファイル: PivotUtil.java プロジェクト: matterche/ocl
 public static ExpressionInOcl resolveMessage(
     MetaModelManager metaModelManager, URI uri, ExpressionInOcl specification, String expression)
     throws ParserException {
   try {
     Resource resource = createXtextResource(metaModelManager, uri, specification, expression);
     checkResourceErrors(NLS.bind(OCLMessages.ErrorsInResource, expression), resource);
     return getExpressionInOcl(resource);
   } catch (IOException e) {
     //				throw new ParserException("Failed to load expression", e);
     OclExpression invalidValueBody = metaModelManager.createInvalidExpression();
     specification.setBodyExpression(invalidValueBody);
     return specification;
   }
 }
コード例 #2
0
ファイル: PivotUtil.java プロジェクト: matterche/ocl
 public static ExpressionInOcl resolveSpecification(
     MetaModelManager metaModelManager, URI uri, NamedElement contextClassifier, String expression)
     throws ParserException {
   Resource resource = null;
   try {
     resource = createXtextResource(metaModelManager, uri, contextClassifier, expression);
     checkResourceErrors(NLS.bind(OCLMessages.ErrorsInResource, expression), resource);
     return getExpressionInOcl(resource);
   } catch (IOException e) {
     //				throw new ParserException("Failed to load expression", e);
     ExpressionInOcl specification = PivotFactory.eINSTANCE.createExpressionInOcl();
     OclExpression invalidValueBody = metaModelManager.createInvalidExpression();
     specification.setBodyExpression(invalidValueBody);
     return specification;
   } finally {
     if (resource != null) {
       MetaModelManagerResourceAdapter adapter =
           MetaModelManagerResourceAdapter.findAdapter(resource);
       if (adapter != null) {
         adapter.dispose();
       }
     }
   }
 }
コード例 #3
0
ファイル: PivotUtil.java プロジェクト: matterche/ocl
 public static String getConstraintTypeName(ExpressionInOcl expression) {
   return ((NamedElement) expression.eContainer().eContainer()).getName();
 }