Class AtlCompletionHelper
java.lang.Object
org.eclipse.m2m.atl.adt.ui.text.atl.AtlCompletionHelper
The completion helper, dedicated to document parsing.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAtlCompletionHelper
(String text) Creates a new helper initialized with the given text. -
Method Summary
Modifier and TypeMethodDescriptioncomputeModelAnalyser
(int offset, String prefix, String fileContext) Computes the document part to analyze, process the analysis.int[]
getElementOffsets
(org.eclipse.emf.ecore.EObject element, int baseOffset) Compute the right offset from an element, according to the base offset of the model.getLastKeyWord
(int offset) Retrieves the last typed keyword.org.eclipse.emf.ecore.EObject
getLocatedElement
(org.eclipse.emf.ecore.EObject root, int offset, int modelOffset) Search the nearest element of the given offset.static String
getLocation
(org.eclipse.emf.ecore.EObject element) Returns the element location as String.getText
(org.eclipse.emf.ecore.EObject locatedElement, int baseOffset) Returns the text associated to the given element.static boolean
isAtlIdentifierPart
(char ch) Checks whether the given char is an ATL identifier part or not.
-
Field Details
-
PARSING_KEYWORDS
ATL parsing triggers. -
HIGH_LEVEL_KEYWORDS
Context indicators.
-
-
Constructor Details
-
AtlCompletionHelper
Creates a new helper initialized with the given text.- Parameters:
text
- the text
-
-
Method Details
-
computeModelAnalyser
public AtlModelAnalyser computeModelAnalyser(int offset, String prefix, String fileContext) throws org.eclipse.jface.text.BadLocationException Computes the document part to analyze, process the analysis.- Parameters:
offset
- the current offsetprefix
- the current prefixfileContext
- the current file context- Returns:
- an analyser which provides contextual informations
- Throws:
org.eclipse.jface.text.BadLocationException
-
getText
public String getText(org.eclipse.emf.ecore.EObject locatedElement, int baseOffset) throws org.eclipse.jface.text.BadLocationException Returns the text associated to the given element.- Parameters:
locatedElement
- the located elementbaseOffset
- the base offset of the element model- Returns:
- the text, as String
- Throws:
org.eclipse.jface.text.BadLocationException
-
getElementOffsets
public int[] getElementOffsets(org.eclipse.emf.ecore.EObject element, int baseOffset) throws org.eclipse.jface.text.BadLocationException Compute the right offset from an element, according to the base offset of the model.- Parameters:
element
- the given elementbaseOffset
- the base offset- Returns:
- [deboffset, endoffset]
- Throws:
org.eclipse.jface.text.BadLocationException
-
getLocation
Returns the element location as String.- Parameters:
element
- the located element- Returns:
- the element location as String
-
getLastKeyWord
Retrieves the last typed keyword.- Parameters:
offset
- the current offset- Returns:
- the last typed keyword
- Throws:
org.eclipse.jface.text.BadLocationException
-
getLocatedElement
public org.eclipse.emf.ecore.EObject getLocatedElement(org.eclipse.emf.ecore.EObject root, int offset, int modelOffset) throws org.eclipse.jface.text.BadLocationException Search the nearest element of the given offset.- Parameters:
root
- the root modeloffset
- the offsetmodelOffset
- the root model offset- Returns:
- the element
- Throws:
org.eclipse.jface.text.BadLocationException
-
isAtlIdentifierPart
public static boolean isAtlIdentifierPart(char ch) Checks whether the given char is an ATL identifier part or not.- Parameters:
ch
- the char- Returns:
true
if the given char is an ATL identifier part
-