// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.pom;

import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiTarget;
import com.intellij.util.Processor;
import com.intellij.util.QueryExecutor;
import javax.annotation.Nonnull;

/**
 * @author Gregory.Shrago
 */
public class PomDefinitionSearch implements QueryExecutor<PsiElement, PsiElement> {
  @Override
  public boolean execute(@Nonnull PsiElement queryParameters, @Nonnull Processor<? super PsiElement> consumer) {
    if (queryParameters instanceof PomTargetPsiElement) {
      final PomTarget target = ((PomTargetPsiElement)queryParameters).getTarget();
      if (target instanceof PsiTarget) {
        if (!consumer.process(((PsiTarget)target).getNavigationElement())) return false;
      }
    }
    return true;
  }
}

@@ -232,16 +232,81 @@
 Target;%0A
+import com.intellij.psi.search.searches.DefinitionsScopedSearch;%0A
 import c
@@ -369,24 +369,25 @@
 ryExecutor;%0A
+%0A
 import javax
@@ -512,26 +512,56 @@
 lement, 
-PsiElement
+DefinitionsScopedSearch.SearchParameters
 %3E %7B%0A  @O
@@ -602,26 +602,56 @@
 Nonnull 
-PsiElement
+DefinitionsScopedSearch.SearchParameters
  queryPa
@@ -707,24 +707,94 @@
 consumer) %7B%0A
+    PsiElement queryParametersElement = queryParameters.getElement();%0A
     if (quer
@@ -804,16 +804,23 @@
 rameters
+Element
  instanc
@@ -914,16 +914,23 @@
 rameters
+Element
 ).getTar

fix cce