当前位置: 首页>>代码示例>>Java>>正文


Java XmlTag类代码示例

本文整理汇总了Java中com.intellij.psi.xml.XmlTag的典型用法代码示例。如果您正苦于以下问题:Java XmlTag类的具体用法?Java XmlTag怎么用?Java XmlTag使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


XmlTag类属于com.intellij.psi.xml包,在下文中一共展示了XmlTag类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: DictionaryClass

import com.intellij.psi.xml.XmlTag; //导入依赖的package包/类
public DictionaryClass(@NotNull Suite suite, @NotNull String name, @NotNull String code,
                       @NotNull XmlTag xmlTagClass, @Nullable String parentClassName,
                       @Nullable List<String> elementNames, @Nullable List<String> respondingCommandNames,
                       @Nullable String pluralClassName) {
  super(suite, name, code, xmlTagClass, null);
  this.parentClassName = parentClassName;
  this.pluralClassName = StringUtil.isEmpty(pluralClassName) ? name + "s" : pluralClassName;
  if (elementNames != null) {
    this.elementNames = elementNames;
  } else {
    this.elementNames = new ArrayList<>();
  }
  if (respondingCommandNames != null) {
    this.respondingCommandNames = respondingCommandNames;
  } else {
    this.respondingCommandNames = new ArrayList<>();
  }
}
 
开发者ID:ant-druha,项目名称:AppleScript-IDEA,代码行数:19,代码来源:DictionaryClass.java

示例2: testReferenceCanResolveDefinition

import com.intellij.psi.xml.XmlTag; //导入依赖的package包/类
public void testReferenceCanResolveDefinition() {
    PsiFile file = myFixture.configureByText(PhpFileType.INSTANCE, "<?php \n" +
            "\"LLL:EXT:foo/sample.xlf:sys_<caret>language.language_isocode.ab\";");

    PsiElement elementAtCaret = file.findElementAt(myFixture.getCaretOffset()).getParent();
    PsiReference[] references = elementAtCaret.getReferences();
    for (PsiReference reference : references) {
        if (reference instanceof TranslationReference) {
            ResolveResult[] resolveResults = ((TranslationReference) reference).multiResolve(false);
            for (ResolveResult resolveResult : resolveResults) {
                assertInstanceOf(resolveResult.getElement(), XmlTag.class);

                return;
            }
        }
    }

    fail("No TranslationReference found");
}
 
开发者ID:cedricziel,项目名称:idea-php-typo3-plugin,代码行数:20,代码来源:TranslationReferenceTest.java

示例3: getComponentDeclarations

import com.intellij.psi.xml.XmlTag; //导入依赖的package包/类
private static List<XmlTag> getComponentDeclarations(String componentValue, String componentType, ID<String, Void> id, Project project, ComponentMatcher componentMatcher) {
    List<XmlTag> results = new ArrayList<XmlTag>();
    Collection<VirtualFile> containingFiles = FileBasedIndex.getInstance()
        .getContainingFiles(
            id,
            componentValue,
            GlobalSearchScope.allScope(project)
        );
    PsiManager psiManager = PsiManager.getInstance(project);

    for (VirtualFile virtualFile: containingFiles) {
        XmlFile xmlFile = (XmlFile)psiManager.findFile(virtualFile);
        if (xmlFile == null) {
            continue;
        }

        XmlTag rootTag = xmlFile.getRootTag();
        if (rootTag == null) {
            continue;
        }
        collectComponentDeclarations(rootTag, results, componentValue, componentType, componentMatcher);
    }

    return results;
}
 
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:26,代码来源:LayoutIndex.java

示例4: getClassConfigurations

