get rid of extra Disposable instance (IDEA-CR-15107)
[idea/community.git] / platform / platform-impl / src / com / intellij / openapi / editor / ex / util / EditorUtil.java
index c19576888362cbd02fdaa164b657c2eda304c97d..f6380f9dedb785dc029c301d063ba501b8a59b01 100644 (file)
@@ -932,12 +932,7 @@ public final class EditorUtil {
     DocumentEx document = ObjectUtils.tryCast(editor.getDocument(), DocumentEx.class);
     if (document != null && document.isInBulkUpdate()) {
       MessageBusConnection connection = ApplicationManager.getApplication().getMessageBus().connect();
-      disposeWithEditor(editor, new Disposable() {
-        @Override
-        public void dispose() {
-          connection.disconnect();
-        }
-      });
+      disposeWithEditor(editor, connection);
       connection.subscribe(DocumentBulkUpdateListener.TOPIC, new DocumentBulkUpdateListener.Adapter() {
         @Override
         public void updateFinished(@NotNull Document doc) {