use of com.intellij.openapi.fileEditor.impl.EditorWithProviderComposite in project ideavim by JetBrains.
the class WindowGroup method getEditorWindowRectangle.
@Nullable
private static Rectangle getEditorWindowRectangle(@NotNull EditorWindow window) {
final EditorWithProviderComposite editor = window.getSelectedEditor();
if (editor != null) {
final Point point = editor.getComponent().getLocationOnScreen();
final Dimension dimension = editor.getComponent().getSize();
return new Rectangle(point, dimension);
}
return null;
}
use of com.intellij.openapi.fileEditor.impl.EditorWithProviderComposite in project intellij-community by JetBrains.
the class QuickEditHandler method closeEditor.
private void closeEditor() {
boolean unsplit = false;
if (mySplittedWindow != null && !mySplittedWindow.isDisposed()) {
final EditorWithProviderComposite[] editors = mySplittedWindow.getEditors();
if (editors.length == 1 && Comparing.equal(editors[0].getFile(), myNewVirtualFile)) {
unsplit = true;
}
}
FileEditorManager.getInstance(myProject).closeFile(myNewVirtualFile);
if (unsplit) {
for (EditorWindow editorWindow : mySplittedWindow.findSiblings()) {
editorWindow.unsplit(true);
}
}
}
use of com.intellij.openapi.fileEditor.impl.EditorWithProviderComposite in project intellij-community by JetBrains.
the class StatusBarUtil method getCurrentFileEditor.
/**
* Finds the current file editor.
*/
@Nullable
public static FileEditor getCurrentFileEditor(@NotNull Project project, @Nullable StatusBar statusBar) {
if (statusBar == null) {
return null;
}
DockContainer c = DockManager.getInstance(project).getContainerFor(statusBar.getComponent());
EditorsSplitters splitters = null;
if (c instanceof DockableEditorTabbedContainer) {
splitters = ((DockableEditorTabbedContainer) c).getSplitters();
}
if (splitters != null && splitters.getCurrentWindow() != null) {
EditorWithProviderComposite editor = splitters.getCurrentWindow().getSelectedEditor();
if (editor != null) {
return editor.getSelectedEditorWithProvider().getFirst();
}
}
return null;
}
use of com.intellij.openapi.fileEditor.impl.EditorWithProviderComposite in project intellij-community by JetBrains.
the class CloseAllUnpinnedEditorsAction method isActionEnabled.
@Override
protected boolean isActionEnabled(final Project project, final AnActionEvent event) {
final ArrayList<Pair<EditorComposite, EditorWindow>> filesToClose = getFilesToClose(event);
if (filesToClose.isEmpty())
return false;
Set<EditorWindow> checked = new HashSet<>();
boolean hasPinned = false;
boolean hasUnpinned = false;
for (Pair<EditorComposite, EditorWindow> pair : filesToClose) {
final EditorWindow window = pair.second;
if (checked.add(window)) {
for (EditorWithProviderComposite e : window.getEditors()) {
if (e.isPinned()) {
hasPinned = true;
} else {
hasUnpinned = true;
}
}
if (/*hasPinned && */
hasUnpinned) {
return true;
}
}
}
return false;
}
use of com.intellij.openapi.fileEditor.impl.EditorWithProviderComposite in project intellij-community by JetBrains.
the class FileDropHandler method findEditorWindow.
@Nullable
private EditorWindow findEditorWindow(Project project) {
final Document document = myEditor.getDocument();
final VirtualFile file = FileDocumentManager.getInstance().getFile(document);
if (file != null) {
final FileEditorManagerEx fileEditorManager = (FileEditorManagerEx) FileEditorManager.getInstance(project);
final EditorWindow[] windows = fileEditorManager.getWindows();
for (EditorWindow window : windows) {
final EditorWithProviderComposite composite = window.findFileComposite(file);
if (composite == null) {
continue;
}
for (FileEditor editor : composite.getEditors()) {
if (editor instanceof TextEditor && ((TextEditor) editor).getEditor() == myEditor) {
return window;
}
}
}
}
return null;
}
Aggregations