本文整理汇总了Java中com.intellij.xml.impl.schema.AnyXmlElementDescriptor类的典型用法代码示例。如果您正苦于以下问题:Java AnyXmlElementDescriptor类的具体用法?Java AnyXmlElementDescriptor怎么用?Java AnyXmlElementDescriptor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AnyXmlElementDescriptor类属于com.intellij.xml.impl.schema包,在下文中一共展示了AnyXmlElementDescriptor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDescriptor
import com.intellij.xml.impl.schema.AnyXmlElementDescriptor; //导入依赖的package包/类
@Nullable
@Override
public XmlElementDescriptor getDescriptor(XmlTag xmlTag) {
final Project project = xmlTag.getProject();
CatberryProjectConfigurationManager manager = CatberryProjectConfigurationManager.getInstance(project);
if (!(xmlTag instanceof HtmlTag && manager.isCatberryEnabled())) return null;
final XmlNSDescriptor nsDescriptor = xmlTag.getNSDescriptor(xmlTag.getNamespace(), false);
final XmlElementDescriptor descriptor = nsDescriptor != null ? nsDescriptor.getElementDescriptor(xmlTag) : null;
final boolean special = CatberryConstants.SPECIAL_COMPONENT_NAMES.contains(xmlTag.getName());
if (descriptor != null && !(descriptor instanceof AnyXmlElementDescriptor || special)) return null;
final String name = CatberryComponentUtils.normalizeName(xmlTag.getName());
final PsiFile file = CatberryComponentUtils.findComponent(project, name);
return file != null ? new CatberryComponentTagDescriptor(xmlTag.getName(), file) : null;
}
示例2: checkTag
import com.intellij.xml.impl.schema.AnyXmlElementDescriptor; //导入依赖的package包/类
private void checkTag(XmlTag tag) {
if (ourDoJaxpTesting) return;
if (!myHolder.hasErrorResults()) {
checkTagByDescriptor(tag);
}
if (!myHolder.hasErrorResults()) {
if (!skipValidation(tag)) {
final XmlElementDescriptor descriptor = tag.getDescriptor();
if (tag instanceof HtmlTag &&
( descriptor instanceof AnyXmlElementDescriptor ||
descriptor == null
)
) {
return;
}
checkReferences(tag);
}
}
}
示例3: resolve
import com.intellij.xml.impl.schema.AnyXmlElementDescriptor; //导入依赖的package包/类
@Override
public PsiElement resolve() {
final XmlTag tag = getTagElement();
final XmlElementDescriptor descriptor = tag != null ? tag.getDescriptor():null;
if (LOG.isDebugEnabled()) {
LOG.debug("Descriptor for tag " +
(tag != null ? tag.getName() : "NULL") +
" is " +
(descriptor != null ? (descriptor.toString() + ": " + descriptor.getClass().getCanonicalName()) : "NULL"));
}
if (descriptor != null){
return descriptor instanceof AnyXmlElementDescriptor ? tag : descriptor.getDeclaration();
}
return null;
}
示例4: getElementDescriptor
import com.intellij.xml.impl.schema.AnyXmlElementDescriptor; //导入依赖的package包/类
@Override
public XmlElementDescriptor getElementDescriptor(@NotNull XmlTag tag) {
XmlElementDescriptor elementDescriptor = super.getElementDescriptor(tag);
if (LOG.isDebugEnabled()) {
LOG.debug("Descriptor from rng for tag " +
tag.getName() +
" is " +
(elementDescriptor != null ? elementDescriptor.getClass().getCanonicalName() : "NULL"));
}
String namespace;
if (elementDescriptor == null &&
!((namespace = tag.getNamespace()).equals(XmlUtil.XHTML_URI))) {
return new AnyXmlElementDescriptor(
null,
XmlUtil.HTML_URI.equals(namespace) ? this : tag.getNSDescriptor(tag.getNamespace(), true)
);
}
return elementDescriptor;
}
示例5: getElementDescriptor
import com.intellij.xml.impl.schema.AnyXmlElementDescriptor; //导入依赖的package包/类
public XmlElementDescriptor getElementDescriptor(@NotNull XmlTag tag) {
XmlElementDescriptor elementDescriptor = super.getElementDescriptor(tag);
if (LOG.isDebugEnabled()) {
LOG.debug("Descriptor from rng for tag " +
tag.getName() +
" is " +
(elementDescriptor != null ? elementDescriptor.getClass().getCanonicalName() : "NULL"));
}
String namespace;
if (elementDescriptor == null &&
!((namespace = tag.getNamespace()).equals(XmlUtil.XHTML_URI))) {
return new AnyXmlElementDescriptor(
null,
XmlUtil.HTML_URI.equals(namespace) ? this : tag.getNSDescriptor(tag.getNamespace(), true)
);
}
return elementDescriptor;
}
示例6: getDescriptor
import com.intellij.xml.impl.schema.AnyXmlElementDescriptor; //导入依赖的package包/类
@Nullable
@Override
public XmlElementDescriptor getDescriptor(XmlTag xmlTag) {
if (!(xmlTag instanceof HtmlTag && EmberIndexUtil.hasEmberJS(xmlTag.getProject()))) return null;
final String componentName = ComponentUtil.getAttributeName(xmlTag.getName());
final XmlNSDescriptor nsDescriptor = xmlTag.getNSDescriptor(xmlTag.getNamespace(), false);
final XmlElementDescriptor descriptor = nsDescriptor != null ? nsDescriptor.getElementDescriptor(xmlTag) : null;
if (descriptor != null && !(descriptor instanceof AnyXmlElementDescriptor)) {
return null;
}
final Project project = xmlTag.getProject();
final JSNamedElementProxy component = ComponentUtil.getComponentProxy(componentName, project);
return component != null ? new EmberJSTagDescriptor(componentName, component) : null;
}
示例7: couldContainDescriptor
import com.intellij.xml.impl.schema.AnyXmlElementDescriptor; //导入依赖的package包/类
static boolean couldContainDescriptor(final XmlTag parentTag, final XmlElementDescriptor parentDescriptor, final XmlElementDescriptor childDescriptor, String childNamespace, boolean strict)
{
if(XmlUtil.nsFromTemplateFramework(childNamespace))
{
return true;
}
if(parentTag == null)
{
return true;
}
if(parentDescriptor == null)
{
return false;
}
final XmlTag childTag = parentTag.createChildTag(childDescriptor.getName(), childNamespace, null, false);
childTag.putUserData(XmlElement.INCLUDING_ELEMENT, parentTag);
XmlElementDescriptor descriptor = parentDescriptor.getElementDescriptor(childTag, parentTag);
return descriptor != null && (!strict || !(descriptor instanceof AnyXmlElementDescriptor));
}
示例8: resolve
import com.intellij.xml.impl.schema.AnyXmlElementDescriptor; //导入依赖的package包/类
@Override
public PsiElement resolve()
{
final XmlTag tag = getTagElement();
final XmlElementDescriptor descriptor = tag != null ? tag.getDescriptor() : null;
if(LOG.isDebugEnabled())
{
LOG.debug("Descriptor for tag " + (tag != null ? tag.getName() : "NULL") + " is " + (descriptor != null ? (descriptor.toString() + ": " + descriptor.getClass().getCanonicalName()) :
"NULL"));
}
if(descriptor != null)
{
return descriptor instanceof AnyXmlElementDescriptor ? tag : descriptor.getDeclaration();
}
return null;
}
示例9: isNamespaceBound
import com.intellij.xml.impl.schema.AnyXmlElementDescriptor; //导入依赖的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);
}
示例10: shouldBeRenamedInplace
import com.intellij.xml.impl.schema.AnyXmlElementDescriptor; //导入依赖的package包/类
private boolean shouldBeRenamedInplace(Project project, PsiElement[] elements) {
boolean inProject = PsiManager.getInstance(project).isInProject(elements[0]);
if(inProject && elements[0] instanceof XmlTag) {
XmlElementDescriptor descriptor = ((XmlTag)elements[0]).getDescriptor();
return descriptor instanceof AnyXmlElementDescriptor;
} else {
return !inProject;
}
}
示例11: checkAttribute
import com.intellij.xml.impl.schema.AnyXmlElementDescriptor; //导入依赖的package包/类
@Override
protected void checkAttribute(@NotNull final XmlAttribute attribute, @NotNull final ProblemsHolder holder, final boolean isOnTheFly) {
final XmlTag tag = attribute.getParent();
if (tag instanceof HtmlTag) {
XmlElementDescriptor elementDescriptor = tag.getDescriptor();
if (elementDescriptor == null || elementDescriptor instanceof AnyXmlElementDescriptor) {
return;
}
XmlAttributeDescriptor attributeDescriptor = elementDescriptor.getAttributeDescriptor(attribute);
if (attributeDescriptor == null && !attribute.isNamespaceDeclaration()) {
final String name = attribute.getName();
if (!XmlUtil.attributeFromTemplateFramework(name, tag) && (!isCustomValuesEnabled() || !isCustomValue(name))) {
boolean maySwitchToHtml5 = HtmlUtil.isCustomHtml5Attribute(name) && !HtmlUtil.hasNonHtml5Doctype(tag);
LocalQuickFix[] quickfixes = new LocalQuickFix[maySwitchToHtml5 ? 3 : 2];
quickfixes[0] = new AddCustomHtmlElementIntentionAction(ATTRIBUTE_KEY, name, XmlBundle.message("add.custom.html.attribute", name));
quickfixes[1] = new RemoveAttributeIntentionAction(name);
if (maySwitchToHtml5) {
quickfixes[2] = new SwitchToHtml5WithHighPriorityAction();
}
registerProblemOnAttributeName(attribute, XmlErrorMessages.message("attribute.is.not.allowed.here", attribute.getName()), holder,
quickfixes);
}
}
}
}
示例12: couldContainDescriptor
import com.intellij.xml.impl.schema.AnyXmlElementDescriptor; //导入依赖的package包/类
static boolean couldContainDescriptor(final XmlTag parentTag,
final XmlElementDescriptor parentDescriptor,
final XmlElementDescriptor childDescriptor,
String childNamespace, boolean strict) {
if (XmlUtil.nsFromTemplateFramework(childNamespace)) return true;
if (parentTag == null) return true;
if (parentDescriptor == null) return false;
final XmlTag childTag = parentTag.createChildTag(childDescriptor.getName(), childNamespace, null, false);
childTag.putUserData(XmlElement.INCLUDING_ELEMENT, parentTag);
XmlElementDescriptor descriptor = parentDescriptor.getElementDescriptor(childTag, parentTag);
return descriptor != null && (!strict || !(descriptor instanceof AnyXmlElementDescriptor));
}
示例13: getElementDescriptor
import com.intellij.xml.impl.schema.AnyXmlElementDescriptor; //导入依赖的package包/类
@Override
public XmlElementDescriptor getElementDescriptor(@NotNull XmlTag tag) {
XmlElementDescriptor elementDescriptor = super.getElementDescriptor(tag);
String namespace;
if (elementDescriptor == null &&
!((namespace = tag.getNamespace()).equals(XmlUtil.XHTML_URI))) {
return new AnyXmlElementDescriptor(
null,
XmlUtil.HTML_URI.equals(namespace) ? this : tag.getNSDescriptor(tag.getNamespace(), true)
);
}
return elementDescriptor;
}
示例14: getRelaxedDescriptor
import com.intellij.xml.impl.schema.AnyXmlElementDescriptor; //导入依赖的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;
}
示例15: isAcceptableMetaData
import com.intellij.xml.impl.schema.AnyXmlElementDescriptor; //导入依赖的package包/类
@Override
public boolean isAcceptableMetaData(final PsiMetaData metaData, final String url) {
if (metaData instanceof XmlNSDescriptorImpl) {
final XmlNSDescriptorImpl nsDescriptor = (XmlNSDescriptorImpl)metaData;
final XmlElementDescriptor descriptor = nsDescriptor.getElementDescriptor(searchFor(), url);
return descriptor != null && !(descriptor instanceof AnyXmlElementDescriptor);
}
return false;
}