Class AbstractEcoreModelQuery<P extends org.eclipse.emf.ecore.EObject,R>
- java.lang.Object
-
- net.ssehub.easy.dslCore.ui.hyperlinking.AbstractEcoreModelQuery<P,R>
-
- Type Parameters:
P- the type of the "project", the top-most semantic language unitR-IModelQuerysearch result type
- All Implemented Interfaces:
IEcoreModelQuery<P,R>
- Direct Known Subclasses:
AbstractEcoreModelQuery,EcoreModelQuery
public abstract class AbstractEcoreModelQuery<P extends org.eclipse.emf.ecore.EObject,R> extends java.lang.Object implements IEcoreModelQuery<P,R>
An absract implementation of the Ecore model query interface with common helpful functionality.- Author:
- kroeher, Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private CommonXtextEditor<?,P>currentEditorStores the currentXtextEditorfrom which theXtextResourceis used as a basis for parsing the Ecore-model which in turn is used for retrieving elements from.private org.eclipse.xtext.resource.XtextResourcecurrentResourceStores the currentXtextResourcethat is the basis for parsing the Ecore-model which in turn is used for retrieving elements from.
-
Constructor Summary
Constructors Constructor Description AbstractEcoreModelQuery()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.eclipse.xtext.nodemodel.ICompositeNodegetRootNode(org.eclipse.xtext.resource.XtextResource resource)Returns theICompositeNodeof the Ecore-model that represent the root node.protected org.eclipse.xtext.resource.XtextResourcegetXtextResource(CommonXtextEditor<?,P> ivmlEditor)Returns theXtextResourcecurrently displayed by the given editor.protected static booleannotEmpty(java.lang.String stringToCheck)Checks whether the givenStringis notnullor empty.protected static booleannotEmpty(java.util.List<?> listToCheck)Checks whether the givenListis notnullor empty.protected static booleannotEmpty(org.eclipse.emf.common.util.EList<?> eListToCheck)Checks whether the givenEListis notnullor empty.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.ssehub.easy.dslCore.ui.hyperlinking.IEcoreModelQuery
getEcoreElement, getName, getProject
-
-
-
-
Field Detail
-
currentResource
private org.eclipse.xtext.resource.XtextResource currentResource
Stores the currentXtextResourcethat is the basis for parsing the Ecore-model which in turn is used for retrieving elements from. This attribute is used to avoid parsing the sameXtextResourcemultiple times.
-
currentEditor
private CommonXtextEditor<?,P extends org.eclipse.emf.ecore.EObject> currentEditor
Stores the currentXtextEditorfrom which theXtextResourceis used as a basis for parsing the Ecore-model which in turn is used for retrieving elements from. This attribute is used to avoid parsing the sameXtextResourcemultiple times.
-
-
Method Detail
-
notEmpty
protected static boolean notEmpty(java.lang.String stringToCheck)
Checks whether the givenStringis notnullor empty.- Parameters:
stringToCheck- theStringto check- Returns:
trueif the givenStringis notnullor empty.Falseotherwise.
-
notEmpty
protected static boolean notEmpty(org.eclipse.emf.common.util.EList<?> eListToCheck)
Checks whether the givenEListis notnullor empty.- Parameters:
eListToCheck- theEListto check- Returns:
trueif the givenEListis notnullor empty.Falseotherwise.
-
notEmpty
protected static boolean notEmpty(java.util.List<?> listToCheck)
Checks whether the givenListis notnullor empty.- Parameters:
listToCheck- theListto check- Returns:
trueif the givenListis notnullor empty.Falseotherwise.
-
getXtextResource
protected org.eclipse.xtext.resource.XtextResource getXtextResource(CommonXtextEditor<?,P> ivmlEditor)
Returns theXtextResourcecurrently displayed by the given editor. This code for reading the resource is copied from: http://code.google.com/a/eclipselabs.org/p/vclipse/source /browse/trunk/plugins/org.vclipse.base.ui/src/org/vclipse/base/ui/util/EditorUtilsExtensions.java?r=1498- Parameters:
ivmlEditor- theXtextEditorfrom which the resource should be retrieved- Returns:
- the
XtextResourcecurrently displayed by the given editor. May returnnullif the given editor isnullor the resource of that editor cannot be read.
-
getRootNode
public org.eclipse.xtext.nodemodel.ICompositeNode getRootNode(org.eclipse.xtext.resource.XtextResource resource)
Returns theICompositeNodeof the Ecore-model that represent the root node.- Specified by:
getRootNodein interfaceIEcoreModelQuery<P extends org.eclipse.emf.ecore.EObject,R>- Parameters:
resource- theXtextResourcefrom which the root node should be retrieved- Returns:
- the
ICompositeNodeof the Ecore-model that represent the root node. May returnnullif the given resource isnullor cannot be parsed
-
-