com.intellij.lang.findUsages
Interface FindUsagesProvider

All Known Implementing Classes:
EmptyFindUsagesProvider

public interface FindUsagesProvider

Defines the support for the "Find Usages" feature in a custom language.

See Also:
Language.getFindUsagesProvider()

Method Summary
 boolean canFindUsagesFor(PsiElement psiElement)
          Checks if it makes sense to search for usages of the specified element.
 java.lang.String getDescriptiveName(PsiElement element)
          Returns an expanded user-visible name of the specified element, shown in the "Find Usages" dialog.
 java.lang.String getHelpId(PsiElement psiElement)
          Returns the ID of the help topic which is shown when the specified element is selected in the "Find Usages" dialog.
 java.lang.String getNodeText(PsiElement element, boolean useFullName)
          Returns the text representing the specified PSI element in the Find Usages tree.
 java.lang.String getType(PsiElement element)
          Returns the user-visible type of the specified element, shown in the "Find Usages" dialog (for example, "class" or "variable").
 WordsScanner getWordsScanner()
          Gets the word scanner for building a word index for the specified language.
 boolean mayHaveReferences(IElementType token, short searchContext)
          Checks if tokens of the specified type can contain references when the search is done with the specified context.
 

Method Detail

mayHaveReferences

boolean mayHaveReferences(IElementType token,
                          short searchContext)
Checks if tokens of the specified type can contain references when the search is done with the specified context.

Parameters:
token - the token type to check for references.
searchContext - represents find usages request, a combination of constants in UsageSearchContext

getWordsScanner

@Nullable
WordsScanner getWordsScanner()
Gets the word scanner for building a word index for the specified language.

Returns:
the word scanner implementation, or null if Find Usages is not supported for the language.

canFindUsagesFor

boolean canFindUsagesFor(PsiElement psiElement)
Checks if it makes sense to search for usages of the specified element.

Parameters:
psiElement - the element for which usages are searched.
Returns:
true if the search is allowed, false otherwise.
See Also:
FindManager.canFindUsages(com.intellij.psi.PsiElement)

getHelpId

@Nullable
java.lang.String getHelpId(PsiElement psiElement)
Returns the ID of the help topic which is shown when the specified element is selected in the "Find Usages" dialog.

Parameters:
psiElement - the element for which the help topic is requested.
Returns:
the help topic ID, or null if no help is available.

getType

@NotNull
java.lang.String getType(PsiElement element)
Returns the user-visible type of the specified element, shown in the "Find Usages" dialog (for example, "class" or "variable"). The type name should not be upper-cased.

Parameters:
element - the element for which the type is requested.
Returns:
the type of the element.

getDescriptiveName

@NotNull
java.lang.String getDescriptiveName(PsiElement element)
Returns an expanded user-visible name of the specified element, shown in the "Find Usages" dialog. For classes, this can return a fully qualified name of the class; for methods - a signature of the method with parameters.

Parameters:
element - the element for which the name is requested.
Returns:
the user-visible name.

getNodeText

@NotNull
java.lang.String getNodeText(PsiElement element,
                                     boolean useFullName)
Returns the text representing the specified PSI element in the Find Usages tree.

Parameters:
element - the element for which the node text is requested.
useFullName - if true, the returned text should use fully qualified names
Returns:
the text representing the element.