use of com.intellij.openapi.fileEditor.impl.EditorWindow in project ideavim by JetBrains.
the class WindowGroup method selectPreviousWindow.
public void selectPreviousWindow(@NotNull DataContext context) {
final FileEditorManagerEx fileEditorManager = getFileEditorManager(context);
final EditorWindow current = fileEditorManager.getCurrentWindow();
if (current != null) {
fileEditorManager.getPrevWindow(current).setAsCurrentWindow(true);
}
}
use of com.intellij.openapi.fileEditor.impl.EditorWindow 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);
}
use of com.intellij.openapi.fileEditor.impl.EditorWindow 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.EditorWindow in project intellij-community by JetBrains.
the class CloseEditorAction method update.
@Override
public void update(final AnActionEvent event) {
final Presentation presentation = event.getPresentation();
final Project project = event.getData(CommonDataKeys.PROJECT);
if (project == null) {
presentation.setEnabled(false);
return;
}
if (ActionPlaces.EDITOR_POPUP.equals(event.getPlace()) || ActionPlaces.EDITOR_TAB_POPUP.equals(event.getPlace())) {
presentation.setText(IdeBundle.message("action.close"));
}
EditorWindow window = event.getData(EditorWindow.DATA_KEY);
if (window == null) {
window = getEditorManager(project).getCurrentWindow();
}
presentation.setEnabled(window != null && window.getTabCount() > 0);
}
use of com.intellij.openapi.fileEditor.impl.EditorWindow in project intellij-community by JetBrains.
the class CloseEditorsActionBase method actionPerformed.
public void actionPerformed(final AnActionEvent e) {
final Project project = e.getData(CommonDataKeys.PROJECT);
final CommandProcessor commandProcessor = CommandProcessor.getInstance();
commandProcessor.executeCommand(project, () -> {
final ArrayList<Pair<EditorComposite, EditorWindow>> filesToClose = getFilesToClose(e);
for (int i = 0; i != filesToClose.size(); ++i) {
final Pair<EditorComposite, EditorWindow> we = filesToClose.get(i);
we.getSecond().closeFile(we.getFirst().getFile());
}
}, IdeBundle.message("command.close.all.unmodified.editors"), null);
}
Aggregations