public void updateUI() {
   super.updateUI();
   TreeCellRenderer tcr = super.getCellRenderer();
   if (tcr instanceof DefaultTreeCellRenderer) {
     DefaultTreeCellRenderer dtcr = (DefaultTreeCellRenderer) tcr;
     dtcr.setTextSelectionColor(UIUtil.getTableSelectionForeground());
     dtcr.setBackgroundSelectionColor(UIUtil.getTableSelectionBackground());
   }
 }
  @NotNull
  public JComponent createComponent() {
    myTree.updateUI();
    reInitWholePanelIfNeeded();

    updateSelectionFromTree();

    final JPanel panel =
        new JPanel(new BorderLayout()) {
          public Dimension getPreferredSize() {
            return getPanelPreferredSize();
          }
        };
    panel.add(myWholePanel, BorderLayout.CENTER);
    return panel;
  }
Example #3
0
  private JPanel createPanel() {
    createModel();
    myTree = new MyTree();
    myTree.setLineStyleAngled();
    myTree.setRootVisible(false);
    myTree.setShowsRootHandles(true);
    myTree.updateUI();
    myTree.setLargeModel(true);

    myTree.addKeyListener(
        new KeyAdapter() {
          public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_ENTER) {
              OpenSourceUtil.openSourcesFrom(
                  DataManager.getInstance().getDataContext(myTree), false);
            }
          }
        });

    myTree.addMouseListener(
        new PopupHandler() {
          public void invokePopup(Component comp, int x, int y) {
            popupInvoked(comp, x, y);
          }
        });

    EditSourceOnDoubleClickHandler.install(myTree);

    myAutoScrollToSourceHandler.install(myTree);

    myOccurenceNavigatorSupport =
        new OccurenceNavigatorSupport(myTree) {
          protected Navigatable createDescriptorForNode(DefaultMutableTreeNode node) {
            if (!(node instanceof MessageNode)) {
              return null;
            }
            MessageNode messageNode = (MessageNode) node;
            AntBuildMessageView.MessageType type = messageNode.getType();

            if (type != AntBuildMessageView.MessageType.MESSAGE
                && type != AntBuildMessageView.MessageType.ERROR) {
              return null;
            }

            if (!isValid(messageNode.getFile())) {
              return null;
            }

            return new OpenFileDescriptor(
                myProject, messageNode.getFile(), messageNode.getOffset());
          }

          @Nullable
          public String getNextOccurenceActionName() {
            return AntBundle.message("ant.execution.next.error.warning.action.name");
          }

          @Nullable
          public String getPreviousOccurenceActionName() {
            return AntBundle.message("ant.execution.previous.error.warning.action.name");
          }
        };

    JPanel panel = new JPanel(new BorderLayout());

    JScrollPane scrollPane = MessageTreeRenderer.install(myTree);
    panel.add(scrollPane, BorderLayout.CENTER);
    return panel;
  }
Example #4
0
 public void updateUI() {
   super.updateUI();
   TreeUtil.installActions(this);
 }