// ActionListener Interface public void actionPerformed(ActionEvent e) { OutlinerDocument doc = (OutlinerDocument) Outliner.documents.getMostRecentDocumentTouched(); OutlinerCellRendererImpl textArea = doc.panel.layout.getUIComponent(doc.tree.getEditingNode()); if (textArea == null) { return; } Node node = textArea.node; JoeTree tree = node.getTree(); OutlineLayoutManager layout = tree.getDocument().panel.layout; if (doc.tree.getComponentFocus() == OutlineLayoutManager.TEXT) { ToggleEditableAction.toggleEditableInheritanceText(node, tree, layout); } else if (doc.tree.getComponentFocus() == OutlineLayoutManager.ICON) { ToggleEditableAction.toggleEditableInheritance(node, tree, layout); } }
@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; } }