public class UsageInfo2UsageAdapter extends java.lang.Object implements UsageInModule, UsageInLibrary, UsageInFile, PsiElementUsage, MergeableUsage, java.lang.Comparable<UsageInfo2UsageAdapter>, RenameableUsage, TypeSafeDataProvider, UsagePresentation
Modifier and Type | Field and Description |
---|---|
static NotNullFunction<UsageInfo,Usage> |
CONVERTER |
protected javax.swing.Icon |
myIcon |
EMPTY_ARRAY
Constructor and Description |
---|
UsageInfo2UsageAdapter(UsageInfo usageInfo) |
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).
|
int |
compareTo(UsageInfo2UsageAdapter o) |
static UsageInfo2UsageAdapter [] |
convert(UsageInfo [] usageInfos) |
TextChunk [] |
getCachedText()
If the implementation caches or lazy-loades the text chunks internally, this method gives it a chance to avoid
re-calculating it synchronously on EDT and return the possibly obsolete data.
|
Document |
getDocument() |
PsiElement |
getElement() |
VirtualFile |
getFile() |
javax.swing.Icon |
getIcon() |
OrderEntry |
getLibraryEntry() |
int |
getLine() |
FileEditorLocation |
getLocation() |
UsageInfo [] |
getMergedInfos() |
Module |
getModule() |
Segment |
getNavigationRange()
Returns the text range of the usage relative to the start of the file.
|
java.lang.String |
getPlainText() |
UsagePresentation |
getPresentation() |
java.util.List<SyntheticLibrary> |
getSyntheticLibraries() |
TextChunk [] |
getText() |
java.lang.String |
getTooltipText() |
UsageInfo |
getUsageInfo() |
UsageType |
getUsageType() |
void |
highlightInEditor() |
boolean |
isNonCodeUsage() |
boolean |
isReadOnly() |
boolean |
isValid() |
boolean |
merge(MergeableUsage other) |
void |
navigate(boolean focus)
Open editor and select/navigate to the object there if possible.
|
Editor |
openTextEditor(boolean focus) |
boolean |
processRangeMarkers(Processor<? super Segment> processor) |
void |
rename(java.lang.String newName) |
void |
reset()
Revert to original status prior any merges
|
void |
selectInEditor() |
java.lang.String |
toString() |
void |
updateCachedText() |
public static final NotNullFunction<UsageInfo,Usage> CONVERTER
protected javax.swing.Icon myIcon
public UsageInfo2UsageAdapter(UsageInfo usageInfo)
public UsagePresentation getPresentation()
getPresentation
in interface Usage
public boolean isReadOnly()
isReadOnly
in interface Usage
public FileEditorLocation getLocation()
getLocation
in interface Usage
public void selectInEditor()
selectInEditor
in interface Usage
public void highlightInEditor()
highlightInEditor
in interface Usage
public Document getDocument()
public void navigate(boolean focus)
Navigatable
navigate
in interface Navigatable
focus
- true
if focus requesting is necessarypublic Editor openTextEditor(boolean focus)
public 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 Segment getNavigationRange()
public java.lang.String toString()
toString
in class java.lang.Object
public Module getModule()
getModule
in interface UsageInModule
public OrderEntry getLibraryEntry()
getLibraryEntry
in interface UsageInLibrary
public java.util.List<SyntheticLibrary> getSyntheticLibraries()
getSyntheticLibraries
in interface UsageInLibrary
public VirtualFile getFile()
getFile
in interface UsageInFile
public int getLine()
public boolean merge(MergeableUsage other)
merge
in interface MergeableUsage
public void reset()
MergeableUsage
reset
in interface MergeableUsage
public final PsiElement getElement()
getElement
in interface PsiElementUsage
public boolean isNonCodeUsage()
isNonCodeUsage
in interface PsiElementUsage
public UsageInfo getUsageInfo()
public int compareTo(UsageInfo2UsageAdapter o)
compareTo
in interface java.lang.Comparable<UsageInfo2UsageAdapter>
public void rename(java.lang.String newName) throws IncorrectOperationException
rename
in interface RenameableUsage
IncorrectOperationException
public static UsageInfo2UsageAdapter [] convert(UsageInfo [] usageInfos)
public void calcData(DataKey key, DataSink sink)
calcData
in interface TypeSafeDataProvider
public UsageInfo [] getMergedInfos()
public TextChunk [] getText()
getText
in interface UsagePresentation
public TextChunk [] getCachedText()
UsagePresentation
UsagePresentation.updateCachedText()
in a background
thread and then use UsagePresentation.getCachedText()
to draw the text.getCachedText
in interface UsagePresentation
public void updateCachedText()
updateCachedText
in interface UsagePresentation
public java.lang.String getPlainText()
getPlainText
in interface UsagePresentation
public javax.swing.Icon getIcon()
getIcon
in interface UsagePresentation
public java.lang.String getTooltipText()
getTooltipText
in interface UsagePresentation
public UsageType getUsageType()