public class PsiElement2UsageTargetAdapter extends java.lang.Object implements PsiElementUsageTarget, TypeSafeDataProvider, PsiElementNavigationItem, ItemPresentation, ConfigurableUsageTarget
Modifier and Type | Field and Description |
---|---|
protected FindUsagesOptions |
myOptions |
EMPTY_ARRAY
Constructor and Description |
---|
PsiElement2UsageTargetAdapter(PsiElement element) |
PsiElement2UsageTargetAdapter(PsiElement element,
FindUsagesOptions options) |
Modifier and Type | Method and Description |
---|---|
void |
calcData(DataKey key,
DataSink sink) |
boolean |
canNavigate()
Indicates whether this instance supports navigation of any kind.
|
boolean |
canNavigateToSource()
Indicates whether this instance supports navigation to source (that means some kind of editor).
|
static PsiElement2UsageTargetAdapter [] |
convert(PsiElement [] psiElements) |
void |
findUsages()
Should open usage view and look for usages
|
void |
findUsagesInEditor(FileEditor editor)
Should look for usages in one specific editor.
|
PsiElement |
getElement() |
VirtualFile[] |
getFiles() |
javax.swing.Icon |
getIcon(boolean open)
Returns the icon representing the object.
|
java.lang.String |
getLocationString()
Returns the location of the object (for example, the package of a class).
|
java.lang.String |
getLongDescriptiveName() |
java.lang.String |
getName() |
java.lang.String |
getPresentableText()
Returns the name of the object to be presented in most renderers across the program.
|
ItemPresentation |
getPresentation() |
Project |
getProject() |
KeyboardShortcut |
getShortcut() |
PsiElement |
getTargetElement() |
void |
highlightUsages(PsiFile file,
Editor editor,
boolean clearHighlights) |
boolean |
isReadOnly() |
boolean |
isValid() |
void |
navigate(boolean requestFocus)
Open editor and select/navigate to the object there if possible.
|
void |
showSettings() |
java.lang.String |
toString() |
void |
update() |
protected final FindUsagesOptions myOptions
public PsiElement2UsageTargetAdapter(PsiElement element, FindUsagesOptions options)
public PsiElement2UsageTargetAdapter(PsiElement element)
public java.lang.String getName()
getName
in interface NavigationItem
public ItemPresentation getPresentation()
getPresentation
in interface NavigationItem
public void navigate(boolean requestFocus)
Navigatable
navigate
in interface Navigatable
requestFocus
- true
if focus requesting is necessarypublic boolean canNavigate()
Navigatable
Navigatable.canNavigateToSource()
returns true
.
We assume that this method should return true
in such case,
so implement this method respectively.canNavigate
in interface Navigatable
false
if navigation is not possible for any reason.public boolean canNavigateToSource()
Navigatable
false
.
In such cases it is not recommended to do batch navigation for all navigatables
available via CommonDataKeys.NAVIGATABLE_ARRAY
,
because it may lead to opening several modal dialogs.
Use OpenSourceUtil.navigate(com.intellij.pom.Navigatable...)
to process such arrays correctly.canNavigateToSource
in interface Navigatable
false
if navigation to source is not possible for any reason.public PsiElement getTargetElement()
getTargetElement
in interface PsiElementNavigationItem
public java.lang.String toString()
toString
in class java.lang.Object
public void findUsages()
UsageTarget
findUsages
in interface UsageTarget
public PsiElement getElement()
getElement
in interface PsiElementUsageTarget
public void findUsagesInEditor(FileEditor editor)
UsageTarget
findUsagesInEditor
in interface UsageTarget
public void highlightUsages(PsiFile file, Editor editor, boolean clearHighlights)
highlightUsages
in interface UsageTarget
public boolean isValid()
isValid
in interface UsageTarget
public boolean isReadOnly()
isReadOnly
in interface UsageTarget
public VirtualFile[] getFiles()
getFiles
in interface UsageTarget
public static PsiElement2UsageTargetAdapter [] convert(PsiElement [] psiElements)
public void calcData(DataKey key, DataSink sink)
calcData
in interface TypeSafeDataProvider
public KeyboardShortcut getShortcut()
getShortcut
in interface ConfigurableUsageTarget
public java.lang.String getLongDescriptiveName()
getLongDescriptiveName
in interface ConfigurableUsageTarget
public void showSettings()
showSettings
in interface ConfigurableUsageTarget
public void update()
update
in interface UsageTarget
public java.lang.String getPresentableText()
ItemPresentation
getPresentableText
in interface ItemPresentation
public java.lang.String getLocationString()
ItemPresentation
getLocationString
in interface ItemPresentation
public javax.swing.Icon getIcon(boolean open)
ItemPresentation
getIcon
in interface ItemPresentation
open
- Used to mean if open/close icons for tree renderer. No longer in use. The parameter is only there for API compatibility reason.public Project getProject()