Merge branch 'master' of git.labs.intellij.net:idea/community
authorDmitry Avdeev <Dmitry.Avdeev@jetbrains.com>
Fri, 4 Dec 2009 08:54:11 +0000 (11:54 +0300)
committerDmitry Avdeev <Dmitry.Avdeev@jetbrains.com>
Fri, 4 Dec 2009 08:54:11 +0000 (11:54 +0300)
67 files changed:
community-resources/src/idea_community_about.png
community-resources/src/idea_community_logo.png
java/compiler/impl/src/com/intellij/compiler/impl/ModuleCompileScope.java
java/compiler/impl/src/com/intellij/compiler/options/AnnotationProcessorsConfigurable.java
java/debugger/impl/src/com/intellij/debugger/actions/SmartStepIntoActionHandler.java
java/execution/impl/src/com/intellij/compiler/options/CompileStepBeforeRun.java
java/idea-ui/src/com/intellij/ide/palette/impl/PaletteManager.java
java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/JavadocEditor.java
java/java-impl/src/com/intellij/ide/hierarchy/call/CallHierarchyNodeDescriptor.java
java/java-impl/src/com/intellij/ide/hierarchy/call/CallerMethodsTreeStructure.java
java/java-impl/src/com/intellij/refactoring/introduceVariable/IntroduceVariableBase.java
java/java-tests/testData/ide/hierarchy/call/IdeaDev41005/A.java [new file with mode: 0644]
java/java-tests/testData/ide/hierarchy/call/IdeaDev41005/B.java [new file with mode: 0644]
java/java-tests/testData/ide/hierarchy/call/IdeaDev41005/D.java [new file with mode: 0644]
java/java-tests/testData/ide/hierarchy/call/IdeaDev41005/IdeaDev41005_verification.xml [new file with mode: 0644]
java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_Inheritance/A.java [new file with mode: 0644]
java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_Inheritance/B.java [new file with mode: 0644]
java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_Inheritance/C.java [new file with mode: 0644]
java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_Inheritance/D.java [new file with mode: 0644]
java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_Inheritance/IdeaDev41005_Inheritance_verification.xml [new file with mode: 0644]
java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_Sibling/A.java [new file with mode: 0644]
java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_Sibling/B.java [new file with mode: 0644]
java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_Sibling/C.java [new file with mode: 0644]
java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_Sibling/D.java [new file with mode: 0644]
java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_Sibling/IdeaDev41005_Sibling_verification.xml [new file with mode: 0644]
java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_SiblingUnderInheritance/A.java [new file with mode: 0644]
java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_SiblingUnderInheritance/B.java [new file with mode: 0644]
java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_SiblingUnderInheritance/C.java [new file with mode: 0644]
java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_SiblingUnderInheritance/CChild.java [new file with mode: 0644]
java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_SiblingUnderInheritance/D.java [new file with mode: 0644]
java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_SiblingUnderInheritance/IdeaDev41005_SiblingUnderInheritance_verification.xml [new file with mode: 0644]
java/java-tests/testData/ide/hierarchy/call/IdeaDev41232/A.java [new file with mode: 0644]
java/java-tests/testData/ide/hierarchy/call/IdeaDev41232/B.java [new file with mode: 0644]
java/java-tests/testData/ide/hierarchy/call/IdeaDev41232/IdeaDev41232_verification.xml [new file with mode: 0644]
java/java-tests/testSrc/com/intellij/ide/hierarchy/JavaCallHierarchyTest.java [new file with mode: 0644]
platform/lang-impl/src/com/intellij/openapi/components/impl/stores/ModuleStoreImpl.java
platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndex.java
platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeUi.java
platform/platform-api/src/com/intellij/ide/util/treeView/UpdaterTreeState.java
platform/platform-impl/src/com/intellij/application/options/pathMacros/PathMacroConfigurable.java
platform/platform-impl/src/com/intellij/ide/IdeEventQueue.java
platform/platform-impl/src/com/intellij/ide/plugins/AvailablePluginsTableModel.java
platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ComponentStoreImpl.java
platform/platform-impl/src/com/intellij/openapi/components/impl/stores/DirectoryBasedStorage.java
platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StorageUtil.java
platform/platform-impl/src/com/intellij/openapi/components/impl/stores/XmlElementStorage.java
platform/platform-impl/src/com/intellij/openapi/project/ex/ProjectEx.java
platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectImpl.java
platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.java
platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateChecker.java
platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/FileWatcher.java
platform/testFramework/src/com/intellij/mock/MockProject.java
platform/vcs-impl/src/com/intellij/lifecycle/PeriodicalTasksCloser.java
platform/vcs-impl/src/com/intellij/lifecycle/SlowlyClosingAlarm.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchAction.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchDifferentiatedDialog.java
plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/quickedit/QuickEditAction.java
plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/refactorings/MavenPropertyRenameHandler.java
plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/refactorings/MavenVetoModelRenameCondition.java
plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/references/MavenTargetUtil.java
plugins/maven/src/main/java/org/jetbrains/idea/maven/indices/MavenIndex.java
plugins/maven/src/main/resources/META-INF/plugin.xml
plugins/testng/src/com/theoryinpractice/testng/configuration/TestNGConfigurationEditor.java
xml/dom-impl/src/com/intellij/util/xml/impl/DomSemContributor.java
xml/impl/src/com/intellij/javaee/ExternalResourceConfigurable.java
xml/openapi/src/com/intellij/patterns/XmlElementPattern.java
xml/openapi/src/com/intellij/patterns/XmlPatterns.java

