Search in sources :

Example 6 with IdentifierFinderVisitor

use of org.eclipse.titan.designer.declarationsearch.IdentifierFinderVisitor in project titan.EclipsePlug-ins by eclipse.

the class RenameRefactoring method findOccurrencesLocationBased.

/**
 * Finds the occurrences of the element located on the given offset.
 * This search is based on the {@link ASTLocationChainVisitor}.
 *
 * @param module
 *                The module to search the occurrences in
 * @param offset
 *                An offset in the module
 * @return The referencefinder
 */
protected static ReferenceFinder findOccurrencesLocationBased(final Module module, final int offset) {
    final IdentifierFinderVisitor visitor = new IdentifierFinderVisitor(offset);
    module.accept(visitor);
    // It works for fields as well
    final Declaration def = visitor.getReferencedDeclaration();
    if (def == null || !def.shouldMarkOccurrences()) {
        return null;
    }
    return def.getReferenceFinder(module);
}
Also used : IdentifierFinderVisitor(org.eclipse.titan.designer.declarationsearch.IdentifierFinderVisitor) Declaration(org.eclipse.titan.designer.declarationsearch.Declaration)

Aggregations

Declaration (org.eclipse.titan.designer.declarationsearch.Declaration)6 IdentifierFinderVisitor (org.eclipse.titan.designer.declarationsearch.IdentifierFinderVisitor)6 IFile (org.eclipse.core.resources.IFile)3 IPreferencesService (org.eclipse.core.runtime.preferences.IPreferencesService)3 TextSelection (org.eclipse.jface.text.TextSelection)3 Module (org.eclipse.titan.designer.AST.Module)3 ProjectSourceParser (org.eclipse.titan.designer.parsers.ProjectSourceParser)3 ArrayList (java.util.ArrayList)1 Undefined_Assignment (org.eclipse.titan.designer.AST.ASN1.Undefined_Assignment)1 ASN1Editor (org.eclipse.titan.designer.editors.asn1editor.ASN1Editor)1 TTCN3Editor (org.eclipse.titan.designer.editors.ttcn3editor.TTCN3Editor)1 TTCNPPEditor (org.eclipse.titan.designer.editors.ttcnppeditor.TTCNPPEditor)1 CompilationTimeStamp (org.eclipse.titan.designer.parsers.CompilationTimeStamp)1 MessageConsoleStream (org.eclipse.ui.console.MessageConsoleStream)1