Mercurial > projects > dwt-addons
comparison dwtx/jface/text/IUndoManager.d @ 129:eb30df5ca28b
Added JFace Text sources
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 23 Aug 2008 19:10:48 +0200 |
parents | |
children | c4fb132a086c |
comparison
equal
deleted
inserted
replaced
128:8df1d4193877 | 129:eb30df5ca28b |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2000, 2006 IBM Corporation and others. | |
3 * All rights reserved. This program and the accompanying materials | |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
10 * Port to the D programming language: | |
11 * Frank Benoit <benoit@tionex.de> | |
12 *******************************************************************************/ | |
13 module dwtx.jface.text.IUndoManager; | |
14 | |
15 import dwt.dwthelper.utils; | |
16 | |
17 /** | |
18 * An undo manager is connected to at most one | |
19 * {@link dwtx.jface.text.ITextViewer}. | |
20 * <p> | |
21 * It monitors the text viewer and keeps a history of the changes applied to the | |
22 * viewer. The undo manager groups those changes into user interactions which on | |
23 * an undo request are rolled back in one atomic change.</p> | |
24 * <p> | |
25 * In order to provide backward compatibility for clients of | |
26 * <code>IUndoManager</code>, extension interfaces are used as a means of | |
27 * evolution. The following extension interfaces exist: | |
28 * <ul> | |
29 * <li>{@link dwtx.jface.text.IUndoManagerExtension} since version 3.1 | |
30 * introducing access to the undo context.</li> | |
31 * </ul></p> | |
32 * <p> | |
33 * Clients may implement this interface or use the standard implementation | |
34 * <code>TextViewerUndoManager</code>. | |
35 * </p> | |
36 * | |
37 * @see TextViewerUndoManager | |
38 * @see IUndoManagerExtension | |
39 */ | |
40 public interface IUndoManager { | |
41 | |
42 /** | |
43 * Connects this undo manager to the given text viewer. | |
44 * | |
45 * @param viewer the viewer the undo manager is connected to | |
46 */ | |
47 void connect(ITextViewer viewer); | |
48 | |
49 /** | |
50 * Disconnects this undo manager from its text viewer. | |
51 * If this undo manager hasn't been connected before this | |
52 * operation has no effect. | |
53 */ | |
54 void disconnect(); | |
55 | |
56 /** | |
57 * Signals the undo manager that all subsequent changes until | |
58 * <code>endCompoundChange</code> is called are to be undone in one piece. | |
59 */ | |
60 void beginCompoundChange(); | |
61 | |
62 /** | |
63 * Signals the undo manager that the sequence of changes which started with | |
64 * <code>beginCompoundChange</code> has been finished. All subsequent changes | |
65 * are considered to be individually undo-able. | |
66 */ | |
67 void endCompoundChange(); | |
68 | |
69 /** | |
70 * Resets the history of the undo manager. After that call, | |
71 * there aren't any undo-able or redo-able text changes. | |
72 */ | |
73 void reset(); | |
74 | |
75 /** | |
76 * The given parameter determines the maximal length of the history | |
77 * remembered by the undo manager. | |
78 * | |
79 * @param undoLevel the length of this undo manager's history | |
80 */ | |
81 void setMaximalUndoLevel(int undoLevel); | |
82 | |
83 /** | |
84 * Returns whether at least one text change can be rolled back. | |
85 * | |
86 * @return <code>true</code> if at least one text change can be rolled back | |
87 */ | |
88 bool undoable(); | |
89 | |
90 /** | |
91 * Returns whether at least one text change can be repeated. A text change | |
92 * can be repeated only if it was executed and rolled back. | |
93 * | |
94 * @return <code>true</code> if at least on text change can be repeated | |
95 */ | |
96 bool redoable(); | |
97 | |
98 /** | |
99 * Rolls back the most recently executed text change. | |
100 */ | |
101 void undo(); | |
102 | |
103 /** | |
104 * Repeats the most recently rolled back text change. | |
105 */ | |
106 void redo(); | |
107 | |
108 } |