comparison org.eclipse.jface.text/src/org/eclipse/jface/contentassist/IContentAssistSubjectControl.d @ 12:bc29606a740c

Added dwt-addons in original directory structure of eclipse.org
author Frank Benoit <benoit@tionex.de>
date Sat, 14 Mar 2009 18:23:29 +0100
parents
children
comparison
equal deleted inserted replaced
11:43904fec5dca 12:bc29606a740c
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 module org.eclipse.jface.contentassist.IContentAssistSubjectControl;
14
15 import java.lang.all;
16 import java.util.Set;
17
18
19
20 import org.eclipse.swt.custom.VerifyKeyListener;
21 import org.eclipse.swt.events.KeyListener;
22 import org.eclipse.swt.events.SelectionListener;
23 import org.eclipse.swt.graphics.Point;
24 import org.eclipse.swt.widgets.Control;
25 import org.eclipse.jface.text.IDocument;
26 import org.eclipse.jface.text.IEventConsumer;
27
28
29 /**
30 * A content assist subject control can request assistance provided by a
31 * {@linkplain org.eclipse.jface.contentassist.ISubjectControlContentAssistant subject control content assistant}.
32 *
33 * @since 3.0
34 */
35 public interface IContentAssistSubjectControl {
36
37 /**
38 * Returns the control of this content assist subject control.
39 *
40 * @return the control of this content assist subject control
41 */
42 Control getControl();
43
44 /**
45 * Returns the line height.
46 *
47 * @return line height in pixel
48 * @exception org.eclipse.swt.SWTException
49 * <ul>
50 * <li>{@link org.eclipse.swt.SWT#ERROR_WIDGET_DISPOSED} - if the receiver has been
51 * disposed</li>
52 * <li>{@link org.eclipse.swt.SWT#ERROR_THREAD_INVALID_ACCESS} - if not called from the
53 * thread that created the receiver</li>
54 * </ul>
55 */
56 int getLineHeight();
57
58 /**
59 * Returns the caret position relative to the start of the text in widget
60 * coordinates.
61 *
62 * @return the caret position relative to the start of the text in widget
63 * coordinates
64 * @exception org.eclipse.swt.SWTException
65 * <ul>
66 * <li>{@link org.eclipse.swt.SWT#ERROR_WIDGET_DISPOSED} - if the receiver has been
67 * disposed</li>
68 * <li>{@link org.eclipse.swt.SWT#ERROR_THREAD_INVALID_ACCESS} - if not called from the
69 * thread that created the receiver</li>
70 * </ul>
71 */
72 int getCaretOffset();
73
74 /**
75 * Returns the x, y location of the upper left corner of the character
76 * bounding box at the specified offset in the text. The point is relative
77 * to the upper left corner of the widget client area.
78 *
79 * @param offset widget offset relative to the start of the content 0
80 * <= offset <= getCharCount()
81 * @return x, y location of the upper left corner of the character bounding
82 * box at the specified offset in the text
83 * @exception org.eclipse.swt.SWTException
84 * <ul>
85 * <li>{@link org.eclipse.swt.SWT#ERROR_WIDGET_DISPOSED} - if the receiver has been disposed</li>
86 * <li>{@link org.eclipse.swt.SWT#ERROR_THREAD_INVALID_ACCESS} - if not called from the thread that created the receiver</li>
87 * </ul>
88 * @exception IllegalArgumentException when the offset is outside the valid range
89 */
90 Point getLocationAtOffset(int offset);
91
92 /**
93 * Returns the line delimiter used for entering new lines by key down or
94 * paste operation.
95 *
96 * @return line delimiter used for entering new lines by key down or paste
97 * operation
98 * @exception org.eclipse.swt.SWTException
99 * <ul>
100 * <li>{@link org.eclipse.swt.SWT#ERROR_WIDGET_DISPOSED} - if the receiver has been disposed</li>
101 * <li>{@link org.eclipse.swt.SWT#ERROR_THREAD_INVALID_ACCESS} - if not called from the thread that created the receiver</li>
102 * </ul>
103 */
104 String getLineDelimiter();
105
106 /**
107 * Returns the selected range in the subject's widget.
108 *
109 * @return start and length of the selection, x is the offset of the
110 * @exception org.eclipse.swt.SWTException
111 * <ul>
112 * <li>{@link org.eclipse.swt.SWT#ERROR_WIDGET_DISPOSED} - if the receiver has been disposed</li>
113 * <li>{@link org.eclipse.swt.SWT#ERROR_THREAD_INVALID_ACCESS} - if not called from the thread that created the receiver</li>
114 * </ul>
115 */
116 Point getWidgetSelectionRange();
117
118 /**
119 * Returns the selected range.
120 *
121 * @return start and length of the selection, x is the offset and y the
122 * length based on the subject's model (e.g. document)
123 */
124 Point getSelectedRange();
125
126 /**
127 * Sets the selected range. Offset and length based on the subject's
128 * model (e.g. document).
129 *
130 * @param offset the offset of the selection based on the subject's model e.g. document
131 * @param length the length of the selection based on the subject's model e.g. document
132 */
133 void setSelectedRange(int offset, int length);
134
135 /**
136 * Reveals the given region. Offset and length based on the subject's
137 * model (e.g. document).
138 *
139 * @param offset the offset of the selection based on the subject's model e.g. document
140 * @param length the length of the selection based on the subject's model e.g. document
141 */
142 void revealRange(int offset, int length);
143
144 /**
145 * Returns this content assist subject control's document.
146 *
147 * @return the viewer's input document
148 */
149 IDocument getDocument();
150
151 /**
152 * If supported, appends a verify key listener to the viewer's list of verify key
153 * listeners. If the listener is already registered with the viewer this
154 * call moves the listener to the end of the list.
155 * <p>
156 * Note: This content assist subject control may not support appending a verify
157 * listener, in which case <code>false</code> will be returned. If this
158 * content assist subject control only supports <code>addVerifyKeyListener</code>
159 * then this method can be used but <code>prependVerifyKeyListener</code>
160 * must return <code>false</code>.
161 * </p>
162 *
163 * @param verifyKeyListener the listener to be added
164 * @return <code>true</code> if the listener was added
165 */
166 bool appendVerifyKeyListener(VerifyKeyListener verifyKeyListener);
167
168 /**
169 * If supported, inserts the verify key listener at the beginning of this content assist
170 * subject's list of verify key listeners. If the listener is already
171 * registered with the viewer this call moves the listener to the beginning
172 * of the list.
173 * <p>
174 * Note: This content assist subject control may not support prepending a verify
175 * listener, in which case <code>false</code> will be returned. However,
176 * {@link #appendVerifyKeyListener(VerifyKeyListener)} might work.
177 * </p>
178 *
179 * @param verifyKeyListener the listener to be inserted
180 * @return <code>true</code> if the listener was added
181 */
182 bool prependVerifyKeyListener(VerifyKeyListener verifyKeyListener);
183
184 /**
185 * Removes the verify key listener from this content assist subject control's
186 * list of verify key listeners. If the listener is not registered, this
187 * call has no effect.
188 *
189 * @param verifyKeyListener the listener to be removed
190 */
191 void removeVerifyKeyListener(VerifyKeyListener verifyKeyListener);
192
193 /**
194 * Tests whether a verify key listener can be added either using <code>prependVerifyKeyListener</code>
195 * or {@link #appendVerifyKeyListener(VerifyKeyListener)}.
196 *
197 * @return <code>true</code> if adding verify key listeners is supported
198 */
199 bool supportsVerifyKeyListener();
200
201 /**
202 * Adds the listener to the collection of listeners who will be notified
203 * when keys are pressed and released on the system keyboard, by sending it
204 * one of the messages defined in the {@link KeyListener} interface.
205 *
206 * @param keyListener the listener which should be notified
207 * @exception IllegalArgumentException if the listener is <code>null</code>
208 * @exception org.eclipse.swt.SWTException
209 * <ul>
210 * <li>{@link org.eclipse.swt.SWT#ERROR_WIDGET_DISPOSED} - if the receiver has been disposed</li>
211 * <li>{@link org.eclipse.swt.SWT#ERROR_THREAD_INVALID_ACCESS} - if not called from the thread that created the receiver</li>
212 * </ul>
213 *
214 * @see KeyListener
215 * @see #removeKeyListener(KeyListener)
216 */
217 void addKeyListener(KeyListener keyListener);
218
219 /**
220 * Removes the listener from the collection of listeners who will be
221 * notified when keys are pressed and released on the system keyboard.
222 *
223 * @param keyListener the listener which should be notified
224 * @exception IllegalArgumentException if the listener is null</li>
225 * @exception org.eclipse.swt.SWTException
226 * <ul>
227 * <li>{@link org.eclipse.swt.SWT#ERROR_WIDGET_DISPOSED} - if the receiver has been disposed</li>
228 * <li>{@link org.eclipse.swt.SWT#ERROR_THREAD_INVALID_ACCESS} - if not called from the thread that created the receiver</li>
229 * </ul>
230 * @see KeyListener
231 * @see #addKeyListener(KeyListener)
232 */
233 void removeKeyListener(KeyListener keyListener);
234
235 /**
236 * If supported, registers an event consumer with this content assist
237 * subject.
238 *
239 * @param eventConsumer the content assist subject control's event consumer. <code>null</code>
240 * is a valid argument.
241 */
242 void setEventConsumer(IEventConsumer eventConsumer);
243
244 /**
245 * Removes the specified selection listener.
246 * <p>
247 *
248 * @param selectionListener the listener
249 * @exception org.eclipse.swt.SWTException <ul>
250 * <ul>
251 * <li>{@link org.eclipse.swt.SWT#ERROR_WIDGET_DISPOSED} - if the receiver has been disposed</li>
252 * <li>{@link org.eclipse.swt.SWT#ERROR_THREAD_INVALID_ACCESS} - if not called from the thread that created the receiver</li>
253 * </ul>
254 * @exception IllegalArgumentException if listener is <code>null</code>
255 */
256 void removeSelectionListener(SelectionListener selectionListener);
257
258 /**
259 * If supported, adds a selection listener. A Selection event is sent by the widget when the
260 * selection has changed.
261 * <p>
262 *
263 * @param selectionListener the listener
264 * @return <code>true</code> if adding a selection listener is supported
265 * <ul>
266 * <li>{@link org.eclipse.swt.SWT#ERROR_WIDGET_DISPOSED} - if the receiver has been disposed</li>
267 * <li>{@link org.eclipse.swt.SWT#ERROR_THREAD_INVALID_ACCESS} - if not called from the thread that created the receiver</li>
268 * </ul>
269 * @exception IllegalArgumentException if listener is <code>null</code>
270 */
271 bool addSelectionListener(SelectionListener selectionListener);
272 }