use of com.intellij.openapi.fileEditor.ex.FileEditorManagerEx in project intellij-community by JetBrains.
the class QuickEditHandler method navigate.
public void navigate(int injectedOffset) {
if (myAction.isShowInBalloon()) {
final JComponent component = myAction.createBalloonComponent(myNewFile);
if (component != null)
showBalloon(myEditor, myNewFile, component);
} else {
final FileEditorManagerEx fileEditorManager = FileEditorManagerEx.getInstanceEx(myProject);
final FileEditor[] editors = fileEditorManager.getEditors(myNewVirtualFile);
if (editors.length == 0) {
final EditorWindow curWindow = fileEditorManager.getCurrentWindow();
mySplittedWindow = curWindow.split(SwingConstants.HORIZONTAL, false, myNewVirtualFile, true);
}
Editor editor = fileEditorManager.openTextEditor(new OpenFileDescriptor(myProject, myNewVirtualFile, injectedOffset), true);
// fold missing values
if (editor != null) {
editor.putUserData(QuickEditAction.QUICK_EDIT_HANDLER, this);
final FoldingModel foldingModel = editor.getFoldingModel();
foldingModel.runBatchFoldingOperation(() -> {
for (RangeMarker o : ContainerUtil.reverse(((DocumentEx) myNewDocument).getGuardedBlocks())) {
String replacement = o.getUserData(REPLACEMENT_KEY);
if (StringUtil.isEmpty(replacement))
continue;
FoldRegion region = foldingModel.addFoldRegion(o.getStartOffset(), o.getEndOffset(), replacement);
if (region != null)
region.setExpanded(false);
}
});
}
SwingUtilities.invokeLater(() -> myEditor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE));
}
}
use of com.intellij.openapi.fileEditor.ex.FileEditorManagerEx in project intellij-community by JetBrains.
the class PrevSplitAction method update.
public void update(final AnActionEvent event) {
final Project project = event.getProject();
final Presentation presentation = event.getPresentation();
if (project == null) {
presentation.setEnabled(false);
return;
}
final FileEditorManagerEx manager = FileEditorManagerEx.getInstanceEx(project);
final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
presentation.setEnabled(toolWindowManager.isEditorComponentActive() && manager.isInSplitter() && manager.getCurrentWindow() != null);
}
use of com.intellij.openapi.fileEditor.ex.FileEditorManagerEx in project intellij-community by JetBrains.
the class PrevSplitAction method actionPerformed.
public void actionPerformed(AnActionEvent e) {
final Project project = e.getProject();
final CommandProcessor commandProcessor = CommandProcessor.getInstance();
commandProcessor.executeCommand(project, () -> {
final FileEditorManagerEx manager = FileEditorManagerEx.getInstanceEx(project);
manager.setCurrentWindow(manager.getPrevWindow(manager.getCurrentWindow()));
}, IdeBundle.message("command.go.to.prev.split"), null);
}
use of com.intellij.openapi.fileEditor.ex.FileEditorManagerEx in project intellij-community by JetBrains.
the class UnsplitAction method actionPerformed.
public void actionPerformed(final AnActionEvent event) {
final Project project = event.getProject();
final FileEditorManagerEx fileEditorManager = FileEditorManagerEx.getInstanceEx(project);
//VirtualFile file = fileEditorManager.getSelectedFiles()[0];
fileEditorManager.unsplitWindow();
}
use of com.intellij.openapi.fileEditor.ex.FileEditorManagerEx in project intellij-community by JetBrains.
the class UnsplitAllAction method actionPerformed.
public void actionPerformed(final AnActionEvent event) {
final Project project = event.getData(CommonDataKeys.PROJECT);
final FileEditorManagerEx fileEditorManager = FileEditorManagerEx.getInstanceEx(project);
//VirtualFile file = fileEditorManager.getSelectedFiles()[0];
fileEditorManager.unsplitAllWindow();
}
Aggregations