use of com.intellij.util.xml.tree.DomModelTreeView in project intellij-community by JetBrains.
the class AddElementInCollectionAction method isEnabled.
@Override
protected boolean isEnabled(final AnActionEvent e) {
final DomModelTreeView treeView = getTreeView(e);
final boolean enabled = treeView != null;
e.getPresentation().setEnabled(enabled);
return enabled;
}
use of com.intellij.util.xml.tree.DomModelTreeView in project intellij-community by JetBrains.
the class AddElementInCollectionAction method getParentDomElement.
@Override
protected DomElement getParentDomElement(final AnActionEvent e) {
final DomModelTreeView view = getTreeView(e);
SimpleNode node = view.getTree().getSelectedNode();
if (node instanceof BaseDomElementNode) {
if (((BaseDomElementNode) node).getConsolidatedChildrenDescriptions().size() > 0) {
return ((BaseDomElementNode) node).getDomElement();
}
}
final DomElementsGroupNode groupNode = getDomElementsGroupNode(view);
return groupNode == null ? null : groupNode.getDomElement();
}
use of com.intellij.util.xml.tree.DomModelTreeView in project intellij-community by JetBrains.
the class AddElementInCollectionAction method getDomCollectionChildDescriptions.
@Override
@NotNull
protected DomCollectionChildDescription[] getDomCollectionChildDescriptions(final AnActionEvent e) {
final DomModelTreeView view = getTreeView(e);
SimpleNode node = view.getTree().getSelectedNode();
if (node instanceof BaseDomElementNode) {
List<DomCollectionChildDescription> consolidated = ((BaseDomElementNode) node).getConsolidatedChildrenDescriptions();
if (consolidated.size() > 0) {
return consolidated.toArray(new DomCollectionChildDescription[consolidated.size()]);
}
}
final DomElementsGroupNode groupNode = getDomElementsGroupNode(view);
return groupNode == null ? DomCollectionChildDescription.EMPTY_ARRAY : new DomCollectionChildDescription[] { groupNode.getChildDescription() };
}
Aggregations