本文整理汇总了Java中com.intellij.psi.xml.XmlTag.getNamespace方法的典型用法代码示例。如果您正苦于以下问题:Java XmlTag.getNamespace方法的具体用法?Java XmlTag.getNamespace怎么用?Java XmlTag.getNamespace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.psi.xml.XmlTag
的用法示例。
在下文中一共展示了XmlTag.getNamespace方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isDevKitConfig
import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
private boolean isDevKitConfig(XmlTag tag, XmlFile baseFile) {
Module module = ModuleUtilCore.findModuleForPsiElement(baseFile);
String namespace = tag.getNamespace();
List<XmlSchemaProvider> providers = XmlSchemaProvider.getAvailableProviders(baseFile);
for (XmlSchemaProvider provider : providers) {
Set<String> locations = provider.getLocations(namespace, baseFile);
for (String location : locations) {
XmlFile schema = provider.getSchema(location, module, baseFile);
if (schema != null) {
String schemaFile = schema.getText();
if (schemaFile.contains("http://www.mulesoft.org/schema/mule/devkit")) {
return true;
}
}
}
}
return false;
}
示例2: annotate
import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
@Override
public void annotate(@NotNull PsiElement element, @NotNull AnnotationHolder holder) {
if (element instanceof XmlTag) {
XmlTag tag = (XmlTag)element;
String namespace = tag.getNamespace();
for (XmlNSColorProvider provider : PROVIDERS) {
TextAttributesKey key = provider.getKeyForNamespace(namespace, tag);
if (key != null) {
TextRange range = XmlTagUtil.getStartTagRange(tag);
if (range != null) {
holder.createInfoAnnotation(range, null).setTextAttributes(key);
}
TextRange endTagRange = XmlTagUtil.getEndTagRange(tag);
if (endTagRange != null) {
holder.createInfoAnnotation(endTagRange, null).setTextAttributes(key);
}
return;
}
}
}
}
示例3: createQName
import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
private static QName createQName(XmlTag tag) {
//todo don't use intern to not pollute PermGen
String namespace = tag.getNamespace();
return new QName(tag.getNamespacePrefix().intern(),
tag.getLocalName().intern(),
tag.getName().intern(),
namespace.isEmpty() ? null : namespace.intern());
}
示例4: createTagSnapshot
import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
@NotNull
public static TagSnapshot createTagSnapshot(@NotNull XmlTag tag) {
// Attributes
List<AttributeSnapshot> attributes = AttributeSnapshot.createAttributesForTag(tag);
// Children
List<TagSnapshot> children;
XmlTag[] subTags = tag.getSubTags();
if (subTags.length > 0) {
TagSnapshot last = null;
children = Lists.newArrayListWithExpectedSize(subTags.length);
for (XmlTag subTag : subTags) {
TagSnapshot child = createTagSnapshot(subTag);
children.add(child);
if (last != null) {
last.myNext = child;
}
last = child;
}
} else {
children = Collections.emptyList();
}
return new TagSnapshot(tag, tag.getName(), tag.getNamespacePrefix(), tag.getNamespace(), attributes, children);
}
示例5: isNamespaceBound
import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
protected boolean isNamespaceBound(PsiElement psiElement) {
PsiElement parent = psiElement.getParent();
if (!(parent instanceof XmlTag)) return false;
final XmlTag tag = (XmlTag) parent;
final XmlElementDescriptor tagDescriptor = tag.getDescriptor();
final String tagNamespace = tag.getNamespace();
return tagDescriptor != null && !(tagDescriptor instanceof AnyXmlElementDescriptor) && namespace.equals(tagNamespace);
}
示例6: skipEndpointValidation
import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
@Override
public boolean skipEndpointValidation(PsiElement element) {
// only accept xml tags from namespaces we support
XmlTag xml = PsiTreeUtil.getParentOfType(element, XmlTag.class);
if (xml != null) {
String ns = xml.getNamespace();
// accept empty namespace which can be from testing
boolean accepted = StringUtils.isEmpty(ns) || Arrays.stream(ACCEPTED_NAMESPACES).anyMatch(ns::contains);
LOG.trace("XmlTag " + xml.getName() + " with namespace: " + ns + " is accepted namespace: " + accepted);
return !accepted; // skip is the opposite
}
return false;
}
示例7: getNamespace
import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
@Override
@NotNull
@NonNls
public String getNamespace() {
XmlTag original = getOriginal();
LOG.assertTrue(original.isValid());
return original.getNamespace();
}
示例8: checkSchemaNamespace
import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
public static boolean checkSchemaNamespace(XmlTag context) {
LOG.assertTrue(context.isValid());
final String namespace = context.getNamespace();
if (namespace.length() > 0) {
return checkSchemaNamespace(namespace);
}
return StringUtil.startsWithConcatenation(context.getName(), XSD_PREFIX, ":");
}
示例9: shouldBeQualified
import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
private boolean shouldBeQualified(String targetNs, XmlTag contextTag) {
boolean attributeShouldBeQualified = false;
String contextNs = contextTag.getNamespace();
if (!contextNs.equals(targetNs)) {
final XmlElementDescriptor xmlElementDescriptor = contextTag.getDescriptor();
if (xmlElementDescriptor instanceof XmlElementDescriptorImpl) {
final XmlElementDescriptorImpl elementDescriptor = (XmlElementDescriptorImpl)xmlElementDescriptor;
final TypeDescriptor type = elementDescriptor.getType();
if (type instanceof ComplexTypeDescriptor) {
final ComplexTypeDescriptor typeDescriptor = (ComplexTypeDescriptor)type;
if (myReferenceName != null) {
return myReferenceName.indexOf(':') != 0;
}
XmlAttributeDescriptor[] attributes = ((ComplexTypeDescriptor)type).getAttributes(contextTag);
if (ArrayUtil.contains(this, attributes)) {
return false;
}
attributeShouldBeQualified = typeDescriptor.canContainAttribute(targetNs, null) != ComplexTypeDescriptor.CanContainAttributeType.CanNotContain;
}
if (!attributeShouldBeQualified && contextNs.length() == 0 && targetNs.length() > 0) {
attributeShouldBeQualified = !targetNs.equals(elementDescriptor.getNamespace());
}
}
}
return attributeShouldBeQualified;
}
示例10: getRelaxedDescriptor
import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
public static XmlElementDescriptor getRelaxedDescriptor(XmlElementDescriptor base, final XmlTag childTag) {
final String namespace = childTag.getNamespace();
final XmlExtension extension = XmlExtension.getExtensionByElement(childTag);
if(!XmlUtil.XHTML_URI.equals(namespace) &&
( base.getContentType() != XmlElementDescriptor.CONTENT_TYPE_EMPTY ||
(extension != null && extension.isCustomTagAllowed(childTag)) // allow custom tag
) ) {
return new AnyXmlElementDescriptor(base,childTag.getNSDescriptor(namespace,true));
}
return null;
}
示例11: createQName
import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
public static QName createQName(@NotNull XmlTag tag) {
if (isNamespaceDeclared(tag, tag.getNamespace())) {
return new QName(tag.getNamespace(), tag.getLocalName(), tag.getNamespacePrefix());
} else {
return new QName(null, tag.getLocalName());
}
}
示例12: addElement
import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
private void addElement(XmlTag tag) {
final String uri = tag.getNamespace();
final String prefix = tag.getNamespacePrefix();
// [IDEA-5885] IDEA assigns System-URI of DTD as namespace.
if (MyPsiUtil.isInDeclaredNamespace(tag, uri, prefix)) {
elements.add(new QName(uri, tag.getLocalName(), prefix));
} else {
elements.add(new QName("", tag.getLocalName(), ""));
}
}
示例13: getQName
import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
public static QName getQName(XmlTag xmlTag) {
return new QName(xmlTag.getNamespace(), xmlTag.getLocalName());
}
示例14: createEvaluatedXmlName
import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
@Override
public EvaluatedXmlName createEvaluatedXmlName(final DomInvocationHandler parent, final XmlTag childTag) {
return new DummyEvaluatedXmlName(childTag.getLocalName(), childTag.getNamespace());
}
示例15: isTagFromHtml
import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
private static boolean isTagFromHtml(final XmlTag tag) {
final String ns = tag.getNamespace();
return XmlUtil.XHTML_URI.equals(ns) || XmlUtil.HTML_URI.equals(ns);
}