diff --git a/src/com/magento/idea/magento2plugin/reference/provider/PluginReferenceProvider.java b/src/com/magento/idea/magento2plugin/reference/provider/PluginReferenceProvider.java index 272ab4790..ae1be9ec1 100644 --- a/src/com/magento/idea/magento2plugin/reference/provider/PluginReferenceProvider.java +++ b/src/com/magento/idea/magento2plugin/reference/provider/PluginReferenceProvider.java @@ -12,6 +12,7 @@ import com.intellij.psi.PsiReference; import com.intellij.psi.PsiReferenceProvider; import com.intellij.psi.search.GlobalSearchScope; +import com.intellij.psi.xml.XmlAttribute; import com.intellij.psi.xml.XmlTag; import com.intellij.util.ProcessingContext; import com.magento.idea.magento2plugin.indexes.PluginIndex; @@ -47,9 +48,9 @@ public class PluginReferenceProvider extends PsiReferenceProvider { final XmlTag typeTag = (XmlTag) type.getParent().getParent(); final XmlTag[] pluginTags = typeTag.findSubTags("plugin"); for (final XmlTag pluginTag: pluginTags) { - final String pluginName = pluginTag.getAttribute("name").getValue(); - if (pluginName.equals(originalPluginName)) { - psiElements.add(pluginTag); + final XmlAttribute pluginNameAttribute = pluginTag.getAttribute("name"); + if (pluginNameAttribute.getValue().equals(originalPluginName)) { + psiElements.add(pluginNameAttribute.getValueElement()); } } } diff --git a/testData/reference/xml/DisabledPluginReferenceRegistrar/disabledPluginNameMustHaveReference/di.xml b/testData/reference/xml/DisabledPluginReferenceRegistrar/disabledPluginNameMustHaveReference/di.xml new file mode 100644 index 000000000..51c95b309 --- /dev/null +++ b/testData/reference/xml/DisabledPluginReferenceRegistrar/disabledPluginNameMustHaveReference/di.xml @@ -0,0 +1,13 @@ + + + + + + + diff --git a/tests/com/magento/idea/magento2plugin/reference/xml/DisabledPluginReferenceRegistrarTest.java b/tests/com/magento/idea/magento2plugin/reference/xml/DisabledPluginReferenceRegistrarTest.java new file mode 100644 index 000000000..5e7a08fe8 --- /dev/null +++ b/tests/com/magento/idea/magento2plugin/reference/xml/DisabledPluginReferenceRegistrarTest.java @@ -0,0 +1,17 @@ +/* + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +package com.magento.idea.magento2plugin.reference.xml; + +import com.magento.idea.magento2plugin.magento.files.ModuleDiXml; + +public class DisabledPluginReferenceRegistrarTest extends ReferenceXmlFixtureTestCase { + public void testDisabledPluginNameMustHaveReference() { + String filePath = this.getFixturePath(ModuleDiXml.FILE_NAME); + myFixture.configureByFile(filePath); + + assertHasReferenceToXmlAttributeValue("catalogTopmenu"); + } +}