public class FileEditorManagerImpl extends FileEditorManagerEx implements PersistentStateComponent<Element>, Disposable
Disposable.Parent| Modifier and Type | Field and Description |
|---|---|
static Key<java.lang.Boolean> |
CLOSING_TO_REOPEN |
static java.lang.String |
FILE_EDITOR_MANAGER |
SEPARATOR_DISABLED, USE_CURRENT_WINDOW| Constructor and Description |
|---|
FileEditorManagerImpl(Project project) |
| Modifier and Type | Method and Description |
|---|---|
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)
Adds specified
listener |
void |
addFileEditorManagerListener(FileEditorManagerListener listener,
Disposable parentDisposable) |
void |
addSelectionRecord(VirtualFile file,
EditorWindow window) |
void |
addTopComponent(FileEditor editor,
javax.swing.JComponent component)
Adds the specified component above the editor and paints a separator line below it.
|
void |
changeSplitterOrientation() |
void |
closeAllFiles()
Closes all files IN ACTIVE SPLITTER (window).
|
void |
closeFile(VirtualFile file)
Closes all editors opened for the file.
|
void |
closeFile(VirtualFile file,
boolean moveFocus,
boolean closeAllCopies) |
void |
closeFile(VirtualFile file,
EditorWindow window)
Closes editors for the file opened in particular window.
|
void |
closeFile(VirtualFile file,
EditorWindow window,
boolean transferFocus) |
void |
createSplitter(int orientation,
EditorWindow window) |
void |
dispose()
Usually not invoked directly, see class javadoc.
|
void |
fireSelectionChanged(EditorComposite newSelectedComposite) |
Promise<EditorWindow> |
getActiveWindow()
Asynchronous version of
FileEditorManagerEx.getCurrentWindow(). |
FileEditor [] |
getAllEditors() |
FileEditor [] |
getAllEditors(VirtualFile file) |
java.util.Set<EditorsSplitters> |
getAllSplitters() |
javax.swing.JComponent |
getComponent() |
VirtualFile |
getCurrentFile() |
EditorWindow |
getCurrentWindow()
Synchronous version of
FileEditorManagerEx.getActiveWindow(). |
FileEditor [] |
getEditors(VirtualFile file) |
Pair<FileEditor[],FileEditorProvider[]> |
getEditorsWithProviders(VirtualFile file) |
VirtualFile |
getFile(FileEditor editor) |
java.awt.Color |
getFileColor(VirtualFile file) |
java.lang.String |
getFileTooltipText(VirtualFile file) |
EditorsSplitters |
getMainSplitters() |
EditorWindow |
getNextWindow(EditorWindow window) |
VirtualFile [] |
getOpenFiles() |
javax.swing.JComponent |
getPreferredFocusedComponent() |
EditorWindow |
getPrevWindow(EditorWindow window) |
Project |
getProject()
Returns the project with which the file editor manager is associated.
|
ActionCallback |
getReady(java.lang.Object requestor) |
FileEditor |
getSelectedEditor() |
FileEditor |
getSelectedEditor(VirtualFile file) |
FileEditor [] |
getSelectedEditors() |
FileEditorWithProvider |
getSelectedEditorWithProvider(VirtualFile file) |
VirtualFile [] |
getSelectedFiles() |
Editor |
getSelectedTextEditor() |
Editor |
getSelectedTextEditor(boolean lockfree) |
java.util.List<Pair<VirtualFile,EditorWindow>> |
getSelectionHistory() |
VirtualFile [] |
getSiblings(VirtualFile file) |
EditorsSplitters |
getSplitters() |
EditorsSplitters |
getSplittersFor(java.awt.Component c) |
Element |
getState() |
java.util.List<javax.swing.JComponent> |
getTopComponents(FileEditor editor) |
EditorWindow [] |
getWindows() |
int |
getWindowSplitCount() |
boolean |
hasOpenedFile() |
boolean |
hasOpenFiles() |
boolean |
hasSplitOrUndockedWindows() |
void |
initDockableContentFactory() |
boolean |
isChanged(EditorComposite editor) |
static boolean |
isDumbAware(FileEditor editor) |
boolean |
isFileOpen(VirtualFile file) |
boolean |
isInsideChange() |
boolean |
isInSplitter() |
boolean |
isProblem(VirtualFile file) |
void |
loadState(Element state)
This method is called when new component state is loaded.
|
ActionCallback |
notifyPublisher(java.lang.Runnable runnable) |
java.util.List<FileEditor> |
openEditor(OpenFileDescriptor descriptor,
boolean focusEditor)
Must be called from EDT.
|
Pair<FileEditor[],FileEditorProvider[]> |
openFileImpl2(EditorWindow window,
VirtualFile file,
boolean focusEditor) |
Pair<FileEditor[],FileEditorProvider[]> |
openFileInNewWindow(VirtualFile file) |
Pair<FileEditor[],FileEditorProvider[]> |
openFileWithProviders(VirtualFile file,
boolean focusEditor,
boolean searchForSplitter) |
Pair<FileEditor[],FileEditorProvider[]> |
openFileWithProviders(VirtualFile file,
boolean focusEditor,
EditorWindow window) |
Editor |
openTextEditor(OpenFileDescriptor descriptor,
boolean focusEditor)
Works as
FileEditorManager.openFile(VirtualFile, boolean) but forces opening of text editor (see TextEditor). |
protected void |
projectOpened(MessageBusConnection connection) |
void |
removeBottomComponent(FileEditor editor,
javax.swing.JComponent component) |
void |
removeFileEditorManagerListener(FileEditorManagerListener listener)
Removes specified
listener |
void |
removeTopComponent(FileEditor editor,
javax.swing.JComponent component) |
void |
setCurrentWindow(EditorWindow window) |
void |
setSelectedEditor(VirtualFile file,
java.lang.String fileEditorProviderId)
Selects a specified file editor tab for the specified editor.
|
void |
unsplitAllWindow() |
void |
unsplitWindow() |
protected void |
updateFileIcon(VirtualFile file)
Updates tab icon for the specified
file. |
void |
updateFilePresentation(VirtualFile file)
Refreshes the text, colors and icon of the editor tabs representing the specified file.
|
getData, getInstanceEx, openFile, openFile, refreshIcons, registerExtraEditorDataProvider, runWhenLoadedgetInstance, navigateToTextEditorclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitinitializeComponent, noStateLoadedpublic static final Key<java.lang.Boolean> CLOSING_TO_REOPEN
public static final java.lang.String FILE_EDITOR_MANAGER
public FileEditorManagerImpl(Project project)
public void dispose()
Disposabledispose in interface Disposablepublic void initDockableContentFactory()
public static boolean isDumbAware(FileEditor editor)
public javax.swing.JComponent getComponent()
getComponent in class FileEditorManagerExJComponent which represent the place where all editors are locatedpublic EditorsSplitters getMainSplitters()
public java.util.Set<EditorsSplitters> getAllSplitters()
public javax.swing.JComponent getPreferredFocusedComponent()
getPreferredFocusedComponent in class FileEditorManagerExFileEditor.getPreferredFocusedComponent()
but it also tracks (and remember) focus movement inside tabbed container.EditorComposite.getPreferredFocusedComponent()public java.awt.Color getFileColor(VirtualFile file)
file which corresponds to the
file's statuspublic boolean isProblem(VirtualFile file)
public java.lang.String getFileTooltipText(VirtualFile file)
public void updateFilePresentation(VirtualFile file)
FileEditorManagerExupdateFilePresentation in class FileEditorManagerExfile - the file to refresh.protected void updateFileIcon(VirtualFile file)
file. The file
should be opened in the myEditor, otherwise the method throws an assertion.public VirtualFile getFile(FileEditor editor)
getFile in class FileEditorManagerExpublic void unsplitWindow()
unsplitWindow in class FileEditorManagerExpublic void unsplitAllWindow()
unsplitAllWindow in class FileEditorManagerExpublic int getWindowSplitCount()
getWindowSplitCount in class FileEditorManagerExpublic boolean hasSplitOrUndockedWindows()
hasSplitOrUndockedWindows in class FileEditorManagerExpublic EditorWindow [] getWindows()
getWindows in class FileEditorManagerExpublic EditorWindow getNextWindow(EditorWindow window)
getNextWindow in class FileEditorManagerExpublic EditorWindow getPrevWindow(EditorWindow window)
getPrevWindow in class FileEditorManagerExpublic void createSplitter(int orientation,
EditorWindow window)
createSplitter in class FileEditorManagerExpublic void changeSplitterOrientation()
changeSplitterOrientation in class FileEditorManagerExpublic boolean isInSplitter()
isInSplitter in class FileEditorManagerExpublic boolean hasOpenedFile()
hasOpenedFile in class FileEditorManagerExpublic VirtualFile getCurrentFile()
getCurrentFile in class FileEditorManagerExpublic Promise<EditorWindow> getActiveWindow()
FileEditorManagerExFileEditorManagerEx.getCurrentWindow(). Execution happens after focus settle down. Can be invoked on any thread.getActiveWindow in class FileEditorManagerExpublic EditorWindow getCurrentWindow()
FileEditorManagerExFileEditorManagerEx.getActiveWindow(). Will return null if invoked not from EDT.getCurrentWindow in class FileEditorManagerExpublic void setCurrentWindow(EditorWindow window)
setCurrentWindow in class FileEditorManagerExpublic void closeFile(VirtualFile file, EditorWindow window, boolean transferFocus)
public void closeFile(VirtualFile file, EditorWindow window)
FileEditorManagerExcloseFile in class FileEditorManagerExfile - file to be closed. Cannot be null.public void closeFile(VirtualFile file)
FileEditorManagercloseFile in class FileEditorManagerfile - file to be closed.public void closeFile(VirtualFile file, boolean moveFocus, boolean closeAllCopies)
public Pair<FileEditor[],FileEditorProvider[]> openFileWithProviders(VirtualFile file, boolean focusEditor, boolean searchForSplitter)
openFileWithProviders in class FileEditorManagerExpublic Pair<FileEditor[],FileEditorProvider[]> openFileInNewWindow(VirtualFile file)
public Pair<FileEditor[],FileEditorProvider[]> openFileWithProviders(VirtualFile file, boolean focusEditor, EditorWindow window)
openFileWithProviders in class FileEditorManagerExpublic Pair<FileEditor[],FileEditorProvider[]> openFileImpl2(EditorWindow window, VirtualFile file, boolean focusEditor)
public ActionCallback notifyPublisher(java.lang.Runnable runnable)
notifyPublisher in class FileEditorManagerExpublic void setSelectedEditor(VirtualFile file, java.lang.String fileEditorProviderId)
FileEditorManagersetSelectedEditor in class FileEditorManagerfile - 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 java.util.List<FileEditor> openEditor(OpenFileDescriptor descriptor, boolean focusEditor)
FileEditorManageropenEditor in class FileEditorManagerpublic Project getProject()
FileEditorManagergetProject in class FileEditorManagerpublic Editor openTextEditor(OpenFileDescriptor descriptor, boolean focusEditor)
FileEditorManagerFileEditorManager.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.openTextEditor in class FileEditorManagernull in case if text editor wasn't opened.public Editor getSelectedTextEditor()
getSelectedTextEditor in class FileEditorManagernull in case
there is no selected editor at all or selected editor is not a text one.
Must be called from EDT.public Editor getSelectedTextEditor(boolean lockfree)
public boolean isFileOpen(VirtualFile file)
isFileOpen in class FileEditorManagertrue if file is opened, false otherwisepublic VirtualFile [] getOpenFiles()
getOpenFiles in class FileEditorManagerpublic boolean hasOpenFiles()
hasOpenFiles in class FileEditorManagerpublic VirtualFile [] getSelectedFiles()
getSelectedFiles in class FileEditorManagerpublic FileEditor [] getSelectedEditors()
getSelectedEditors in class FileEditorManagerpublic EditorsSplitters getSplitters()
getSplitters in class FileEditorManagerExpublic FileEditor getSelectedEditor()
getSelectedEditor in class FileEditorManagernull if there is no selected editor at all.public FileEditor getSelectedEditor(VirtualFile file)
getSelectedEditor in class FileEditorManagernull if file is not opened.public FileEditorWithProvider getSelectedEditorWithProvider(VirtualFile file)
getSelectedEditorWithProvider in class FileEditorManagerExpublic Pair<FileEditor[],FileEditorProvider[]> getEditorsWithProviders(VirtualFile file)
getEditorsWithProviders in class FileEditorManagerExpublic FileEditor [] getEditors(VirtualFile file)
getEditors in class FileEditorManagerfilepublic FileEditor [] getAllEditors(VirtualFile file)
getAllEditors in class FileEditorManagerfilepublic FileEditor [] getAllEditors()
getAllEditors in class FileEditorManagerpublic java.util.List<javax.swing.JComponent> getTopComponents(FileEditor editor)
public void addTopComponent(FileEditor editor, javax.swing.JComponent component)
FileEditorManagertrue:
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.
addTopComponent in class FileEditorManagerpublic void removeTopComponent(FileEditor editor, javax.swing.JComponent component)
removeTopComponent in class FileEditorManagerpublic void addBottomComponent(FileEditor editor, javax.swing.JComponent component)
FileEditorManagertrue:
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.
addBottomComponent in class FileEditorManagerpublic void removeBottomComponent(FileEditor editor, javax.swing.JComponent component)
removeBottomComponent in class FileEditorManagerpublic void addFileEditorManagerListener(FileEditorManagerListener listener)
FileEditorManagerlisteneraddFileEditorManagerListener in class FileEditorManagerlistener - listener to be addedpublic void addFileEditorManagerListener(FileEditorManagerListener listener, Disposable parentDisposable)
addFileEditorManagerListener in class FileEditorManagerpublic void removeFileEditorManagerListener(FileEditorManagerListener listener)
FileEditorManagerlistenerremoveFileEditorManagerListener in class FileEditorManagerlistener - listener to be removedprotected void projectOpened(MessageBusConnection connection)
public Element getState()
getState in interface PersistentStateComponent<Element>null value indicates
that the returned state won't be stored, as a result previously stored state will be used.XmlSerializerpublic void loadState(Element state)
PersistentStateComponentState object should be used directly, defensive copying is not required.
loadState in interface PersistentStateComponent<Element>state - loaded component stateXmlSerializerUtil.copyBean(Object, Object)public void fireSelectionChanged(EditorComposite newSelectedComposite)
public boolean isChanged(EditorComposite editor)
isChanged in class FileEditorManagerExpublic boolean isInsideChange()
isInsideChange in class FileEditorManagerExpublic void closeAllFiles()
FileEditorManagerExcloseAllFiles in class FileEditorManagerExDockManager.getContainers(),
DockContainer.closeAll()public VirtualFile [] getSiblings(VirtualFile file)
getSiblings in class FileEditorManagerExfile itself) that belong
to the same tabbed container. The method returns empty array if file
is not open. The returned files have the same order as they have in the
tabbed container.public EditorsSplitters getSplittersFor(java.awt.Component c)
getSplittersFor in class FileEditorManagerExpublic java.util.List<Pair<VirtualFile,EditorWindow>> getSelectionHistory()
public void addSelectionRecord(VirtualFile file, EditorWindow window)
public ActionCallback getReady(java.lang.Object requestor)