org.eclipse.m2m.atl.adt.ui.text.atl
Class AtlCompletionHelper

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

public class AtlCompletionHelper
extends java.lang.Object

The completion helper, dedicated to document parsing.


Field Summary
static java.lang.String[] HIGH_LEVEL_KEYWORDS
          Context indicators.
static java.lang.String[] PARSING_KEYWORDS
          ATL parsing triggers.
 
Constructor Summary
AtlCompletionHelper(java.lang.String text)
          Creates a new helper initialized with the given text.
 
Method Summary
 AtlModelAnalyser computeModelAnalyser(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.String 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 java.lang.String getLocation(org.eclipse.emf.ecore.EObject element)
          Returns the element location as String.
 java.lang.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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARSING_KEYWORDS

public static final java.lang.String[] PARSING_KEYWORDS
ATL parsing triggers.


HIGH_LEVEL_KEYWORDS

public static final java.lang.String[] HIGH_LEVEL_KEYWORDS
Context indicators.

Constructor Detail

AtlCompletionHelper

public AtlCompletionHelper(java.lang.String text)
Creates a new helper initialized with the given text.

Parameters:
text - the text
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 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 java.lang.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 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.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

Copyright 2007 IBM Corporation and others.
All Rights Reserved.