org.eclipse.xtext.ui.editor.selection
Class AstSelectionProvider

java.lang.Object
  extended by org.eclipse.xtext.ui.editor.selection.AstSelectionProvider

public class AstSelectionProvider
extends java.lang.Object

Author:
Michael Clay - Initial contribution and API, Sven Efftinge

Field Summary
static java.lang.String SELECT_ENCLOSING
           
static java.lang.String SELECT_LAST
           
static java.lang.String SELECT_NEXT
           
static java.lang.String SELECT_PREVIOUS
           
 
Constructor Summary
AstSelectionProvider()
           
 
Method Summary
protected  ITextRegion computeInitialFineGrainedSelection(INode node, ITextRegion currentEditorSelection)
           
protected  org.eclipse.emf.ecore.EObject findSemanticObjectFor(INode node)
           
protected  int getEndOffset(ITextRegion region)
           
protected  org.eclipse.emf.ecore.EObject getEObjectAtOffset(XtextResource resource, ITextRegion currentEditorSelection)
           
protected  ITextRegion getRegion(Pair<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EObject> selection)
           
protected  Pair<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EObject> getSelectedAstElements(XtextResource resource, ITextRegion currentSelection)
           
protected  int getSelectionOffset(ICompositeNode rootNode, ITextRegion region)
           
protected  ITextRegion getTextRegion(org.eclipse.emf.ecore.EObject eObject)
           
 void initialize(XtextEditor xtextEditor)
           
protected  Pair<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EObject> internalGetSelectedAstElements(org.eclipse.emf.ecore.EObject eObject, ITextRegion currentSelection)
           
protected  ITextRegion register(ITextRegion textRegion)
           
 ITextRegion selectEnclosing(XtextResource resource, ITextRegion currentEditorSelection)
           
 ITextRegion selectLast(XtextResource resource, ITextRegion currentEditorSelection)
           
 ITextRegion selectNext(XtextResource resource, ITextRegion currentEditorSelection)
           
 ITextRegion selectPrevious(XtextResource resource, ITextRegion currentEditorSelection)
           
protected  void setAction(XtextEditor xtextEditor, org.eclipse.jface.action.IAction action, java.lang.String actionDefinitionId)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SELECT_ENCLOSING

public static final java.lang.String SELECT_ENCLOSING
See Also:
Constant Field Values

SELECT_NEXT

public static final java.lang.String SELECT_NEXT
See Also:
Constant Field Values

SELECT_PREVIOUS

public static final java.lang.String SELECT_PREVIOUS
See Also:
Constant Field Values

SELECT_LAST

public static final java.lang.String SELECT_LAST
See Also:
Constant Field Values
Constructor Detail

AstSelectionProvider

public AstSelectionProvider()
Method Detail

selectLast

public ITextRegion selectLast(XtextResource resource,
                              ITextRegion currentEditorSelection)

selectEnclosing

public ITextRegion selectEnclosing(XtextResource resource,
                                   ITextRegion currentEditorSelection)

selectNext

public ITextRegion selectNext(XtextResource resource,
                              ITextRegion currentEditorSelection)

selectPrevious

public ITextRegion selectPrevious(XtextResource resource,
                                  ITextRegion currentEditorSelection)

getSelectedAstElements

protected Pair<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EObject> getSelectedAstElements(XtextResource resource,
                                                                                                   ITextRegion currentSelection)
Returns:
the starting EObject and the ending EObject of the current selection or null if the selection doesn't match the exact boundaries of two EObjects with the same container.

internalGetSelectedAstElements

protected Pair<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EObject> internalGetSelectedAstElements(org.eclipse.emf.ecore.EObject eObject,
                                                                                                           ITextRegion currentSelection)

getRegion

protected ITextRegion getRegion(Pair<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EObject> selection)

computeInitialFineGrainedSelection

protected ITextRegion computeInitialFineGrainedSelection(INode node,
                                                         ITextRegion currentEditorSelection)

findSemanticObjectFor

protected org.eclipse.emf.ecore.EObject findSemanticObjectFor(INode node)

getEObjectAtOffset

protected org.eclipse.emf.ecore.EObject getEObjectAtOffset(XtextResource resource,
                                                           ITextRegion currentEditorSelection)

initialize

public void initialize(XtextEditor xtextEditor)

setAction

protected void setAction(XtextEditor xtextEditor,
                         org.eclipse.jface.action.IAction action,
                         java.lang.String actionDefinitionId)

register

protected ITextRegion register(ITextRegion textRegion)

getTextRegion

protected ITextRegion getTextRegion(org.eclipse.emf.ecore.EObject eObject)

getEndOffset

protected int getEndOffset(ITextRegion region)

getSelectionOffset

protected int getSelectionOffset(ICompositeNode rootNode,
                                 ITextRegion region)