Java Code Examples for com.intellij.util.ui.tree.WideSelectionTreeUI#isWideSelection()

The following examples show how to use com.intellij.util.ui.tree.WideSelectionTreeUI#isWideSelection() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DnDAwareTree.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public final boolean isOverSelection(final Point point) {
  final TreePath path = WideSelectionTreeUI.isWideSelection(this)
                        ? getClosestPathForLocation(point.x, point.y) : getPathForLocation(point.x, point.y);
  if (path == null) return false;
  return isPathSelected(path);
}
 
Example 2
Source File: InspectorColoredTreeCellRenderer.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public final Component getTreeCellRendererComponent(JTree tree,
                                                    Object value,
                                                    boolean selected,
                                                    boolean expanded,
                                                    boolean leaf,
                                                    int row,
                                                    boolean hasFocus) {
  myTree = tree;

  clear();

  myFocusedCalculated = false;

  // We paint background if and only if tree path is selected and tree has focus.
  // If path is selected and tree is not focused then we just paint focused border.
  if (UIUtil.isFullRowSelectionLAF()) {
    setBackground(selected ? UIUtil.getTreeSelectionBackground() : null);
  }
  else if (WideSelectionTreeUI.isWideSelection(tree)) {
    setPaintFocusBorder(false);
    if (selected) {
      setBackground(hasFocus ? UIUtil.getTreeSelectionBackground() : UIUtil.getTreeUnfocusedSelectionBackground());
    }
  }
  else if (selected) {
    setPaintFocusBorder(true);
    if (isFocused()) {
      setBackground(UIUtil.getTreeSelectionBackground());
    }
    else {
      setBackground(null);
    }
  }
  else {
    setBackground(null);
  }

  if (value instanceof LoadingNode) {
    setForeground(JBColor.GRAY);
  }
  else {
    setForeground(tree.getForeground());
    setIcon(null);
  }

  super.setOpaque(myOpaque || selected && hasFocus || selected && isFocused()); // draw selection background even for non-opaque tree


  if (tree.getUI() instanceof InspectorTreeUI && UIUtil.isUnderAquaBasedLookAndFeel()) {
    setMyBorder(null);
    setIpad(JBUI.insets(0, 2));
  }

  customizeCellRenderer(tree, value, selected, expanded, leaf, row, hasFocus);

  return this;
}
 
Example 3
Source File: InspectorColoredTreeCellRenderer.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public final Component getTreeCellRendererComponent(JTree tree,
                                                    Object value,
                                                    boolean selected,
                                                    boolean expanded,
                                                    boolean leaf,
                                                    int row,
                                                    boolean hasFocus) {
  myTree = tree;

  clear();

  myFocusedCalculated = false;

  // We paint background if and only if tree path is selected and tree has focus.
  // If path is selected and tree is not focused then we just paint focused border.
  if (UIUtil.isFullRowSelectionLAF()) {
    setBackground(selected ? UIUtil.getTreeSelectionBackground() : null);
  }
  else if (WideSelectionTreeUI.isWideSelection(tree)) {
    setPaintFocusBorder(false);
    if (selected) {
      setBackground(hasFocus ? UIUtil.getTreeSelectionBackground() : UIUtil.getTreeUnfocusedSelectionBackground());
    }
  }
  else if (selected) {
    setPaintFocusBorder(true);
    if (isFocused()) {
      setBackground(UIUtil.getTreeSelectionBackground());
    }
    else {
      setBackground(null);
    }
  }
  else {
    setBackground(null);
  }

  if (value instanceof LoadingNode) {
    setForeground(JBColor.GRAY);
  }
  else {
    setForeground(tree.getForeground());
    setIcon(null);
  }

  super.setOpaque(myOpaque || selected && hasFocus || selected && isFocused()); // draw selection background even for non-opaque tree


  if (tree.getUI() instanceof InspectorTreeUI && UIUtil.isUnderAquaBasedLookAndFeel()) {
    setMyBorder(null);
    setIpad(JBUI.insets(0, 2));
  }

  customizeCellRenderer(tree, value, selected, expanded, leaf, row, hasFocus);

  return this;
}