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

项目:intellij-ce-playground    文件:DomElementsToggleAction.java   
public DomElementsToggleAction(final DomModelTreeView treeView, final Class aClass) {
  myTreeView = treeView;
  myClass = aClass;

  Icon myIcon = ElementPresentationManager.getIcon(myClass);
  if (myIcon == null) {
    myIcon = AllIcons.Nodes.Pointcut;
  }
  this.myIcon = myIcon;

  myText = TypePresentationService.getService().getTypePresentableName(myClass);

  if(getHiders() == null) DomUtil.getFile(myTreeView.getRootElement()).putUserData(AbstractDomElementNode.TREE_NODES_HIDERS_KEY, new HashMap<Class, Boolean>());

  if(getHiders().get(myClass) == null) getHiders().put(myClass, true);
}
项目: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()};
}
项目:intellij-ce-playground    文件:DeleteDomElement.java   
@Override
public void actionPerformed(AnActionEvent e, DomModelTreeView treeView) {
  final SimpleNode selectedNode = treeView.getTree().getSelectedNode();

  if (selectedNode instanceof BaseDomElementNode) {

    if (selectedNode instanceof DomFileElementNode) {
      e.getPresentation().setVisible(false);
      return;
    }

    final DomElement domElement = ((BaseDomElementNode)selectedNode).getDomElement();

    final int ret = Messages.showOkCancelDialog(getPresentationText(selectedNode, "Remove") + "?", "Remove",
                                                Messages.getQuestionIcon());
    if (ret == Messages.OK) {
    new WriteCommandAction(domElement.getManager().getProject(), DomUtil.getFile(domElement)) {
      @Override
      protected void run(@NotNull final Result result) throws Throwable {
        domElement.undefine();
      }
    }.execute();
    }
  }
}
项目:tools-idea    文件:DomElementsToggleAction.java   
public DomElementsToggleAction(final DomModelTreeView treeView, final Class aClass) {
  myTreeView = treeView;
  myClass = aClass;

  Icon myIcon = ElementPresentationManager.getIcon(myClass);
  if (myIcon == null) {
    myIcon = AllIcons.Nodes.Pointcut;
  }
  this.myIcon = myIcon;

  myText = TypePresentationService.getService().getTypePresentableName(myClass);

  if(getHiders() == null) DomUtil.getFile(myTreeView.getRootElement()).putUserData(BaseDomElementNode.TREE_NODES_HIDERS_KEY, new HashMap<Class, Boolean>());

  if(getHiders().get(myClass) == null) getHiders().put(myClass, true);
}
项目: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()};
}
项目:tools-idea    文件:DeleteDomElement.java   
public void actionPerformed(AnActionEvent e, DomModelTreeView treeView) {
  final SimpleNode selectedNode = treeView.getTree().getSelectedNode();

  if (selectedNode instanceof BaseDomElementNode) {

    if (selectedNode instanceof DomFileElementNode) {
      e.getPresentation().setVisible(false);
      return;
    }

    final DomElement domElement = ((BaseDomElementNode)selectedNode).getDomElement();

    final int ret = Messages.showOkCancelDialog(getPresentationText(selectedNode) + "?", ApplicationBundle.message("action.remove"),
                                                Messages.getQuestionIcon());
    if (ret == 0) {
    new WriteCommandAction(domElement.getManager().getProject(), DomUtil.getFile(domElement)) {
      protected void run(final Result result) throws Throwable {
        domElement.undefine();
      }
    }.execute();
    }
  }
}
项目:consulo-xml    文件:DomElementsToggleAction.java   
public DomElementsToggleAction(final DomModelTreeView treeView, final Class aClass) {
  myTreeView = treeView;
  myClass = aClass;

  Icon myIcon = ElementPresentationManager.getIcon(myClass);
  if (myIcon == null) {
    myIcon = AllIcons.Nodes.Pointcut;
  }
  this.myIcon = myIcon;

  myText = TypePresentationService.getInstance().getTypePresentableName(myClass);

  if(getHiders() == null) DomUtil.getFile(myTreeView.getRootElement()).putUserData(BaseDomElementNode.TREE_NODES_HIDERS_KEY, new HashMap<Class, Boolean>());

  if(getHiders().get(myClass) == null) getHiders().put(myClass, true);
}
项目: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()};
}
项目:consulo-xml    文件:DeleteDomElement.java   
public void actionPerformed(AnActionEvent e, DomModelTreeView treeView) {
  final SimpleNode selectedNode = treeView.getTree().getSelectedNode();

  if (selectedNode instanceof BaseDomElementNode) {

    if (selectedNode instanceof DomFileElementNode) {
      e.getPresentation().setVisible(false);
      return;
    }

    final DomElement domElement = ((BaseDomElementNode)selectedNode).getDomElement();

    final int ret = Messages.showOkCancelDialog(getPresentationText(selectedNode) + "?", ApplicationBundle.message("action.remove"),
                                                Messages.getQuestionIcon());
    if (ret == 0) {
    new WriteCommandAction(domElement.getManager().getProject(), DomUtil.getFile(domElement)) {
      protected void run(final Result result) throws Throwable {
        domElement.undefine();
      }
    }.execute();
    }
  }
}
项目:intellij-ce-playground    文件:AddElementInCollectionAction.java   
@Override
protected boolean isEnabled(final AnActionEvent e) {
  final DomModelTreeView treeView = getTreeView(e);

  final boolean enabled = treeView != null;
  e.getPresentation().setEnabled(enabled);

  return enabled;
}
项目:intellij-ce-playground    文件:AddElementInCollectionAction.java   
@Override
protected void showPopup(final ListPopup groupPopup, final AnActionEvent e) {
  if (myTreeView == null) {
    if (e.getPlace().equals(DomModelTreeView.DOM_MODEL_TREE_VIEW_POPUP)) {
      groupPopup.showInCenterOf(getTreeView(e).getTree());
    }
    else {
      groupPopup.showInBestPositionFor(e.getDataContext());
    }
  }
  else {
    super.showPopup(groupPopup, e);
  }
}
项目: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   
@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;
}
项目:intellij-ce-playground    文件:GotoDomElementDeclarationAction.java   
@Override
public void actionPerformed(AnActionEvent e, DomModelTreeView treeView) {
  final SimpleNode simpleNode = treeView.getTree().getSelectedNode();

  if(simpleNode instanceof BaseDomElementNode) {
    final DomElement domElement = ((BaseDomElementNode)simpleNode).getDomElement();
    final DomElementNavigationProvider provider =
      DomElementsNavigationManager.getManager(domElement.getManager().getProject()).getDomElementsNavigateProvider(DomElementsNavigationManager.DEFAULT_PROVIDER_NAME);

    provider.navigate(domElement, true);

  }
}
项目:intellij-ce-playground    文件:BaseDomTreeAction.java   
@Override
final public void update(AnActionEvent e) {
  final DomModelTreeView treeView = getTreeView(e);

  if (treeView != null) {
    update(e, treeView);
  }
  else {
    e.getPresentation().setEnabled(false);
  }
}
项目:intellij-ce-playground    文件:BaseDomTreeAction.java   
@Override
final public void actionPerformed(AnActionEvent e) {
  final DomModelTreeView treeView = getTreeView(e);
  if (treeView != null) {
    actionPerformed(e, treeView);
  }
}
项目:intellij-ce-playground    文件:DeleteDomElement.java   
@Override
public void update(AnActionEvent e, DomModelTreeView treeView) {
  final SimpleNode selectedNode = treeView.getTree().getSelectedNode();

  if (selectedNode instanceof DomFileElementNode) {
    e.getPresentation().setVisible(false);
    return;
  }

  boolean enabled = false;
  if (selectedNode instanceof BaseDomElementNode) {
    final DomElement domElement = ((BaseDomElementNode)selectedNode).getDomElement();
    if (domElement.isValid() && DomUtil.hasXml(domElement) && !(domElement.getParent() instanceof DomFileElement)) {
      enabled = true;
    }
  }

  e.getPresentation().setEnabled(enabled);


  if (enabled) {
    e.getPresentation().setText(getPresentationText(selectedNode, ApplicationBundle.message("action.remove")));
  }
  else {
    e.getPresentation().setText(ApplicationBundle.message("action.remove"));
  }

  e.getPresentation().setIcon(AllIcons.General.Remove);
}
项目:tools-idea    文件:AddElementInCollectionAction.java   
protected boolean isEnabled(final AnActionEvent e) {
  final DomModelTreeView treeView = getTreeView(e);

  final boolean enabled = treeView != null;
  e.getPresentation().setEnabled(enabled);

  return enabled;
}
项目:tools-idea    文件:AddElementInCollectionAction.java   
protected void showPopup(final ListPopup groupPopup, final AnActionEvent e) {
  if (myTreeView == null) {
    if (e.getPlace().equals(DomModelTreeView.DOM_MODEL_TREE_VIEW_POPUP)) {
      groupPopup.showInCenterOf(getTreeView(e).getTree());
    }
    else {
      groupPopup.showInBestPositionFor(e.getDataContext());
    }
  }
  else {
    super.showPopup(groupPopup, e);
  }
}
项目: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   
@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    文件:GotoDomElementDeclarationAction.java   
public void actionPerformed(AnActionEvent e, DomModelTreeView treeView) {
  final SimpleNode simpleNode = treeView.getTree().getSelectedNode();

  if(simpleNode instanceof BaseDomElementNode) {
    final DomElement domElement = ((BaseDomElementNode)simpleNode).getDomElement();
    final DomElementNavigationProvider provider =
      DomElementsNavigationManager.getManager(domElement.getManager().getProject()).getDomElementsNavigateProvider(DomElementsNavigationManager.DEFAULT_PROVIDER_NAME);

    provider.navigate(domElement, true);

  }
}
项目:tools-idea    文件:BaseDomTreeAction.java   
final public void update(AnActionEvent e) {
  final DomModelTreeView treeView = getTreeView(e);

  if (treeView != null) {
    update(e, treeView);
  }
  else {
    e.getPresentation().setEnabled(false);
  }
}
项目:tools-idea    文件:DeleteDomElement.java   
public void update(AnActionEvent e, DomModelTreeView treeView) {
  final SimpleNode selectedNode = treeView.getTree().getSelectedNode();

  if (selectedNode instanceof DomFileElementNode) {
    e.getPresentation().setVisible(false);
    return;
  }

  boolean enabled = false;
  if (selectedNode instanceof BaseDomElementNode) {
    final DomElement domElement = ((BaseDomElementNode)selectedNode).getDomElement();
    if (domElement.isValid() && DomUtil.hasXml(domElement) && !(domElement.getParent() instanceof DomFileElement)) {
      enabled = true;
    }
  }

  e.getPresentation().setEnabled(enabled);


  if (enabled) {
    e.getPresentation().setText(getPresentationText(selectedNode));
  }
  else {
    e.getPresentation().setText(ApplicationBundle.message("action.remove"));
  }

  e.getPresentation().setIcon(AllIcons.General.Remove);
}
项目:consulo-xml    文件:AddElementInCollectionAction.java   
protected boolean isEnabled(final AnActionEvent e) {
  final DomModelTreeView treeView = getTreeView(e);

  final boolean enabled = treeView != null;
  e.getPresentation().setEnabled(enabled);

  return enabled;
}
项目:consulo-xml    文件:AddElementInCollectionAction.java   
protected void showPopup(final ListPopup groupPopup, final AnActionEvent e) {
  if (myTreeView == null) {
    if (e.getPlace().equals(DomModelTreeView.DOM_MODEL_TREE_VIEW_POPUP)) {
      groupPopup.showInCenterOf(getTreeView(e).getTree());
    }
    else {
      groupPopup.showInBestPositionFor(e.getDataContext());
    }
  }
  else {
    super.showPopup(groupPopup, e);
  }
}
项目: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   
@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    文件:GotoDomElementDeclarationAction.java   
public void actionPerformed(AnActionEvent e, DomModelTreeView treeView) {
  final SimpleNode simpleNode = treeView.getTree().getSelectedNode();

  if(simpleNode instanceof BaseDomElementNode) {
    final DomElement domElement = ((BaseDomElementNode)simpleNode).getDomElement();
    final DomElementNavigationProvider provider =
      DomElementsNavigationManager.getManager(domElement.getManager().getProject()).getDomElementsNavigateProvider(DomElementsNavigationManager.DEFAULT_PROVIDER_NAME);

    provider.navigate(domElement, true);

  }
}
项目:consulo-xml    文件:BaseDomTreeAction.java   
final public void update(AnActionEvent e) {
  final DomModelTreeView treeView = getTreeView(e);

  if (treeView != null) {
    update(e, treeView);
  }
  else {
    e.getPresentation().setEnabled(false);
  }
}
项目:consulo-xml    文件:DeleteDomElement.java   
public void update(AnActionEvent e, DomModelTreeView treeView) {
  final SimpleNode selectedNode = treeView.getTree().getSelectedNode();

  if (selectedNode instanceof DomFileElementNode) {
    e.getPresentation().setVisible(false);
    return;
  }

  boolean enabled = false;
  if (selectedNode instanceof BaseDomElementNode) {
    final DomElement domElement = ((BaseDomElementNode)selectedNode).getDomElement();
    if (domElement.isValid() && DomUtil.hasXml(domElement) && !(domElement.getParent() instanceof DomFileElement)) {
      enabled = true;
    }
  }

  e.getPresentation().setEnabled(enabled);


  if (enabled) {
    e.getPresentation().setText(getPresentationText(selectedNode));
  }
  else {
    e.getPresentation().setText(ApplicationBundle.message("action.remove"));
  }

  e.getPresentation().setIcon(AllIcons.General.Remove);
}
项目:intellij-ce-playground    文件:AddElementInCollectionAction.java   
public AddElementInCollectionAction(final DomModelTreeView treeView) {
  myTreeView = treeView;
}
项目:intellij-ce-playground    文件:AddElementInCollectionAction.java   
protected DomModelTreeView getTreeView(AnActionEvent e) {
  if (myTreeView != null) return myTreeView;

  return DomModelTreeView.DATA_KEY.getData(e.getDataContext());
}
项目:intellij-ce-playground    文件:GotoDomElementDeclarationAction.java   
@Override
public void update(AnActionEvent e, DomModelTreeView treeView) {
  e.getPresentation().setVisible(treeView.getTree().getSelectedNode() instanceof BaseDomElementNode);
  e.getPresentation().setText(ActionsBundle.message("action.EditSource.text"));
}
项目:intellij-ce-playground    文件:BaseDomTreeAction.java   
protected BaseDomTreeAction(DomModelTreeView treeView) {
  myTreeView = treeView;
}
项目:intellij-ce-playground    文件:BaseDomTreeAction.java   
protected DomModelTreeView getTreeView(AnActionEvent e) {
  if (myTreeView != null) return myTreeView;

  return DomModelTreeView.DATA_KEY.getData(e.getDataContext());
}
项目:intellij-ce-playground    文件:DeleteDomElement.java   
public DeleteDomElement(final DomModelTreeView treeView) {
  super(treeView);
}
项目:tools-idea    文件:AddElementInCollectionAction.java   
public AddElementInCollectionAction(final DomModelTreeView treeView) {
  myTreeView = treeView;
}
项目:tools-idea    文件:AddElementInCollectionAction.java   
protected DomModelTreeView getTreeView(AnActionEvent e) {
  if (myTreeView != null) return myTreeView;

  return DomModelTreeView.DATA_KEY.getData(e.getDataContext());
}
项目:tools-idea    文件:GotoDomElementDeclarationAction.java   
public void update(AnActionEvent e, DomModelTreeView treeView) {
  e.getPresentation().setVisible(treeView.getTree().getSelectedNode() instanceof BaseDomElementNode);
  e.getPresentation().setText(ActionsBundle.message("action.EditSource.text"));
}