Search in sources :

Example 36 with DomElement

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

the class GlobalExceptionMappingResultResolveConverter method getVariants.

@NotNull
public Collection<? extends GlobalResult> getVariants(final ConvertContext context) {
    final DomElement invocationElement = context.getInvocationElement();
    final StrutsPackage strutsPackage = invocationElement.getParentOfType(StrutsPackage.class, true);
    if (strutsPackage != null) {
        return strutsPackage.getGlobalResults().getResults();
    }
    return Collections.emptySet();
}
Also used : DomElement(com.intellij.util.xml.DomElement) NotNull(org.jetbrains.annotations.NotNull)

Example 37 with DomElement

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

the class ActionMethodConverter method getActionElement.

/**
   * Gets the enclosing <code>action</code>-element for the current context.
   *
   * @param context Current context.
   * @return Action-element.
   */
@NotNull
private static Action getActionElement(final ConvertContext context) {
    final DomElement domElement = context.getInvocationElement();
    final Action action = domElement.getParentOfType(Action.class, false);
    assert action != null : "not triggered within <action> for " + domElement.getXmlElement();
    return action;
}
Also used : DomElement(com.intellij.util.xml.DomElement) NotNull(org.jetbrains.annotations.NotNull)

Example 38 with DomElement

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

the class Struts2GraphComponent method getSelectedDomElements.

public List<DomElement> getSelectedDomElements() {
    final List<DomElement> selected = new ArrayList<>();
    final Graph2D graph = myBuilder.getGraph();
    for (final Node node : graph.getNodeArray()) {
        if (graph.isSelected(node)) {
            final BasicStrutsNode nodeObject = myBuilder.getNodeObject(node);
            if (nodeObject != null) {
                ContainerUtil.addIfNotNull(selected, nodeObject.getIdentifyingElement());
            }
        }
    }
    return selected;
}
Also used : BasicStrutsNode(com.intellij.struts2.graph.beans.BasicStrutsNode) DomElement(com.intellij.util.xml.DomElement) Node(com.intellij.openapi.graph.base.Node) BasicStrutsNode(com.intellij.struts2.graph.beans.BasicStrutsNode) ArrayList(java.util.ArrayList) Graph2D(com.intellij.openapi.graph.view.Graph2D)

Example 39 with DomElement

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

the class StructureViewTreeElement method getChildren.

@NotNull
public TreeElement[] getChildren() {
    final DomElement element = getElement();
    if (!element.isValid()) {
        return EMPTY_ARRAY;
    }
    final List<TreeElement> result = new SmartList<>();
    DomUtil.acceptAvailableChildren(element, new DomElementVisitor() {

        @Override
        public void visitDomElement(final DomElement domElement) {
            result.add(new StructureViewTreeElement(domElement));
        }
    });
    return ArrayUtil.toObjectArray(result, TreeElement.class);
}
Also used : DomElement(com.intellij.util.xml.DomElement) DomElementVisitor(com.intellij.util.xml.DomElementVisitor) SmartList(com.intellij.util.SmartList) DomStructureTreeElement(com.intellij.util.xml.structure.DomStructureTreeElement) TreeElement(com.intellij.ide.util.treeView.smartTree.TreeElement) NotNull(org.jetbrains.annotations.NotNull)

Example 40 with DomElement

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

the class StructureViewTreeModel method getRoot.

@NotNull
@Override
public StructureViewTreeElement getRoot() {
    final XmlFile xmlFile = getPsiFile();
    final DomFileElement<DomElement> fileElement = DomManager.getDomManager(xmlFile.getProject()).getFileElement(xmlFile, DomElement.class);
    if (fileElement == null) {
        return new XmlFileTreeElement(xmlFile);
    }
    return new com.intellij.struts2.structure.StructureViewTreeElement(fileElement.getRootElement().createStableCopy());
}
Also used : DomElement(com.intellij.util.xml.DomElement) XmlFile(com.intellij.psi.xml.XmlFile) StructureViewTreeElement(com.intellij.ide.structureView.StructureViewTreeElement) XmlFileTreeElement(com.intellij.ide.structureView.impl.xml.XmlFileTreeElement) NotNull(org.jetbrains.annotations.NotNull)

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