129
|
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.ITextOperationTarget;
|
|
14
|
131
|
15
|
129
|
16 import dwt.dwthelper.utils;
|
|
17
|
|
18
|
|
19 /**
|
|
20 * Defines the target for text operations. <code>canDoOperation</code> informs
|
|
21 * the clients about the ability of the target to perform the specified
|
|
22 * operation at the current point in time. <code>doOperation</code> executes
|
|
23 * the specified operation.
|
|
24 * <p>
|
|
25 * In order to provide backward compatibility for clients of
|
|
26 * <code>ITextOperationTarget</code>, extension interfaces are used as a
|
|
27 * means of evolution. The following extension interfaces exist:
|
|
28 * <ul>
|
|
29 * <li>{@link dwtx.jface.text.ITextOperationTargetExtension} since
|
|
30 * version 2.0 introducing text operation enabling/disabling.</li>
|
|
31 * </ul>
|
|
32 *
|
|
33 * @see dwtx.jface.text.ITextOperationTargetExtension
|
|
34 */
|
|
35 public interface ITextOperationTarget {
|
|
36
|
|
37
|
|
38 /**
|
|
39 * Text operation code for undoing the last edit command.
|
|
40 */
|
162
|
41 public static const int UNDO= 1;
|
129
|
42
|
|
43 /**
|
|
44 * Text operation code for redoing the last undone edit command.
|
|
45 */
|
162
|
46 public static const int REDO= 2;
|
129
|
47
|
|
48 /**
|
|
49 * Text operation code for moving the selected text to the clipboard.
|
|
50 */
|
162
|
51 public static const int CUT= 3;
|
129
|
52
|
|
53 /**
|
|
54 * Text operation code for copying the selected text to the clipboard.
|
|
55 */
|
162
|
56 public static const int COPY= 4;
|
129
|
57
|
|
58 /**
|
|
59 * Text operation code for inserting the clipboard content at the
|
|
60 * current position.
|
|
61 */
|
162
|
62 public static const int PASTE= 5;
|
129
|
63
|
|
64 /**
|
|
65 * Text operation code for deleting the selected text or if selection
|
|
66 * is empty the character at the right of the current position.
|
|
67 */
|
162
|
68 public static const int DELETE= 6;
|
129
|
69
|
|
70 /**
|
|
71 * Text operation code for selecting the complete text.
|
|
72 */
|
162
|
73 public static const int SELECT_ALL= 7;
|
129
|
74
|
|
75 /**
|
|
76 * Text operation code for shifting the selected text block to the right.
|
|
77 */
|
162
|
78 public static const int SHIFT_RIGHT= 8;
|
129
|
79
|
|
80 /**
|
|
81 * Text operation code for shifting the selected text block to the left.
|
|
82 */
|
162
|
83 public static const int SHIFT_LEFT= 9;
|
129
|
84
|
|
85 /**
|
|
86 * Text operation code for printing the complete text.
|
|
87 */
|
162
|
88 public static const int PRINT= 10;
|
129
|
89
|
|
90 /**
|
|
91 * Text operation code for prefixing the selected text block.
|
|
92 */
|
162
|
93 public static const int PREFIX= 11;
|
129
|
94
|
|
95 /**
|
|
96 * Text operation code for removing the prefix from the selected text block.
|
|
97 */
|
162
|
98 public static const int STRIP_PREFIX= 12;
|
129
|
99
|
|
100
|
|
101 /**
|
|
102 * Returns whether the operation specified by the given operation code
|
|
103 * can be performed.
|
|
104 *
|
|
105 * @param operation the operation code
|
|
106 * @return <code>true</code> if the specified operation can be performed
|
|
107 */
|
|
108 bool canDoOperation(int operation);
|
|
109
|
|
110 /**
|
|
111 * Performs the operation specified by the operation code on the target.
|
|
112 * <code>doOperation</code> must only be called if <code>canDoOperation</code>
|
|
113 * returns <code>true</code>.
|
|
114 *
|
|
115 * @param operation the operation code
|
|
116 */
|
|
117 void doOperation(int operation);
|
|
118 }
|