use of com.intellij.openapi.editor.EditorFactory in project intellij-community by JetBrains.
the class IpnbEditorUtil method createPythonCodeEditor.
public static Editor createPythonCodeEditor(@NotNull final Project project, @NotNull final IpnbCodeSourcePanel codeSourcePanel) {
final EditorFactory editorFactory = EditorFactory.getInstance();
assert editorFactory != null;
final String text = codeSourcePanel.getCell().getSourceAsString().trim();
final Module module = ProjectRootManagerEx.getInstanceEx(project).getFileIndex().getModuleForFile(codeSourcePanel.getIpnbCodePanel().getFileEditor().getVirtualFile());
final IpnbPyFragment fragment = new IpnbPyFragment(project, text, true, codeSourcePanel);
fragment.putUserData(ModuleUtilCore.KEY_MODULE, module);
final Document document = PsiDocumentManager.getInstance(project).getDocument(fragment);
assert document != null;
EditorEx editor = (EditorEx) editorFactory.createEditor(document, project, fragment.getVirtualFile(), false);
setupEditor(editor);
return editor;
}
Aggregations