public class OpenFileDescriptor extends java.lang.Object implements Navigatable, java.lang.Comparable<OpenFileDescriptor>
Modifier and Type | Field and Description |
---|---|
static DataKey<Editor> |
NAVIGATE_IN_EDITOR
Tells descriptor to navigate in specific editor rather than file editor in main IDE window.
|
Constructor and Description |
---|
OpenFileDescriptor(Project project,
VirtualFile file) |
OpenFileDescriptor(Project project,
VirtualFile file,
int offset) |
OpenFileDescriptor(Project project,
VirtualFile file,
int logicalLine,
int logicalColumn) |
OpenFileDescriptor(Project project,
VirtualFile file,
int logicalLine,
int logicalColumn,
boolean persistent) |
Modifier and Type | Method and Description |
---|---|
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(OpenFileDescriptor o) |
void |
dispose() |
int |
getColumn() |
VirtualFile |
getFile() |
int |
getLine() |
int |
getOffset() |
Project |
getProject() |
RangeMarker |
getRangeMarker() |
static TextRange |
getRangeToUnfoldOnNavigation(Editor editor) |
boolean |
isUseCurrentWindow() |
void |
navigate(boolean requestFocus)
Open editor and select/navigate to the object there if possible.
|
void |
navigateIn(Editor e) |
protected boolean |
navigateInAnyFileEditor(Project project,
boolean focusEditor) |
boolean |
navigateInEditor(Project project,
boolean requestFocus) |
void |
setScrollType(ScrollType scrollType) |
OpenFileDescriptor |
setUseCurrentWindow(boolean search) |
protected static void |
unfoldCurrentLine(Editor editor) |
public OpenFileDescriptor(Project project, VirtualFile file, int offset)
public OpenFileDescriptor(Project project, VirtualFile file, int logicalLine, int logicalColumn)
public OpenFileDescriptor(Project project, VirtualFile file, int logicalLine, int logicalColumn, boolean persistent)
public OpenFileDescriptor(Project project, VirtualFile file)
public VirtualFile getFile()
public RangeMarker getRangeMarker()
public int getOffset()
public int getLine()
public int getColumn()
public void navigate(boolean requestFocus)
Navigatable
navigate
in interface Navigatable
requestFocus
- true
if focus requesting is necessarypublic boolean navigateInEditor(Project project, boolean requestFocus)
protected boolean navigateInAnyFileEditor(Project project, boolean focusEditor)
public void navigateIn(Editor e)
protected static void unfoldCurrentLine(Editor editor)
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 Project getProject()
public OpenFileDescriptor setUseCurrentWindow(boolean search)
public boolean isUseCurrentWindow()
public void setScrollType(ScrollType scrollType)
public void dispose()
public int compareTo(OpenFileDescriptor o)
compareTo
in interface java.lang.Comparable<OpenFileDescriptor>