use of com.intellij.util.xml.tree.DomElementsGroupNode 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.DomElementsGroupNode 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() };
}
use of com.intellij.util.xml.tree.DomElementsGroupNode in project intellij-community by JetBrains.
the class AddElementInCollectionAction method getActionText.
@Override
protected String getActionText(final AnActionEvent e) {
String text = ApplicationBundle.message("action.add");
if (e.getPresentation().isEnabled()) {
final DomElementsGroupNode selectedNode = getDomElementsGroupNode(getTreeView(e));
if (selectedNode != null) {
final Type type = selectedNode.getChildDescription().getType();
text += " " + TypePresentationService.getService().getTypePresentableName(ReflectionUtil.getRawType(type));
}
}
return text;
}
Aggregations