Java 类com.intellij.util.xml.ui.TooltipUtils 实例源码

项目:intellij-ce-playground    文件:BaseDomElementNode.java   
@Override
protected void doUpdate() {
  if (!myDomElement.isValid()) return;
  final Project project = myDomElement.getManager().getProject();
  if (project.isDisposed()) return;

  setUniformIcon(getNodeIcon());
  clearColoredText();

  final DomElementAnnotationsManager manager = DomElementAnnotationsManager.getInstance(project);
  final DomElementsProblemsHolder holder = manager.getCachedProblemHolder(myDomElement);
  final List<DomElementProblemDescriptor> problems =
    holder.getProblems(myDomElement, highlightIfChildrenHaveProblems(), HighlightSeverity.ERROR);

  if (problems.size() > 0) {
    final String toolTip = TooltipUtils.getTooltipText(problems);
    addColoredFragment(getNodeName(), toolTip, getWavedAttributes(SimpleTextAttributes.STYLE_PLAIN));
    if (isShowContainingFileInfo()) {
      addColoredFragment(" (" + DomUtil.getFile(myDomElement).getName() + ")", toolTip, SimpleTextAttributes.GRAY_ATTRIBUTES);
    }
  }
  else if (myDomElement.getXmlTag() == null && !(myDomElement instanceof DomFileElement)) {
    addColoredFragment(getNodeName(), folder ? SimpleTextAttributes.GRAYED_BOLD_ATTRIBUTES : SimpleTextAttributes.GRAYED_ATTRIBUTES);
  }
  else if (folder) {
    addColoredFragment(getNodeName(), SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
    final int childrenCount = getChildren().length;
    addColoredFragment(" (" + childrenCount + ')', SimpleTextAttributes.GRAY_ATTRIBUTES);
  }
  else {
    addColoredFragment(getNodeName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);

    if (isShowContainingFileInfo()) {
      addColoredFragment(" (" + DomUtil.getFile(myDomElement).getName() + ")", SimpleTextAttributes.GRAY_ATTRIBUTES);
    }
  }
}
项目:tools-idea    文件:BaseDomElementNode.java   
protected void doUpdate() {
  if (!myDomElement.isValid()) return;
  final Project project = myDomElement.getManager().getProject();
  if (project.isDisposed()) return;

  setUniformIcon(getNodeIcon());
  clearColoredText();

  final DomElementAnnotationsManager manager = DomElementAnnotationsManager.getInstance(project);
  final DomElementsProblemsHolder holder = manager.getCachedProblemHolder(myDomElement);
  final List<DomElementProblemDescriptor> problems =
    holder.getProblems(myDomElement, highlightIfChildrenHaveProblems(), HighlightSeverity.ERROR);

  if (problems.size() > 0) {
    final String toolTip = TooltipUtils.getTooltipText(problems);
    addColoredFragment(getNodeName(), toolTip, getWavedAttributes(SimpleTextAttributes.STYLE_PLAIN));
    if (isShowContainingFileInfo()) {
      addColoredFragment(" (" + DomUtil.getFile(myDomElement).getName() + ")", toolTip, SimpleTextAttributes.GRAY_ATTRIBUTES);
    }
  }
  else if (myDomElement.getXmlTag() == null && !(myDomElement instanceof DomFileElement)) {
    addColoredFragment(getNodeName(), folder ? SimpleTextAttributes.GRAYED_BOLD_ATTRIBUTES : SimpleTextAttributes.GRAYED_ATTRIBUTES);
  }
  else if (folder) {
    addColoredFragment(getNodeName(), SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
    final int childrenCount = getChildren().length;
    addColoredFragment(" (" + childrenCount + ')', SimpleTextAttributes.GRAY_ATTRIBUTES);
  }
  else {
    addColoredFragment(getNodeName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);

    if (isShowContainingFileInfo()) {
      addColoredFragment(" (" + DomUtil.getFile(myDomElement).getName() + ")", SimpleTextAttributes.GRAY_ATTRIBUTES);
    }
  }
}
项目:consulo-xml    文件:BaseDomElementNode.java   
protected void doUpdate() {
  if (!myDomElement.isValid()) return;
  final Project project = myDomElement.getManager().getProject();
  if (project.isDisposed()) return;

  setUniformIcon(getNodeIcon());
  clearColoredText();

  final DomElementAnnotationsManager manager = DomElementAnnotationsManager.getInstance(project);
  final DomElementsProblemsHolder holder = manager.getCachedProblemHolder(myDomElement);
  final List<DomElementProblemDescriptor> problems =
    holder.getProblems(myDomElement, highlightIfChildrenHaveProblems(), HighlightSeverity.ERROR);

  if (problems.size() > 0) {
    final String toolTip = TooltipUtils.getTooltipText(problems);
    addColoredFragment(getNodeName(), toolTip, getWavedAttributes(SimpleTextAttributes.STYLE_PLAIN));
    if (isShowContainingFileInfo()) {
      addColoredFragment(" (" + DomUtil.getFile(myDomElement).getName() + ")", toolTip, SimpleTextAttributes.GRAY_ATTRIBUTES);
    }
  }
  else if (myDomElement.getXmlTag() == null && !(myDomElement instanceof DomFileElement)) {
    addColoredFragment(getNodeName(), folder ? SimpleTextAttributes.GRAYED_BOLD_ATTRIBUTES : SimpleTextAttributes.GRAYED_ATTRIBUTES);
  }
  else if (folder) {
    addColoredFragment(getNodeName(), SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
    final int childrenCount = getChildren().length;
    addColoredFragment(" (" + childrenCount + ')', SimpleTextAttributes.GRAY_ATTRIBUTES);
  }
  else {
    addColoredFragment(getNodeName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);

    if (isShowContainingFileInfo()) {
      addColoredFragment(" (" + DomUtil.getFile(myDomElement).getName() + ")", SimpleTextAttributes.GRAY_ATTRIBUTES);
    }
  }
}