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

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

public final class OpenDeclarationUtils
extends java.lang.Object

Open declaration utilities.


Method Summary
static org.eclipse.jface.text.IRegion findWord(org.eclipse.jface.text.IDocument document, int offset)
          The region of the found word.
static java.lang.Object getDeclaration(AtlEditor editor, int offset, int length)
          Retrieves the declaration of the element at the given offset if exists.
static java.lang.Object getIFileXorIOFile(org.eclipse.emf.common.util.URI fileURI)
          Returns the workspace file (IFile).
static java.lang.String getInformation(AtlEditor editor, int offset, int length)
          Returns a description of the element available at the given offset.
static OclAnyType getType(AtlEditor editor, int offset, int length)
          Retrieves the declaration of the element at the given offset if exists.
static void openDeclaration(UnitType unit, org.eclipse.emf.ecore.EObject target, AtlEditor editor)
          Opens the declaration of the given object.
static void showEObject(org.eclipse.ui.IWorkbenchPage page, org.eclipse.emf.common.util.URI fileURI, org.eclipse.emf.ecore.EObject eObject)
          Opens the referenced definition on the given page.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getType

public static OclAnyType getType(AtlEditor editor,
                                 int offset,
                                 int length)
                          throws org.eclipse.jface.text.BadLocationException
Retrieves the declaration of the element at the given offset if exists.

Parameters:
editor - the current editor
offset - the given offset
length - the region length (after offset, unused)
Returns:
the declaration if exists
Throws:
org.eclipse.jface.text.BadLocationException

getInformation

public static java.lang.String getInformation(AtlEditor editor,
                                              int offset,
                                              int length)
                                       throws org.eclipse.jface.text.BadLocationException
Returns a description of the element available at the given offset.

Parameters:
editor - the current editor
offset - the given offset
length - the region length (after offset, unused)
Returns:
a description of the element available at the given offset
Throws:
org.eclipse.jface.text.BadLocationException

getDeclaration

public static java.lang.Object getDeclaration(AtlEditor editor,
                                              int offset,
                                              int length)
                                       throws org.eclipse.jface.text.BadLocationException
Retrieves the declaration of the element at the given offset if exists.

Parameters:
editor - the current editor
offset - the given offset
length - the region length (after offset, unused)
Returns:
the declaration if exists
Throws:
org.eclipse.jface.text.BadLocationException

openDeclaration

public static void openDeclaration(UnitType unit,
                                   org.eclipse.emf.ecore.EObject target,
                                   AtlEditor editor)
                            throws org.eclipse.jface.text.BadLocationException
Opens the declaration of the given object. Support both meta-elements: open the declaration inside of the metamodel; and ATL model elements.

Parameters:
unit - the atl unit containing the declaration
target - the target EObject
editor - the editor
Throws:
org.eclipse.jface.text.BadLocationException

showEObject

public static void showEObject(org.eclipse.ui.IWorkbenchPage page,
                               org.eclipse.emf.common.util.URI fileURI,
                               org.eclipse.emf.ecore.EObject eObject)
Opens the referenced definition on the given page. It can be on the active editor, or not. The highlighted range of the active editor is modified if the file URI of the referenced object is the active editor itself. Another editor can be opened if the referenced file is another file.

Parameters:
page - is the current page
fileURI - is the file to open on the page
eObject - is the EObject to select (Ecore editor)

getIFileXorIOFile

public static java.lang.Object getIFileXorIOFile(org.eclipse.emf.common.util.URI fileURI)
Returns the workspace file (IFile). If it doesn't exist, we try to find the java.io.File.

Parameters:
fileURI - is the platform URI or the file URI...
Returns:
the IFile, or the java.io.File, or null if it doesn't exist

findWord

public static org.eclipse.jface.text.IRegion findWord(org.eclipse.jface.text.IDocument document,
                                                      int offset)
The region of the found word.

Parameters:
document - the current document
offset - the given offset
Returns:
the region of the word at the given offset

Copyright 2007 IBM Corporation and others.
All Rights Reserved.