@NotNull
public FileEditor createEditor(@NotNull Project project, @NotNull VirtualFile file) {
DatabaseEditableObjectFile databaseFile;
if (file instanceof SourceCodeFile) {
SourceCodeFile sourceCodeFile = (SourceCodeFile) file;
databaseFile = sourceCodeFile.getDatabaseFile();
} else {
databaseFile = (DatabaseEditableObjectFile) file;
}
SourceCodeFile sourceCodeFile = getSourceCodeFile(databaseFile);
boolean isMainEditor = sourceCodeFile.getContentType() == databaseFile.getMainContentType();
/*
BasicTextEditor openEditor = lookupExistingEditor(project, databaseFile);
if (openEditor != null) return openEditor;
*/
String editorName = getName();
BasicTextEditor textEditor = isMainEditor ?
new SourceCodeMainEditor(project, sourceCodeFile, editorName) :
new SourceCodeEditor(project, sourceCodeFile, editorName);
updateEditorActions(textEditor);
Document document = textEditor.getEditor().getDocument();
int documentTracking = document.hashCode();
if (document.hashCode() != sourceCodeFile.getDocumentHashCode()) {
document.addDocumentListener(sourceCodeFile);
sourceCodeFile.setDocumentHashCode(documentTracking);
}
Icon icon = getIcon();
if (icon != null) {
updateTabIcon(databaseFile, textEditor, icon);