public abstract class FileEditorManager
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static Key<java.lang.Boolean> |
SEPARATOR_DISABLED |
static Key<java.lang.Boolean> |
USE_CURRENT_WINDOW |
Constructor and Description |
---|
FileEditorManager() |
Modifier and Type | Method and Description |
---|---|
abstract void |
addBottomComponent(FileEditor editor,
javax.swing.JComponent component)
Adds the specified component below the editor and paints a separator line above it.
|
void |
addFileEditorManagerListener(FileEditorManagerListener listener)
Deprecated.
Use
MessageBus instead: see FileEditorManagerListener.FILE_EDITOR_MANAGER |
void |
addFileEditorManagerListener(FileEditorManagerListener listener,
Disposable parentDisposable)
Deprecated.
Use
FileEditorManagerListener.FILE_EDITOR_MANAGER instead |
abstract void |
addTopComponent(FileEditor editor,
javax.swing.JComponent component)
Adds the specified component above the editor and paints a separator line below it.
|
abstract void |
closeFile(VirtualFile file)
Closes all editors opened for the file.
|
abstract FileEditor [] |
getAllEditors() |
abstract FileEditor [] |
getAllEditors(VirtualFile file) |
abstract java.lang.Object |
getData(java.lang.String dataId,
Editor editor,
Caret caret)
Returns data associated with given editor/caret context.
|
abstract FileEditor [] |
getEditors(VirtualFile file) |
static FileEditorManager |
getInstance(Project project) |
abstract VirtualFile [] |
getOpenFiles() |
abstract Project |
getProject()
Returns the project with which the file editor manager is associated.
|
FileEditor |
getSelectedEditor() |
abstract FileEditor |
getSelectedEditor(VirtualFile file) |
abstract FileEditor [] |
getSelectedEditors() |
abstract VirtualFile [] |
getSelectedFiles() |
abstract Editor |
getSelectedTextEditor() |
boolean |
hasOpenFiles() |
abstract boolean |
isFileOpen(VirtualFile file) |
void |
navigateToTextEditor(OpenFileDescriptor descriptor,
boolean focusEditor)
Deprecated.
|
abstract java.util.List<FileEditor> |
openEditor(OpenFileDescriptor descriptor,
boolean focusEditor)
Must be called from EDT.
|
abstract FileEditor [] |
openFile(VirtualFile file,
boolean focusEditor) |
FileEditor [] |
openFile(VirtualFile file,
boolean focusEditor,
boolean searchForOpen)
Opens a file.
|
abstract Editor |
openTextEditor(OpenFileDescriptor descriptor,
boolean focusEditor)
Works as
openFile(VirtualFile, boolean) but forces opening of text editor (see TextEditor ). |
abstract void |
registerExtraEditorDataProvider(EditorDataProvider provider,
Disposable parentDisposable) |
abstract void |
removeBottomComponent(FileEditor editor,
javax.swing.JComponent component) |
void |
removeFileEditorManagerListener(FileEditorManagerListener listener)
Deprecated.
Use
FileEditorManagerListener.FILE_EDITOR_MANAGER instead |
abstract void |
removeTopComponent(FileEditor editor,
javax.swing.JComponent component) |
abstract void |
runWhenLoaded(Editor editor,
java.lang.Runnable runnable)
FileEditorManager supports asynchronous opening of text editors, i.e. |
abstract void |
setSelectedEditor(VirtualFile file,
java.lang.String fileEditorProviderId)
Selects a specified file editor tab for the specified editor.
|
public static final Key<java.lang.Boolean> USE_CURRENT_WINDOW
public static final Key<java.lang.Boolean> SEPARATOR_DISABLED
public static FileEditorManager getInstance(Project project)
public abstract FileEditor [] openFile(VirtualFile file, boolean focusEditor)
file
- file to open. File should be valid.
Must be called from EDT.public FileEditor [] openFile(VirtualFile file, boolean focusEditor, boolean searchForOpen)
file
- file to openfocusEditor
- true
if need to focuspublic abstract void closeFile(VirtualFile file)
file
- file to be closed.public abstract Editor openTextEditor(OpenFileDescriptor descriptor, boolean focusEditor)
openFile(VirtualFile, boolean)
but forces opening of text editor (see TextEditor
).
If several text editors are opened, including the default one, default text editor is focused (if requested) and returned.
Must be called from EDT.null
in case if text editor wasn't opened.@Deprecated public void navigateToTextEditor(OpenFileDescriptor descriptor, boolean focusEditor)
openTextEditor(OpenFileDescriptor, boolean)
public abstract Editor getSelectedTextEditor()
null
in case
there is no selected editor at all or selected editor is not a text one.
Must be called from EDT.public abstract boolean isFileOpen(VirtualFile file)
true
if file
is opened, false
otherwisepublic abstract VirtualFile [] getOpenFiles()
public boolean hasOpenFiles()
public abstract VirtualFile [] getSelectedFiles()
public abstract FileEditor [] getSelectedEditors()
public FileEditor getSelectedEditor()
null
if there is no selected editor at all.public abstract FileEditor getSelectedEditor(VirtualFile file)
null
if file
is not opened.public abstract FileEditor [] getEditors(VirtualFile file)
file
public abstract FileEditor [] getAllEditors(VirtualFile file)
file
public abstract FileEditor [] getAllEditors()
public abstract void addTopComponent(FileEditor editor, javax.swing.JComponent component)
true
:
component.putClientProperty(SEPARATOR_DISABLED, true);Otherwise, a separator line will be painted by a
SEPARATOR_ABOVE_COLOR
or
TEARLINE_COLOR
if it is not set.
This method allows to add several components above the editor.
To change an order of components the specified component may implement the
Weighted
interface.
public abstract void removeTopComponent(FileEditor editor, javax.swing.JComponent component)
public abstract void addBottomComponent(FileEditor editor, javax.swing.JComponent component)
true
:
component.putClientProperty(SEPARATOR_DISABLED, true);Otherwise, a separator line will be painted by a
SEPARATOR_BELOW_COLOR
or
TEARLINE_COLOR
if it is not set.
This method allows to add several components below the editor.
To change an order of components the specified component may implement the
Weighted
interface.
public abstract void removeBottomComponent(FileEditor editor, javax.swing.JComponent component)
@Deprecated public void addFileEditorManagerListener(FileEditorManagerListener listener)
MessageBus
instead: see FileEditorManagerListener.FILE_EDITOR_MANAGER
listener
listener
- listener to be added@Deprecated public void addFileEditorManagerListener(FileEditorManagerListener listener, Disposable parentDisposable)
FileEditorManagerListener.FILE_EDITOR_MANAGER
instead@Deprecated public void removeFileEditorManagerListener(FileEditorManagerListener listener)
FileEditorManagerListener.FILE_EDITOR_MANAGER
insteadlistener
listener
- listener to be removedpublic abstract java.util.List<FileEditor> openEditor(OpenFileDescriptor descriptor, boolean focusEditor)
public abstract Project getProject()
public abstract void registerExtraEditorDataProvider(EditorDataProvider provider, Disposable parentDisposable)
public abstract java.lang.Object getData(java.lang.String dataId, Editor editor, Caret caret)
registerExtraEditorDataProvider(EditorDataProvider, Disposable)
method.public abstract void setSelectedEditor(VirtualFile file, java.lang.String fileEditorProviderId)
file
- a file to switch the file editor tab for. The function does nothing if the file is not currently open in the editor.fileEditorProviderId
- the ID of the file editor to open; matches the return value of
FileEditorProvider.getEditorTypeId()
public abstract void runWhenLoaded(Editor editor, java.lang.Runnable runnable)
FileEditorManager
supports asynchronous opening of text editors, i.e. when one of 'openFile' methods returns, returned
editor might not be fully initialized yet. This method allows to delay (if needed) execution of given runnable until editor is
fully loaded.