Class AtlCompletionHelper

java.lang.Object
org.eclipse.m2m.atl.adt.ui.text.atl.AtlCompletionHelper

public class AtlCompletionHelper extends Object
The completion helper, dedicated to document parsing.
  • Field Details

    • PARSING_KEYWORDS

      public static final String[] PARSING_KEYWORDS
      ATL parsing triggers.
    • HIGH_LEVEL_KEYWORDS

      public static final String[] HIGH_LEVEL_KEYWORDS
      Context indicators.
  • Constructor Details

    • AtlCompletionHelper

      public AtlCompletionHelper(String text)
      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 offset
      prefix - the current prefix
      fileContext - 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 element
      baseOffset - 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 element
      baseOffset - the base offset
      Returns:
      [deboffset, endoffset]
      Throws:
      org.eclipse.jface.text.BadLocationException
    • getLocation

      public static 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 String getLastKeyWord(int offset) throws org.eclipse.jface.text.BadLocationException
      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 model
      offset - the offset
      modelOffset - 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