当前位置: 首页>>代码示例>>Java>>正文


Java WideSelectionTreeUI类代码示例

本文整理汇总了Java中com.intellij.util.ui.tree.WideSelectionTreeUI的典型用法代码示例。如果您正苦于以下问题:Java WideSelectionTreeUI类的具体用法?Java WideSelectionTreeUI怎么用?Java WideSelectionTreeUI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


WideSelectionTreeUI类属于com.intellij.util.ui.tree包,在下文中一共展示了WideSelectionTreeUI类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onDoubleClick

import com.intellij.util.ui.tree.WideSelectionTreeUI; //导入依赖的package包/类
@Override
public boolean onDoubleClick(MouseEvent e) {
  final TreePath clickPath = myTree.getUI() instanceof WideSelectionTreeUI ? myTree.getClosestPathForLocation(e.getX(), e.getY())
                                                                           : myTree.getPathForLocation(e.getX(), e.getY());
  if (clickPath == null) return false;

  final DataContext dataContext = DataManager.getInstance().getDataContext(myTree);
  final Project project = CommonDataKeys.PROJECT.getData(dataContext);
  if (project == null) return false;

  final TreePath selectionPath = myTree.getSelectionPath();
  if (selectionPath == null || !clickPath.equals(selectionPath)) return false;
  final Object lastPathComponent = selectionPath.getLastPathComponent();
  if (((TreeNode)lastPathComponent).isLeaf() || !expandOnDoubleClick(((TreeNode)lastPathComponent))) {
    //Node expansion for non-leafs has a higher priority
    processDoubleClick(e, dataContext, (TreeNode) lastPathComponent);
    return true;
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:EditSourceOnDoubleClickHandler.java

示例2: updateStyle

import com.intellij.util.ui.tree.WideSelectionTreeUI; //导入依赖的package包/类
protected void updateStyle(@NotNull JEditorPane editorPane, @Nullable JTree tree, Object value, boolean selected, boolean hasFocus) {
  final HTMLDocument htmlDocument = (HTMLDocument)editorPane.getDocument();
  final Style style = htmlDocument.getStyleSheet().getStyle(MSG_STYLE);
  if (value instanceof LoadingNode) {
    StyleConstants.setForeground(style, JBColor.GRAY);
  }
  else {
    if (selected) {
      StyleConstants.setForeground(style, hasFocus ? UIUtil.getTreeSelectionForeground() : UIUtil.getTreeTextForeground());
    }
    else {
      StyleConstants.setForeground(style, UIUtil.getTreeTextForeground());
    }
  }

  if (UIUtil.isUnderGTKLookAndFeel() ||
      UIUtil.isUnderNimbusLookAndFeel() && selected && hasFocus ||
      tree != null && tree.getUI() instanceof WideSelectionTreeUI && ((WideSelectionTreeUI)tree.getUI()).isWideSelection()) {
    editorPane.setOpaque(false);
  }
  else {
    editorPane.setOpaque(selected && hasFocus);
  }

  htmlDocument.setCharacterAttributes(0, htmlDocument.getLength(), style, false);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:NotificationMessageElement.java

示例3: doNotFillBackground

import com.intellij.util.ui.tree.WideSelectionTreeUI; //导入依赖的package包/类
public static void doNotFillBackground(@NotNull final JTree tree, @NotNull final DefaultTreeCellRenderer renderer) {
  TreeUI ui = tree.getUI();
  if (ui instanceof WideSelectionTreeUI) {
    if (((WideSelectionTreeUI)ui).isWideSelection()) {
      renderer.setOpaque(false);
      try {
        final Field fillBackground = DefaultTreeCellRenderer.class.getDeclaredField("fillBackground");
        fillBackground.setAccessible(true);
        fillBackground.set(renderer, false);
      }
      catch (Exception e) {
        // nothing
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:MacUIUtil.java

示例4: onDoubleClick

import com.intellij.util.ui.tree.WideSelectionTreeUI; //导入依赖的package包/类
@Override
public boolean onDoubleClick(MouseEvent e) {
  final TreePath clickPath = myTree.getUI() instanceof WideSelectionTreeUI ? myTree.getClosestPathForLocation(e.getX(), e.getY())
                                                                           : myTree.getPathForLocation(e.getX(), e.getY());
  if (clickPath == null) return false;

  final DataContext dataContext = DataManager.getInstance().getDataContext(myTree);
  final Project project = PlatformDataKeys.PROJECT.getData(dataContext);
  if (project == null) return false;

  final TreePath selectionPath = myTree.getSelectionPath();
  if (selectionPath == null || !clickPath.equals(selectionPath)) return false;
  final Object lastPathComponent = selectionPath.getLastPathComponent();
  if (((TreeNode)lastPathComponent).isLeaf() || !expandOnDoubleClick(((TreeNode)lastPathComponent))) {
    //Node expansion for non-leafs has a higher priority
    processDoubleClick(e, dataContext, (TreeNode) lastPathComponent);
    return true;
  }
  return false;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:EditSourceOnDoubleClickHandler.java

示例5: onDoubleClick

import com.intellij.util.ui.tree.WideSelectionTreeUI; //导入依赖的package包/类
@Override
public boolean onDoubleClick(MouseEvent e) {
  final TreePath clickPath = myTree.getUI() instanceof WideSelectionTreeUI ? myTree.getClosestPathForLocation(e.getX(), e.getY())
                                                                           : myTree.getPathForLocation(e.getX(), e.getY());
  if (clickPath == null) return false;

  final DataContext dataContext = DataManager.getInstance().getDataContext(myTree);
  final Project project = dataContext.getData(CommonDataKeys.PROJECT);
  if (project == null) return false;

  final TreePath selectionPath = myTree.getSelectionPath();
  if (selectionPath == null || !clickPath.equals(selectionPath)) return false;
  final Object lastPathComponent = selectionPath.getLastPathComponent();
  if (((TreeNode)lastPathComponent).isLeaf() || !expandOnDoubleClick(((TreeNode)lastPathComponent))) {
    //Node expansion for non-leafs has a higher priority
    processDoubleClick(e, dataContext, (TreeNode) lastPathComponent);
    return true;
  }
  return false;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:21,代码来源:EditSourceOnDoubleClickHandler.java

示例6: updateStyle

import com.intellij.util.ui.tree.WideSelectionTreeUI; //导入依赖的package包/类
protected void updateStyle(@Nonnull JEditorPane editorPane, @javax.annotation.Nullable JTree tree, Object value, boolean selected, boolean hasFocus) {
  final HTMLDocument htmlDocument = (HTMLDocument)editorPane.getDocument();
  final Style style = htmlDocument.getStyleSheet().getStyle(MSG_STYLE);
  if (value instanceof LoadingNode) {
    StyleConstants.setForeground(style, JBColor.GRAY);
  }
  else {
    if (selected) {
      StyleConstants.setForeground(style, hasFocus ? UIUtil.getTreeSelectionForeground() : UIUtil.getTreeTextForeground());
    }
    else {
      StyleConstants.setForeground(style, UIUtil.getTreeTextForeground());
    }
  }

  if (UIUtil.isUnderGTKLookAndFeel() ||
      UIUtil.isUnderNimbusLookAndFeel() && selected && hasFocus ||
      tree != null && tree.getUI() instanceof WideSelectionTreeUI && ((WideSelectionTreeUI)tree.getUI()).isWideSelection()) {
    editorPane.setOpaque(false);
  }
  else {
    editorPane.setOpaque(selected && hasFocus);
  }

  htmlDocument.setCharacterAttributes(0, htmlDocument.getLength(), style, false);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:27,代码来源:NotificationMessageElement.java

示例7: doNotFillBackground

import com.intellij.util.ui.tree.WideSelectionTreeUI; //导入依赖的package包/类
public static void doNotFillBackground(@Nonnull final JTree tree, @Nonnull final DefaultTreeCellRenderer renderer) {
  TreeUI ui = tree.getUI();
  if (ui instanceof WideSelectionTreeUI) {
    if (((WideSelectionTreeUI)ui).isWideSelection()) {
      renderer.setOpaque(false);
      try {
        final Field fillBackground = DefaultTreeCellRenderer.class.getDeclaredField("fillBackground");
        fillBackground.setAccessible(true);
        fillBackground.set(renderer, false);
      }
      catch (Exception e) {
        // nothing
      }
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:MacUIUtil.java

示例8: initTree

import com.intellij.util.ui.tree.WideSelectionTreeUI; //导入依赖的package包/类
protected void initTree(Tree tree) {
    tree.setCellRenderer(new ContactTreeCellRenderer());
    tree.setShowsRootHandles(false);
    tree.setRootVisible(false);
    tree.addMouseListener(new IMContactDoubleClicker(getImPanel()));
    tree.setUI(new WideSelectionTreeUI() {

    });
}
 
开发者ID:Jamling,项目名称:SmartQQ4IntelliJ,代码行数:10,代码来源:IMContactView.java

示例9: getTreeCellRendererComponent

import com.intellij.util.ui.tree.WideSelectionTreeUI; //导入依赖的package包/类
public Component getTreeCellRendererComponent(
  JTree tree,
  Object value,
  boolean selected,
  boolean expanded,
  boolean leaf,
  int row,
  boolean hasFocus
  ) {
  setText(tree.convertValueToText(value, selected, expanded, leaf, row, hasFocus));
  setFont(UIUtil.getTreeFont());
  setIcon(null);

  if (tree.getUI() instanceof WideSelectionTreeUI && ((WideSelectionTreeUI)tree.getUI()).isWideSelection()) {
    setOpaque(false);
    myIsSelected = false;
    myHasFocus = false;
    setDoNotHighlight(selected && hasFocus);
    setForeground(selected && hasFocus ? UIUtil.getTreeSelectionForeground() : UIUtil.getTreeForeground());
  } else {
    setOpaque(true);
    myIsSelected = selected;
    myHasFocus = hasFocus;
    setDoNotHighlight(false);
  }
  
  myHasFocus = hasFocus;
  return this;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:HighlightableCellRenderer.java

示例10: getTreeCellEditorComponent

import com.intellij.util.ui.tree.WideSelectionTreeUI; //导入依赖的package包/类
public Component getTreeCellEditorComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row) {
  myPanel.removeAll();
  myPanel.add(myLeft.getTreeCellRendererComponent(tree, value, false, expanded, leaf, row, true), BorderLayout.WEST);
  myPanel.add(myRight.getTreeCellEditorComponent(tree, value, selected, expanded, leaf, row), BorderLayout.EAST);

  if (UIUtil.isFullRowSelectionLAF()) {
    myPanel.setBackground(selected ? UIUtil.getTreeSelectionBackground() : null);
  }
  else if (tree.getUI() instanceof WideSelectionTreeUI && ((WideSelectionTreeUI)tree.getUI()).isWideSelection()) {
    if (selected) {
      myPanel.setBackground(UIUtil.getTreeSelectionBackground());
    }
  }
  else if (selected) {
    myPanel.setBackground(UIUtil.getTreeSelectionBackground());
  }
  else {
    myPanel.setBackground(null);
  }

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

  if (UIUtil.isUnderGTKLookAndFeel() ||
      UIUtil.isUnderNimbusLookAndFeel() && selected ||
      tree.getUI() instanceof WideSelectionTreeUI && ((WideSelectionTreeUI)tree.getUI()).isWideSelection()) {
    myPanel.setOpaque(false);
  }
  return myPanel;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:35,代码来源:NewErrorTreeEditor.java

示例11: isOverSelection

import com.intellij.util.ui.tree.WideSelectionTreeUI; //导入依赖的package包/类
@Override
public final boolean isOverSelection(final Point point) {
  final TreeUI ui = getUI();
  final TreePath path = ui instanceof WideSelectionTreeUI && ((WideSelectionTreeUI)ui).isWideSelection()
                        ? getClosestPathForLocation(point.x, point.y) : getPathForLocation(point.x, point.y);
  if (path == null) return false;
  return isPathSelected(path);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:DnDAwareTree.java

示例12: ActionsTree

import com.intellij.util.ui.tree.WideSelectionTreeUI; //导入依赖的package包/类
public ActionsTree() {
  myRoot = new DefaultMutableTreeNode(ROOT);

  myTree = new Tree(new MyModel(myRoot)) {
    @Override
    public void paint(Graphics g) {
      super.paint(g);
      Rectangle visibleRect = getVisibleRect();
      Rectangle clip = g.getClipBounds();
      for (int row = 0; row < getRowCount(); row++) {
        Rectangle rowBounds = getRowBounds(row);
        rowBounds.x = 0;
        rowBounds.width = Integer.MAX_VALUE;

        if (rowBounds.intersects(clip)) {
          Object node = getPathForRow(row).getLastPathComponent();

          if (node instanceof DefaultMutableTreeNode) {
            Object data = ((DefaultMutableTreeNode)node).getUserObject();
            Rectangle fullRowRect = new Rectangle(visibleRect.x, rowBounds.y, visibleRect.width, rowBounds.height);
            paintRowData(this, data, fullRowRect, (Graphics2D)g);
          }
        }
      }
      
    }
  };
  myTree.setRootVisible(false);
  myTree.setShowsRootHandles(true);

  myTree.putClientProperty(WideSelectionTreeUI.STRIPED_CLIENT_PROPERTY, Boolean.TRUE);
  myTree.setCellRenderer(new KeymapsRenderer());

  myTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);

  myComponent = ScrollPaneFactory.createScrollPane(myTree,
                                                   ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
                                                   ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:40,代码来源:ActionsTree.java

示例13: isOverSelection

import com.intellij.util.ui.tree.WideSelectionTreeUI; //导入依赖的package包/类
public final boolean isOverSelection(final Point point) {
  final TreeUI ui = getUI();
  final TreePath path = ui instanceof WideSelectionTreeUI && ((WideSelectionTreeUI)ui).isWideSelection()
                        ? getClosestPathForLocation(point.x, point.y) : getPathForLocation(point.x, point.y);
  if (path == null) return false;
  return isPathSelected(path);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:8,代码来源:DnDAwareTree.java

示例14: isOverSelection

import com.intellij.util.ui.tree.WideSelectionTreeUI; //导入依赖的package包/类
@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);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:8,代码来源:DnDAwareTree.java

示例15: JBDefaultTreeCellRenderer

import com.intellij.util.ui.tree.WideSelectionTreeUI; //导入依赖的package包/类
public JBDefaultTreeCellRenderer(@NotNull final JTree tree) {
  MacUIUtil.doNotFillBackground(tree, this);
  myMacTreeUI = tree.getUI() instanceof WideSelectionTreeUI && ((WideSelectionTreeUI)tree.getUI()).isWideSelection();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:JBDefaultTreeCellRenderer.java


注:本文中的com.intellij.util.ui.tree.WideSelectionTreeUI类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。