show dialog outside write action
authorAlexey Kudravtsev <cdr@intellij.com>
Mon, 9 Aug 2010 09:56:28 +0000 (13:56 +0400)
committerAlexey Kudravtsev <cdr@intellij.com>
Mon, 9 Aug 2010 10:44:17 +0000 (14:44 +0400)
java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateClassFromUsageFix.java

index df827ef8e3488810b94c5d6245ab6dd72d5115db..8ace8021c913d392558d1b93e31fd8604fb943d6 100644 (file)
@@ -49,12 +49,13 @@ public class CreateClassFromUsageFix extends CreateClassFromUsageBaseFix {
     assert element != null;
     if (!CodeInsightUtilBase.preparePsiElementForWrite(element)) return;
     final String superClassName = getSuperClassName(element);
+    final PsiClass aClass = CreateFromUsageUtils.createClass(element, myKind, superClassName);
+    if (aClass == null) return;
+
     ApplicationManager.getApplication().runWriteAction(
       new Runnable() {
         public void run() {
           PsiJavaCodeReferenceElement refElement = element;
-          final PsiClass aClass = CreateFromUsageUtils.createClass(refElement, myKind, superClassName);
-          if (aClass == null) return;
           try {
             refElement = (PsiJavaCodeReferenceElement)refElement.bindToElement(aClass);
           }