IDEA-25204: Can't find usages of filter or servlet
authorDmitry Avdeev <Dmitry.Avdeev@jetbrains.com>
Fri, 5 Mar 2010 10:02:36 +0000 (13:02 +0300)
committerDmitry Avdeev <Dmitry.Avdeev@jetbrains.com>
Fri, 5 Mar 2010 10:02:36 +0000 (13:02 +0300)
platform/lang-impl/src/com/intellij/find/findUsages/FindUsagesManager.java
platform/lang-impl/src/com/intellij/psi/impl/PomTargetPsiElementImpl.java
xml/dom-impl/src/com/intellij/util/xml/impl/GenericDomValueReference.java
xml/dom-impl/src/com/intellij/util/xml/impl/GenericValueReferenceProvider.java
xml/dom-openapi/src/com/intellij/util/xml/DomResolveConverter.java
xml/impl/src/com/intellij/psi/impl/source/xml/XmlElementImpl.java

index 9095d209e5c393b37dbc7c60223bb07542652dd4..44d4cb0407e21c046c17d63598066baf660d0083 100644 (file)
@@ -114,10 +114,6 @@ public class FindUsagesManager implements JDOMExternalizable {
     myAnotherManager = anotherManager;
   }
 
-  /**
-   * @param handler
-   * @deprecated use extension point instead
-   */
   public void registerFindUsagesHandler(FindUsagesHandlerFactory handler) {
     myHandlers.add(0, handler);
   }
@@ -641,4 +637,4 @@ public class FindUsagesManager implements JDOMExternalizable {
     }
   }
 
-}
\ No newline at end of file
+}
index 085a802a8cf7613604541b1b6a2d3bebe286ec30..3b9cbca74937a23927959fd12f7dab019a3838e7 100644 (file)
@@ -70,6 +70,15 @@ public class PomTargetPsiElementImpl extends RenameableFakePsiElement implements
     throw new UnsupportedOperationException("Method getTypeName is not yet implemented for " + myTarget.getClass().getName() + "; see PomDescriptionProvider");
   }
 
+  @NotNull
+  @Override
+  public PsiElement getNavigationElement() {
+    if (myTarget instanceof PsiTarget) {
+      return ((PsiTarget)myTarget).getNavigationElement();
+    }
+    return super.getNavigationElement();  
+  }
+
   public Icon getIcon() {
     for (IconProvider iconProvider : IconProvider.EXTENSION_POINT_NAME.getExtensions()) {
       if (iconProvider instanceof PomIconProvider) {
index 52ec66d3b4805186bb4c725b1f789bd20a1e3ee6..44f1e4c78542cf383b05551fedbfe59189de5d17 100644 (file)
 package com.intellij.util.xml.impl;
 
 import com.intellij.codeInsight.daemon.EmptyResolveMessageProvider;
-import com.intellij.codeInsight.lookup.LookupValueFactory;
 import com.intellij.codeInsight.lookup.LookupElement;
+import com.intellij.codeInsight.lookup.LookupValueFactory;
 import com.intellij.openapi.util.TextRange;
+import com.intellij.pom.references.PomService;
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.PsiManager;
 import com.intellij.psi.PsiReferenceBase;
@@ -87,7 +88,8 @@ public class GenericDomValueReference<T> extends PsiReferenceBase<XmlElement> im
       return (PsiElement)o;
     }
     if (o instanceof DomElement) {
-      return ((DomElement)o).getXmlElement();
+      DomTarget target = DomTarget.getTarget((DomElement)o);
+      return target == null ? null : PomService.convertToPsi(target);
     }
     if (o instanceof MergedObject) {
       final List<T> list = ((MergedObject<T>)o).getImplementations();
index 4f859ff5ce1e35ab01db1d6f26d84a4525e460cd..4a9a36133de60678bf6e8af692f079c0da473f81 100644 (file)
@@ -25,6 +25,7 @@ import com.intellij.util.ArrayUtil;
 import com.intellij.util.ProcessingContext;
 import com.intellij.util.ReflectionCache;
 import com.intellij.util.xml.*;
+import com.intellij.pom.references.PomService;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -103,7 +104,10 @@ public class GenericValueReferenceProvider extends PsiReferenceProvider {
       if (nameValue != null && nameValue.referencable()) {
         DomElement parent = domElement.getParent();
         assert parent != null;
-        references = ArrayUtil.append(references, PsiReferenceBase.createSelfReference(psiElement, parent.getXmlElement()), PsiReference.class);
+        final DomTarget target = DomTarget.getTarget(parent);
+        if (target != null) {
+          references = ArrayUtil.append(references, PsiReferenceBase.createSelfReference(psiElement, PomService.convertToPsi(target)), PsiReference.class);
+        }
       }
     }
     return references;
index d865735cbcc12103fde36456636b6b2fb958f5eb..524ce448691c8caf27b5022c1cc444d10f8f45ae 100644 (file)
@@ -18,7 +18,8 @@ package com.intellij.util.xml;
 import com.intellij.codeInsight.CodeInsightBundle;
 import com.intellij.codeInspection.LocalQuickFix;
 import com.intellij.openapi.project.Project;
-import com.intellij.psi.PsiManager;
+import com.intellij.pom.references.PomService;
+import com.intellij.psi.PsiElement;
 import com.intellij.psi.util.CachedValue;
 import com.intellij.psi.util.CachedValueProvider;
 import com.intellij.psi.util.CachedValuesManager;
@@ -29,6 +30,7 @@ import com.intellij.util.containers.SoftFactoryMap;
 import com.intellij.util.xml.highlighting.ResolvingElementQuickFix;
 import gnu.trove.THashMap;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
 import java.util.Collection;
 import java.util.Map;
@@ -93,6 +95,13 @@ public class DomResolveConverter<T extends DomElement> extends ResolvingConverte
     return (T) myResolveCache.get(getResolvingScope(context)).getValue().get(s);
   }
 
+  @Override
+  public PsiElement getPsiElement(@Nullable T resolvedValue) {
+    if (resolvedValue == null) return null;
+    DomTarget target = DomTarget.getTarget(resolvedValue);
+    return target == null ? super.getPsiElement(resolvedValue) : PomService.convertToPsi(target);
+  }
+
   private static DomElement getResolvingScope(final ConvertContext context) {
     final DomElement invocationElement = context.getInvocationElement();
     return invocationElement.getManager().getResolvingScope((GenericDomValue)invocationElement);
index a61850106e2b205ded42158cddeec0f3ffe04901..20969bc4a04778c07cd4bfb34b26db9357a52467 100644 (file)
@@ -129,6 +129,8 @@ public abstract class XmlElementImpl extends CompositePsiElement implements XmlE
 
   @Override
   public boolean isEquivalentTo(final PsiElement another) {
+
+    if (super.isEquivalentTo(another)) return true;
     PsiElement element1 = this;
     PsiElement element2 = another;