void (PreviewEditorState editorState) { final VirtualFile file = editorState.getFile(); final LogicalPosition positionToNavigate = editorState.getNavigate(); final TextAttributes lineAttributes = editorState.getAttributes(); Document document = FileDocumentManager.getInstance().getDocument(file); clearEditor(); myEditorState = editorState; remove(myLabel); if (document != null) { if (getEditor() == null || getEditor().getDocument() != document) { setEditor(createEditor(myProject, document, file)); add(getEditor().getComponent(), BorderLayout.CENTER); } if (positionToNavigate != null) { getEditor().getCaretModel().moveToLogicalPosition(positionToNavigate); validate(); getEditor().getScrollingModel().scrollToCaret(ScrollType.CENTER); } else { revalidate(); repaint(); } clearHighlighting(); if (lineAttributes != null && positionToNavigate != null && positionToNavigate.line < getEditor().getDocument().getLineCount()) { myHighlighter = getEditor().getMarkupModel().addLineHighlighter(positionToNavigate.line, HighlighterLayer.SELECTION - 1, lineAttributes); } } else { myLabel.setText(LangBundle.message(file.isDirectory() ? "detail.view.navigate.to.directory" :"detail.view.navigate.to.file")); add(myLabel, BorderLayout.CENTER); validate(); } }