com.intellij.psi.XmlRecursiveElementVisitor Java Examples
The following examples show how to use
com.intellij.psi.XmlRecursiveElementVisitor.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FindUsageAction.java From Android-Resource-Usage-Count with MIT License | 5 votes |
@Override public void actionPerformed(AnActionEvent e) { VirtualFile vFile = e.getData(PlatformDataKeys.VIRTUAL_FILE); if (vFile == null) { return; } String fileName = vFile.getName(); if (!fileName.endsWith(".xml")) { return; } PsiFile pFile = e.getData(PlatformDataKeys.PSI_FILE); if (pFile == null) { return; } // for (PsiElement psiElement : pFile.getChildren()) { // System.out.println(psiElement.getText() + " is: " + (psiElement instanceof XmlTag)); // if (psiElement instanceof XmlTag) { // System.out.println(FindUsagesCompat.findUsage((XmlTag) psiElement)); // } // } pFile.accept(new XmlRecursiveElementVisitor() { @Override public void visitElement(PsiElement element) { super.visitElement(element); if (element instanceof XmlTag) { System.out.println(element.getText()); if (ResourceUsageCountUtils.isTargetTagToCount(element)) { System.out.println(FindUsagesCompat.findUsage((XmlTag) element)); } } } }); }