mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[dev kit] process only exactly matched references in StatefulEpInspection
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,6 +16,7 @@
|
||||
package org.jetbrains.idea.devkit.util;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
@@ -23,6 +24,7 @@ import com.intellij.psi.search.PsiNonJavaFileReferenceProcessor;
|
||||
import com.intellij.psi.search.PsiSearchHelper;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.xml.XmlTag;
|
||||
import com.intellij.psi.xml.XmlToken;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.util.xml.DomElement;
|
||||
import com.intellij.util.xml.DomService;
|
||||
@@ -101,7 +103,10 @@ public class ExtensionPointLocator {
|
||||
return !PsiSearchHelper.SERVICE.getInstance(project).processUsagesInNonJavaFiles(name, new PsiNonJavaFileReferenceProcessor() {
|
||||
@Override
|
||||
public boolean process(PsiFile file, int startOffset, int endOffset) {
|
||||
XmlTag tag = PsiTreeUtil.getParentOfType(file.findElementAt(startOffset), XmlTag.class);
|
||||
PsiElement at = file.findElementAt(startOffset);
|
||||
String tokenText = at instanceof XmlToken ? at.getText() : null;
|
||||
if (!StringUtil.equals(name, tokenText)) return true;
|
||||
XmlTag tag = PsiTreeUtil.getParentOfType(at, XmlTag.class);
|
||||
if (tag == null) return true;
|
||||
DomElement dom = DomUtil.getDomElement(tag);
|
||||
return !(dom instanceof Extension && ((Extension)dom).getExtensionPoint() != null);
|
||||
|
||||
@@ -9,4 +9,8 @@ public class NonFix {
|
||||
r =null;
|
||||
p = pf = null;
|
||||
}
|
||||
|
||||
public static class Ext2 {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@
|
||||
</extensionPoints>
|
||||
<extensions>
|
||||
<ep implementation="Ext"/>
|
||||
<ep implementation="NonFix$Ext2"/>
|
||||
<ep implementation="ProjectComp"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -41,6 +41,7 @@ public class StatefulEpInspectionTest extends PluginModuleTestCase {
|
||||
}
|
||||
|
||||
public void testNonFix() {
|
||||
setPluginXml("plugin.xml");
|
||||
myFixture.testHighlighting("NonFix.java");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user