run configurations for default project exceptions : IDEA-80092
authoranna <Anna.Kozlova@jetbrains.com>
Thu, 19 Jan 2012 13:10:47 +0000 (14:10 +0100)
committeranna <Anna.Kozlova@jetbrains.com>
Thu, 19 Jan 2012 14:59:58 +0000 (15:59 +0100)
java/java-impl/src/com/intellij/ui/EditorTextFieldWithBrowseButton.java
platform/lang-impl/src/com/intellij/util/TextFieldCompletionProvider.java

index ea8ab92284e20ed784e6967c470c95213cba6335..420393e1e156a6e1904faaba4f861a54d899b750 100644 (file)
@@ -32,8 +32,15 @@ public class EditorTextFieldWithBrowseButton extends ComponentWithBrowseButton<E
   public EditorTextFieldWithBrowseButton(Project project,
                                          boolean isClassAccepted,
                                          final JavaCodeFragment.VisibilityChecker visibilityChecker) {
-    super(new EditorTextField(createDocument("", project, isClassAccepted,
-                                             visibilityChecker), project, StdFileTypes.JAVA), null);
+    super(createEditorTextField(project, isClassAccepted, visibilityChecker), null);
+  }
+
+  private static EditorTextField createEditorTextField(Project project,
+                                                       boolean isClassAccepted,
+                                                       JavaCodeFragment.VisibilityChecker visibilityChecker) {
+    if (project.isDefault()) return new EditorTextField();
+    return new EditorTextField(createDocument("", project, isClassAccepted,
+                                             visibilityChecker), project, StdFileTypes.JAVA);
   }
 
   private static Document createDocument(final String text,
index 6e472f88928247d1b4e6606433208e5a514217f2..fcb85dedff21e71b3c011013a0f8815188e5a293 100644 (file)
@@ -31,8 +31,9 @@ public abstract class TextFieldCompletionProvider {
 
   public void apply(@NotNull EditorTextField field, String text) {
     Project project = field.getProject();
-    assert project != null;
-    field.setDocument(createDocument(project, text));
+    if (project != null) {
+      field.setDocument(createDocument(project, text));
+    }
   }
   
   public void apply(@NotNull EditorTextField field) {