Imported GNU Classpath 0.90
[official-gcc.git] / libjava / classpath / javax / swing / undo / UndoableEdit.java
blob9938af751c70b8700185c99e13531255eecad9b9
1 /* UndoableEdit.java --
2 Copyright (C) 2002, 2006, Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 02110-1301 USA.
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
38 package javax.swing.undo;
40 /**
41 * An editing operation that supports undo/redoability.
43 * @author Andrew Selkirk
45 public interface UndoableEdit
48 /**
49 * Incorporates another editing action into this one, thus forming a
50 * combined action.
52 * @param edit the editing action to be incorporated.
54 * @return <code>true</code> if the edit was combined successfully, and
55 * <code>false</code> if it could not be combined.
57 boolean addEdit(UndoableEdit edit);
59 /**
60 * Determines whether it would be possible to redo this editing
61 * action.
63 * @return <code>true</code> to indicate that this action can be
64 * redone, <code>false</code> otherwise.
66 * @see #redo()
67 * @see #canUndo()
69 boolean canRedo();
71 /**
72 * Determines whether it would be possible to undo this editing
73 * action.
75 * @return <code>true</code> to indicate that this action can be
76 * undone, <code>false</code> otherwise.
78 * @see #undo()
79 * @see #canRedo()
81 boolean canUndo();
83 /**
84 * Informs this edit action that it will no longer be used. Some
85 * actions might use this information to release resources, for
86 * example open files. Called by {@link UndoManager} before this
87 * action is removed from the edit queue.
89 void die();
91 /**
92 * Returns a human-readable, localized name that describes this
93 * editing action and can be displayed to the user.
95 * @return The presentation name.
97 String getPresentationName();
99 /**
100 * Returns the redo presentation name.
102 * @return The redo presentation name.
104 String getRedoPresentationName();
107 * Returns the undo presentation name.
109 * @return The undo presentation name.
111 String getUndoPresentationName();
114 * Determines whether this editing action is significant enough for
115 * being seperately undoable by the user. A typical significant
116 * action would be the resizing of an object. However, changing the
117 * selection in a text document would usually not be considered
118 * significant.
120 * @return <code>true</code> to indicate that the action is
121 * significant enough for being separately undoable, or
122 * <code>false</code> otherwise.
124 boolean isSignificant();
127 * Redoes this editing action.
129 * @throws CannotRedoException if the edit cannot be undone.
131 * @see #canRedo()
132 * @see #undo()
134 void redo() throws CannotRedoException;
137 * Incorporates another editing action into this one, thus forming a
138 * combined action that replaces the argument action.
140 * @param edit the editing action to be replaced.
142 * @return <code>true</code> if the edit is successfully replaced, and
143 * <code>false</code> otherwise.
145 boolean replaceEdit(UndoableEdit edit);
148 * Undoes this editing action.
150 * @throws CannotUndoException if the edit cannot be undone.
152 * @see #canUndo()
153 * @see #redo()
155 void undo() throws CannotUndoException;