Class OpenDeclarationUtils
- java.lang.Object
-
- org.eclipse.m2m.atl.adt.ui.text.atl.OpenDeclarationUtils
-
public final class OpenDeclarationUtils extends java.lang.Object
Open declaration utilities.
-
-
Method Summary
All Methods Static Methods Concrete Methods 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 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 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.
-
-
-
Method Detail
-
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 editoroffset
- the given offsetlength
- 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 editoroffset
- the given offsetlength
- 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 editoroffset
- the given offsetlength
- 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 declarationtarget
- the targetEObject
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 pagefileURI
- is the file to open on the pageeObject
- 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 documentoffset
- the given offset- Returns:
- the region of the word at the given offset
-
-