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 12
12
import com .intellij .psi .PsiReference ;
13
13
import com .intellij .psi .PsiReferenceProvider ;
14
14
import com .intellij .psi .search .GlobalSearchScope ;
15
+ import com .intellij .psi .xml .XmlAttribute ;
15
16
import com .intellij .psi .xml .XmlTag ;
16
17
import com .intellij .util .ProcessingContext ;
17
18
import com .magento .idea .magento2plugin .indexes .PluginIndex ;
@@ -47,9 +48,9 @@ public class PluginReferenceProvider extends PsiReferenceProvider {
47
48
final XmlTag typeTag = (XmlTag ) type .getParent ().getParent ();
48
49
final XmlTag [] pluginTags = typeTag .findSubTags ("plugin" );
49
50
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 () );
53
54
}
54
55
}
55
56
}
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