Prefer onSuccess() to invokeLater in run()
authorKirill Likhodedov <Kirill.Likhodedov@jetbrains.com>
Wed, 4 May 2016 16:11:52 +0000 (19:11 +0300)
committerKirill Likhodedov <Kirill.Likhodedov@jetbrains.com>
Wed, 4 May 2016 16:12:46 +0000 (19:12 +0300)
plugins/svn4idea/src/org/jetbrains/idea/svn/actions/AbstractShowPropertiesDiffAction.java

index c1394c50503b953a687d1c8e71df9cc858906198..d2f2f07196920ee575b9b257cddb2a976cf4f7ba 100644 (file)
@@ -17,7 +17,6 @@ package org.jetbrains.idea.svn.actions;
 
 import com.intellij.diff.DiffManager;
 import com.intellij.openapi.actionSystem.*;
-import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.progress.PerformInBackgroundOption;
 import com.intellij.openapi.progress.ProgressIndicator;
 import com.intellij.openapi.progress.ProgressManager;
@@ -141,33 +140,34 @@ public abstract class AbstractShowPropertiesDiffAction extends AnAction implemen
         // gets exactly WORKING revision property
         myAfterContent = getPropertyList(vcs, myChange.getAfterRevision(), myAfterRevision);
       }
-      catch(SVNException exc) {
+      catch (SVNException exc) {
         myException = exc;
       }
       catch (VcsException exc) {
         myException = exc;
       }
+    }
 
-      ApplicationManager.getApplication().invokeLater(() -> {
-        if (myException != null) {
-          Messages.showErrorDialog(myException.getMessage(), myErrorTitle);
-          return;
+    @Override
+    public void onSuccess() {
+      if (myException != null) {
+        Messages.showErrorDialog(myException.getMessage(), myErrorTitle);
+        return;
+      }
+      if (myBeforeContent != null && myAfterContent != null && myBeforeRevisionValue != null && myAfterRevision != null) {
+        SvnPropertiesDiffRequest diffRequest;
+        if (compareRevisions(myBeforeRevisionValue, myAfterRevision) > 0) {
+          diffRequest = new SvnPropertiesDiffRequest(getDiffWindowTitle(myChange),
+                                                     new PropertyContent(myAfterContent), new PropertyContent(myBeforeContent),
+                                                     revisionToString(myAfterRevision), revisionToString(myBeforeRevisionValue));
         }
-        if (myBeforeContent != null && myAfterContent != null && myBeforeRevisionValue != null && myAfterRevision != null) {
-          SvnPropertiesDiffRequest diffRequest;
-          if (compareRevisions(myBeforeRevisionValue, myAfterRevision) > 0) {
-            diffRequest = new SvnPropertiesDiffRequest(getDiffWindowTitle(myChange),
-                                                       new PropertyContent(myAfterContent), new PropertyContent(myBeforeContent),
-                                                       revisionToString(myAfterRevision), revisionToString(myBeforeRevisionValue));
-          }
-          else {
-            diffRequest = new SvnPropertiesDiffRequest(getDiffWindowTitle(myChange),
-                                                       new PropertyContent(myBeforeContent), new PropertyContent(myAfterContent),
-                                                       revisionToString(myBeforeRevisionValue), revisionToString(myAfterRevision));
-          }
-          DiffManager.getInstance().showDiff(myProject, diffRequest);
+        else {
+          diffRequest = new SvnPropertiesDiffRequest(getDiffWindowTitle(myChange),
+                                                     new PropertyContent(myBeforeContent), new PropertyContent(myAfterContent),
+                                                     revisionToString(myBeforeRevisionValue), revisionToString(myAfterRevision));
         }
-      });
+        DiffManager.getInstance().showDiff(myProject, diffRequest);
+      }
     }
   }