本文整理汇总了Java中com.intellij.patterns.XmlPatterns类的典型用法代码示例。如果您正苦于以下问题:Java XmlPatterns类的具体用法?Java XmlPatterns怎么用?Java XmlPatterns使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XmlPatterns类属于com.intellij.patterns包,在下文中一共展示了XmlPatterns类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: tagAttributeValuePattern
import com.intellij.patterns.XmlPatterns; //导入依赖的package包/类
/**
* <tagName attributeName="XmlAttributeValue">
*/
public static XmlAttributeValuePattern tagAttributeValuePattern(
String tagName,
String attributeName,
String fileName
) {
return XmlPatterns
.xmlAttributeValue()
.withParent(
XmlPatterns
.xmlAttribute(attributeName)
.withParent(
XmlPatterns
.xmlTag()
.withName(tagName)
)
).inside(
insideTagPattern(tagName)
).inFile(XmlPatterns.psiFile()
.withName(XmlPatterns.string().endsWith(fileName + ".xml")));
}
示例2: tagAttributePattern
import com.intellij.patterns.XmlPatterns; //导入依赖的package包/类
public static PsiElementPattern.Capture<PsiElement> tagAttributePattern(
String tag,
String attributeName,
String fileName
) {
return XmlPatterns
.psiElement()
.inside(XmlPatterns
.xmlAttributeValue()
.inside(XmlPatterns
.xmlAttribute()
.withName(attributeName)
.withParent(XmlPatterns
.xmlTag()
.withName(tag)
)
)
).inFile(getXmlFilePattern(fileName));
}
示例3: registerXmlAttributeValueReferenceProvider
import com.intellij.patterns.XmlPatterns; //导入依赖的package包/类
public static void registerXmlAttributeValueReferenceProvider(PsiReferenceRegistrar registrar,
@Nullable @NonNls String[] attributeNames,
@Nullable ElementFilter elementFilter,
boolean caseSensitive,
@NotNull PsiReferenceProvider provider,
double priority) {
if (attributeNames == null) {
registrar.registerReferenceProvider(XmlPatterns.xmlAttributeValue().and(new FilterPattern(elementFilter)), provider, priority);
return;
}
final StringPattern namePattern = caseSensitive
? StandardPatterns.string().oneOf(attributeNames)
: StandardPatterns.string().oneOfIgnoreCase(attributeNames);
registrar
.registerReferenceProvider(XmlPatterns.xmlAttributeValue().withLocalName(namePattern).and(new FilterPattern(elementFilter)), provider,
priority);
}
示例4: registerXmlTagReferenceProvider
import com.intellij.patterns.XmlPatterns; //导入依赖的package包/类
public static void registerXmlTagReferenceProvider(PsiReferenceRegistrar registrar,
@NonNls String[] names,
@Nullable ElementFilter elementFilter,
boolean caseSensitive,
@NotNull PsiReferenceProvider provider) {
if (names == null) {
registrar.registerReferenceProvider(XmlPatterns.xmlTag().and(new FilterPattern(elementFilter)), provider,
PsiReferenceRegistrar.DEFAULT_PRIORITY);
return;
}
final StringPattern namePattern =
caseSensitive ? StandardPatterns.string().oneOf(names) : StandardPatterns.string().oneOfIgnoreCase(names);
registrar.registerReferenceProvider(XmlPatterns.xmlTag().withLocalName(namePattern).and(new FilterPattern(elementFilter)), provider,
PsiReferenceRegistrar.DEFAULT_PRIORITY);
}
示例5: registerKeyProviders
import com.intellij.patterns.XmlPatterns; //导入依赖的package包/类
private static void registerKeyProviders(PsiReferenceRegistrar registrar) {
ElementPattern pattern = createPattern(EXTENSION_TAG_NAMES, "key", "groupKey");
registrar.registerReferenceProvider(pattern,
new PropertyKeyReferenceProvider(false, "groupKey", "groupBundle"),
PsiReferenceRegistrar.DEFAULT_PRIORITY);
ElementPattern typeNameKeyPattern = createPattern(TYPE_NAME_TAG, "resourceKey");
registrar.registerReferenceProvider(typeNameKeyPattern,
new PropertyKeyReferenceProvider(false, "resourceKey", "resourceBundle"),
PsiReferenceRegistrar.DEFAULT_PRIORITY);
final XmlTagPattern.Capture intentionActionKeyTagPattern =
XmlPatterns.xmlTag().withName("categoryKey").
withParent(XmlPatterns.xmlTag().withName(INTENTION_ACTION_TAG).
withSuperParent(2, XmlPatterns.xmlTag().withName("idea-plugin")));
registrar.registerReferenceProvider(intentionActionKeyTagPattern,
new PropertyKeyReferenceProvider(true, null, INTENTION_ACTION_BUNDLE_TAG));
}
示例6: XmlHaxelibCompletionContributor
import com.intellij.patterns.XmlPatterns; //导入依赖的package包/类
public XmlHaxelibCompletionContributor() {
HaxelibCache haxelibCache = HaxelibCache.getInstance();
availableHaxelibs = haxelibCache.getAvailableHaxelibs();
localHaxelibs = haxelibCache.getLocalHaxelibs();
extend(CompletionType.BASIC, PlatformPatterns.psiElement().inside(
XmlPatterns.xmlAttributeValue().withParent(XmlPatterns.xmlAttribute("name"))
.withSuperParent(2, XmlPatterns.xmlTag().withName("haxelib")).withLanguage(XMLLanguage.INSTANCE)),
new CompletionProvider<CompletionParameters>() {
@Override
protected void addCompletions(@NotNull CompletionParameters parameters,
ProcessingContext context,
@NotNull CompletionResultSet result) {
for (int i = 0; i < availableHaxelibs.size(); i++) {
result.addElement(LookupElementBuilder.create(availableHaxelibs.get(i))
.withTailText(" available at haxelib", true));
}
for (int i = 0; i < localHaxelibs.size(); i++) {
result.addElement(LookupElementBuilder.create(localHaxelibs.get(i))
.withTailText(" installed", true));
}
}
});
}
示例7: getXmlTargetDocumentClass
import com.intellij.patterns.XmlPatterns; //导入依赖的package包/类
/**
* <reference-one target-document="Foo"/>
* <reference-many target-document="Foo"/>
* <embed-many target-document="Foo"/>
* <embed-one target-document="Foo"/>
*/
public static XmlAttributeValuePattern getXmlTargetDocumentClass() {
return XmlPatterns
.xmlAttributeValue()
.withParent(XmlPatterns
.xmlAttribute("target-document")
.withParent(XmlPatterns
.xmlTag().withName(PlatformPatterns.string().oneOf("reference-one", "reference-many", "embed-many", "embed-one"))
.withParent(
XmlPatterns.xmlTag().withName(XmlPatterns.string().oneOf("embedded-document", "embedded", "document")).withParent(
XmlPatterns.xmlTag().withName(PlatformPatterns.string().matches(DOCTRINE_MAPPING))
)
)
)
);
}
示例8: getXmlTargetEntityClass
import com.intellij.patterns.XmlPatterns; //导入依赖的package包/类
/**
* <one-to-one target-entity="Foo">
* <one-to-many target-entity="Foo">
* <many-to-one target-entity="Foo">
* <many-to-many target-entity="Foo">
*/
public static XmlAttributeValuePattern getXmlTargetEntityClass() {
return XmlPatterns
.xmlAttributeValue()
.withParent(XmlPatterns
.xmlAttribute("target-entity")
.withParent(XmlPatterns
.xmlTag().withName(PlatformPatterns.string().oneOf("one-to-one", "one-to-many", "many-to-one", "many-to-many"))
.withParent(
XmlPatterns.xmlTag().withName("entity").withParent(
XmlPatterns.xmlTag().withName(PlatformPatterns.string().matches(DOCTRINE_MAPPING))
)
)
)
);
}
示例9: getFieldType
import com.intellij.patterns.XmlPatterns; //导入依赖的package包/类
/**
* <doctrine-mapping|doctrine-*-mapping>
* <field type="Class\Name"/>
* </doctrine-mapping>
*/
public static XmlAttributeValuePattern getFieldType() {
return XmlPatterns
.xmlAttributeValue()
.withParent(XmlPatterns
.xmlAttribute("type")
.withParent(XmlPatterns
.xmlTag().withName("field")
.withParent(
XmlPatterns.xmlTag().withName(XmlPatterns.string().oneOf("entity", "document", "embedded-document", "embedded")).withParent(
XmlPatterns.xmlTag().withName(PlatformPatterns.string().matches(DOCTRINE_MAPPING))
)
)
)
);
}
示例10: getFieldName
import com.intellij.patterns.XmlPatterns; //导入依赖的package包/类
/**
* <doctrine-mapping|doctrine-*-mapping>
* <document><field name="Foo"/></document>
* <document><id name="Foo"/></document>
* </doctrine-mapping>
*/
public static XmlAttributeValuePattern getFieldName() {
return XmlPatterns
.xmlAttributeValue()
.withParent(XmlPatterns
.xmlAttribute("name")
.withParent(XmlPatterns
.xmlTag().withName(XmlPatterns.string().oneOf("field", "id"))
.withParent(
XmlPatterns.xmlTag().withName(XmlPatterns.string().oneOf("entity", "document", "embedded-document", "embedded")).withParent(
XmlPatterns.xmlTag().withName(PlatformPatterns.string().matches(DOCTRINE_MAPPING))
)
)
)
);
}
示例11: getFieldNameRelation
import com.intellij.patterns.XmlPatterns; //导入依赖的package包/类
/**
* <doctrine-mapping|doctrine-*-mapping>
* <document><embed-one field="Foo"/></document>
* </doctrine-mapping>
*/
public static XmlAttributeValuePattern getFieldNameRelation() {
return XmlPatterns
.xmlAttributeValue()
.withParent(XmlPatterns
.xmlAttribute("field")
.withParent(XmlPatterns
.xmlTag().withName(XmlPatterns.string().oneOf("embed-one", "embed-many", "reference-one", "reference-many", "one-to-one", "one-to-many", "many-to-one", "many-to-many"))
.withParent(
XmlPatterns.xmlTag().withName(XmlPatterns.string().oneOf("entity", "document", "embedded-document", "embedded")).withParent(
XmlPatterns.xmlTag().withName(PlatformPatterns.string().matches(DOCTRINE_MAPPING))
)
)
)
);
}
示例12: getReferencesByElement
import com.intellij.patterns.XmlPatterns; //导入依赖的package包/类
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement psiElement, @NotNull ProcessingContext context) {
if(!Symfony2ProjectComponent.isEnabled(psiElement)) {
return new PsiReference[0];
}
// check for valid xml file and services container
if(!XmlPatterns.psiElement().inside(XmlHelper.getInsideTagPattern("services")).inFile(XmlHelper.getXmlFilePattern()).accepts(psiElement)) {
return new PsiReference[0];
}
String serviceDefinitionClass = XmlHelper.getServiceDefinitionClass(psiElement);
if(serviceDefinitionClass == null) {
return new PsiReference[0];
}
return new PsiReference[] { new ClassPublicMethodReference(psiElement, serviceDefinitionClass)};
}
示例13: testDBALConnectionFieldArrayNavigation
import com.intellij.patterns.XmlPatterns; //导入依赖的package包/类
/**
* @see fr.adrienbrault.idea.symfony2plugin.doctrine.querybuilder.dbal.DoctrineDbalQbGotoCompletionRegistrar
*/
public void testDBALConnectionFieldArrayNavigation() {
for (String s : new String[]{"insert", "update"}) {
assertNavigationMatch(PhpFileType.INSTANCE, "<?php" +
"/** @var $foo \\Doctrine\\DBAL\\Connection */\n" +
"$foo->" + s + "('cms_users', ['name<caret>']);",
XmlPatterns.xmlTag().withName("field")
);
assertNavigationMatch(PhpFileType.INSTANCE, "<?php" +
"/** @var $foo \\Doctrine\\DBAL\\Connection */\n" +
"$foo->" + s + "('cms_users', ['' => '', 'user_email<caret>' => '']);",
XmlPatterns.xmlTag().withName("field")
);
}
}
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:19,代码来源:DoctrineDbalQbGotoCompletionRegistrarTest.java
示例14: testXmlServiceLineMarker
import com.intellij.patterns.XmlPatterns; //导入依赖的package包/类
public void testXmlServiceLineMarker() {
myFixture.configureByText(XmlFileType.INSTANCE,
"<container>\n" +
" <services>\n" +
" <service class=\"Service\\Bar\" id=\"service_bar\"/>\n" +
" </services>\n" +
"</container>"
);
assertLineMarker(PhpPsiElementFactory.createPsiFileFromText(getProject(), "<?php\n" +
"namespace Service{\n" +
" class Bar{}\n" +
"}"
), new LineMarker.ToolTipEqualsAssert("Navigate to definition"));
assertLineMarker(PhpPsiElementFactory.createPsiFileFromText(getProject(), "<?php\n" +
"namespace Service{\n" +
" class Bar{}\n" +
"}"
), new LineMarker.TargetAcceptsPattern("Navigate to definition", XmlPatterns.xmlTag().withName("service").withAttributeValue("id", "service_bar")));
}
示例15: testXmlServiceLineMarkerForClassName
import com.intellij.patterns.XmlPatterns; //导入依赖的package包/类
public void testXmlServiceLineMarkerForClassName() {
myFixture.configureByText(XmlFileType.INSTANCE,
"<container>\n" +
" <services>\n" +
" <service id=\"Service\\Bar\"/>\n" +
" </services>\n" +
"</container>"
);
assertLineMarker(PhpPsiElementFactory.createPsiFileFromText(getProject(), "<?php\n" +
"namespace Service{\n" +
" class Bar{}\n" +
"}"
), new LineMarker.ToolTipEqualsAssert("Navigate to definition"));
assertLineMarker(PhpPsiElementFactory.createPsiFileFromText(getProject(), "<?php\n" +
"namespace Service{\n" +
" class Bar{}\n" +
"}"
), new LineMarker.TargetAcceptsPattern("Navigate to definition", XmlPatterns.xmlTag().withName("service").withAttributeValue("id", "Service\\Bar")));
}