use of com.intellij.ui.docking.DockContainer in project intellij-community by JetBrains.
the class FileEditorManagerImpl method getAllSplitters.
@NotNull
public Set<EditorsSplitters> getAllSplitters() {
Set<EditorsSplitters> all = new LinkedHashSet<>();
all.add(getMainSplitters());
Set<DockContainer> dockContainers = myDockManager.getContainers();
for (DockContainer each : dockContainers) {
if (each instanceof DockableEditorTabbedContainer) {
all.add(((DockableEditorTabbedContainer) each).getSplitters());
}
}
return Collections.unmodifiableSet(all);
}
use of com.intellij.ui.docking.DockContainer in project intellij-community by JetBrains.
the class FileEditorManagerImpl method getActiveSplittersAsync.
@NotNull
private AsyncResult<EditorsSplitters> getActiveSplittersAsync() {
final AsyncResult<EditorsSplitters> result = new AsyncResult<>();
final IdeFocusManager fm = IdeFocusManager.getInstance(myProject);
fm.doWhenFocusSettlesDown(() -> {
if (myProject.isDisposed()) {
result.setRejected();
return;
}
Component focusOwner = fm.getFocusOwner();
DockContainer container = myDockManager.getContainerFor(focusOwner);
if (container instanceof DockableEditorTabbedContainer) {
result.setDone(((DockableEditorTabbedContainer) container).getSplitters());
} else {
result.setDone(getMainSplitters());
}
});
return result;
}
use of com.intellij.ui.docking.DockContainer 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.ui.docking.DockContainer in project intellij-community by JetBrains.
the class FileEditorManagerTestCase method tearDown.
@Override
protected void tearDown() throws Exception {
try {
for (DockContainer container : DockManager.getInstance(getProject()).getContainers()) {
if (!myOldDockContainers.contains(container)) {
Disposer.dispose(container);
}
}
myOldDockContainers = null;
((ComponentManagerImpl) getProject()).registerComponentInstance(FileEditorManager.class, myOldManager);
myManager.closeAllFiles();
((FileEditorProviderManagerImpl) FileEditorProviderManager.getInstance()).clearSelectedProviders();
} finally {
myManager = null;
myOldManager = null;
super.tearDown();
}
}
use of com.intellij.ui.docking.DockContainer in project intellij-community by JetBrains.
the class FileEditorManagerImpl method getActiveSplittersSync.
private EditorsSplitters getActiveSplittersSync() {
assertDispatchThread();
final IdeFocusManager fm = IdeFocusManager.getInstance(myProject);
Component focusOwner = fm.getFocusOwner();
if (focusOwner == null) {
focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
}
if (focusOwner == null) {
focusOwner = fm.getLastFocusedFor(fm.getLastFocusedFrame());
}
DockContainer container = myDockManager.getContainerFor(focusOwner);
if (container == null) {
focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
container = myDockManager.getContainerFor(focusOwner);
}
if (container instanceof DockableEditorTabbedContainer) {
return ((DockableEditorTabbedContainer) container).getSplitters();
}
return getMainSplitters();
}
Aggregations