void () { EditorFactory editorFactory = EditorFactory.getInstance(); Editor editor = editorFactory.createViewer(myDocument, myProject); try { ((EditorEx)editor).setHighlighter( new LexerEditorHighlighter(new XmlFileHighlighter(), EditorColorsManager.getInstance().getGlobalScheme())); JComponent component = editor.getComponent(); component.setPreferredSize(new Dimension(640, 480)); DialogBuilder dialog = new DialogBuilder(myProject); dialog.title(UIDesignerBundle.message("GuiDesigner.FormSource.title", myFile.getPresentableName())) .dimensionKey("GuiDesigner.FormSource.Dialog"); dialog.centerPanel(component).setPreferredFocusComponent(editor.getContentComponent()); dialog.addOkAction(); dialog.show(); } finally { editorFactory.releaseEditor(editor); } }