OCL

org.topcased.editors.ocleditor.utils
Class OCLRuleUtil

java.lang.Object
  extended by org.topcased.editors.ocleditor.utils.OCLRuleUtil

public class OCLRuleUtil
extends java.lang.Object

A class with useful methods


Constructor Summary
OCLRuleUtil()
           
 
Method Summary
static EClassifier computeContextClassifier(org.eclipse.jface.text.IDocument document, EPackage modelPackage, org.eclipse.jface.text.ITypedRegion region, org.eclipse.jface.text.ITypedRegion packageRegion)
          Computes the context of the given region in the document
static ETypedElement computeTypedContext(org.eclipse.jface.text.IDocument document, EPackage modelPackage, org.eclipse.jface.text.ITypedRegion region, org.eclipse.jface.text.ITypedRegion packageRegion)
           
static org.eclipse.ocl.ecore.Constraint createConstraint(org.eclipse.jface.text.ITypedRegion region, org.eclipse.jface.text.Document oclDocument, org.eclipse.ocl.helper.OCLHelper<EClassifier,EOperation,EStructuralFeature,org.eclipse.ocl.ecore.Constraint> oclHelper)
          Create the typed constraint for the identified region
static EPackage findMetamodelPackage(URI mmUri)
           
static EPackage findSubPackage(EPackage currentPackage, java.util.List<java.lang.String> packagePrefixes)
           
static java.lang.String getESuperPackage(java.lang.String mmUri)
          Gets the highest package from a meta model
static EObject loadModel(org.eclipse.core.resources.IFile file)
          Uses the read service to read a model.
static java.util.List<org.eclipse.ocl.Query<EClassifier,EClass,EObject>> loadRulesFromText(java.lang.String text, EObject model, EClassifier ruleType)
          Reads, extracts and returns the list of rules found in the text file.
static void registerMetaModel(EObject model)
          Register the meta model if it has not been registered before.
static EList<Resource> registerResolvedResources(EObject model)
          Tries to resolve all resources
static java.lang.String subModelsClauses()
          Gives the 'subModels' clause.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OCLRuleUtil

public OCLRuleUtil()
Method Detail

createConstraint

public static org.eclipse.ocl.ecore.Constraint createConstraint(org.eclipse.jface.text.ITypedRegion region,
                                                                org.eclipse.jface.text.Document oclDocument,
                                                                org.eclipse.ocl.helper.OCLHelper<EClassifier,EOperation,EStructuralFeature,org.eclipse.ocl.ecore.Constraint> oclHelper)
                                                         throws org.eclipse.ocl.ParserException
Create the typed constraint for the identified region

Parameters:
region - : the identified region
oclDocument - : the document partitionned in region
oclHelper - : the helper which has the context set
Returns:
: the constraint Rule, Pre, Post ... Def
Throws:
org.eclipse.ocl.ParserException

loadRulesFromText

public static java.util.List<org.eclipse.ocl.Query<EClassifier,EClass,EObject>> loadRulesFromText(java.lang.String text,
                                                                                                  EObject model,
                                                                                                  EClassifier ruleType)
Reads, extracts and returns the list of rules found in the text file.

Parameters:
text -
model -
Returns:

loadModel

public static EObject loadModel(org.eclipse.core.resources.IFile file)
Uses the read service to read a model.

Parameters:
file -
Returns:

computeContextClassifier

public static EClassifier computeContextClassifier(org.eclipse.jface.text.IDocument document,
                                                   EPackage modelPackage,
                                                   org.eclipse.jface.text.ITypedRegion region,
                                                   org.eclipse.jface.text.ITypedRegion packageRegion)
Computes the context of the given region in the document

Parameters:
document -
modelPackage -
region -
Returns:

computeTypedContext

public static ETypedElement computeTypedContext(org.eclipse.jface.text.IDocument document,
                                                EPackage modelPackage,
                                                org.eclipse.jface.text.ITypedRegion region,
                                                org.eclipse.jface.text.ITypedRegion packageRegion)

findMetamodelPackage

public static EPackage findMetamodelPackage(URI mmUri)

registerMetaModel

public static void registerMetaModel(EObject model)
Register the meta model if it has not been registered before. This is necessary to take into account local meta meta models that have not been prepared as new plugin.

Parameters:
model -

getESuperPackage

public static java.lang.String getESuperPackage(java.lang.String mmUri)
Gets the highest package from a meta model

Parameters:
mmUri -
Returns:
URI from the container package at the highest level

findSubPackage

public static EPackage findSubPackage(EPackage currentPackage,
                                      java.util.List<java.lang.String> packagePrefixes)
Parameters:
currentPackage -
packagePrefixes -
Returns:

registerResolvedResources

public static EList<Resource> registerResolvedResources(EObject model)
Tries to resolve all resources

Parameters:
model -
Returns:

subModelsClauses

public static java.lang.String subModelsClauses()
Gives the 'subModels' clause.

Returns:
The string representation

OCL

Copyright (c) 2005 TOPCASED Contributors 2005 - 2007. All rights reserved.