void (int injectedOffset) { if (myAction.isShowInBalloon()) { JComponent component = myAction.createBalloonComponent(myNewFile); if (component != null) showBalloon(myEditor, myNewFile, component); } else { FileEditorManagerEx fileEditorManager = FileEditorManagerEx.getInstanceEx(myProject); FileEditor[] editors = fileEditorManager.getEditors(myNewVirtualFile); if (editors.length == 0) { EditorWindow currentWindow = fileEditorManager.getCurrentWindow(); mySplittedWindow = Objects.requireNonNull(currentWindow).split(JSplitPane.VERTICAL_SPLIT, false, myNewVirtualFile, true); } Editor editor = fileEditorManager.openTextEditor(new OpenFileDescriptor(myProject, myNewVirtualFile, injectedOffset), true); // fold missing values if (editor instanceof EditorEx) { editor.putUserData(QuickEditAction.QUICK_EDIT_HANDLER, this); FoldingModelEx foldingModel = ((EditorEx)editor).getFoldingModel(); foldingModel.runBatchFoldingOperation(() -> { CharSequence sequence = myNewDocument.getImmutableCharSequence(); for (RangeMarker o : ContainerUtil.reverse(((DocumentEx)myNewDocument).getGuardedBlocks())) { String replacement = o.getUserData(REPLACEMENT_KEY); if (StringUtil.isEmpty(replacement)) continue; int start = o.getStartOffset(); int end = o.getEndOffset(); start += StringUtil.countChars(sequence, '\n', start, end, true); end -= StringUtil.countChars(sequence, '\n', end, start, true); if (start <= end) { FoldRegion region = foldingModel.getFoldRegion(start, end); if (region == null) { region = foldingModel.createFoldRegion(start, end, replacement, null, true); } if (region != null) region.setExpanded(false); } } }); } } ApplicationManager.getApplication().invokeLater( () -> myEditor.getScrollingModel().scrollToCaret(ScrollType.CENTER), ModalityState.any()); }