Esempio n. 1
0
  @Override
  public void actionPerformed(ActionEvent e) {
    // System.out.println("MergeAction");

    OutlinerCellRendererImpl textArea = null;
    boolean isIconFocused = true;
    Component c = (Component) e.getSource();
    if (c instanceof OutlineButton) {
      textArea = ((OutlineButton) c).renderer;
    } else if (c instanceof OutlineLineNumber) {
      textArea = ((OutlineLineNumber) c).renderer;
    } else if (c instanceof OutlineCommentIndicator) {
      textArea = ((OutlineCommentIndicator) c).renderer;
    } else if (c instanceof OutlinerCellRendererImpl) {
      textArea = (OutlinerCellRendererImpl) c;
      isIconFocused = false;
    }

    // Shorthand
    Node node = textArea.node;
    JoeTree tree = node.getTree();
    OutlineLayoutManager layout = tree.getDocument().panel.layout;

    // System.out.println(e.getModifiers());
    switch (e.getModifiers()) {
      case 2:
        if (isIconFocused) {
          merge(node, tree, layout, false);
        }
        break;

      case 3:
        if (isIconFocused) {
          merge(node, tree, layout, true);
        }
        break;
    }
  }