@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()}; }
@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()}; }
@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(); }
@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; }
@Nullable private static DomElementsGroupNode getDomElementsGroupNode(final DomModelTreeView treeView) { SimpleNode simpleNode = treeView.getTree().getSelectedNode(); while (simpleNode != null) { if (simpleNode instanceof DomElementsGroupNode) return (DomElementsGroupNode)simpleNode; simpleNode = simpleNode.getParent(); } return null; }
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(); }
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; }
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.getInstance().getTypePresentableName(ReflectionUtil.getRawType(type)); } } return text; }