Package org.eclipse.m2m.atl.adt.ui.text.atl

# Class OpenDeclarationUtils

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

public final class OpenDeclarationUtils extends Object
Open declaration utilities.

## Method Summary

Modifier and Type
Method
Description
`static org.eclipse.jface.text.IRegion`
`findWord(org.eclipse.jface.text.IDocument document, int offset)`
The region of the found word.
`static Object`
`getDeclaration(AtlEditor editor, int offset, int length)`
Retrieves the declaration of the element at the given offset if exists.
`static Object`
`getIFileXorIOFile(org.eclipse.emf.common.util.URI fileURI)`
Returns the workspace file (IFile).
`static String`
`getInformation(AtlEditor editor, int offset, int length)`
Returns a description of the element available at the given offset.
`static org.eclipse.m2m.atl.adt.ui.text.atl.types.OclAnyType`
`getType(AtlEditor editor, int offset, int length)`
Retrieves the declaration of the element at the given offset if exists.
`static void`
`openDeclaration(org.eclipse.m2m.atl.adt.ui.text.atl.types.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 Details

### getType

public static org.eclipse.m2m.atl.adt.ui.text.atl.types.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 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 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(org.eclipse.m2m.atl.adt.ui.text.atl.types.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 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