Class AtlCompletionHelper
- java.lang.Object
-
- org.eclipse.m2m.atl.adt.ui.text.atl.AtlCompletionHelper
-
public class AtlCompletionHelper extends java.lang.ObjectThe completion helper, dedicated to document parsing.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String[]HIGH_LEVEL_KEYWORDSContext indicators.static java.lang.String[]PARSING_KEYWORDSATL parsing triggers.
-
Constructor Summary
Constructors Constructor Description AtlCompletionHelper(java.lang.String text)Creates a new helper initialized with the given text.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description AtlModelAnalysercomputeModelAnalyser(int offset, java.lang.String prefix, java.lang.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.java.lang.StringgetLastKeyWord(int offset)Retrieves the last typed keyword.org.eclipse.emf.ecore.EObjectgetLocatedElement(org.eclipse.emf.ecore.EObject root, int offset, int modelOffset)Search the nearest element of the given offset.static java.lang.StringgetLocation(org.eclipse.emf.ecore.EObject element)Returns the element location as String.java.lang.StringgetText(org.eclipse.emf.ecore.EObject locatedElement, int baseOffset)Returns the text associated to the given element.static booleanisAtlIdentifierPart(char ch)Checks whether the given char is an ATL identifier part or not.
-
-
-
Method Detail
-
computeModelAnalyser
public AtlModelAnalyser computeModelAnalyser(int offset, java.lang.String prefix, java.lang.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 java.lang.String getText(org.eclipse.emf.ecore.EObject locatedElement, int baseOffset) throws org.eclipse.jface.text.BadLocationExceptionReturns 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.BadLocationExceptionCompute 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
public static java.lang.String getLocation(org.eclipse.emf.ecore.EObject element)
Returns the element location as String.- Parameters:
element- the located element- Returns:
- the element location as String
-
getLastKeyWord
public java.lang.String getLastKeyWord(int offset) throws org.eclipse.jface.text.BadLocationExceptionRetrieves 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.BadLocationExceptionSearch 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:
trueif the given char is an ATL identifier part
-
-