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 Usagepublic boolean isReadOnly()
isReadOnly in interface Usagepublic FileEditorLocation getLocation()
getLocation in interface Usagepublic void selectInEditor()
selectInEditor in interface Usagepublic void highlightInEditor()
highlightInEditor in interface Usagepublic Document getDocument()
public void navigate(boolean focus)
Navigatablenavigate in interface Navigatablefocus - true if focus requesting is necessarypublic Editor openTextEditor(boolean focus)
public boolean canNavigate()
NavigatableNavigatable.canNavigateToSource() returns true.
We assume that this method should return true in such case,
so implement this method respectively.canNavigate in interface Navigatablefalse if navigation is not possible for any reason.public boolean canNavigateToSource()
Navigatablefalse.
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 Navigatablefalse if navigation to source is not possible for any reason.public Segment getNavigationRange()
public java.lang.String toString()
toString in class java.lang.Objectpublic Module getModule()
getModule in interface UsageInModulepublic OrderEntry getLibraryEntry()
getLibraryEntry in interface UsageInLibrarypublic java.util.List<SyntheticLibrary> getSyntheticLibraries()
getSyntheticLibraries in interface UsageInLibrarypublic VirtualFile getFile()
getFile in interface UsageInFilepublic int getLine()
public boolean merge(MergeableUsage other)
merge in interface MergeableUsagepublic void reset()
MergeableUsagereset in interface MergeableUsagepublic final PsiElement getElement()
getElement in interface PsiElementUsagepublic boolean isNonCodeUsage()
isNonCodeUsage in interface PsiElementUsagepublic 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 RenameableUsageIncorrectOperationExceptionpublic static UsageInfo2UsageAdapter [] convert(UsageInfo [] usageInfos)
public void calcData(DataKey key, DataSink sink)
calcData in interface TypeSafeDataProviderpublic UsageInfo [] getMergedInfos()
public TextChunk [] getText()
getText in interface UsagePresentationpublic TextChunk [] getCachedText()
UsagePresentationUsagePresentation.updateCachedText() in a background
thread and then use UsagePresentation.getCachedText() to draw the text.getCachedText in interface UsagePresentationpublic void updateCachedText()
updateCachedText in interface UsagePresentationpublic java.lang.String getPlainText()
getPlainText in interface UsagePresentationpublic javax.swing.Icon getIcon()
getIcon in interface UsagePresentationpublic java.lang.String getTooltipText()
getTooltipText in interface UsagePresentationpublic UsageType getUsageType()