use of com.intellij.openapi.fileEditor.impl.EditorsSplitters in project intellij-community by JetBrains.
the class ProjectImpl method distributeProgress.
private void distributeProgress() {
ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
if (indicator == null)
return;
ModuleManager moduleManager = ModuleManager.getInstance(this);
if (!(moduleManager instanceof ModuleManagerImpl)) {
return;
}
double toDistribute = 1 - indicator.getFraction();
int modulesCount = ((ModuleManagerImpl) moduleManager).getModulePathsCount();
EditorsSplitters splitters = ((FileEditorManagerImpl) FileEditorManager.getInstance(this)).getMainSplitters();
int editors = splitters.getEditorsCount();
double modulesPart = ourClassesAreLoaded || editors == 0 ? toDistribute : toDistribute * 0.5;
if (modulesCount != 0) {
double step = modulesPart / modulesCount;
((ModuleManagerImpl) moduleManager).setProgressStep(step);
}
if (editors != 0) {
splitters.setProgressStep(toDistribute - modulesPart / editors);
}
}
use of com.intellij.openapi.fileEditor.impl.EditorsSplitters 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.EditorsSplitters in project intellij-community by JetBrains.
the class ToggleReadOnlyAttributePanel method getCurrentFile.
@Nullable
private VirtualFile getCurrentFile() {
final Project project = getProject();
if (project == null)
return null;
EditorsSplitters splitters = FileEditorManagerEx.getInstanceEx(project).getSplittersFor(myStatusBar.getComponent());
return splitters.getCurrentFile();
}
use of com.intellij.openapi.fileEditor.impl.EditorsSplitters in project intellij-community by JetBrains.
the class ToolWindowManagerImpl method getSplittersToFocus.
private EditorsSplitters getSplittersToFocus() {
Window activeWindow = myWindowManager.getMostRecentFocusedWindow();
if (activeWindow instanceof FloatingDecorator) {
IdeFocusManager ideFocusManager = IdeFocusManager.findInstanceByComponent(activeWindow);
IdeFrame lastFocusedFrame = ideFocusManager.getLastFocusedFrame();
JComponent frameComponent = lastFocusedFrame != null ? lastFocusedFrame.getComponent() : null;
Window lastFocusedWindow = frameComponent != null ? SwingUtilities.getWindowAncestor(frameComponent) : null;
activeWindow = ObjectUtils.notNull(lastFocusedWindow, activeWindow);
}
FileEditorManagerEx fem = FileEditorManagerEx.getInstanceEx(myProject);
EditorsSplitters splitters = activeWindow != null ? fem.getSplittersFor(activeWindow) : null;
return splitters != null ? splitters : fem.getSplitters();
}
use of com.intellij.openapi.fileEditor.impl.EditorsSplitters in project android by JetBrains.
the class HprofEditorFixture method findByFileName.
@NotNull
public static HprofEditorFixture findByFileName(@NotNull Robot robot, @NotNull final IdeFrameFixture frame, @NotNull final String hprofFileName) {
HprofEditor hprofEditor = GuiQuery.getNonNull(() -> {
FileEditor[] openEditors = null;
FileEditorManagerImpl fileEditorManager = (FileEditorManagerImpl) FileEditorManager.getInstance(frame.getProject());
for (EditorsSplitters splitters : fileEditorManager.getAllSplitters()) {
for (EditorWindow window : splitters.getWindows()) {
for (EditorWithProviderComposite editorWithProviderComposite : window.getEditors()) {
if (editorWithProviderComposite.getFile().getName().endsWith(hprofFileName)) {
if (openEditors != null) {
throw new ComponentLookupException(String.format("More than one Hprof editor for file '%s' found", hprofFileName));
}
openEditors = editorWithProviderComposite.getEditors();
}
}
}
}
if (openEditors == null) {
throw new ComponentLookupException(String.format("Cannot find any open Hprof editors for file '%s'", hprofFileName));
}
HprofEditor targetEditor = null;
for (FileEditor editor : openEditors) {
if (editor instanceof HprofEditor) {
if (targetEditor != null) {
throw new ComponentLookupException(String.format("More than one Hprof editor pane for file '%s' found", hprofFileName));
} else {
targetEditor = (HprofEditor) editor;
}
}
}
return targetEditor;
});
return new HprofEditorFixture(robot, frame, hprofEditor);
}
Aggregations