import com.intellij.psi.xml.XmlTag; //导入依赖的package包/类
public static List<XmlTag> getClassConfigurations(PhpClass phpClass) {
    String classFqn = phpClass.getPresentableFQN();

    Collection<VirtualFile> containingFiles = FileBasedIndex.getInstance()
        .getContainingFiles(KEY, classFqn, GlobalSearchScope.allScope(phpClass.getProject())
    );

    PsiManager psiManager = PsiManager.getInstance(phpClass.getProject());

    List<XmlTag> tags = new ArrayList<XmlTag>();

    for (VirtualFile virtualFile: containingFiles) {
        XmlFile file = (XmlFile)psiManager.findFile(virtualFile);

        if (file == null) {
            continue;
        }

        XmlTag rootTag = file.getRootTag();
        fillRelatedTags(classFqn, rootTag, tags);
    }

    return tags;
}
 
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:25,代码来源:TypeConfigurationIndex.java

示例5: fillRelatedTags

import com.intellij.psi.xml.XmlTag; //导入依赖的package包/类
private static void fillRelatedTags(String classFqn, XmlTag parentTag, List<XmlTag> tagsReferences) {
    for (XmlTag childTag: parentTag.getSubTags()) {
        String tagName = childTag.getName();
        String attribute = TAG_ATTRIBUTE_RELATION.get(tagName);
        if (attribute != null) {
            String className = childTag.getAttributeValue(attribute);
            if (className != null && PhpLangUtil.toPresentableFQN(className).equals(classFqn)) {
                tagsReferences.add(getLineMarkerDecorator(childTag));
            }
        }

        // type tag has plugin tags
        if (tagName.equals(TYPE_TAG)) {
            fillRelatedTags(classFqn, childTag, tagsReferences);
        }

        if (tagName.equals("event")) {
            fillRelatedTags(classFqn, childTag, tagsReferences);
        }
    }
}
 
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:22,代码来源:TypeConfigurationIndex.java

示例6: getLineMarkerDecorator

import com.intellij.psi.xml.XmlTag; //导入依赖的package包/类
/**
 * Decorate tag with appropriate line marker decorator.
 */
@NotNull
private static XmlTag getLineMarkerDecorator(XmlTag tag) {
    switch (tag.getName()) {
        case PREFERENCE_TAG:
            return new DiPreferenceLineMarkerXmlTagDecorator(tag);
        case TYPE_TAG:
            return new DiTypeLineMarkerXmlTagDecorator(tag);
        case PLUGIN_TAG:
            return new DiPluginLineMarkerXmlTagDecorator(tag);
        case VIRTUAL_TYPE_TAG:
            return new DiVirtualTypeLineMarkerXmlTagDecorator(tag);
        default:
            return tag;
    }
}
 
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:19,代码来源:TypeConfigurationIndex.java

示例7: getWebApiRoutes

import com.intellij.psi.xml.XmlTag; //导入依赖的package包/类
/**
 * Get list of Web API routes associated with the provided method.
 *
 * Parent classes are not taken into account.
 */
public static List<XmlTag> getWebApiRoutes(Method method) {
    List<XmlTag> tags = new ArrayList<>();
    if (!method.getAccess().isPublic()) {
        return tags;
    }
    PhpClass phpClass = method.getContainingClass();
    String methodFqn = method.getName();
    if (phpClass == null) {
        return tags;
    }
    String classFqn = phpClass.getPresentableFQN();
    Collection<VirtualFile> containingFiles = FileBasedIndex
        .getInstance().getContainingFiles(KEY, classFqn, GlobalSearchScope.allScope(phpClass.getProject()));

    PsiManager psiManager = PsiManager.getInstance(phpClass.getProject());
    for (VirtualFile virtualFile : containingFiles) {
        XmlFile file = (XmlFile) psiManager.findFile(virtualFile);
        if (file == null) {
            continue;
        }
        XmlTag rootTag = file.getRootTag();
        fillRelatedTags(classFqn, methodFqn, rootTag, tags);
    }
    return tags;
}
 
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:31,代码来源:WebApiTypeIndex.java

示例8: getMagentoName

