mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
allow showing usages of pom target (not only PsiNameIdentifierOwner)
This commit is contained in:
@@ -85,7 +85,6 @@ import com.intellij.usageView.UsageViewTypeLocation;
|
||||
import com.intellij.usageView.UsageViewUtil;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.Processor;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import gnu.trove.TIntArrayList;
|
||||
import org.intellij.lang.annotations.JdkConstants;
|
||||
@@ -597,9 +596,9 @@ public class CtrlMouseHandler extends AbstractProjectComponent {
|
||||
}
|
||||
}
|
||||
|
||||
final PsiNameIdentifierOwner element = GotoDeclarationAction.findElementToShowUsagesOf(editor, offset);
|
||||
if (element != null) {
|
||||
PsiElement identifier = element.getNameIdentifier();
|
||||
final PsiElement element = GotoDeclarationAction.findElementToShowUsagesOf(editor, offset);
|
||||
if (element instanceof PsiNameIdentifierOwner) {
|
||||
PsiElement identifier = ((PsiNameIdentifierOwner)element).getNameIdentifier();
|
||||
if (identifier != null && identifier.isValid()) {
|
||||
return new Info(identifier){
|
||||
@Override
|
||||
|
||||
+6
-8
@@ -53,7 +53,10 @@ import com.intellij.openapi.ui.popup.JBPopupFactory;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.pom.Navigatable;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiReference;
|
||||
import com.intellij.psi.search.PsiElementProcessor;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.PsiUtilCore;
|
||||
@@ -156,13 +159,8 @@ public class GotoDeclarationAction extends BaseCodeInsightAction implements Code
|
||||
}, progressTitle, true, project);
|
||||
}
|
||||
|
||||
public static PsiNameIdentifierOwner findElementToShowUsagesOf(@NotNull Editor editor, int offset) {
|
||||
PsiElement elementAt = TargetElementUtil.getInstance().findTargetElement(editor, TargetElementUtil.ELEMENT_NAME_ACCEPTED, offset);
|
||||
if (elementAt instanceof PsiNameIdentifierOwner) {
|
||||
LOG.assertTrue(elementAt.isValid(), elementAt);
|
||||
return (PsiNameIdentifierOwner)elementAt;
|
||||
}
|
||||
return null;
|
||||
public static PsiElement findElementToShowUsagesOf(@NotNull Editor editor, int offset) {
|
||||
return TargetElementUtil.getInstance().findTargetElement(editor, TargetElementUtil.ELEMENT_NAME_ACCEPTED, offset);
|
||||
}
|
||||
|
||||
private static void chooseAmbiguousTarget(final Editor editor, int offset, PsiElement[] elements, PsiFile currentFile) {
|
||||
|
||||
Reference in New Issue
Block a user