public void hideCoverageData() { if (myEditor == null) return; final FileEditorManager fileEditorManager = FileEditorManager.getInstance(myProject); final List<RangeHighlighter> highlighters = myEditor.getUserData(COVERAGE_HIGHLIGHTERS); if (highlighters != null) { for (final RangeHighlighter highlighter : highlighters) { ApplicationManager.getApplication().invokeLater(() -> highlighter.dispose()); } myEditor.putUserData(COVERAGE_HIGHLIGHTERS, null); } final Map<FileEditor, EditorNotificationPanel> map = myFile.getCopyableUserData(NOTIFICATION_PANELS); if (map != null) { final VirtualFile vFile = myFile.getVirtualFile(); LOG.assertTrue(vFile != null); boolean freeAll = !fileEditorManager.isFileOpen(vFile); myFile.putCopyableUserData(NOTIFICATION_PANELS, null); for (FileEditor fileEditor : map.keySet()) { if (!freeAll && !isCurrentEditor(fileEditor)) { continue; } fileEditorManager.removeTopComponent(fileEditor, map.get(fileEditor)); } } final DocumentListener documentListener = myEditor.getUserData(COVERAGE_DOCUMENT_LISTENER); if (documentListener != null) { myDocument.removeDocumentListener(documentListener); myEditor.putUserData(COVERAGE_DOCUMENT_LISTENER, null); } }
@Override protected void onDispose() { if (myFileListener != null) VirtualFileManager.getInstance().removeVirtualFileListener(myFileListener); for (Document document : getDocuments()) { document.removeDocumentListener(myDocumentListener); } super.onDispose(); }
/** * Disposes all resources allocated be the TextEditorComponent. It disposes all created editors, * unregisters listeners. The behaviour of the splitter after disposing is unpredictable. */ void dispose() { myDocument.removeDocumentListener(myDocumentListener); EditorHistoryManager.getInstance(myProject).updateHistoryEntry(myFile, false); disposeEditor(myEditor); myConnection.disconnect(); myFile.getFileSystem().removeVirtualFileListener(myVirtualFileListener); // myFocusWatcher.deinstall(this); // removePropertyChangeListener(mySplitterPropertyChangeListener); // super.dispose(); }
public void release() { synchronized (myLock) { myReleased = true; if (myDocumentListener != null) { myDocument.removeDocumentListener(myDocumentListener); } if (myApplication.isDispatchThread()) { removeAnathema(); removeHighlightersFromMarkupModel(); } else { invalidateRanges(); myApplication.invokeLater( new Runnable() { @Override public void run() { removeAnathema(); removeHighlightersFromMarkupModel(); } }); } } }