use of com.intellij.openapi.fileEditor.ex.FileEditorManagerEx in project intellij-community by JetBrains.
the class CloseAllEditorsButActiveAction method update.
public void update(AnActionEvent event) {
Presentation presentation = event.getPresentation();
Project project = event.getData(CommonDataKeys.PROJECT);
if (project == null) {
presentation.setEnabled(false);
return;
}
FileEditorManagerEx fileEditorManager = FileEditorManagerEx.getInstanceEx(project);
VirtualFile selectedFile;
final EditorWindow window = event.getData(EditorWindow.DATA_KEY);
if (window != null) {
presentation.setEnabled(window.getFiles().length > 1);
return;
} else {
if (fileEditorManager.getSelectedFiles().length == 0) {
presentation.setEnabled(false);
return;
}
selectedFile = fileEditorManager.getSelectedFiles()[0];
}
VirtualFile[] siblings = fileEditorManager.getSiblings(selectedFile);
presentation.setEnabled(siblings.length > 1);
}
use of com.intellij.openapi.fileEditor.ex.FileEditorManagerEx in project intellij-community by JetBrains.
the class CloseEditorAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
final Project project = e.getData(CommonDataKeys.PROJECT);
FileEditorManagerEx editorManager = getEditorManager(project);
EditorWindow window = e.getData(EditorWindow.DATA_KEY);
VirtualFile file = null;
if (window == null) {
window = editorManager.getCurrentWindow();
if (window != null) {
file = window.getSelectedFile();
}
} else {
file = e.getData(CommonDataKeys.VIRTUAL_FILE);
}
if (file != null) {
editorManager.closeFile(file, window);
}
}
use of com.intellij.openapi.fileEditor.ex.FileEditorManagerEx in project intellij-community by JetBrains.
the class InfoAndProgressPanel method getAnchor.
@NotNull
private static Component getAnchor(@NotNull JRootPane pane) {
Component tabWrapper = UIUtil.findComponentOfType(pane, TabbedPaneWrapper.TabWrapper.class);
if (tabWrapper != null)
return tabWrapper;
Component splitters = UIUtil.findComponentOfType(pane, EditorsSplitters.class);
if (splitters != null)
return splitters;
FileEditorManagerEx ex = FileEditorManagerEx.getInstanceEx(ProjectUtil.guessCurrentProject(pane));
return ex == null ? pane : ex.getSplitters();
}
use of com.intellij.openapi.fileEditor.ex.FileEditorManagerEx in project ideavim by JetBrains.
the class WindowGroup method selectWindowInRow.
public void selectWindowInRow(@NotNull DataContext context, int relativePosition, boolean vertical) {
final FileEditorManagerEx fileEditorManager = getFileEditorManager(context);
final EditorWindow currentWindow = fileEditorManager.getCurrentWindow();
if (currentWindow != null) {
final EditorWindow[] windows = fileEditorManager.getWindows();
final List<EditorWindow> row = findWindowsInRow(currentWindow, Arrays.asList(windows), vertical);
selectWindow(currentWindow, row, relativePosition);
}
}
use of com.intellij.openapi.fileEditor.ex.FileEditorManagerEx in project ideavim by JetBrains.
the class WindowGroup method splitWindow.
private void splitWindow(int orientation, @NotNull DataContext context, @NotNull String filename) {
final Project project = PlatformDataKeys.PROJECT.getData(context);
final FileEditorManagerEx fileEditorManager = FileEditorManagerEx.getInstanceEx(project);
VirtualFile virtualFile = null;
if (filename.length() > 0 && project != null) {
virtualFile = VimPlugin.getFile().findFile(filename, project);
if (virtualFile == null) {
VimPlugin.showMessage("Could not find file: " + filename);
return;
}
}
final EditorWindow editorWindow = fileEditorManager.getSplitters().getCurrentWindow();
if (editorWindow != null) {
editorWindow.split(orientation, true, virtualFile, true);
}
}
Aggregations