129
|
1 /*******************************************************************************
|
|
2 * Copyright (c) 2000, 2005 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
|
131
|
14
|
151
|
15 module dwtx.jface.text.ITextViewerExtension;
|
|
16
|
131
|
17 import dwtx.jface.text.IRewriteTarget; // packageimport
|
|
18
|
129
|
19 import dwt.dwthelper.utils;
|
|
20
|
|
21 import dwt.custom.VerifyKeyListener;
|
|
22 import dwt.widgets.Control;
|
|
23
|
|
24
|
|
25 /**
|
|
26 * Extension interface for {@link dwtx.jface.text.ITextViewer}.
|
|
27 * <p>
|
|
28 * This extension interface replaces the event consumer mechanism (
|
|
29 * {@link dwtx.jface.text.ITextViewer#setEventConsumer(IEventConsumer)})
|
|
30 * with a set of methods that allow to manage a sequence of
|
|
31 * {@link dwt.custom.VerifyKeyListener}objects. It also adds
|
|
32 * <ul>
|
|
33 * <li>access to the control of this viewer</li>
|
|
34 * <li>marked region support as in emacs</li>
|
|
35 * <li>control of the viewer's redraw behavior by introducing
|
|
36 * <code>setRedraw(bool)</code>
|
|
37 * <li>access to the viewer's rewrite target.
|
|
38 * </ul>
|
|
39 *
|
|
40 * A rewrite target ({@link dwtx.jface.text.IRewriteTarget}) represents
|
|
41 * an facade offering the necessary methods to manipulate a document that is the
|
|
42 * input document of a text viewer.
|
|
43 *
|
|
44 * @since 2.0
|
|
45 */
|
|
46 public interface ITextViewerExtension {
|
|
47
|
|
48 /**
|
|
49 * Inserts the verify key listener at the beginning of the viewer's list of
|
|
50 * verify key listeners. If the listener is already registered with the
|
|
51 * viewer this call moves the listener to the beginning of the list.
|
|
52 *
|
|
53 * @param listener the listener to be inserted
|
|
54 */
|
|
55 void prependVerifyKeyListener(VerifyKeyListener listener);
|
|
56
|
|
57 /**
|
|
58 * Appends a verify key listener to the viewer's list of verify key
|
|
59 * listeners. If the listener is already registered with the viewer this
|
|
60 * call moves the listener to the end of the list.
|
|
61 *
|
|
62 * @param listener the listener to be added
|
|
63 */
|
|
64 void appendVerifyKeyListener(VerifyKeyListener listener);
|
|
65
|
|
66 /**
|
|
67 * Removes the verify key listener from the viewer's list of verify key listeners.
|
|
68 * If the listener is not registered with this viewer, this call has no effect.
|
|
69 *
|
|
70 * @param listener the listener to be removed
|
|
71 */
|
|
72 void removeVerifyKeyListener(VerifyKeyListener listener);
|
|
73
|
|
74 /**
|
|
75 * Returns the control of this viewer.
|
|
76 *
|
|
77 * @return the control of this viewer
|
|
78 */
|
|
79 Control getControl();
|
|
80
|
|
81 /**
|
|
82 * Sets a mark at the given offset or clears the mark if the specified
|
|
83 * offset is <code>-1</code>. If a mark is set and the selection is
|
|
84 * empty, cut and copy actions performed on this text viewer work on the
|
|
85 * region described by the positions of the mark and the cursor.
|
|
86 *
|
|
87 * @param offset the offset of the mark
|
|
88 */
|
|
89 void setMark(int offset);
|
|
90
|
|
91 /**
|
|
92 * Returns the position of the mark, <code>-1</code> if the mark is not set.
|
|
93 *
|
|
94 * @return the position of the mark or <code>-1</code> if no mark is set
|
|
95 */
|
|
96 int getMark();
|
|
97
|
|
98 /**
|
|
99 * Enables/disables the redrawing of this text viewer. This temporarily
|
|
100 * disconnects the viewer from its underlying
|
|
101 * {@link dwt.custom.StyledText}widget. While being
|
|
102 * disconnected only the viewer's selection may be changed using
|
|
103 * <code>setSelectedRange</code>. Any direct manipulation of the widget
|
|
104 * as well as calls to methods that change the viewer's presentation state
|
|
105 * (such as enabling the segmented view) are not allowed. When redrawing is
|
|
106 * disabled the viewer does not send out any selection or view port change
|
|
107 * notification. When redrawing is enabled again, a selection change
|
|
108 * notification is sent out for the selected range and this range is
|
|
109 * revealed causing a view port changed notification.
|
|
110 *
|
|
111 * @param redraw <code>true</code> to enable redrawing, <code>false</code>
|
|
112 * otherwise
|
|
113 */
|
|
114 void setRedraw(bool redraw);
|
|
115
|
|
116 /**
|
|
117 * Returns the viewer's rewrite target.
|
|
118 *
|
|
119 * @return the viewer's rewrite target
|
|
120 */
|
|
121 IRewriteTarget getRewriteTarget();
|
|
122 }
|