Index: javax/swing/text/TextAction.java =================================================================== RCS file: /cvs/gcc/gcc/libjava/javax/swing/text/TextAction.java,v retrieving revision 1.2.8.3 diff -u -r1.2.8.3 TextAction.java --- javax/swing/text/TextAction.java 22 Oct 2004 12:41:29 -0000 1.2.8.3 +++ javax/swing/text/TextAction.java 29 Dec 2004 13:34:31 -0000 @@ -39,6 +39,8 @@ package javax.swing.text; import java.awt.event.ActionEvent; +import java.util.ArrayList; +import java.util.HashSet; import javax.swing.AbstractAction; import javax.swing.Action; @@ -59,33 +61,48 @@ } /** - * getTextComponent - * @param event TODO - * @return JTextComponent + * Returns the JTextComponent object associated with the given + * ActionEvent. If the source of the event is not a + * JTextComponent the currently focused text component is returned. + * + * @param event the action event + * + * @return the JTextComponent */ protected final JTextComponent getTextComponent(ActionEvent event) { - if (event.getSource() != null && - event.getSource() instanceof JTextComponent) + if (event.getSource() instanceof JTextComponent) return (JTextComponent) event.getSource(); - else - return getFocusedComponent(); + + return getFocusedComponent(); } /** - * augmentList - * @param list1 TODO - * @param list2 TODO - * @return Action[] + * Creates a new array of Action containing both given arrays. + * + * @param list1 the first action array + * @param list2 the second action array + * + * @return the augmented array of actions */ public static final Action[] augmentList(Action[] list1, Action[] list2) { - return null; // TODO + HashSet actionSet = new HashSet(); + + for (int i = 0; i < list1.length; ++i) + actionSet.add(list1[i]); + + for (int i = 0; i < list2.length; ++i) + actionSet.add(list2[i]); + + ArrayList list = new ArrayList(actionSet); + return (Action[]) list.toArray(new Action[actionSet.size()]); } /** - * getFocusedComponent - * @return JTextComponent + * Returns the current focused JTextComponent object. + * + * @return the JTextComponent */ protected final JTextComponent getFocusedComponent() {