void () { Object source = getSource(); String fileName = "Dummy." + (source instanceof FileType ? ((FileType)source).getDefaultExtension() : "txt"); LightVirtualFile lightFile; if (source instanceof PsiViewerExtension) { lightFile = new LightVirtualFile(fileName, ((PsiViewerExtension)source).getDefaultFileType(), ""); } else if (source instanceof LanguageFileType) { lightFile = new LightVirtualFile(fileName, ObjectUtils .chooseNotNull((Language)myDialectComboBox.getSelectedItem(), ((LanguageFileType)source).getLanguage()), ""); } else if (source instanceof FileType) { lightFile = new LightVirtualFile(fileName, (FileType)source, ""); } else { return; } EditorHighlighter highlighter = EditorHighlighterFactory.getInstance().createEditorHighlighter(myProject, lightFile); try { myEditor.setHighlighter(highlighter); } catch (Throwable e) { LOG.warn(e); } }