index bb4708573adc2434ee90ee566224c600f408dbf4..701c546ce0cec2b86b47cdfcd3dffe5cdd1daca5 100644 (file)
Binary files a/community-resources/src/idea_community_about.png and b/community-resources/src/idea_community_about.png differ
index f9225e10f258cb7a86cdf6833af47c4cc84c9e1a..fb89ba3ec5e91bb3223a7385cc35e2cefaf35b08 100644 (file)
Binary files a/community-resources/src/idea_community_logo.png and b/community-resources/src/idea_community_logo.png differ
index 1f27bc9a3303a636a57bbbd37d90f729718a76da..7a21af6af0651d1858c3c88fa11c793b7087d3d5 100644 (file)
@@ -61,6 +61,9 @@ public class ModuleCompileScope extends FileIndexCompileScope {
     myProject = project;
     myScopeModules = new HashSet<Module>();
     for (Module module : modules) {
+      if (module == null) {
+        continue; // prevent NPE
+      }
       if (includeDependentModules) {
         buildScopeModulesSet(module);
       }
index e20bb8d7ddca0dcccedd1a6cc4ba15e9562a7d0f..9d4d0cb91c8b351820281ff74641cb543107ce67 100644 (file)
@@ -65,7 +65,7 @@ public class AnnotationProcessorsConfigurable implements Configurable{
   }
 
   public String getHelpTopic() {
-    return null;
+    return "reference.projectsettings.compiler.annotationProcessors";
   }
 
   public JComponent createComponent() {
index 2dafdfcb2a5f05727e2c6d031a007235cb9d2865..d656c07121245b42f3d1d557f6913b72177c84d4 100644 (file)
@@ -102,7 +102,7 @@ public class SmartStepIntoActionHandler extends DebuggerActionHandler {
     final TextRange lineRange = new TextRange(startOffset, doc.getLineEndOffset(line));
     final int offset = CharArrayUtil.shiftForward(doc.getCharsSequence(), startOffset, " \t");
     PsiElement element = file.findElementAt(offset);
-    if (element != null) {
+    if (element != null && !(element instanceof PsiCompiledElement)) {
       do {
         final PsiElement parent = element.getParent();
         if (parent == null || (parent.getTextOffset() < lineRange.getStartOffset())) {
index f4204cdeb0ea37bd98c8aa79b46ea64e9025006c..d165861a020c40d03075d30bde8a7b1b628bcfea 100644 (file)
@@ -28,6 +28,7 @@ import com.intellij.openapi.compiler.CompileContext;
 import com.intellij.openapi.compiler.CompileScope;
 import com.intellij.openapi.compiler.CompileStatusNotification;
 import com.intellij.openapi.compiler.CompilerManager;
+import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Key;
@@ -40,6 +41,7 @@ import org.jetbrains.annotations.Nullable;
  * @author spleaner
  */
 public class CompileStepBeforeRun extends BeforeRunTaskProvider<CompileStepBeforeRun.MakeBeforeRunTask> {
+  private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.options.CompileStepBeforeRun");
   public static final Key<MakeBeforeRunTask> ID = Key.create("Make");
   private static final Key<RunConfiguration> RUN_CONFIGURATION = Key.create("RUN_CONFIGURATION");
 
@@ -98,6 +100,14 @@ public class CompileStepBeforeRun extends BeforeRunTaskProvider<CompileStepBefor
           else {
             final Module[] modules = runConfiguration.getModules();
             if (modules.length > 0) {
+              for (Module module : modules) {
+                if (module == null) {
+                  LOG.assertTrue(
+                    false,
+                    "RunConfiguration should not return null modules. Configuration=" + runConfiguration.getName() + "; class=" + runConfiguration.getClass().getName()
+                  );
+                }
+              }
               scope = compilerManager.createModulesCompileScope(modules, true);
             }
             else {
index 0ff19abc62966738e867be3cb8ed30c8b13ed871..6656c6d9c4710cd9bce2bdd6ea45eb6ded116611 100644 (file)
@@ -77,6 +77,10 @@ public class PaletteManager implements ProjectComponent {
   }
 
   public void projectClosed() {
+    if (myPaletteWindow != null) {
+      ToolWindowManager.getInstance(myProject).unregisterToolWindow(IdeBundle.message("toolwindow.palette"));
+      myPaletteWindow = null;
+    }
   }
 
   @NotNull
index 9b70f57c10188bb4777c1169c396cad943e4fa22..4923907c57ceb90febea6244d6af37402821cce6 100644 (file)
@@ -170,7 +170,9 @@ public class JavadocEditor extends ModuleElementsEditor {
       setBorder(NO_FOCUS_BORDER);
 
       final TableItem tableItem = ((TableItem)value);
-      tableItem.getCellAppearance().customize(this);
+      if (tableItem != null) {
+        tableItem.getCellAppearance().customize(this);
+      }
     }
   }
 
index 3d1be3755c6ff2341afb4d9636be396763cbd854..93b982515e93738e249827f0a1b7268293b1ff22 100644 (file)
@@ -176,6 +176,10 @@ public final class CallHierarchyNodeDescriptor extends HierarchyNodeDescriptor i
     myReferences.add(reference);
   }
 
+  public boolean hasReference(PsiReference reference) {
+    return myReferences.contains(reference);
+  }
+
   public void navigate(boolean requestFocus) {
     if (!myNavigateToReference) {
       if (myElement instanceof Navigatable && ((Navigatable)myElement).canNavigate()) {
index 32b5550f187c498416813b91bd123142916b2be9..8db99a3526b9a625e38457b68a599213fa94b999 100644 (file)
@@ -73,9 +73,15 @@ public final class CallerMethodsTreeStructure extends HierarchyTreeStructure {
             }
             if (qualifier != null && !methodToFind.hasModifierProperty(PsiModifier.STATIC)) {
               final PsiType qualifierType = qualifier.getType();
-              if (qualifierType == null) return true;
-              if (!TypeConversionUtil.isAssignable(qualifierType, originalType)) {
-                return true;
+              if (qualifierType instanceof PsiClassType && !TypeConversionUtil.isAssignable(qualifierType, originalType) && methodToFind != method) {
+                final PsiClass psiClass = ((PsiClassType)qualifierType).resolve();
+                if (psiClass != null) {
+                  final PsiMethod callee = psiClass.findMethodBySignature(methodToFind, true);
+                  if (callee != null && !methodsToFind.contains(callee)) {
+                    // skip sibling methods
+                    return true;
+                  }
+                }
               }
             }
           }
@@ -109,7 +115,7 @@ public final class CallerMethodsTreeStructure extends HierarchyTreeStructure {
               d = new CallHierarchyNodeDescriptor(myProject, descriptor, element, false, true);
               methodToDescriptorMap.put(key, d);
             }
-            else {
+            else if (!d.hasReference(reference)) {
               d.incrementUsageCount();
             }
             d.addReference(reference);
index 017c5a7228521e86954b2be74eb211fe059d06a4..251716f4652a4e2d5a6e0ad175c573a11b68daf4 100644 (file)
@@ -243,12 +243,18 @@ public abstract class IntroduceVariableBase extends IntroduceHandlerBase impleme
   }
 
   public static PsiExpression getSelectedExpression(final Project project, final PsiFile file, final int startOffset, final int endOffset) {
+
+    final PsiElement elementAtStart = file.findElementAt(startOffset);
+    if (elementAtStart == null) return null;
+    final PsiElement elementAtEnd = file.findElementAt(endOffset - 1);
+    if (elementAtEnd == null) return null;
+
     PsiExpression tempExpr;
-    final PsiElement elementAt = PsiTreeUtil.findCommonParent(file.findElementAt(startOffset), file.findElementAt(endOffset - 1));
+    final PsiElement elementAt = PsiTreeUtil.findCommonParent(elementAtStart, elementAtEnd);
     if (PsiTreeUtil.getParentOfType(elementAt, PsiExpression.class, false) == null) return null;
     final PsiLiteralExpression literalExpression = PsiTreeUtil.getParentOfType(elementAt, PsiLiteralExpression.class);
 
-    final PsiLiteralExpression startLiteralExpression = PsiTreeUtil.getParentOfType(file.findElementAt(startOffset), PsiLiteralExpression.class);
+    final PsiLiteralExpression startLiteralExpression = PsiTreeUtil.getParentOfType(elementAtStart, PsiLiteralExpression.class);
     final PsiLiteralExpression endLiteralExpression = PsiTreeUtil.getParentOfType(file.findElementAt(endOffset), PsiLiteralExpression.class);
 
     final PsiElementFactory elementFactory = JavaPsiFacade.getInstance(project).getElementFactory();
diff --git a/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005/A.java b/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005/A.java
new file mode 100644 (file)
index 0000000..a00769f
--- /dev/null
@@ -0,0 +1,6 @@
+class A {
+  public static void main(String[] args) {
+    D d = new D();
+    d.xyzzy();
+  }
+}
diff --git a/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005/B.java b/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005/B.java
new file mode 100644 (file)
index 0000000..805e99b
--- /dev/null
@@ -0,0 +1,4 @@
+class B {
+  public void xyzzy() {
+  }
+}
diff --git a/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005/D.java b/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005/D.java
new file mode 100644 (file)
index 0000000..381134f
--- /dev/null
@@ -0,0 +1,2 @@
+class D extends B {
+}
diff --git a/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005/IdeaDev41005_verification.xml b/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005/IdeaDev41005_verification.xml
new file mode 100644 (file)
index 0000000..96e2954
--- /dev/null
@@ -0,0 +1,4 @@
+<node text="B.xyzzy()  ()" base="true">
+  <node text="A.main(String[])  ()">
+  </node>
+</node>
diff --git a/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_Inheritance/A.java b/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_Inheritance/A.java
new file mode 100644 (file)
index 0000000..d2557a7
--- /dev/null
@@ -0,0 +1,9 @@
+class A {
+  public static void main(String[] args) {
+    D d = new D();
+    d.xyzzy();
+
+    C c = new C();
+    c.xyzzy();
+  }
+}
diff --git a/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_Inheritance/B.java b/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_Inheritance/B.java
new file mode 100644 (file)
index 0000000..805e99b
--- /dev/null
@@ -0,0 +1,4 @@
+class B {
+  public void xyzzy() {
+  }
+}
diff --git a/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_Inheritance/C.java b/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_Inheritance/C.java
new file mode 100644 (file)
index 0000000..be4cfc1
--- /dev/null
@@ -0,0 +1,2 @@
+class C extends B {
+}
diff --git a/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_Inheritance/D.java b/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_Inheritance/D.java
new file mode 100644 (file)
index 0000000..5f10411
--- /dev/null
@@ -0,0 +1,4 @@
+class D extends B {
+  public void xyzzy() {
+  }
+}
diff --git a/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_Inheritance/IdeaDev41005_Inheritance_verification.xml b/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_Inheritance/IdeaDev41005_Inheritance_verification.xml
new file mode 100644 (file)
index 0000000..d67f954
--- /dev/null
@@ -0,0 +1,4 @@
+<node text="D.xyzzy()  ()" base="true">
+  <node text="A.main(String[])(2 usages)  ()">
+  </node>
+</node>
diff --git a/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_Sibling/A.java b/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_Sibling/A.java
new file mode 100644 (file)
index 0000000..d2557a7
--- /dev/null
@@ -0,0 +1,9 @@
+class A {
+  public static void main(String[] args) {
+    D d = new D();
+    d.xyzzy();
+
+    C c = new C();
+    c.xyzzy();
+  }
+}
diff --git a/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_Sibling/B.java b/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_Sibling/B.java
new file mode 100644 (file)
index 0000000..805e99b
--- /dev/null
@@ -0,0 +1,4 @@
+class B {
+  public void xyzzy() {
+  }
+}
diff --git a/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_Sibling/C.java b/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_Sibling/C.java
new file mode 100644 (file)
index 0000000..1a16dd1
--- /dev/null
@@ -0,0 +1,4 @@
+class C extends B {
+  public void xyzzy() {
+  }
+}
diff --git a/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_Sibling/D.java b/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_Sibling/D.java
new file mode 100644 (file)
index 0000000..5f10411
--- /dev/null
@@ -0,0 +1,4 @@
+class D extends B {
+  public void xyzzy() {
+  }
+}
diff --git a/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_Sibling/IdeaDev41005_Sibling_verification.xml b/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_Sibling/IdeaDev41005_Sibling_verification.xml
new file mode 100644 (file)
index 0000000..026cf00
--- /dev/null
@@ -0,0 +1,4 @@
+<node text="D.xyzzy()  ()" base="true">
+  <node text="A.main(String[])  ()">
+  </node>
+</node>
diff --git a/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_SiblingUnderInheritance/A.java b/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_SiblingUnderInheritance/A.java
new file mode 100644 (file)
index 0000000..5768b5e
--- /dev/null
@@ -0,0 +1,9 @@
+class A {
+  public static void main(String[] args) {
+    D d = new D();
+    d.xyzzy();
+
+    CChild c = new CChild();
+    c.xyzzy();
+  }
+}
diff --git a/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_SiblingUnderInheritance/B.java b/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_SiblingUnderInheritance/B.java
new file mode 100644 (file)
index 0000000..805e99b
--- /dev/null
@@ -0,0 +1,4 @@
+class B {
+  public void xyzzy() {
+  }
+}
diff --git a/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_SiblingUnderInheritance/C.java b/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_SiblingUnderInheritance/C.java
new file mode 100644 (file)
index 0000000..1a16dd1
--- /dev/null
@@ -0,0 +1,4 @@
+class C extends B {
+  public void xyzzy() {
+  }
+}
diff --git a/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_SiblingUnderInheritance/CChild.java b/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_SiblingUnderInheritance/CChild.java
new file mode 100644 (file)
index 0000000..41ef7e8
--- /dev/null
@@ -0,0 +1,2 @@
+class CChild extends C {
+}
diff --git a/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_SiblingUnderInheritance/D.java b/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_SiblingUnderInheritance/D.java
new file mode 100644 (file)
index 0000000..5f10411
--- /dev/null
@@ -0,0 +1,4 @@
+class D extends B {
+  public void xyzzy() {
+  }
+}
diff --git a/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_SiblingUnderInheritance/IdeaDev41005_SiblingUnderInheritance_verification.xml b/java/java-tests/testData/ide/hierarchy/call/IdeaDev41005_SiblingUnderInheritance/IdeaDev41005_SiblingUnderInheritance_verification.xml
new file mode 100644 (file)
index 0000000..026cf00
--- /dev/null
@@ -0,0 +1,4 @@
+<node text="D.xyzzy()  ()" base="true">
+  <node text="A.main(String[])  ()">
+  </node>
+</node>
diff --git a/java/java-tests/testData/ide/hierarchy/call/IdeaDev41232/A.java b/java/java-tests/testData/ide/hierarchy/call/IdeaDev41232/A.java
new file mode 100644 (file)
index 0000000..5734020
--- /dev/null
@@ -0,0 +1,4 @@
+class A {
+  public static void main() {
+  }
+}
diff --git a/java/java-tests/testData/ide/hierarchy/call/IdeaDev41232/B.java b/java/java-tests/testData/ide/hierarchy/call/IdeaDev41232/B.java
new file mode 100644 (file)
index 0000000..2e412d2
--- /dev/null
@@ -0,0 +1,5 @@
+class B {
+  public void xyzzy() {
+    A.main();
+  }
+}
diff --git a/java/java-tests/testData/ide/hierarchy/call/IdeaDev41232/IdeaDev41232_verification.xml b/java/java-tests/testData/ide/hierarchy/call/IdeaDev41232/IdeaDev41232_verification.xml
new file mode 100644 (file)
index 0000000..c32f6b8
--- /dev/null
@@ -0,0 +1,4 @@
+<node text="A.main()  ()" base="true">
+  <node text="B.xyzzy()  ()">
+  </node>
+</node>
diff --git a/java/java-tests/testSrc/com/intellij/ide/hierarchy/JavaCallHierarchyTest.java b/java/java-tests/testSrc/com/intellij/ide/hierarchy/JavaCallHierarchyTest.java
new file mode 100644 (file)
index 0000000..3f7c321
--- /dev/null
@@ -0,0 +1,55 @@
+package com.intellij.ide.hierarchy;
+
+import com.intellij.JavaTestUtil;
+import com.intellij.ide.hierarchy.call.CallerMethodsTreeStructure;
+import com.intellij.openapi.util.Computable;
+import com.intellij.psi.JavaPsiFacade;
+import com.intellij.psi.PsiClass;
+import com.intellij.psi.PsiMethod;
+import com.intellij.psi.search.ProjectScope;
+import com.intellij.testFramework.codeInsight.hierarchy.HierarchyViewTestBase;
+
+/**
+ * @author yole
+ */
+public class JavaCallHierarchyTest extends HierarchyViewTestBase {
+  @Override
+  protected String getTestDataPath() {
+    return JavaTestUtil.getJavaTestDataPath();
+  }
+
+  @Override
+  protected String getBasePath() {
+    return "ide/hierarchy/call/" + getTestName(false);
+  }
+
+  private void doJavaCallTypeHierarchyTest(final String classFqn, final String methodName, final String... fileNames) throws Exception {
+    doHierarchyTest(new Computable<HierarchyTreeStructure>() {
+      public HierarchyTreeStructure compute() {
+        final PsiClass psiClass = JavaPsiFacade.getInstance(getProject()).findClass(classFqn, ProjectScope.getProjectScope(getProject()));
+        final PsiMethod method = psiClass.findMethodsByName(methodName, false) [0];
+        return new CallerMethodsTreeStructure(getProject(), method, HierarchyBrowserBaseEx.SCOPE_PROJECT);
+      }
+    }, fileNames);
+  }
+
+  public void testIdeaDev41005() throws Exception {
+    doJavaCallTypeHierarchyTest("B", "xyzzy", "B.java", "D.java", "A.java");
+  }
+
+  public void testIdeaDev41005_Inheritance() throws Exception {
+    doJavaCallTypeHierarchyTest("D", "xyzzy", "B.java", "D.java", "A.java", "C.java");
+  }
+
+  public void testIdeaDev41005_Sibling() throws Exception {
+    doJavaCallTypeHierarchyTest("D", "xyzzy", "B.java", "D.java", "A.java", "C.java");
+  }
+
+  public void testIdeaDev41005_SiblingUnderInheritance() throws Exception {
+    doJavaCallTypeHierarchyTest("D", "xyzzy", "B.java", "D.java", "A.java", "C.java", "CChild.java");
+  }
+
+  public void testIdeaDev41232() throws Exception {
+    doJavaCallTypeHierarchyTest("A", "main", "B.java", "A.java");
+  }
+}
index 5ef3ef2d6bdad066fd8edae799259c7386ebb101..f3bd4332d48167a7c5d7a337c6b526f012e5de41 100644 (file)
@@ -16,7 +16,6 @@
 
 package com.intellij.openapi.components.impl.stores;
 
-import com.intellij.notification.*;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.components.PathMacroManager;
 import com.intellij.openapi.components.PathMacroSubstitutor;
@@ -30,7 +29,6 @@ import com.intellij.openapi.module.impl.ModuleImpl;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.project.ex.ProjectEx;
 import com.intellij.openapi.startup.StartupManager;
-import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.LocalFileSystem;
 import com.intellij.openapi.vfs.VirtualFile;
 import org.jdom.Attribute;
@@ -39,7 +37,6 @@ import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
-import javax.swing.event.HyperlinkEvent;
 import java.io.File;
 import java.io.IOException;
 import java.util.*;
@@ -85,18 +82,12 @@ public class ModuleStoreImpl extends BaseFileConfigurableStoreImpl implements IM
       final Collection<String> macros = substitutor.getUnknownMacros(null);
       if (!macros.isEmpty()) {
         final Project project = myModule.getProject();
-        StartupManager.getInstance(project).runWhenProjectIsInitialized(new Runnable() {
-          public void run() {
-            Notifications.Bus.notify(new UnknownMacroNotification("Load Error", String.format("Error loading module '%s':", myModule.getName()),
-                                                      String.format(
-                                                        "<p>Undefined Path Variable(s): <i>%s</i>. <a href=\"\">Fix it!</a></p>",
-                                                        StringUtil.join(macros, ", ")), NotificationType.ERROR, new NotificationListener() {
-                public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
-                  ((ProjectEx)myModule.getProject()).checkUnknownMacros();
-                }
-              }, macros), NotificationDisplayType.STICKY_BALLOON, project);
-          }
-        });
+
+          StartupManager.getInstance(project).runWhenProjectIsInitialized(new Runnable() {
+            public void run() {
+              StorageUtil.notifyUnknownMacros(substitutor, project, null);
+            }
+          });
       }
     }
   }
index f6f21036a1244e47a1979ed5cbccf584191812cb..59747f06f54418e70bb6d57cc4568abdfe9e76bc 100644 (file)
@@ -1815,18 +1815,25 @@ private boolean indexUnsavedDocument(final Document document, final ID<?, ?> req
   }
 
   public static void iterateIndexableFiles(final ContentIterator processor, Project project) {
+    if (project.isDisposed()) {
+      return;
+    }
     final ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
-    // iterate associated libraries
-    final Module[] modules = ModuleManager.getInstance(project).getModules();
     // iterate project content
     projectFileIndex.iterateContent(processor);
 
+    if (project.isDisposed()) {
+      return;
+    }
     ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
 
     Set<VirtualFile> visitedRoots = new com.intellij.util.containers.HashSet<VirtualFile>();
     for (IndexedRootsProvider provider : Extensions.getExtensions(IndexedRootsProvider.EP_NAME)) {
       //important not to depend on project here, to support per-project background reindex
       // each client gives a project to FileBasedIndex
+      if (project.isDisposed()) {
+        return;
+      }
       final Set<String> rootsToIndex = provider.getRootsToIndex();
       for (String url : rootsToIndex) {
         final VirtualFile root = VirtualFileManager.getInstance().findFileByUrl(url);
@@ -1835,7 +1842,15 @@ private boolean indexUnsavedDocument(final Document document, final ID<?, ?> req
         }
       }
     }
-    for (Module module : modules) {
+
+    if (project.isDisposed()) {
+      return;
+    }
+    // iterate associated libraries
+    for (Module module : ModuleManager.getInstance(project).getModules()) {
+      if (module.isDisposed()) {
+        return;
+      }
       OrderEntry[] orderEntries = ModuleRootManager.getInstance(module).getOrderEntries();
       for (OrderEntry orderEntry : orderEntries) {
         if (orderEntry instanceof LibraryOrderEntry || orderEntry instanceof JdkOrderEntry) {
index 893d91942275fe94b54eef8d6a0bf676a2707400..434ccefcd86c5d33f04f45eac44f28c05e0b29e1 100644 (file)
@@ -1489,6 +1489,18 @@ public class AbstractTreeUi {
         myInitialized.setDone();
       }
 
+
+      if (myUpdaterState != null && !myUpdaterState.isProcessingNow()) {
+        UpdaterTreeState oldState = myUpdaterState;
+        if (!myUpdaterState.restore(null)) {
+          setUpdaterState(oldState);
+        }
+
+        if (!isReady()) {
+          return;
+        }
+      }
+
       if (myTree.isShowing()) {
         if (getBuilder().isToEnsureSelectionOnFocusGained() && Registry.is("ide.tree.ensureSelectionOnFocusGained")) {
           TreeUtil.ensureSelection(myTree);
@@ -2868,7 +2880,11 @@ public class AbstractTreeUi {
           addNext(elementsToSelect, 0, new Runnable() {
             public void run() {
               if (getTree().isSelectionEmpty()) {
-                restoreSelection(currentElements);
+                processInnerChange(new Runnable() {
+                  public void run() {
+                    restoreSelection(currentElements);
+                  }
+                });
               }
               runDone(onDone);
             }
index 5e61c53e07fd6c29c681947bde6b3d2559e289d6..31b5f1b70ef1e5dabf809e51d6e2415ca02d7a6f 100644 (file)
@@ -143,7 +143,9 @@ public class UpdaterTreeState {
   }
 
   public boolean restore(@Nullable DefaultMutableTreeNode actionNode) {
-    if (isProcessingNow() || !myCanRunRestore || myUi.hasNodesToUpdate()) return false;
+    if (isProcessingNow() || !myCanRunRestore || myUi.hasNodesToUpdate()) {
+      return false;
+    }
 
     invalidateToSelectWithRefsToParent(actionNode);
 
index 1b382ccede8b1509fa6850fc36342482fabd342c..202488e849abd048235861f065b97d6b2b832cc6 100644 (file)
@@ -18,6 +18,9 @@ package com.intellij.application.options.pathMacros;
 import com.intellij.openapi.application.ApplicationBundle;
 import com.intellij.openapi.options.ConfigurationException;
 import com.intellij.openapi.options.SearchableConfigurable;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.project.ProjectManager;
+import com.intellij.openapi.project.ex.ProjectEx;
 import com.intellij.openapi.util.IconLoader;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.Nullable;
@@ -40,6 +43,11 @@ public class PathMacroConfigurable implements SearchableConfigurable {
 
   public void apply() throws ConfigurationException {
     myEditor.commit();
+
+    final Project[] projects = ProjectManager.getInstance().getOpenProjects();
+    for (Project project : projects) {
+      ((ProjectEx)project).checkUnknownMacros(false);
+    }
   }
 
   public void reset() {
index 5c32ff9a9bffff84bf2fe71f0a7f66ce60039a5d..846bef631cdf7c971c8610d9b69e9070f482d289 100644 (file)
@@ -606,7 +606,7 @@ public class IdeEventQueue extends EventQueue {
       }
     }
 
-    return consumed && Patches.REQUEST_FOCUS_MAY_ACTIVATE_APP;
+    return false;
   }
 
 
index 8105b92333256a35970e06c16e5917cf86753fd3..52fa116b1fc7f90455f1f869be75c1fc469dd4cc 100644 (file)
@@ -39,7 +39,7 @@ import java.util.Map;
  * To change this template use Options | File Templates.
  */
 public class AvailablePluginsTableModel extends PluginTableModel {
-  private static final Map<PluginId, String> UpdateVersions = new HashMap<PluginId, String>();
+  private final Map<PluginId, String> myUpdateVersions = new HashMap<PluginId, String>();
 
   public AvailablePluginsTableModel(SortableProvider sortableProvider) {
     super(sortableProvider, 
@@ -65,7 +65,7 @@ public class AvailablePluginsTableModel extends PluginTableModel {
     for (IdeaPluginDescriptor descr : list) {
       updateStatus(descr);
       view.add(descr);
-      UpdateVersions.put(descr.getPluginId(), descr.getVersion());
+      myUpdateVersions.put(descr.getPluginId(), descr.getVersion());
     }
     safeSort();
   }
@@ -87,8 +87,8 @@ public class AvailablePluginsTableModel extends PluginTableModel {
     for (IdeaPluginDescriptor descr : list) {
       updateStatus(descr);
       PluginId descrId = descr.getPluginId();
-      if (UpdateVersions.containsKey(descrId)) {
-        String currVersion = UpdateVersions.get(descrId);
+      if (myUpdateVersions.containsKey(descrId)) {
+        String currVersion = myUpdateVersions.get(descrId);
         int state = StringUtil.compareVersionNumbers(descr.getVersion(), currVersion);
         if (state > 0) {
           for (int i = 0; i < view.size(); i++) {
@@ -100,6 +100,7 @@ public class AvailablePluginsTableModel extends PluginTableModel {
       }
       else {
         view.add(descr);
+        myUpdateVersions.put(descr.getPluginId(), descr.getVersion());
       }
     }
     safeSort();
index 8489cf5817782ebd94db38f02bff587338f1f99b..f40da2a5825b9c9b524ce5fab3bead7f023671b2 100644 (file)
@@ -33,7 +33,9 @@ import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.util.ArrayUtil;
 import com.intellij.util.ReflectionCache;
 import com.intellij.util.ReflectionUtil;
+import com.intellij.util.containers.ContainerUtil;
 import com.intellij.util.io.fs.IFile;
+import net.sf.cglib.core.CollectionUtils;
 import org.jdom.Element;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -258,19 +260,7 @@ abstract class ComponentStoreImpl implements IComponentStore {
       if (service && componentName != null && project.isInitialized()) {
         final TrackingPathMacroSubstitutor substitutor = getStateStorageManager().getMacroSubstitutor();
         if (substitutor != null) {
-          final Collection<String> macros = substitutor.getUnknownMacros(componentName);
-          if (!macros.isEmpty()) {
-            Notifications.Bus.notify(new UnknownMacroNotification("Load Error", "Component load error: undefined path variables!",
-                                                      String.format("<p><i>%s</i> %s undefined. <a href=\"\">Fix it!</a></p>",
-                                                                    StringUtil.join(macros, ", "), macros.size() == 1 ? "is" : "are"),
-                                                      NotificationType.ERROR,
-                                                      new NotificationListener() {
-                                                        public void hyperlinkUpdate(@NotNull Notification notification,
-                                                                                    @NotNull HyperlinkEvent event) {
-                                                          ((ProjectEx)project).checkUnknownMacros();
-                                                        }
-                                                      }, macros), NotificationDisplayType.STICKY_BALLOON, project);
-          }
+          StorageUtil.notifyUnknownMacros(substitutor, project, componentName);
         }
       }
     }
index bc4510571eef2d03225c63db71fd524cf998e0a8..1549e2f4ab67a18d24970cb82d9987a23f0a56ab 100644 (file)
@@ -28,6 +28,7 @@ import com.intellij.openapi.util.Disposer;
 import com.intellij.openapi.util.JDOMUtil;
 import com.intellij.openapi.util.Pair;
 import com.intellij.openapi.util.WriteExternalException;
+import com.intellij.openapi.util.io.FileUtil;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.LocalFileSystem;
 import com.intellij.openapi.vfs.VirtualFile;
@@ -246,7 +247,7 @@ public class DirectoryBasedStorage implements StateStorage, Disposable {
       IFile[] children = myDir.exists() ? myDir.listFiles() : EMPTY_FILES;
       for (IFile child : children) {
         final String fileName = child.getName();
-        if (!myFileTypeManager.isFileIgnored(fileName)) {
+        if (!myFileTypeManager.isFileIgnored(fileName) && StringUtil.endsWithIgnoreCase(fileName, ".xml")) {
           currentNames.add(fileName);
         }
       }
index 9c39e2b7bf12b259fbc24278b69b5e148ac2dd92..e5b43e73312288ff1c38399f993ed0ac7afcc463 100644 (file)
 package com.intellij.openapi.components.impl.stores;
 
 import com.intellij.application.options.PathMacrosCollector;
+import com.intellij.notification.*;
 import com.intellij.openapi.application.ApplicationInfo;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.application.PathManager;
 import com.intellij.openapi.application.ex.ApplicationManagerEx;
+import com.intellij.openapi.components.PathMacroSubstitutor;
 import com.intellij.openapi.components.RoamingType;
 import com.intellij.openapi.components.StateStorage;
+import com.intellij.openapi.components.TrackingPathMacroSubstitutor;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.options.StreamProvider;
+import com.intellij.openapi.project.Project;
 import com.intellij.openapi.project.ProjectBundle;
+import com.intellij.openapi.project.ex.ProjectEx;
 import com.intellij.openapi.util.JDOMUtil;
 import com.intellij.openapi.util.Pair;
 import com.intellij.openapi.util.Ref;
@@ -36,14 +41,17 @@ import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.util.NotNullFunction;
 import com.intellij.util.SystemProperties;
 import com.intellij.util.UniqueFileNamesProvider;
+import com.intellij.util.containers.ContainerUtil;
 import com.intellij.util.io.fs.FileSystem;
 import com.intellij.util.io.fs.IFile;
 import org.jdom.*;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
+import javax.swing.event.HyperlinkEvent;
 import java.io.*;
 import java.text.SimpleDateFormat;
+import java.util.Collection;
 import java.util.Date;
 import java.util.Set;
 
@@ -57,6 +65,30 @@ public class StorageUtil {
   private StorageUtil() {
   }
 
+  public static void notifyUnknownMacros(@NotNull final TrackingPathMacroSubstitutor substitutor, @NotNull final Project project, @Nullable final String componentName) {
+    Collection<String> macros = substitutor.getUnknownMacros(componentName);
+    if (!macros.isEmpty()) {
+      final UnknownMacroNotification[] notifications =
+        NotificationsManager.getNotificationsManager().getNotificationsOfType(UnknownMacroNotification.class, project);
+      for (final UnknownMacroNotification notification : notifications) {
+        macros = ContainerUtil.subtract(macros, notification.getMacros());
+      }
+
+      if (!macros.isEmpty()) {
+        Notifications.Bus.notify(new UnknownMacroNotification("Load Error", "Loading error: undefined path variables!",
+                                                              String.format("<p><i>%s</i> %s undefined. <a href=\"\">Fix it!</a></p>",
+                                                                            StringUtil.join(macros, ", "),
+                                                                            macros.size() == 1 ? "is" : "are"), NotificationType.ERROR,
+                                                              new NotificationListener() {
+                                                                public void hyperlinkUpdate(@NotNull Notification notification,
+                                                                                            @NotNull HyperlinkEvent event) {
+                                                                  ((ProjectEx)project).checkUnknownMacros(true);
+                                                                }
+                                                              }, macros), NotificationDisplayType.STICKY_BALLOON, project);
+      }
+    }
+  }
+
   static void save(final IFile file, final byte[] text, final Object requestor) throws StateStorage.StateStorageException {
     final String filePath = file.getCanonicalPath();
     try {
index 28b5783b2ff4fcf89e00f6f46c0346ddc39e869a..0419e7856058271f49315434a70007e2529d518a 100644 (file)
@@ -710,6 +710,8 @@ public abstract class XmlElementStorage implements StateStorage, Disposable {
     }
 
     public void checkUnknownMacros(TrackingPathMacroSubstitutor pathMacroSubstitutor) {
+      if (pathMacroSubstitutor == null) return;
+
       for (String componentName : myComponentStates.keySet()) {
         final Set<String> unknownMacros = StorageUtil.getMacroNames(myComponentStates.get(componentName));
         if (!unknownMacros.isEmpty()) {
index 18697eab7dcd354df946d4394d485e3902a6296a..21bc05e604374f5e73366b1731ba38af023bf5f8 100644 (file)
@@ -30,5 +30,5 @@ public interface ProjectEx extends Project {
 
   void setOptimiseTestLoadSpeed(boolean optimiseTestLoadSpeed);
 
-  void checkUnknownMacros();
+  void checkUnknownMacros(final boolean showDialog);
 }
index 8418750b1737688e25ee9fb5ff645f3fc99ea320..23cea6f0382be9d66f6dd94346f4dc4f71d8acc5 100644 (file)
@@ -359,7 +359,7 @@ public class ProjectImpl extends ComponentManagerImpl implements ProjectEx {
     return false;
   }
 
-  public void checkUnknownMacros() {
+  public void checkUnknownMacros(final boolean showDialog) {
     final IProjectStore stateStore = getStateStore();
 
     final TrackingPathMacroSubstitutor[] substitutors = stateStore.getSubstitutors();
@@ -369,7 +369,7 @@ public class ProjectImpl extends ComponentManagerImpl implements ProjectEx {
     }
 
     if (!unknownMacros.isEmpty()) {
-      if (ProjectMacrosUtil.checkMacros(this, new HashSet<String>(unknownMacros))) {
+      if (!showDialog || ProjectMacrosUtil.checkMacros(this, new HashSet<String>(unknownMacros))) {
         final PathMacros pathMacros = PathMacros.getInstance();
         final Set<String> macros2invalidate = new HashSet<String>(unknownMacros);
         for (Iterator it = macros2invalidate.iterator(); it.hasNext();) {
index f902ac473cd9da83bcf974f26dfd689c11dc2786..f956a0ff901a7ffe77bc8c9a6363e6b4310e42cd 100644 (file)
@@ -29,10 +29,7 @@ import com.intellij.openapi.application.impl.ApplicationImpl;
 import com.intellij.openapi.components.ExportableApplicationComponent;
 import com.intellij.openapi.components.StateStorage;
 import com.intellij.openapi.components.TrackingPathMacroSubstitutor;
-import com.intellij.openapi.components.impl.stores.IComponentStore;
-import com.intellij.openapi.components.impl.stores.IProjectStore;
-import com.intellij.openapi.components.impl.stores.UnknownMacroNotification;
-import com.intellij.openapi.components.impl.stores.XmlElementStorage;
+import com.intellij.openapi.components.impl.stores.*;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.fileEditor.FileDocumentManager;
 import com.intellij.openapi.progress.ProcessCanceledException;
@@ -399,19 +396,7 @@ public class ProjectManagerImpl extends ProjectManagerEx implements NamedJDOMExt
           final TrackingPathMacroSubstitutor macroSubstitutor =
             ((ProjectEx)project).getStateStore().getStateStorageManager().getMacroSubstitutor();
           if (macroSubstitutor != null) {
-            final Collection<String> macros = macroSubstitutor.getUnknownMacros(null);
-            if (!macros.isEmpty()) {
-              Notifications.Bus.notify(new UnknownMacroNotification("Load Error", "Project loading error: undefined path variables!",
-                                                        String.format("<p><i>%s</i> %s undefined. <a href=\"\">Fix it!</a></p>",
-                                                                      StringUtil.join(macros, ", "), macros.size() == 1 ? "is" : "are"),
-                                                        NotificationType.ERROR,
-                                                        new NotificationListener() {
-                                                          public void hyperlinkUpdate(@NotNull Notification notification,
-                                                                                      @NotNull HyperlinkEvent event) {
-                                                            ((ProjectEx)project).checkUnknownMacros();
-                                                          }
-                                                        }, macros), NotificationDisplayType.STICKY_BALLOON, project);
-            }
+            StorageUtil.notifyUnknownMacros(macroSubstitutor, project, null);
           }
         }
       });
index 96360e6b9c5e18387a44e462c0181f7ab2a3b279..4ab79a4c9cc35a4f387d14d9d688a86a3f5df369 100644 (file)
@@ -26,6 +26,9 @@ package com.intellij.openapi.updateSettings.impl;
 
 import com.intellij.ide.IdeBundle;
 import com.intellij.ide.reporter.ConnectionException;
+import com.intellij.notification.Notification;
+import com.intellij.notification.NotificationType;
+import com.intellij.notification.Notifications;
 import com.intellij.openapi.application.ApplicationInfo;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.application.PathManager;
@@ -407,13 +410,17 @@ public final class UpdateChecker {
           result[0] = DownloadPatchResult.SUCCESS;
         }
         catch (final IOException e) {
+          LOG.info(e);
+          result[0] = DownloadPatchResult.FAILED;
+
           SwingUtilities.invokeLater(new Runnable() {
             public void run() {
-              Messages.showErrorDialog(e.getMessage(), "Failed to download patch file");
+              Notifications.Bus.notify(new Notification("Updater", 
+                                                        "Failed to download patch file",
+                                                        e.getMessage(),
+                                                        NotificationType.ERROR));
             }
           });
-          LOG.info(e);
-          result[0] = DownloadPatchResult.FAILED;
         }
       }
     }, IdeBundle.message("update.downloading.patch.progress.title"), true, null)) {
index 5a61075032e2855f8bfc9358606068938f770ecf..48a66d5bdad5f1a49080b1de2d61ae0c6f50c6bd 100644 (file)
@@ -22,6 +22,7 @@ package com.intellij.openapi.vfs.impl.local;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.application.PathManager;
 import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.util.Pair;
 import com.intellij.openapi.util.SystemInfo;
 import com.intellij.openapi.util.io.FileUtil;
 import com.intellij.openapi.vfs.VirtualFile;
@@ -32,9 +33,7 @@ import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.Nullable;
 
 import java.io.*;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
+import java.util.*;
 
 public class FileWatcher {
   @NonNls public static final String PROPERTY_WATCHER_DISABLED = "filewatcher.disabled";
@@ -46,6 +45,7 @@ public class FileWatcher {
   @NonNls private static final String RESET_COMMAND = "RESET";
   @NonNls private static final String UNWATCHEABLE_COMMAND = "UNWATCHEABLE";
   @NonNls private static final String ROOTS_COMMAND = "ROOTS";
+  @NonNls private static final String REMAP_COMMAND = "REMAP";
   @NonNls private static final String EXIT_COMMAND = "EXIT";
 
   private final Object LOCK = new Object();
@@ -53,6 +53,7 @@ public class FileWatcher {
   private List<String> myDirtyRecursivePaths = new ArrayList<String>();
   private List<String> myDirtyDirs = new ArrayList<String>();
   private List<String> myManualWatchRoots = new ArrayList<String>();
+  private List<Pair<String, String>> myMapping = new ArrayList<Pair<String, String>>();
 
   private List<String> myRecursiveWatchRoots = new ArrayList<String>();
   private List<String> myFlatWatchRoots = new ArrayList<String>();
@@ -137,6 +138,8 @@ public class FileWatcher {
 
         if (isAlive()) {
           writeLine(ROOTS_COMMAND);
+          myMapping.clear();
+
           for (String path : recursive) {
             writeLine(path);
           }
@@ -255,6 +258,21 @@ public class FileWatcher {
 
             setManualWatchRoots(roots);
           }
+          else if (REMAP_COMMAND.equals(command)) {
+            Set<Pair<String, String>> pairs = new HashSet<Pair<String, String>>();
+            do {
+              final String pathA = readLine();
+              if (pathA == null || "#".equals(pathA)) break;
+              final String pathB = readLine();
+              if (pathB == null || "#".equals(pathB)) break;
+
+              pairs.add(new Pair<String, String>(ensureEndsWithSlash(pathA), ensureEndsWithSlash(pathB)));
+            }
+            while (true);
+
+            myMapping.clear();
+            myMapping.addAll(pairs);
+          }
           else {
             String path = readLine();
             if (path == null) {
@@ -285,6 +303,11 @@ public class FileWatcher {
     }
   }
 
+  private String ensureEndsWithSlash(String path) {
+    if (path.endsWith("/") || path.endsWith(File.separator)) return path;
+    return path + '/';
+  }
+
   private void writeLine(String line) throws IOException {
     try {
       if (LOG.isDebugEnabled()) {
@@ -342,26 +365,26 @@ public class FileWatcher {
       switch (changeKind) {
         case STATS:
         case CHANGE:
-          myDirtyPaths.add(path);
+          addPath(path, myDirtyPaths);
           break;
 
         case CREATE:
         case DELETE:
           final File parentFile = new File(path).getParentFile();
           if (parentFile != null) {
-            myDirtyPaths.add(parentFile.getPath());
+            addPath(parentFile.getPath(), myDirtyPaths);
           }
           else {
-            myDirtyPaths.add(path);
+            addPath(path, myDirtyPaths);
           }
           break;
 
         case DIRTY:
-          myDirtyDirs.add(path);
+          addPath(path, myDirtyDirs);
           break;
 
         case RECDIRTY:
-          myDirtyRecursivePaths.add(path);
+          addPath(path, myDirtyRecursivePaths);
           break;
 
         case RESET:
@@ -371,6 +394,19 @@ public class FileWatcher {
     }
   }
 
+  private void addPath(String path, List<String> list) {
+    list.add(path);
+
+    for (Pair<String, String> map : myMapping) {
+      if (FileUtil.startsWith(path, map.getFirst())) {
+        list.add(map.getSecond() + path.substring(map.getFirst().length()));
+      }
+      else if (FileUtil.startsWith(path, map.getSecond())) {
+        list.add(map.getFirst() + path.substring(map.getSecond().length()));
+      }
+    }
+  }
+
   private void reset() {
     final ManagingFS fs = ManagingFS.getInstance();
     synchronized (LOCK) {
index 0c6013fd4912a90b73e8e5e2eda955d876dd6b31..f43767a88e51840b62a1d84fab131d352b45771a 100644 (file)
@@ -36,7 +36,7 @@ public class MockProject extends MockComponentManager implements ProjectEx {
     return false;
   }
 
-  public void checkUnknownMacros() {
+  public void checkUnknownMacros(final boolean showDialog) {
   }
 
   @NotNull
index 10dd889ab6d0175ad97760ee0c0586cf0a104d24..1f45b6f6a85377e1b2d50f431d408dc8675ef5e3 100644 (file)
@@ -44,8 +44,10 @@ public class PeriodicalTasksCloser implements ProjectManagerListener {
   private final static Object ourLock = new Object();
   private final List<Pair<String, Runnable>> myInterrupters;
   private final static Map<Project, Boolean> myStates = new HashMap<Project, Boolean>();
+  private final Project myProject;
 
   private PeriodicalTasksCloser(final Project project, final ProjectManager projectManager) {
+    myProject = project;
     myInterrupters = new ArrayList<Pair<String, Runnable>>();
     projectManager.addProjectManagerListener(project, this);
   }
@@ -54,8 +56,14 @@ public class PeriodicalTasksCloser implements ProjectManagerListener {
     return ServiceManager.getService(project, PeriodicalTasksCloser.class);
   }
 
-  public void register(final String name, final Runnable runnable) {
-    myInterrupters.add(new Pair<String, Runnable>(name, runnable));
+  public boolean register(final String name, final Runnable runnable) {
+    synchronized (ourLock) {
+      if (Boolean.FALSE.equals(myStates.get(myProject))) {
+        return false;
+      }
+      myInterrupters.add(new Pair<String, Runnable>(name, runnable));
+      return true;
+    }
   }       
 
   public void projectOpened(Project project) {
@@ -81,7 +89,11 @@ public class PeriodicalTasksCloser implements ProjectManagerListener {
     ProgressManager.getInstance().runProcessWithProgressSynchronously(new Runnable() {
       public void run() {
         final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
-        for (Pair<String, Runnable> pair : myInterrupters) {
+        final List<Pair<String, Runnable>> list;
+        synchronized (ourLock) {
+          list = myInterrupters;
+        }
+        for (Pair<String, Runnable> pair : list) {
           if (indicator != null) {
             indicator.setText(pair.getFirst());
             indicator.checkCanceled();
index e15cab7c6fd9c563cec49f76ef380d9dbb80b07f..164c181955fe5d7edde8643bf0186ffb2d901e7c 100644 (file)
@@ -80,7 +80,7 @@ public class SlowlyClosingAlarm implements AtomicSectionsAware, Disposable {
     myLock = new Object();
     myFutureList = new ArrayList<Future<?>>();
     Disposer.register(project, this);
-    PeriodicalTasksCloser.getInstance(project).register(name, new Runnable() {
+    myDisposeStarted = ! PeriodicalTasksCloser.getInstance(project).register(name, new Runnable() {
       public void run() {
         waitAndInterrupt(ProgressManager.getInstance().getProgressIndicator());
       }
index 2d9d21ab385ab18fc1cbc74791b8452cd9e5e816..9026e98f86a99ef396940f71b0fc35521b46944d 100644 (file)
@@ -162,7 +162,9 @@ public class ApplyPatchAction extends AnAction {
   private static ApplyPatchStatus showMergeDialog(Project project, VirtualFile file, CharSequence content, final String patchedContent,
                                                   final PatchMergeRequestFactory mergeRequestFactory) {
     CharSequence fileContent = LoadTextUtil.loadText(file);
-
+    if (fileContent == null || content == null) {
+      return ApplyPatchStatus.FAILURE;
+    }
     final MergeRequest request = mergeRequestFactory.createMergeRequest(fileContent.toString(), patchedContent, content.toString(), file,
                                                       project);
     DiffManager.getInstance().getDiffTool().show(request);
index 9727b21565cbb6dce8ecc81fd090cb064e976f00..87c4eec435857f6818f4b960ff17e4283041052a 100644 (file)
@@ -159,6 +159,11 @@ public class ApplyPatchDifferentiatedDialog extends DialogWrapper {
     return "vcs.ApplyPatchDifferentiatedDialog";
   }
 
+  @Override
+  protected String getHelpId() {
+    return "reference.dialogs.vcs.patch.apply";
+  }
+
   private void setPathFileChangeDefault() {
     myRecentPathFileChange.set(new FilePresentation(myPatchFile.getText()));
   }
index d8f15f90a4328822cd68fe68cbd8d54c1b9edaac..3c5b6db9bd59abe0b37bb81f1523a13c777dbf7e 100644 (file)
@@ -140,7 +140,7 @@ public class QuickEditAction implements IntentionAction {
         final RangeMarker rangeMarker = document.createGuardedBlock(curOffset, start);
         if (curOffset == 0) rangeMarker.setGreedyToLeft(true);
       }
-      curOffset = end + 1;
+      curOffset = end;
     }
     if (curOffset < text.length()) {
       document.createGuardedBlock(curOffset, text.length()).setGreedyToRight(true);
index 7292471206ccf99f6bf0df1107b955814207d297..8098a46c93508334792fe07048af86dfda4e84c7 100644 (file)
@@ -55,8 +55,6 @@ public class MavenPropertyRenameHandler extends PsiElementRenameHandler {
   }
 
   private PsiElement findTarget(DataContext context) {
-    PsiElement target = MavenTargetUtil.getRefactorTarget(PlatformDataKeys.EDITOR.getData(context),
-                                                          LangDataKeys.PSI_FILE.getData(context));
-    return isVetoed(target) ? null : target;
+    return MavenTargetUtil.getRefactorTarget(PlatformDataKeys.EDITOR.getData(context), LangDataKeys.PSI_FILE.getData(context));
   }
 }
index 957cd95d05ac0112ccd6028000eacb9868fb3544..9ff7fd088cc99e59dd169444c7c53c7ab10bec64 100644 (file)
@@ -18,9 +18,10 @@ package org.jetbrains.idea.maven.dom.refactorings;
 import com.intellij.openapi.util.Condition;
 import com.intellij.psi.PsiElement;
 import org.jetbrains.idea.maven.dom.MavenDomUtil;
+import org.jetbrains.idea.maven.dom.references.MavenPsiElementWrapper;
 
 public class MavenVetoModelRenameCondition implements Condition<PsiElement> {
   public boolean value(PsiElement target) {
-    return MavenDomUtil.isMavenFile(target) && !MavenDomUtil.isMavenProperty(target);
+    return target instanceof MavenPsiElementWrapper || MavenDomUtil.isMavenFile(target);
   }
 }
index 1fad11be78b2570d5baad11fe6ac46499eaf7ab4..18ecd76db4b6ea064803fce057840623a6176c36 100644 (file)
@@ -28,7 +28,7 @@ import org.jetbrains.idea.maven.dom.MavenDomUtil;
 public class MavenTargetUtil {
   public static PsiElement getRefactorTarget(Editor editor, PsiFile file) {
     PsiElement target = getFindTarget(editor, file);
-    return target == null || !MavenDomUtil.isMavenFile(target) ? null : target;
+    return target == null || !MavenDomUtil.isMavenProperty(target) ? null : target;
   }
 
   public static PsiElement getFindTarget(Editor editor, PsiFile file) {
index 6c0850fb80a22d0e7dac8affe4d2bb30164199ee..ab2093c92f8547fd8450635ea3eb80688530144a 100644 (file)
@@ -499,7 +499,9 @@ public class MavenIndex {
   }
 
   private Iterable<File> getAllDataDirs() {
-    return ContainerUtil.iterate(myDir.listFiles(), new Condition<File>() {
+    File[] children = myDir.listFiles();
+    if (children == null) return ContainerUtil.emptyIterable();
+    return ContainerUtil.iterate(children, new Condition<File>() {
       public boolean value(File file) {
         return file.getName().startsWith(DATA_DIR_PREFIX);
       }
index 366328d2a9897bc28acac5134bdb201aa33abcad..cff9e8d818d24f6a8e4f9134d0f3d2c16a94d57d 100644 (file)
@@ -44,8 +44,8 @@
     <dom.fileDescription implementation="org.jetbrains.idea.maven.dom.MavenDomSettingsModelDescription"/>
     <dom.fileDescription implementation="org.jetbrains.idea.maven.dom.MavenDomPluginModelDescription"/>
 
-    <lang.documentationProvider language="XML" implementationClass="org.jetbrains.idea.maven.dom.MavenModelDocumentationProvider" id="mavenModel" order="first"/>
-    <lang.documentationProvider language="XML" implementationClass="org.jetbrains.idea.maven.dom.MavenPluginModelDocumentationProvider" order="after mavenModel"/>
+    <lang.documentationProvider language="XML" implementationClass="org.jetbrains.idea.maven.dom.MavenModelDocumentationProvider" order="first"/>
+    <lang.documentationProvider language="XML" implementationClass="org.jetbrains.idea.maven.dom.MavenPluginModelDocumentationProvider" order="first"/>
     <elementDescriptionProvider implementation="org.jetbrains.idea.maven.dom.MavenModelDocumentationProvider" order="first"/>
 
     <inspectionToolProvider implementation="org.jetbrains.idea.maven.dom.MavenModelInspection"/>
index 87910bbf7cc64752b42df49d4dc061ffa358387b..beff36b2da045141f895ce9330a726569ce5c77e 100644 (file)
@@ -37,6 +37,7 @@ import com.intellij.openapi.module.Module;
 import com.intellij.openapi.options.SettingsEditor;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.ui.LabeledComponent;
+import com.intellij.openapi.ui.Messages;
 import com.intellij.openapi.ui.TextFieldWithBrowseButton;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.psi.PsiClass;
@@ -45,6 +46,7 @@ import com.intellij.ui.table.TableView;
 import com.theoryinpractice.testng.configuration.browser.*;
 import com.theoryinpractice.testng.model.*;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 import org.testng.TestNG;
 
 import javax.swing.*;
@@ -417,6 +419,7 @@ public class TestNGConfigurationEditor extends SettingsEditor<TestNGConfiguratio
       }
     }
 
+    @Nullable
     protected GlobalSearchScope getSearchScope(Module[] modules) {
       if (modules == null || modules.length == 0) return null;
       GlobalSearchScope scope = GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(modules[0]);
@@ -426,8 +429,14 @@ public class TestNGConfigurationEditor extends SettingsEditor<TestNGConfiguratio
       return scope;
     }
 
+    @Nullable
     protected String selectListenerClass() {
-      TestListenerFilter filter = new TestListenerFilter(getSearchScope(config.getModules()), project);
+      final GlobalSearchScope searchScope = getSearchScope(config.getModules());
+      if (searchScope == null) {
+        Messages.showErrorDialog(panel, "Module is not selected", "Can't Browse Listeners");
+        return null;
+      }
+      final TestListenerFilter filter = new TestListenerFilter(searchScope, project);
 
       TreeClassChooser chooser = TreeClassChooserFactory.getInstance(project).createWithInnerClassesScopeChooser("Choose Listener Class", filter.getScope(), filter, null);
       chooser.showDialog();
index 6926d071978bbcfc797d18278c9968dc5163eb62..459eec27c0f6af0a836dc8a95eb3101a19be91bc 100644 (file)
@@ -19,7 +19,6 @@ import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.util.Ref;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.patterns.ElementPattern;
-import static com.intellij.patterns.XmlPatterns.*;
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.xml.XmlAttribute;
 import com.intellij.psi.xml.XmlDocument;
@@ -43,6 +42,8 @@ import org.jetbrains.annotations.Nullable;
 import java.util.Collection;
 import java.util.Set;
 
+import static com.intellij.patterns.XmlPatterns.*;
+
 /**
  * @author peter
  */
@@ -80,7 +81,7 @@ public class DomSemContributor extends SemContributor {
       }
     });
 
-    final ElementPattern<XmlTag> nonRootTag = xmlTag().withParent(xmlTag());
+    final ElementPattern<XmlTag> nonRootTag = xmlTag().withParent(or(xmlTag(), xmlEntityRef().withParent(xmlTag())));
     registrar.registerSemElementProvider(DomManagerImpl.DOM_INDEXED_HANDLER_KEY, nonRootTag, new NullableFunction<XmlTag, IndexedElementInvocationHandler>() {
       public IndexedElementInvocationHandler fun(XmlTag tag) {
         final XmlTag parentTag = PhysicalDomParentStrategy.getParentTag(tag);
index 9ae10ab8eadc66955492ebc121f102f28fdadaee..d89aa4edab2557a189330a746c39b9d79848ae16 100644 (file)
@@ -231,19 +231,21 @@ public class ExternalResourceConfigurable extends BaseConfigurable implements Se
 
   private static class PathRenderer extends DefaultTableCellRenderer {
     public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
-      super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
-      String loc = value.toString().replace('\\', '/');
-      final int jarDelimIndex = loc.indexOf(JarFileSystem.JAR_SEPARATOR);
-      final VirtualFile path;
-
-      if (jarDelimIndex != -1) {
-        path = JarFileSystem.getInstance().findFileByPath(loc);
-      } else {
-        path = LocalFileSystem.getInstance().findFileByPath(loc);
+      final Component rendererComponent = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
+      if (value != null) {
+        String loc = value.toString().replace('\\', '/');
+        final int jarDelimIndex = loc.indexOf(JarFileSystem.JAR_SEPARATOR);
+        final VirtualFile path;
+
+        if (jarDelimIndex != -1) {
+          path = JarFileSystem.getInstance().findFileByPath(loc);
+        } else {
+          path = LocalFileSystem.getInstance().findFileByPath(loc);
+        }
+
+        setForeground(path != null ? isSelected ? UIUtil.getTableSelectionForeground() : Color.black : new Color(210, 0, 0));
       }
-
-      setForeground(path != null ? isSelected ? UIUtil.getTableSelectionForeground() : Color.black : new Color(210, 0, 0));
-      return this;
+      return rendererComponent;
     }
   }
 
index 2a921406a9879b877be60f775255c6a55111c36d..611bb40c5e9607f46b30b6853bb39e52d65a335f 100644 (file)
@@ -16,6 +16,7 @@
 package com.intellij.patterns;
 
 import com.intellij.psi.xml.XmlElement;
+import com.intellij.psi.xml.XmlEntityRef;
 import com.intellij.psi.xml.XmlText;
 import com.intellij.util.ProcessingContext;
 import org.jetbrains.annotations.NotNull;
@@ -53,4 +54,14 @@ public class XmlElementPattern<T extends XmlElement,Self extends XmlElementPatte
     }
   }
 
+  public static class XmlEntityRefPattern extends XmlElementPattern<XmlEntityRef, XmlEntityRefPattern> {
+    public XmlEntityRefPattern() {
+      super(new InitialPatternCondition<XmlEntityRef>(XmlEntityRef.class) {
+        public boolean accepts(@Nullable final Object o, final ProcessingContext context) {
+          return o instanceof XmlEntityRef;
+        }
+      });
+    }
+  }
+
 }
index a675bc410c6cb6016ef82a8b1216f4cd520d034f..5f449f26bc836192ee9574b767938a2686e6c877 100644 (file)
@@ -49,4 +49,8 @@ public class XmlPatterns extends PlatformPatterns {
   public static XmlElementPattern.XmlTextPattern xmlText() {
     return new XmlElementPattern.XmlTextPattern();
   }
+
+  public static XmlElementPattern.XmlEntityRefPattern xmlEntityRef() {
+    return new XmlElementPattern.XmlEntityRefPattern();
+  }
 }