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