use async commit in DocumentationManager
authorpeter <peter@jetbrains.com>
Mon, 2 May 2016 18:39:54 +0000 (20:39 +0200)
committerpeter <peter@jetbrains.com>
Mon, 2 May 2016 18:54:04 +0000 (20:54 +0200)
platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationManager.java

index 76ecbb90f08360a81515adc9c685196c4dbee016..6816e27b662bcafbf9e4c35d6b3845e70678d289 100644 (file)
@@ -757,37 +757,31 @@ public class DocumentationManager extends DockablePopupManager<DocumentationComp
           return;
         }
         final String documentationText = text;
-        //noinspection SSBasedInspection
-        SwingUtilities.invokeLater(new Runnable() {
-          @Override
-          public void run() {
-            PsiDocumentManager.getInstance(myProject).commitAllDocuments();
-
-            if (!element.isValid()) {
-              LOG.debug("Element for which documentation was requested is not valid");
-              callback.setDone();
-              return;
-            }
+        PsiDocumentManager.getInstance(myProject).performLaterWhenAllCommitted(() -> {
+          if (!element.isValid()) {
+            LOG.debug("Element for which documentation was requested is not valid");
+            callback.setDone();
+            return;
+          }
 
-            if (documentationText == null) {
-              component.setText(CodeInsightBundle.message("no.documentation.found"), element, true, clearHistory);
-            }
-            else if (documentationText.isEmpty()) {
-              component.setText(component.getText(), element, true, clearHistory);
-            }
-            else {
-              component.setData(element, documentationText, clearHistory, provider.getEffectiveExternalUrl(), provider.getRef());
-            }
+          if (documentationText == null) {
+            component.setText(CodeInsightBundle.message("no.documentation.found"), element, true, clearHistory);
+          }
+          else if (documentationText.isEmpty()) {
+            component.setText(component.getText(), element, true, clearHistory);
+          }
+          else {
+            component.setData(element, documentationText, clearHistory, provider.getEffectiveExternalUrl(), provider.getRef());
+          }
 
-            final AbstractPopup jbPopup = (AbstractPopup)getDocInfoHint();
-            if(jbPopup==null){
-              callback.setDone();
-              return;
-            }
-            jbPopup.setDimensionServiceKey(JAVADOC_LOCATION_AND_SIZE);
-            jbPopup.setCaption(getTitle(element, false));
+          final AbstractPopup jbPopup = (AbstractPopup)getDocInfoHint();
+          if(jbPopup==null){
             callback.setDone();
+            return;
           }
+          jbPopup.setDimensionServiceKey(JAVADOC_LOCATION_AND_SIZE);
+          jbPopup.setCaption(getTitle(element, false));
+          callback.setDone();
         });
       }
     }, 10);