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

Completion helper, dedicated to document parsing.


Constructor Summary
AtlCompletionHelper()
           
 
Method Summary
 AtlModelAnalyser computeContext(int offset, java.lang.String prefix)
          Computes the document part to analyze, process the analysis.
 java.lang.String extractPrefix(int offset)
          Extracts the prefix of the last typed characters.
 java.lang.String getCurrentLine(int offset)
          Compute the whole line of the current offset.
 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.
 void setDocument(org.eclipse.jface.text.IDocument document)
          Configures the IDocument for this helper.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AtlCompletionHelper

public AtlCompletionHelper()
Method Detail

setDocument

public void setDocument(org.eclipse.jface.text.IDocument document)
Configures the IDocument for this helper.

Parameters:
document - the current document

computeContext

public AtlModelAnalyser computeContext(int offset,
                                       java.lang.String prefix)
                                throws org.eclipse.jface.text.BadLocationException
Computes the document part to analyze, process the analysis.

Parameters:
offset - the current offset
prefix - the current prefix
Returns:
an analyser which purposes contextual informations.
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

extractPrefix

public java.lang.String extractPrefix(int offset)
Extracts the prefix of the last typed characters.

Parameters:
offset - the current offset
Returns:
the prefix of the last word

getCurrentLine

public java.lang.String getCurrentLine(int offset)
                                throws org.eclipse.jface.text.BadLocationException
Compute the whole line of the current offset.

Parameters:
offset - the current offset
Returns:
the line containing the offset, ended with the offset
Throws:
org.eclipse.jface.text.BadLocationException

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

Copyright 2007 IBM Corporation and others.
All Rights Reserved.