Package com.intellij.usages.impl

Examples of com.intellij.usages.impl.UsageNode


  }

  @Override
  public Component getTableCellRendererComponent(JTable list, Object value, boolean isSelected,
      boolean hasFocus, int row, int column) {
    UsageNode usageNode = value instanceof UsageNode ? (UsageNode) value : null;

    Usage usage = usageNode == null ? null : usageNode.getUsage();

    JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
    Color fileBgColor = getBackgroundColor(isSelected, usage);
    final Color bg = UIUtil.getListSelectionBackground();
    final Color fg = UIUtil.getListSelectionForeground();
    panel.setBackground(isSelected ? bg : fileBgColor == null ? list.getBackground() : fileBgColor);
    panel.setForeground(isSelected ? fg : list.getForeground());

    if (usage == null || usageNode instanceof ShowUsagesAction.StringNode) {
      panel.setLayout(new BorderLayout());
      if (column == 0) {
        panel.add(
            new JLabel("<html><body><b>" + value + "</b></body></html>", SwingConstants.CENTER));
      }
      return panel;
    }

    SimpleColoredComponent textChunks = new SimpleColoredComponent();
    textChunks.setIpad(new Insets(0, 0, 0, 0));
    textChunks.setBorder(null);

    if (column == 0) {
      GroupNode parent = (GroupNode) usageNode.getParent();
      appendGroupText(parent, panel, fileBgColor);
      if (usage == ShowUsagesAction.MORE_USAGES_SEPARATOR) {
        textChunks.append("...<");
        textChunks.append("more usages", SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
        textChunks.append(">...");
View Full Code Here


          }

          Usage usageToAdd = decider.shouldShow(myUsageTarget, usage) ? usage : null;
          if (usageToAdd == null) return true;

          UsageNode node = usageView.doAppendUsage(usageToAdd);
          usages.add(usageToAdd);

          if (node != null) {
            visibleNodes.add(node);
            boolean continueSearch = true;
View Full Code Here

      return list.toArray(new ColumnInfo[list.size()]);
    }

    @Override
    public void addToModel(int idx, Object element) {
      UsageNode node =
          element instanceof UsageNode ? (UsageNode) element : createStringNode(element);

      if (idx < getRowCount()) {
        insertRow(idx, node);
      } else {
View Full Code Here

    }

    @Override
    protected String getElementText(@NotNull Object element) {
      if (!(element instanceof UsageNode)) return element.toString();
      UsageNode node = (UsageNode) element;
      if (node instanceof StringNode) return "";
      Usage usage = node.getUsage();
      if (usage == MORE_USAGES_SEPARATOR) return "";
      GroupNode group = (GroupNode) node.getParent();
      return usage.getPresentation().getPlainText() + group;
    }
View Full Code Here

    myUsageView = usageView;
  }

  @Override
  public Component getTableCellRendererComponent(JTable list, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
    UsageNode usageNode = value instanceof UsageNode ? (UsageNode)value : null;

    Usage usage = usageNode == null ? null : usageNode.getUsage();

    JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0,0));
    Color fileBgColor = getBackgroundColor(isSelected, usage);
    final Color bg = UIUtil.getListSelectionBackground();
    final Color fg = UIUtil.getListSelectionForeground();
    panel.setBackground(isSelected ? bg : fileBgColor == null ? list.getBackground() : fileBgColor);
    panel.setForeground(isSelected ? fg : list.getForeground());

    if (usage == null || usageNode instanceof ShowUsagesAction.StringNode) {
      panel.setLayout(new BorderLayout());
      if (column == 0) {
        panel.add(new JLabel("<html><body><b>" + value + "</b></body></html>", SwingConstants.CENTER));
      }
      return panel;
    }


    SimpleColoredComponent textChunks = new SimpleColoredComponent();
    textChunks.setIpad(new Insets(0,0,0,0));
    textChunks.setBorder(null);

    if (column == 0) {
      GroupNode parent = (GroupNode)usageNode.getParent();
      appendGroupText(parent, panel, fileBgColor);
      if (usage == ShowUsagesAction.MORE_USAGES_SEPARATOR) {
        textChunks.append("...<");
        textChunks.append("more usages", SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
        textChunks.append(">...");
View Full Code Here

      return list.toArray(new ColumnInfo[list.size()]);
    }

    @Override
    public void addToModel(int idx, Object element) {
      UsageNode node = element instanceof UsageNode ? (UsageNode)element : createStringNode(element);

      if (idx < getRowCount()) {
        insertRow(idx, node);
      }
      else {
View Full Code Here

    }

    @Override
    protected String getElementText(@NotNull Object element) {
      if (!(element instanceof UsageNode)) return element.toString();
      UsageNode node = (UsageNode)element;
      if (node instanceof StringNode) return "";
      Usage usage = node.getUsage();
      if (usage == MORE_USAGES_SEPARATOR) return "";
      GroupNode group = (GroupNode)node.getParent();
      return usage.getPresentation().getPlainText() + group;
    }
View Full Code Here

          }

          Usage usageToAdd = transform(usage);
          if (usageToAdd == null) return true;

          UsageNode node = usageView.doAppendUsage(usageToAdd);
          usages.add(usageToAdd);
          if (node != null) {
            visibleNodes.add(node);
            boolean continueSearch = true;
            if (visibleNodes.size() == maxUsages) {
View Full Code Here

TOP

Related Classes of com.intellij.usages.impl.UsageNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.