KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > text > ITextOperationTarget


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  *******************************************************************************/

11 package org.eclipse.jface.text;
12
13
14 /**
15  * Defines the target for text operations. <code>canDoOperation</code> informs
16  * the clients about the ability of the target to perform the specified
17  * operation at the current point in time. <code>doOperation</code> executes
18  * the specified operation.
19  * <p>
20  * In order to provide backward compatibility for clients of
21  * <code>ITextOperationTarget</code>, extension interfaces are used as a
22  * means of evolution. The following extension interfaces exist:
23  * <ul>
24  * <li>{@link org.eclipse.jface.text.ITextOperationTargetExtension} since
25  * version 2.0 introducing text operation enabling/disabling.</li>
26  * </ul>
27  *
28  * @see org.eclipse.jface.text.ITextOperationTargetExtension
29  */

30 public interface ITextOperationTarget {
31
32
33     /**
34      * Text operation code for undoing the last edit command.
35      */

36     static final int UNDO= 1;
37
38     /**
39      * Text operation code for redoing the last undone edit command.
40      */

41     static final int REDO= 2;
42
43     /**
44      * Text operation code for moving the selected text to the clipboard.
45      */

46     static final int CUT= 3;
47
48     /**
49      * Text operation code for copying the selected text to the clipboard.
50      */

51     static final int COPY= 4;
52
53     /**
54      * Text operation code for inserting the clipboard content at the
55      * current position.
56      */

57     static final int PASTE= 5;
58
59     /**
60      * Text operation code for deleting the selected text or if selection
61      * is empty the character at the right of the current position.
62      */

63     static final int DELETE= 6;
64
65     /**
66      * Text operation code for selecting the complete text.
67      */

68     static final int SELECT_ALL= 7;
69
70     /**
71      * Text operation code for shifting the selected text block to the right.
72      */

73     static final int SHIFT_RIGHT= 8;
74
75     /**
76      * Text operation code for shifting the selected text block to the left.
77      */

78     static final int SHIFT_LEFT= 9;
79
80     /**
81      * Text operation code for printing the complete text.
82      */

83     static final int PRINT= 10;
84
85     /**
86      * Text operation code for prefixing the selected text block.
87      */

88     static final int PREFIX= 11;
89
90     /**
91      * Text operation code for removing the prefix from the selected text block.
92      */

93     static final int STRIP_PREFIX= 12;
94
95
96     /**
97      * Returns whether the operation specified by the given operation code
98      * can be performed.
99      *
100      * @param operation the operation code
101      * @return <code>true</code> if the specified operation can be performed
102      */

103     boolean canDoOperation(int operation);
104
105     /**
106      * Performs the operation specified by the operation code on the target.
107      * <code>doOperation</code> must only be called if <code>canDoOperation</code>
108      * returns <code>true</code>.
109      *
110      * @param operation the operation code
111      */

112     void doOperation(int operation);
113 }
114
Popular Tags