import com.intellij.psi.xml.XmlTag; //导入依赖的package包/类
@Override
public String getMagentoName() {
    if (moduleName != null) {
        return moduleName;
    }

    PsiDirectory configurationDir = directory.findSubdirectory(CONFIGURATION_PATH);
    if (configurationDir != null) {
        PsiFile configurationFile = configurationDir.findFile("module.xml");

        if (configurationFile != null && configurationFile instanceof XmlFile) {
            XmlTag rootTag = ((XmlFile) configurationFile).getRootTag();
            if (rootTag != null) {
                XmlTag module = rootTag.findFirstSubTag("module");
                if (module != null && module.getAttributeValue("name") != null) {
                    moduleName = module.getAttributeValue("name");
                    return moduleName;
                }
            }
        }
    }

    return DEFAULT_MODULE_NAME;
}
 
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:25,代码来源:MagentoComponentManager.java

示例9: extractRoutesForMethod

import com.intellij.psi.xml.XmlTag; //导入依赖的package包/类
/**
 * Get list of Web API routes related to the specified method.
 * <p/>
 * Web API declarations for parent classes are taken into account.
 * Results are not cached.
 */
List<XmlTag> extractRoutesForMethod(@NotNull Method method) {
    List<XmlTag> routesForMethod = WebApiTypeIndex.getWebApiRoutes(method);
    PhpClass phpClass = method.getContainingClass();
    if (phpClass == null) {
        return routesForMethod;
    }
    for (PhpClass parent : method.getContainingClass().getSupers()) {
        for (Method parentMethod : parent.getMethods()) {
            if (parentMethod.getName().equals(method.getName())) {
                routesForMethod.addAll(extractRoutesForMethod(parentMethod));
            }
        }
    }
    return routesForMethod;
}
 
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:22,代码来源:WebApiLineMarkerProvider.java

示例10: expectDomAttributeValue

