File tree Expand file tree Collapse file tree 3 files changed +37
-3
lines changed
src/com/magento/idea/magento2plugin/reference/provider
testData/reference/xml/DisabledPluginReferenceRegistrar/disabledPluginNameMustHaveReference
tests/com/magento/idea/magento2plugin/reference/xml Expand file tree Collapse file tree 3 files changed +37
-3
lines changed Original file line number Diff line number Diff line change 1212import com .intellij .psi .PsiReference ;
1313import com .intellij .psi .PsiReferenceProvider ;
1414import com .intellij .psi .search .GlobalSearchScope ;
15+ import com .intellij .psi .xml .XmlAttribute ;
1516import com .intellij .psi .xml .XmlTag ;
1617import com .intellij .util .ProcessingContext ;
1718import com .magento .idea .magento2plugin .indexes .PluginIndex ;
@@ -47,9 +48,9 @@ public class PluginReferenceProvider extends PsiReferenceProvider {
4748 final XmlTag typeTag = (XmlTag ) type .getParent ().getParent ();
4849 final XmlTag [] pluginTags = typeTag .findSubTags ("plugin" );
4950 for (final XmlTag pluginTag : pluginTags ) {
50- final String pluginName = pluginTag .getAttribute ("name" ). getValue ( );
51- if (pluginName .equals (originalPluginName )) {
52- psiElements .add (pluginTag );
51+ final XmlAttribute pluginNameAttribute = pluginTag .getAttribute ("name" );
52+ if (pluginNameAttribute . getValue () .equals (originalPluginName )) {
53+ psiElements .add (pluginNameAttribute . getValueElement () );
5354 }
5455 }
5556 }
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" ?>
2+ <!--
3+ /**
4+ * Copyright © Magento, Inc. All rights reserved.
5+ * See COPYING.txt for license details.
6+ */
7+ -->
8+ <config xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
9+ xsi : noNamespaceSchemaLocation =" urn:magento:framework:ObjectManager/etc/config.xsd" >
10+ <type name =" Magento\Theme\Block\Html\Topmenu" >
11+ <plugin name =" catalogTopmenu<caret>" disabled =" true" />
12+ </type >
13+ </config >
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright © Magento, Inc. All rights reserved.
3+ * See COPYING.txt for license details.
4+ */
5+
6+ package com .magento .idea .magento2plugin .reference .xml ;
7+
8+ import com .magento .idea .magento2plugin .magento .files .ModuleDiXml ;
9+
10+ public class DisabledPluginReferenceRegistrarTest extends ReferenceXmlFixtureTestCase {
11+
12+ /**
13+ * Tests for disabled plugin name reference to original definition.
14+ */
15+ public void testDisabledPluginNameMustHaveReference () {
16+ myFixture .configureByFile (this .getFixturePath (ModuleDiXml .FILE_NAME ));
17+
18+ assertHasReferenceToXmlAttributeValue ("catalogTopmenu" );
19+ }
20+ }
You can’t perform that action at this time.
0 commit comments