void (Disposable parentDisposable) { EditorCodePreview previousPreview = myEditorPreview; if (previousPreview != null) Disposer.dispose(previousPreview); EditorCodePreview preview = EditorCodePreview.Companion.create(myEditor); Disposer.register(parentDisposable, preview); myEditorPreview = preview; PsiParameter psiParameter = getParameter(); if (psiParameter == null) return; MarkupModel markupModel = myEditor.getMarkupModel(); TextRange newParameterRange = psiParameter.getTextRange(); List<RangeHighlighter> highlighters = new ArrayList<>(); highlighters.add(markupModel.addRangeHighlighter(newParameterRange.getStartOffset(), newParameterRange.getEndOffset(), 0, getTextAttributesForAdd(myEditor), HighlighterTargetArea.EXACT_RANGE)); PsiParameterList list = myMethod.getParameterList(); for (PsiParameter parameter : list.getParameters()) { if (parameter != psiParameter && myPanel.isParamToRemove(parameter)) { TextRange range = parameter.getTextRange(); highlighters.add(markupModel.addRangeHighlighter(range.getStartOffset(), range.getEndOffset(), 0, getTestAttributesForRemoval(), HighlighterTargetArea.EXACT_RANGE)); } } Document document = myEditor.getDocument(); int previewLineStart = document.getLineNumber(myMethod.getTextOffset()); int previewLineEnd = document.getLineNumber(list.getTextRange().getEndOffset()); preview.addPreview(new IntRange(previewLineStart, previewLineEnd), IntroduceParameterHelperKt.onClickCallback(psiParameter)); Disposer.register(preview, () -> { for (RangeHighlighter highlighter : highlighters) { highlighter.dispose(); } }); PsiMethod delegate = myCreatedDelegate; if (delegate != null) { InplaceExtractUtils utils = InplaceExtractUtils.INSTANCE; Disposable highlighting = utils.createInsertedHighlighting(myEditor, delegate.getTextRange()); Disposer.register(preview, highlighting); IntRange linesForPreview = utils.getLinesFromTextRange(myEditor.getDocument(), delegate.getTextRange()); utils.addPreview(preview, myEditor, linesForPreview, delegate.getTextRange().getStartOffset()); } }