Skip to content
This repository has been archived by the owner on May 20, 2021. It is now read-only.

Commit

Permalink
fixed #120 (EditorImpl#dispose method was 'deprecated')
Browse files Browse the repository at this point in the history
  • Loading branch information
ShyykoSerhiy committed Apr 13, 2017
1 parent 1325e7e commit 983949b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,9 @@ private void createUIComponents() {
@Override
public void dispose() {
if (this.additionalCssTextArea instanceof EditorImpl) {
EditorImpl editor = (EditorImpl) additionalCssTextArea;
if (!editor.isDisposed()) {//!isReleased
if (!additionalCssTextArea.isDisposed()) {//!isReleased
//for some reason Editor is not Disposable. release in this case is dispose.
editor.release();
Utils.releaseEditor(additionalCssTextArea);
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/com/github/shyykoserhiy/gfm/ui/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ public static Editor createEditor(String fileExtension) {
return editor;
}

public static void releaseEditor(Editor editor) {
EditorFactory editorFactory = EditorFactory.getInstance();
editorFactory.releaseEditor(editor);
}

private static void setHighlighting(EditorEx editor, String fileExtension) {
FileType cssFileType = FileTypeManager.getInstance().getFileTypeByExtension(fileExtension);
if (cssFileType != UnknownFileType.INSTANCE) {
Expand Down

0 comments on commit 983949b

Please sign in to comment.