Search in sources :

Example 76 with DomElement

use of com.intellij.util.xml.DomElement in project intellij-community by JetBrains.

the class DomElementPattern method getChildren.

@Override
protected DomElement[] getChildren(@NotNull final DomElement domElement) {
    final List<DomElement> children = new ArrayList<>();
    domElement.acceptChildren(new DomElementVisitor() {

        @Override
        public void visitDomElement(final DomElement element) {
            children.add(element);
        }
    });
    return children.toArray(new DomElement[children.size()]);
}
Also used : DomElement(com.intellij.util.xml.DomElement) DomElementVisitor(com.intellij.util.xml.DomElementVisitor) ArrayList(java.util.ArrayList)

Example 77 with DomElement

use of com.intellij.util.xml.DomElement in project intellij-community by JetBrains.

the class GenerateDomElementProvider method navigate.

public void navigate(final DomElement element) {
    if (element != null && element.isValid()) {
        final DomElement copy = element.createStableCopy();
        final Project project = element.getManager().getProject();
        final DomElementNavigationProvider navigateProvider = getNavigationProviderName(project);
        if (navigateProvider != null && navigateProvider.canNavigate(copy)) {
            ApplicationManager.getApplication().invokeLater(() -> {
                if (!project.isDisposed()) {
                    doNavigate(navigateProvider, copy);
                }
            });
        }
    }
}
Also used : Project(com.intellij.openapi.project.Project) DomElement(com.intellij.util.xml.DomElement) DomElementNavigationProvider(com.intellij.util.xml.DomElementNavigationProvider)

Example 78 with DomElement

use of com.intellij.util.xml.DomElement in project intellij-community by JetBrains.

the class DomCollectionControl method navigate.

@Override
public void navigate(DomElement element) {
    final Class<DomElement> aClass = (Class<DomElement>) ReflectionUtil.getRawType(myChildDescription.getType());
    final DomElement domElement = element.getParentOfType(aClass, false);
    int index = myCollectionElements.indexOf(domElement);
    if (index < 0)
        index = 0;
    myCollectionPanel.getTable().setRowSelectionInterval(index, index);
}
Also used : DomElement(com.intellij.util.xml.DomElement)

Example 79 with DomElement

use of com.intellij.util.xml.DomElement in project intellij-community by JetBrains.

the class DomCollectionControl method canNavigate.

@Override
public boolean canNavigate(DomElement element) {
    final Class<DomElement> aClass = (Class<DomElement>) ReflectionUtil.getRawType(myChildDescription.getType());
    final DomElement domElement = element.getParentOfType(aClass, false);
    return domElement != null && myCollectionElements.contains(domElement);
}
Also used : DomElement(com.intellij.util.xml.DomElement)

Example 80 with DomElement

use of com.intellij.util.xml.DomElement in project intellij-community by JetBrains.

the class DomCollectionWrapper method setValue.

@Override
public void setValue(final T value) throws IllegalAccessException, InvocationTargetException {
    final List<? extends DomElement> list = myChildDescription.getValues(myDomElement);
    final DomElement domElement;
    if (list.isEmpty()) {
        domElement = myChildDescription.addValue(myDomElement);
    } else {
        domElement = list.get(0);
    }
    mySetter.invoke(domElement, value);
}
Also used : DomElement(com.intellij.util.xml.DomElement)

Aggregations

DomElement (com.intellij.util.xml.DomElement)97 XmlTag (com.intellij.psi.xml.XmlTag)34 PsiElement (com.intellij.psi.PsiElement)19 Nullable (org.jetbrains.annotations.Nullable)19 NotNull (org.jetbrains.annotations.NotNull)15 Project (com.intellij.openapi.project.Project)11 PsiFile (com.intellij.psi.PsiFile)11 XmlFile (com.intellij.psi.xml.XmlFile)11 XmlAttribute (com.intellij.psi.xml.XmlAttribute)10 XmlAttributeValue (com.intellij.psi.xml.XmlAttributeValue)9 ArrayList (java.util.ArrayList)8 LayoutViewElement (org.jetbrains.android.dom.layout.LayoutViewElement)7 ResourceElement (org.jetbrains.android.dom.resources.ResourceElement)6 DomManager (com.intellij.util.xml.DomManager)5 Style (org.jetbrains.android.dom.resources.Style)5 AntDomTarget (com.intellij.lang.ant.dom.AntDomTarget)4 XmlElement (com.intellij.psi.xml.XmlElement)4 DomElementProblemDescriptor (com.intellij.util.xml.highlighting.DomElementProblemDescriptor)4 LookupElement (com.intellij.codeInsight.lookup.LookupElement)3 TextRange (com.intellij.openapi.util.TextRange)3