Java 类com.intellij.util.xml.tree.DomElementsGroupNode 实例源码

项目:intellij-ce-playground    文件:AddElementInCollectionAction.java   
@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()};
}
项目:tools-idea    文件:AddElementInCollectionAction.java   
@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()};
}
项目:consulo-xml    文件:AddElementInCollectionAction.java   
@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()};
}
项目:intellij-ce-playground    文件:AddElementInCollectionAction.java   
@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();
}
项目:intellij-ce-playground    文件:AddElementInCollectionAction.java   
@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;
}
项目:intellij-ce-playground    文件:AddElementInCollectionAction.java   
@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;
}
项目:tools-idea    文件:AddElementInCollectionAction.java   
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();
}
项目:tools-idea    文件:AddElementInCollectionAction.java   
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;
}
项目:tools-idea    文件:AddElementInCollectionAction.java   
@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;
}
项目:consulo-xml    文件:AddElementInCollectionAction.java   
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();
}
项目:consulo-xml    文件:AddElementInCollectionAction.java   
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;
}
项目:consulo-xml    文件:AddElementInCollectionAction.java   
@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;
}