Skip to content

Commit 364ba65

Browse files
author
Vitaliy Boyko
committed
Refactoring
1 parent 74bafbc commit 364ba65

File tree

3 files changed

+10
-18
lines changed

3 files changed

+10
-18
lines changed

src/com/magento/idea/magento2plugin/completion/xml/XmlCompletionContributor.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,6 @@ public XmlCompletionContributor() {
7171
new PhpClassCompletionProvider()
7272
);
7373

74-
// <frontend_model>completion</frontend_model>
75-
extend(CompletionType.BASIC,
76-
psiElement(XmlTokenType.XML_DATA_CHARACTERS)
77-
.inside(XmlPatterns.xmlTag().withName(SystemXml.XML_TAG_FRONTEND_MODEL)),
78-
new PhpClassCompletionProvider()
79-
);
80-
8174
/* File Path Completion provider */
8275
extend(CompletionType.BASIC, psiElement(XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN)
8376
.inside(XmlPatterns.xmlAttribute().withName(LayoutXml.XML_ATTRIBUTE_TEMPLATE)),
@@ -112,12 +105,19 @@ public XmlCompletionContributor() {
112105

113106
// <source_model>php class completion</source_model> in system.xml files.
114107
extend(CompletionType.BASIC, psiElement(XmlTokenType.XML_DATA_CHARACTERS)
115-
.inside(XmlPatterns.xmlTag().withName(ModuleSystemXml.SOURCE_MODEL_ELEMENT_NAME)
108+
.inside(XmlPatterns.xmlTag().withName(ModuleSystemXml.XML_TAG_SOURCE_MODEL)
116109
.withParent(XmlPatterns.xmlTag().withName(ModuleSystemXml.FIELD_ELEMENT_NAME))
117110
).inFile(xmlFile().withName(string().endsWith(ModuleSystemXml.FILE_NAME))),
118111
new PhpClassCompletionProvider()
119112
);
120113

114+
// <frontend_model>completion</frontend_model>
115+
extend(CompletionType.BASIC,
116+
psiElement(XmlTokenType.XML_DATA_CHARACTERS)
117+
.inside(XmlPatterns.xmlTag().withName(ModuleSystemXml.XML_TAG_FRONTEND_MODEL)),
118+
new PhpClassCompletionProvider()
119+
);
120+
121121
// <parameter source_model="completion">...</parameter> in widget.xml files.
122122
extend(CompletionType.BASIC, psiElement(XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN)
123123
.inside(XmlPatterns.xmlAttribute().withName(ModuleWidgetXml.ATTRIBUTE_SOURCE_MODEL_NAME)

src/com/magento/idea/magento2plugin/magento/files/ModuleSystemXml.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
public class ModuleSystemXml {
88
public static final String FILE_NAME = "system.xml";
99
public static final String FIELD_ELEMENT_NAME = "field";
10-
public static final String SOURCE_MODEL_ELEMENT_NAME = "source_model";
10+
public static final String XML_TAG_SOURCE_MODEL = "source_model";
11+
public static final String XML_TAG_FRONTEND_MODEL = "frontend_model";
1112
}

src/com/magento/idea/magento2plugin/magento/files/SystemXml.java

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)