Class AtlOccurrencesFinder
- java.lang.Object
-
- org.eclipse.m2m.atl.adt.ui.editor.AtlOccurrencesFinder
-
- All Implemented Interfaces:
IOccurrencesFinder
public class AtlOccurrencesFinder extends java.lang.Object implements IOccurrencesFinder
This class allows us to look into the model for the occurrence of the selected word (if there are). Several problems are encountered:- while the model isn't saved, the finder looks into the old model
- if there is an error in the model, the finder cannot go through it, and can only find occurrences before the error
- see also the query todo
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.m2m.atl.adt.ui.editor.IOccurrencesFinder
IOccurrencesFinder.OccurrenceLocation
-
-
Field Summary
-
Fields inherited from interface org.eclipse.m2m.atl.adt.ui.editor.IOccurrencesFinder
F_EXCEPTION_DECLARATION, F_READ_OCCURRENCE, F_WRITE_OCCURRENCE, K_BREAK_TARGET_OCCURRENCE, K_EXCEPTION_OCCURRENCE, K_EXIT_POINT_OCCURRENCE, K_IMPLEMENTS_OCCURRENCE, K_OCCURRENCE
-
-
Constructor Summary
Constructors Constructor Description AtlOccurrencesFinder(AtlEditor editor, org.eclipse.jface.text.IDocument document)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbrowseModel(org.eclipse.emf.ecore.EObject element, java.lang.String name, java.lang.String featureName, java.lang.String declarationType, java.lang.String useType, java.lang.String displayType)Browses the model in order to find occurrences of an element and add it to the result list.voidbrowseModelForType(org.eclipse.emf.ecore.EObject element, java.lang.String name)Browses the model in order to find occurrences of a type and add it to the result list.static java.lang.ObjecteGet(org.eclipse.emf.ecore.EObject self, java.lang.String featureName)Returns the value of a feature on an EObject.java.lang.StringgetElementName()Returns the name of the element to look for ornullif the finder hasn't been initialized yet.java.lang.StringgetID()Returns the id of this finder.java.lang.StringgetJobLabel()IOccurrencesFinder.OccurrenceLocation[]getOccurrences()Returns the occurrencesorg.eclipse.jface.text.IRegiongetRegionFromElement(org.eclipse.emf.ecore.EObject element)Gets the region of the element (actually, it gives the region of the word that is interesting for us in the expression given by the element.intgetSearchKind()java.lang.StringgetUnformattedPluralLabel()Returns the plural label for this finder with 3 placeholders: {0} for theelement name{1} for the number of results found {2} for the scope (name of the compilation unit)java.lang.StringgetUnformattedSingularLabel()Returns the singular label for this finder with 2 placeholders: {0} for theelement name{1} for the scope (name of the compilation unit)java.lang.Stringinitialize(org.eclipse.jface.text.IRegion selection)Initialization of the finder, with a text selection.static booleanoclIsKindOf(org.eclipse.emf.ecore.EObject element, java.lang.String testedElementName)Equivalent of ASMOclAny oclIsKindOf method for EObjects.
-
-
-
Constructor Detail
-
AtlOccurrencesFinder
public AtlOccurrencesFinder(AtlEditor editor, org.eclipse.jface.text.IDocument document)
-
-
Method Detail
-
initialize
public java.lang.String initialize(org.eclipse.jface.text.IRegion selection)
Initialization of the finder, with a text selection.- Parameters:
selection- the current text selection- Returns:
- always null (this is not used here)
-
getJobLabel
public java.lang.String getJobLabel()
- Specified by:
getJobLabelin interfaceIOccurrencesFinder
-
getUnformattedPluralLabel
public java.lang.String getUnformattedPluralLabel()
Description copied from interface:IOccurrencesFinderReturns the plural label for this finder with 3 placeholders:- {0} for the
element name - {1} for the number of results found
- {2} for the scope (name of the compilation unit)
- Specified by:
getUnformattedPluralLabelin interfaceIOccurrencesFinder- Returns:
- the unformatted label
- {0} for the
-
getUnformattedSingularLabel
public java.lang.String getUnformattedSingularLabel()
Description copied from interface:IOccurrencesFinderReturns the singular label for this finder with 2 placeholders:- {0} for the
element name - {1} for the scope (name of the compilation unit)
- Specified by:
getUnformattedSingularLabelin interfaceIOccurrencesFinder- Returns:
- the unformatted label
- {0} for the
-
getElementName
public java.lang.String getElementName()
Description copied from interface:IOccurrencesFinderReturns the name of the element to look for ornullif the finder hasn't been initialized yet.- Specified by:
getElementNamein interfaceIOccurrencesFinder- Returns:
- the name of the element
-
getOccurrences
public IOccurrencesFinder.OccurrenceLocation[] getOccurrences()
Returns the occurrences- Specified by:
getOccurrencesin interfaceIOccurrencesFinder- Returns:
- the occurrences
- See Also:
IOccurrencesFinder.getOccurrences()
-
eGet
public static java.lang.Object eGet(org.eclipse.emf.ecore.EObject self, java.lang.String featureName)Returns the value of a feature on an EObject.- Parameters:
self- the EObjectfeatureName- the feature name- Returns:
- the feature value
-
oclIsKindOf
public static boolean oclIsKindOf(org.eclipse.emf.ecore.EObject element, java.lang.String testedElementName)Equivalent of ASMOclAny oclIsKindOf method for EObjects.- Parameters:
element- the tested elementtestedElementName- the type name- Returns:
Trueelement has testedElementName in its superTypes,Falseelse.
-
getRegionFromElement
public org.eclipse.jface.text.IRegion getRegionFromElement(org.eclipse.emf.ecore.EObject element) throws org.eclipse.jface.text.BadLocationExceptionGets the region of the element (actually, it gives the region of the word that is interesting for us in the expression given by the element.- Parameters:
element- the expression we want to extract the word- Returns:
- the region of the interesting word of the given element
- Throws:
org.eclipse.jface.text.BadLocationException
-
browseModel
public void browseModel(org.eclipse.emf.ecore.EObject element, java.lang.String name, java.lang.String featureName, java.lang.String declarationType, java.lang.String useType, java.lang.String displayType) throws org.eclipse.jface.text.BadLocationExceptionBrowses the model in order to find occurrences of an element and add it to the result list.- Parameters:
element- the element we want the occurrences fromname- the name of the element we are looking forfeatureName- the name of the feature that allows us to find the name of the current navigated elementdeclarationType- the type of the element that will be considered as "declaration" (different highlighting)useType- the type of the element that will be considered as "occurrence" (different highlighting)displayType- the type that is going to be displayed in the eclipse marker- Throws:
org.eclipse.jface.text.BadLocationException
-
browseModelForType
public void browseModelForType(org.eclipse.emf.ecore.EObject element, java.lang.String name) throws org.eclipse.jface.text.BadLocationExceptionBrowses the model in order to find occurrences of a type and add it to the result list.- Parameters:
element- the typename- the name of the type- Throws:
org.eclipse.jface.text.BadLocationException
-
getSearchKind
public int getSearchKind()
- Specified by:
getSearchKindin interfaceIOccurrencesFinder
-
getID
public java.lang.String getID()
Description copied from interface:IOccurrencesFinderReturns the id of this finder.- Specified by:
getIDin interfaceIOccurrencesFinder- Returns:
- returns the id of this finder.
-
-