Editor (String text) { EditorFactory editorFactory = EditorFactory.getInstance(); myDocument = editorFactory.createDocument(text); final Editor editor = editorFactory.createEditor(myDocument, getProject()); myHighlighter = HighlighterFactory .createHighlighter(JavaFileType.INSTANCE, EditorColorsManager.getInstance().getGlobalScheme(), getProject()); ((EditorEx)editor).setHighlighter(myHighlighter); myEditorsToRelease.add(editor); return editor; }