use of com.intellij.openapi.fileEditor.ex.FileEditorManagerEx in project intellij-community by JetBrains.
the class FormOpeningTest method getEditorComponent.
private JComponent getEditorComponent() {
FileEditorManagerEx editorManager = FileEditorManagerEx.getInstanceEx(getProject());
EditorWindow window = editorManager.getSplitters().getCurrentWindow();
return (JComponent) ((JComponent) window.getSelectedEditor().getComponent().getComponents()[0]).getComponents()[0];
}
use of com.intellij.openapi.fileEditor.ex.FileEditorManagerEx in project ideavim by JetBrains.
the class WindowGroup method closeCurrentWindow.
public void closeCurrentWindow(@NotNull DataContext context) {
final FileEditorManagerEx fileEditorManager = getFileEditorManager(context);
final EditorWindow window = fileEditorManager.getSplitters().getCurrentWindow();
if (window != null) {
window.closeAllExcept(null);
}
}
use of com.intellij.openapi.fileEditor.ex.FileEditorManagerEx in project ideavim by JetBrains.
the class WindowGroup method closeAllExceptCurrent.
public void closeAllExceptCurrent(@NotNull DataContext context) {
final FileEditorManagerEx fileEditorManager = getFileEditorManager(context);
final EditorWindow current = fileEditorManager.getCurrentWindow();
for (final EditorWindow window : fileEditorManager.getWindows()) {
if (window != current) {
window.closeAllExcept(null);
}
}
}
use of com.intellij.openapi.fileEditor.ex.FileEditorManagerEx in project ideavim by JetBrains.
the class WindowGroup method selectNextWindow.
public void selectNextWindow(@NotNull DataContext context) {
final FileEditorManagerEx fileEditorManager = getFileEditorManager(context);
final EditorWindow current = fileEditorManager.getCurrentWindow();
if (current != null) {
fileEditorManager.getNextWindow(current).setAsCurrentWindow(true);
}
}
use of com.intellij.openapi.fileEditor.ex.FileEditorManagerEx in project ideavim by JetBrains.
the class FileGroup method closeFile.
/**
* Close the current editor
*
* @param context The data context
*/
public void closeFile(@NotNull Editor editor, @NotNull DataContext context) {
final Project project = PlatformDataKeys.PROJECT.getData(context);
if (project != null) {
final FileEditorManagerEx fileEditorManager = FileEditorManagerEx.getInstanceEx(project);
final EditorWindow window = fileEditorManager.getCurrentWindow();
final EditorTabbedContainer tabbedPane = window.getTabbedPane();
if (tabbedPane != null) {
if (tabbedPane.getTabCount() > 1) {
final int index = tabbedPane.getSelectedIndex();
tabbedPane.removeTabAt(index, index + 1);
} else {
tabbedPane.close();
}
} else {
VirtualFile virtualFile = EditorData.getVirtualFile(editor);
if (virtualFile != null) {
fileEditorManager.closeFile(virtualFile);
}
}
}
}
Aggregations