import com.intellij.psi.xml.XmlTag; //导入依赖的package包/类
public static <T extends DomElement, V> GenericAttributeValue<V> expectDomAttributeValue(
    @NotNull final PsiElement element,
    @NotNull final Class<? extends T> domTagClass,
    @NotNull final Function<T, GenericAttributeValue<V>> domGetter
) {
    final DomManager domManager = DomManager.getDomManager(element.getProject());

    if (!(element instanceof XmlElement)) {
        return null;
    }

    final XmlAttribute xmlAttribute = PsiTreeUtil.getParentOfType(element, XmlAttribute.class, false);
    if (xmlAttribute == null) {
        return null;
    }

    final XmlTag xmlParentTag = PsiTreeUtil.getParentOfType(element, XmlTag.class, false);
    DomElement domParentTag = domManager.getDomElement(xmlParentTag);

    return Optional.ofNullable(domParentTag)
                   .map(o -> ObjectUtils.tryCast(o, domTagClass))
                   .map(domGetter)
                   .filter(val -> val == domManager.getDomElement(xmlAttribute))
                   .orElse(null);
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:26,代码来源:BeansUtils.java

示例11: tagAttributeValuePattern

import com.intellij.psi.xml.XmlTag; //导入依赖的package包/类
/**
 * <tagName attributeName="XmlAttributeValue">
 */
public static XmlAttributeValuePattern tagAttributeValuePattern(
    String attributeName,
    String fileName
) {
    return XmlPatterns
        .xmlAttributeValue()
        .withParent(
            XmlPatterns
                .xmlAttribute(attributeName)
                .withParent(
                    XmlPatterns
                        .xmlTag()
                )
        ).inside(
            XmlPatterns.psiElement(XmlTag.class)
        ).inFile(XmlPatterns.psiFile()
                            .withName(XmlPatterns.string().endsWith(fileName + ".xml")));
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:22,代码来源:PsiXmlUtils.java

示例12: findByLineAndColumn

import com.intellij.psi.xml.XmlTag; //导入依赖的package包/类
@Nullable
private static PsiElement findByLineAndColumn(
    @NotNull final PsiElement file,
    @Nullable final Point columnAndLine
) {
    if (columnAndLine == null) {
        return file;
    }
    final int line = columnAndLine.y - 1;
    final int column = columnAndLine.x - 1;

    PsiElement leaf = findByLineAndColumn(file, line, column);

    if (leaf instanceof PsiWhiteSpace) {
        leaf = PsiTreeUtil.prevVisibleLeaf(leaf);
    }

    final PsiElement tag = leaf instanceof XmlTag ? leaf : PsiTreeUtil.getParentOfType(leaf, XmlTag.class);
    return tag == null ? leaf : tag;
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:21,代码来源:ValidateContextImpl.java

示例13: findTagUsage

import com.intellij.psi.xml.XmlTag; //导入依赖的package包/类
private int findTagUsage(XmlTag element) {
    final FindUsagesHandler handler = FindUsageUtils.getFindUsagesHandler(element, element.getProject());
    if (handler != null) {
        final FindUsagesOptions findUsagesOptions = handler.getFindUsagesOptions();
        final PsiElement[] primaryElements = handler.getPrimaryElements();
        final PsiElement[] secondaryElements = handler.getSecondaryElements();
        Factory factory = new Factory() {
            public UsageSearcher create() {
                return FindUsageUtils.createUsageSearcher(primaryElements, secondaryElements, handler, findUsagesOptions, (PsiFile) null);
            }
        };
        UsageSearcher usageSearcher = (UsageSearcher)factory.create();
        final AtomicInteger mCount = new AtomicInteger(0);
        usageSearcher.generate(new Processor<Usage>() {
            @Override
            public boolean process(Usage usage) {
                if (ResourceUsageCountUtils.isUsefulUsageToCount(usage)) {
                    mCount.incrementAndGet();
                }
                return true;
            }
        });
        return mCount.get();
    }
    return 0;
}
 
开发者ID:niorgai,项目名称:Android-Resource-Usage-Count,代码行数:27,代码来源:UsageCountLineProvider.java

示例14: isTargetTagToCount

import com.intellij.psi.xml.XmlTag; //导入依赖的package包/类
/**
 * valid tag to count
 */
static boolean isTargetTagToCount(PsiElement tag) {
    if (tag == null || !(tag instanceof XmlTag) || TextUtils.isEmpty(((XmlTag)tag).getName())) {
        return false;
    }
    String name = ((XmlTag)tag).getName();
    return name.equals("array")
            || name.equals("attr")
            || name.equals("bool")
            || name.equals("color")
            || name.equals("declare-styleable")
            || name.equals("dimen")
            || name.equals("drawable")
            || name.equals("eat-comment")
            || name.equals("fraction")
            || name.equals("integer")
            || name.equals("integer-array")
            || name.equals("item")
            || name.equals("plurals")
            || name.equals("string")
            || name.equals("string-array")
            || name.equals("style");
}
 
开发者ID:niorgai,项目名称:Android-Resource-Usage-Count,代码行数:26,代码来源:ResourceUsageCountUtils.java

示例15: testRemoveAttributeParent

import com.intellij.psi.xml.XmlTag; //导入依赖的package包/类
public void testRemoveAttributeParent() throws Throwable {
  final XmlFile file = (XmlFile)createFile("file.xml", "<?xml version='1.0' encoding='UTF-8'?>\n" +
                                                       "<!DOCTYPE ejb-jar PUBLIC \"-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN\" \"http://java.sun.com/dtd/ejb-jar_2_0.dtd\">\n" +
                                                       "<a>\n" +
                                                       " <child-element xxx=\"239\"/>\n" +
                                                       "</a>");
  final DomFileElementImpl<MyElement> fileElement =
    getDomManager().getFileElement(file, MyElement.class, "a");
  myCallRegistry.clear();
  final MyElement rootElement = fileElement.getRootElement();
  final MyElement oldLeaf = rootElement.getChildElements().get(0);
  final GenericAttributeValue<String> xxx = oldLeaf.getXxx();
  final XmlTag oldLeafTag = oldLeaf.getXmlTag();

  new WriteCommandAction(getProject()) {
    @Override
    protected void run(@NotNull Result result) throws Throwable {
      oldLeafTag.delete();
    }
  }.execute();

  assertFalse(oldLeaf.isValid());
  assertFalse(xxx.isValid());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:TreeIncrementalUpdateTest.java


注:本文中的com.intellij.psi.xml.XmlTag类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。