本文整理汇总了Java中com.intellij.psi.xml.XmlTag.findSubTags方法的典型用法代码示例。如果您正苦于以下问题:Java XmlTag.findSubTags方法的具体用法?Java XmlTag.findSubTags怎么用?Java XmlTag.findSubTags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.psi.xml.XmlTag
的用法示例。
在下文中一共展示了XmlTag.findSubTags方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDimenValuesInFile
import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
protected XmlTag[] getDimenValuesInFile(XmlFile xmlFile) {
XmlTag[] dimens = null;
if (xmlFile.getDocument() != null && xmlFile.getDocument().getRootTag() != null) {
String name = xmlFile.getDocument().getRootTag().getName();
switch (name) {
case "xml":
XmlTag resourcesTag = xmlFile.getDocument().getRootTag().findFirstSubTag("resources");
if (resourcesTag != null) {
dimens = resourcesTag.findSubTags("dimen");
}
break;
case "resources":
dimens = xmlFile.getDocument().getRootTag().findSubTags("dimen");
break;
}
}
return dimens;
}
示例2: validate
import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
@Override
public void validate(@NotNull final XmlTag tag, @NotNull ValidationHost host) {
if (!isFromSchemaNs(tag)) return;
final String nsPrefix = tag.getNamespacePrefix();
final XmlTag[] attrDeclTags = tag.findSubTags((nsPrefix.length() > 0 ? nsPrefix + ":" : "") + "attribute");
XmlUtil.doDuplicationCheckForElements(
attrDeclTags,
new HashMap<String, XmlTag>(attrDeclTags.length),
SCHEMA_ATTR_DUP_INFO_PROVIDER,
host
);
final XmlTag[] elementDeclTags = tag.findSubTags((nsPrefix.length() > 0 ? nsPrefix + ":" : "") + "element");
XmlUtil.doDuplicationCheckForElements(
elementDeclTags,
new HashMap<String, XmlTag>(elementDeclTags.length),
SCHEMA_ATTR_DUP_INFO_PROVIDER,
host
);
}
示例3: processWsdlSchemas
import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
public static void processWsdlSchemas(final XmlTag rootTag, Processor<XmlTag> processor) {
if ("definitions".equals(rootTag.getLocalName())) {
final String nsPrefix = rootTag.getNamespacePrefix();
final String types = nsPrefix.isEmpty() ? "types" : nsPrefix + ":types";
final XmlTag subTag = rootTag.findFirstSubTag(types);
if (subTag != null) {
for (int i = 0; i < XmlUtil.SCHEMA_URIS.length; i++) {
final XmlTag[] tags = subTag.findSubTags("schema", XmlUtil.SCHEMA_URIS[i]);
for (XmlTag t : tags) {
if (!processor.process(t)) return;
}
}
}
}
}
示例4: getDocumentationFromTag
import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
private static StringBuilder getDocumentationFromTag(XmlTag tag, String localName, String kind) {
if (tag.getNamespace().equals(ApplicationLoader.RNG_NAMESPACE)) {
final StringBuilder sb = new StringBuilder();
sb.append(kind).append(": <b>").append(localName).append("</b><br>");
final XmlTag[] docTags = tag.findSubTags("documentation", COMPATIBILITY_ANNOTATIONS_1_0);
for (XmlTag docTag : docTags) {
sb.append(docTag.getValue().getTrimmedText());
sb.append("\n");
}
final XmlTag nextTag = PsiTreeUtil.getNextSiblingOfType(tag, XmlTag.class);
if (nextTag != null) {
if ("documentation".equals(nextTag.getLocalName()) && COMPATIBILITY_ANNOTATIONS_1_0.equals(nextTag.getNamespace())) {
sb.append(nextTag.getValue().getTrimmedText());
}
}
return sb;
}
return null;
}
示例5: parseDeclareStyleableTag
import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
private StyleableDefinitionImpl parseDeclareStyleableTag(XmlTag tag, Map<StyleableDefinitionImpl, String[]> parentMap) {
String name = tag.getAttributeValue(ATTR_NAME);
if (name == null) {
LOG.info("Found declare-styleable tag with no name: " + tag.getText());
return null;
}
StyleableDefinitionImpl def = new StyleableDefinitionImpl(name);
String parentNameAttributeValue = tag.getAttributeValue(ATTR_PARENT);
if (parentNameAttributeValue != null) {
String[] parentNames = parentNameAttributeValue.split("\\s+");
parentMap.put(def, parentNames);
}
myStyleables.put(name, def);
if (name.endsWith("State")) {
myStateStyleables.add(def);
}
for (XmlTag subTag : tag.findSubTags(TAG_ATTR)) {
parseStyleableAttr(def, subTag);
}
return def;
}
示例6: tryResolveToActivationSection
import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
private PsiElement tryResolveToActivationSection() {
XmlTag xmlTag = PsiTreeUtil.getParentOfType(getElement(), XmlTag.class);
while (xmlTag != null) {
if (xmlTag.getName().equals("profile")) {
XmlTag activation = xmlTag.findFirstSubTag("activation");
if (activation != null) {
for (XmlTag propertyTag : activation.findSubTags("property")) {
XmlTag nameTag = propertyTag.findFirstSubTag("name");
if (nameTag != null) {
if (nameTag.getValue().getTrimmedText().equals(myText)) {
return nameTag;
}
}
}
}
break;
}
xmlTag = xmlTag.getParentTag();
}
return null;
}
示例7: createNavigatableForPom
import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
@Nullable
public static Navigatable createNavigatableForPom(final Project project, final VirtualFile file) {
if (file == null || !file.isValid()) return null;
final PsiFile result = PsiManager.getInstance(project).findFile(file);
return result == null ? null : new NavigatableAdapter() {
public void navigate(boolean requestFocus) {
int offset = 0;
if (result instanceof XmlFile) {
final XmlDocument xml = ((XmlFile)result).getDocument();
if (xml != null) {
final XmlTag rootTag = xml.getRootTag();
if (rootTag != null) {
final XmlTag[] id = rootTag.findSubTags(ARTIFACT_ID, rootTag.getNamespace());
if (id.length > 0) {
offset = id[0].getValue().getTextRange().getStartOffset();
}
}
}
}
navigate(project, file, offset, requestFocus);
}
};
}
示例8: ensurePropertiesLoaded
import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
private void ensurePropertiesLoaded() {
while (myFileModificationStamp != myFile.getModificationStamp() || myPropertiesMap == null) {
myFileModificationStamp = myFile.getModificationStamp();
MostlySingularMultiMap<String, IProperty> propertiesMap = new MostlySingularMultiMap<String, IProperty>();
XmlTag rootTag = myFile.getRootTag();
final List<IProperty> propertiesOrder = new ArrayList<IProperty>();
if (rootTag != null) {
XmlTag[] entries = rootTag.findSubTags("entry");
for (XmlTag entry : entries) {
XmlProperty property = new XmlProperty(entry, this);
propertiesOrder.add(property);
propertiesMap.add(property.getKey(), property);
}
}
final boolean isAlphaSorted = PropertiesImplUtil.isAlphaSorted(propertiesOrder);
myAlphaSorted = isAlphaSorted;
myProperties = propertiesOrder;
myPropertiesMap = propertiesMap;
}
}
示例9: process
import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
public void process(XmlTag rootTag, Processor processor) {
final XmlTag[] compGroup = rootTag.findSubTags(myName);
for (XmlTag tag : compGroup) {
if (!tag.isPhysical()) continue; //skip included tags
final XmlTag[] components = tag.findSubTags("component");
for (XmlTag component : components) {
final XmlTag impl = component.findFirstSubTag("implementation-class");
final XmlTag intf = component.findFirstSubTag("interface-class");
if (!processor.process(this, component,
impl != null ? impl.getValue() : null,
intf != null ? intf.getValue() : null))
{
return;
}
}
}
}
示例10: process
import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
public void process(XmlTag rootTag, Processor processor) {
final XmlTag[] actions = rootTag.findSubTags("actions");
for (XmlTag tag : actions) {
if (!tag.isPhysical()) continue;
final XmlTag[] components = tag.getSubTags();
for (XmlTag actionOrGroup : components) {
if (myName.equals(actionOrGroup.getName())) {
if (!processor.process(this, actionOrGroup)) {
return;
}
} else if (this == ACTION && GROUP.myName.equals(actionOrGroup.getName())) {
final XmlTag[] groupActions = actionOrGroup.findSubTags(myName);
for (XmlTag a : groupActions) {
if (!processor.process(this, a)) {
return;
}
}
}
}
}
}
示例11: getIndexer
import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
@NotNull
@Override
public DataIndexer<String, String, FileContent> getIndexer() {
return inputData -> {
Map<String, String> map = new THashMap<>();
PsiFile psiFile = inputData.getPsiFile();
if (!Settings.isEnabled(psiFile.getProject())) {
return map;
}
if (psiFile instanceof XmlFile) {
XmlDocument xmlDocument = ((XmlFile) psiFile).getDocument();
if (xmlDocument != null) {
XmlTag xmlRootTag = xmlDocument.getRootTag();
if (xmlRootTag != null) {
for (XmlTag virtualTypeTag : xmlRootTag.findSubTags("virtualType")) {
String name = virtualTypeTag.getAttributeValue("name");
String type = virtualTypeTag.getAttributeValue("type");
if (name != null && type != null && !name.isEmpty() && !type.isEmpty()) {
map.put(name, type);
}
}
}
}
}
return map;
};
}
示例12: getIndexer
import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
@NotNull
@Override
public DataIndexer<String, Void, FileContent> getIndexer() {
return inputData -> {
Map<String, Void> map = new HashMap<>();
PsiFile psiFile = inputData.getPsiFile();
if (!Settings.isEnabled(psiFile.getProject())) {
return map;
}
if (!(psiFile instanceof XmlFile)) {
return map;
}
XmlDocument document = ((XmlFile) psiFile).getDocument();
if (document == null) {
return map;
}
XmlTag xmlTags[] = PsiTreeUtil.getChildrenOfType(psiFile.getFirstChild(), XmlTag.class);
if (xmlTags == null) {
return map;
}
for (XmlTag xmlTag : xmlTags) {
if (xmlTag.getName().equals("routes")) {
for (XmlTag routeNode : xmlTag.findSubTags("route")) {
for (XmlTag serviceNode : routeNode.findSubTags("service")) {
String typeName = serviceNode.getAttributeValue("class");
if (typeName != null) {
map.put(PhpLangUtil.toPresentableFQN(typeName), null);
}
}
}
}
}
return map;
};
}
示例13: fillRelatedTags
import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
/**
* Find routes related to the specified method within single webapi.xml
*/
private static void fillRelatedTags(String classFqn, String methodFqn, XmlTag parentTag, List<XmlTag> tagsReferences) {
for (XmlTag routeNode : parentTag.findSubTags("route")) {
for (XmlTag serviceNode : routeNode.findSubTags("service")) {
String typeName = serviceNode.getAttributeValue("class");
String methodName = serviceNode.getAttributeValue("method");
if (typeName != null && typeName.equals(classFqn)
&& methodName != null && methodName.equals(methodFqn)
) {
tagsReferences.add(new WebApiLineMarkerXmlTagDecorator(routeNode));
}
}
}
}
示例14: grabEventNamesFromXmlFile
import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
private void grabEventNamesFromXmlFile(XmlFile file, Map<String, Void> map) {
XmlDocument xmlDocument = file.getDocument();
if (xmlDocument != null) {
XmlTag xmlRootTag = xmlDocument.getRootTag();
if (xmlRootTag != null) {
for (XmlTag eventTag : xmlRootTag.findSubTags("event")) {
String name = eventTag.getAttributeValue("name");
if (name != null && !name.isEmpty()) {
map.put(name, null);
}
}
}
}
}
示例15: isMUnitFile
import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
public static boolean isMUnitFile(PsiFile psiFile) {
if (!(psiFile instanceof XmlFile)) {
return false;
}
if (psiFile.getFileType() != StdFileTypes.XML) {
return false;
}
final XmlFile psiFile1 = (XmlFile) psiFile;
final XmlTag rootTag = psiFile1.getRootTag();
if (rootTag == null || !isMuleTag(rootTag)) {
return false;
}
final XmlTag[] munitTags = rootTag.findSubTags(MUNIT_TEST_LOCAL_NAME, rootTag.getNamespaceByPrefix(MUNIT_NAMESPACE));
return munitTags.length > 0;
}