Mercurial > projects > dwt2
comparison org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControl.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, 2008 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 | |
14 | |
15 module org.eclipse.jface.text.IInformationControl; | |
16 | |
17 import org.eclipse.jface.text.IDocumentPartitioningListener; // packageimport | |
18 import org.eclipse.jface.text.DefaultTextHover; // packageimport | |
19 import org.eclipse.jface.text.AbstractInformationControl; // packageimport | |
20 import org.eclipse.jface.text.TextUtilities; // packageimport | |
21 import org.eclipse.jface.text.IInformationControlCreatorExtension; // packageimport | |
22 import org.eclipse.jface.text.AbstractInformationControlManager; // packageimport | |
23 import org.eclipse.jface.text.ITextViewerExtension2; // packageimport | |
24 import org.eclipse.jface.text.IDocumentPartitioner; // packageimport | |
25 import org.eclipse.jface.text.DefaultIndentLineAutoEditStrategy; // packageimport | |
26 import org.eclipse.jface.text.ITextSelection; // packageimport | |
27 import org.eclipse.jface.text.Document; // packageimport | |
28 import org.eclipse.jface.text.FindReplaceDocumentAdapterContentProposalProvider; // packageimport | |
29 import org.eclipse.jface.text.ITextListener; // packageimport | |
30 import org.eclipse.jface.text.BadPartitioningException; // packageimport | |
31 import org.eclipse.jface.text.ITextViewerExtension5; // packageimport | |
32 import org.eclipse.jface.text.IDocumentPartitionerExtension3; // packageimport | |
33 import org.eclipse.jface.text.IUndoManager; // packageimport | |
34 import org.eclipse.jface.text.ITextHoverExtension2; // packageimport | |
35 import org.eclipse.jface.text.IRepairableDocument; // packageimport | |
36 import org.eclipse.jface.text.IRewriteTarget; // packageimport | |
37 import org.eclipse.jface.text.DefaultPositionUpdater; // packageimport | |
38 import org.eclipse.jface.text.RewriteSessionEditProcessor; // packageimport | |
39 import org.eclipse.jface.text.TextViewerHoverManager; // packageimport | |
40 import org.eclipse.jface.text.DocumentRewriteSession; // packageimport | |
41 import org.eclipse.jface.text.TextViewer; // packageimport | |
42 import org.eclipse.jface.text.ITextViewerExtension8; // packageimport | |
43 import org.eclipse.jface.text.RegExMessages; // packageimport | |
44 import org.eclipse.jface.text.IDelayedInputChangeProvider; // packageimport | |
45 import org.eclipse.jface.text.ITextOperationTargetExtension; // packageimport | |
46 import org.eclipse.jface.text.IWidgetTokenOwner; // packageimport | |
47 import org.eclipse.jface.text.IViewportListener; // packageimport | |
48 import org.eclipse.jface.text.GapTextStore; // packageimport | |
49 import org.eclipse.jface.text.MarkSelection; // packageimport | |
50 import org.eclipse.jface.text.IDocumentPartitioningListenerExtension; // packageimport | |
51 import org.eclipse.jface.text.IDocumentAdapterExtension; // packageimport | |
52 import org.eclipse.jface.text.IInformationControlExtension; // packageimport | |
53 import org.eclipse.jface.text.IDocumentPartitioningListenerExtension2; // packageimport | |
54 import org.eclipse.jface.text.DefaultDocumentAdapter; // packageimport | |
55 import org.eclipse.jface.text.ITextViewerExtension3; // packageimport | |
56 import org.eclipse.jface.text.IInformationControlCreator; // packageimport | |
57 import org.eclipse.jface.text.TypedRegion; // packageimport | |
58 import org.eclipse.jface.text.ISynchronizable; // packageimport | |
59 import org.eclipse.jface.text.IMarkRegionTarget; // packageimport | |
60 import org.eclipse.jface.text.TextViewerUndoManager; // packageimport | |
61 import org.eclipse.jface.text.IRegion; // packageimport | |
62 import org.eclipse.jface.text.IInformationControlExtension2; // packageimport | |
63 import org.eclipse.jface.text.IDocumentExtension4; // packageimport | |
64 import org.eclipse.jface.text.IDocumentExtension2; // packageimport | |
65 import org.eclipse.jface.text.IDocumentPartitionerExtension2; // packageimport | |
66 import org.eclipse.jface.text.Assert; // packageimport | |
67 import org.eclipse.jface.text.DefaultInformationControl; // packageimport | |
68 import org.eclipse.jface.text.IWidgetTokenOwnerExtension; // packageimport | |
69 import org.eclipse.jface.text.DocumentClone; // packageimport | |
70 import org.eclipse.jface.text.DefaultUndoManager; // packageimport | |
71 import org.eclipse.jface.text.IFindReplaceTarget; // packageimport | |
72 import org.eclipse.jface.text.IAutoEditStrategy; // packageimport | |
73 import org.eclipse.jface.text.ILineTrackerExtension; // packageimport | |
74 import org.eclipse.jface.text.IUndoManagerExtension; // packageimport | |
75 import org.eclipse.jface.text.TextSelection; // packageimport | |
76 import org.eclipse.jface.text.DefaultAutoIndentStrategy; // packageimport | |
77 import org.eclipse.jface.text.IAutoIndentStrategy; // packageimport | |
78 import org.eclipse.jface.text.IPainter; // packageimport | |
79 import org.eclipse.jface.text.IInformationControlExtension3; // packageimport | |
80 import org.eclipse.jface.text.ITextViewerExtension6; // packageimport | |
81 import org.eclipse.jface.text.IInformationControlExtension4; // packageimport | |
82 import org.eclipse.jface.text.DefaultLineTracker; // packageimport | |
83 import org.eclipse.jface.text.IDocumentInformationMappingExtension; // packageimport | |
84 import org.eclipse.jface.text.IRepairableDocumentExtension; // packageimport | |
85 import org.eclipse.jface.text.ITextHover; // packageimport | |
86 import org.eclipse.jface.text.FindReplaceDocumentAdapter; // packageimport | |
87 import org.eclipse.jface.text.ILineTracker; // packageimport | |
88 import org.eclipse.jface.text.Line; // packageimport | |
89 import org.eclipse.jface.text.ITextViewerExtension; // packageimport | |
90 import org.eclipse.jface.text.IDocumentAdapter; // packageimport | |
91 import org.eclipse.jface.text.TextEvent; // packageimport | |
92 import org.eclipse.jface.text.BadLocationException; // packageimport | |
93 import org.eclipse.jface.text.AbstractDocument; // packageimport | |
94 import org.eclipse.jface.text.AbstractLineTracker; // packageimport | |
95 import org.eclipse.jface.text.TreeLineTracker; // packageimport | |
96 import org.eclipse.jface.text.ITextPresentationListener; // packageimport | |
97 import org.eclipse.jface.text.Region; // packageimport | |
98 import org.eclipse.jface.text.ITextViewer; // packageimport | |
99 import org.eclipse.jface.text.IDocumentInformationMapping; // packageimport | |
100 import org.eclipse.jface.text.MarginPainter; // packageimport | |
101 import org.eclipse.jface.text.IPaintPositionManager; // packageimport | |
102 import org.eclipse.jface.text.TextPresentation; // packageimport | |
103 import org.eclipse.jface.text.IFindReplaceTargetExtension; // packageimport | |
104 import org.eclipse.jface.text.ISlaveDocumentManagerExtension; // packageimport | |
105 import org.eclipse.jface.text.ISelectionValidator; // packageimport | |
106 import org.eclipse.jface.text.IDocumentExtension; // packageimport | |
107 import org.eclipse.jface.text.PropagatingFontFieldEditor; // packageimport | |
108 import org.eclipse.jface.text.ConfigurableLineTracker; // packageimport | |
109 import org.eclipse.jface.text.SlaveDocumentEvent; // packageimport | |
110 import org.eclipse.jface.text.IDocumentListener; // packageimport | |
111 import org.eclipse.jface.text.PaintManager; // packageimport | |
112 import org.eclipse.jface.text.IFindReplaceTargetExtension3; // packageimport | |
113 import org.eclipse.jface.text.ITextDoubleClickStrategy; // packageimport | |
114 import org.eclipse.jface.text.IDocumentExtension3; // packageimport | |
115 import org.eclipse.jface.text.Position; // packageimport | |
116 import org.eclipse.jface.text.TextMessages; // packageimport | |
117 import org.eclipse.jface.text.CopyOnWriteTextStore; // packageimport | |
118 import org.eclipse.jface.text.WhitespaceCharacterPainter; // packageimport | |
119 import org.eclipse.jface.text.IPositionUpdater; // packageimport | |
120 import org.eclipse.jface.text.DefaultTextDoubleClickStrategy; // packageimport | |
121 import org.eclipse.jface.text.ListLineTracker; // packageimport | |
122 import org.eclipse.jface.text.ITextInputListener; // packageimport | |
123 import org.eclipse.jface.text.BadPositionCategoryException; // packageimport | |
124 import org.eclipse.jface.text.IWidgetTokenKeeperExtension; // packageimport | |
125 import org.eclipse.jface.text.IInputChangedListener; // packageimport | |
126 import org.eclipse.jface.text.ITextOperationTarget; // packageimport | |
127 import org.eclipse.jface.text.IDocumentInformationMappingExtension2; // packageimport | |
128 import org.eclipse.jface.text.ITextViewerExtension7; // packageimport | |
129 import org.eclipse.jface.text.IInformationControlExtension5; // packageimport | |
130 import org.eclipse.jface.text.IDocumentRewriteSessionListener; // packageimport | |
131 import org.eclipse.jface.text.JFaceTextUtil; // packageimport | |
132 import org.eclipse.jface.text.AbstractReusableInformationControlCreator; // packageimport | |
133 import org.eclipse.jface.text.TabsToSpacesConverter; // packageimport | |
134 import org.eclipse.jface.text.CursorLinePainter; // packageimport | |
135 import org.eclipse.jface.text.ITextHoverExtension; // packageimport | |
136 import org.eclipse.jface.text.IEventConsumer; // packageimport | |
137 import org.eclipse.jface.text.IDocument; // packageimport | |
138 import org.eclipse.jface.text.IWidgetTokenKeeper; // packageimport | |
139 import org.eclipse.jface.text.DocumentCommand; // packageimport | |
140 import org.eclipse.jface.text.TypedPosition; // packageimport | |
141 import org.eclipse.jface.text.IEditingSupportRegistry; // packageimport | |
142 import org.eclipse.jface.text.IDocumentPartitionerExtension; // packageimport | |
143 import org.eclipse.jface.text.AbstractHoverInformationControlManager; // packageimport | |
144 import org.eclipse.jface.text.IEditingSupport; // packageimport | |
145 import org.eclipse.jface.text.IMarkSelection; // packageimport | |
146 import org.eclipse.jface.text.ISlaveDocumentManager; // packageimport | |
147 import org.eclipse.jface.text.DocumentEvent; // packageimport | |
148 import org.eclipse.jface.text.DocumentPartitioningChangedEvent; // packageimport | |
149 import org.eclipse.jface.text.ITextStore; // packageimport | |
150 import org.eclipse.jface.text.JFaceTextMessages; // packageimport | |
151 import org.eclipse.jface.text.DocumentRewriteSessionEvent; // packageimport | |
152 import org.eclipse.jface.text.SequentialRewriteTextStore; // packageimport | |
153 import org.eclipse.jface.text.DocumentRewriteSessionType; // packageimport | |
154 import org.eclipse.jface.text.TextAttribute; // packageimport | |
155 import org.eclipse.jface.text.ITextViewerExtension4; // packageimport | |
156 import org.eclipse.jface.text.ITypedRegion; // packageimport | |
157 | |
158 import java.lang.all; | |
159 import java.util.Set; | |
160 | |
161 | |
162 import org.eclipse.swt.SWT; | |
163 import org.eclipse.swt.events.DisposeListener; | |
164 import org.eclipse.swt.events.FocusListener; | |
165 import org.eclipse.swt.graphics.Color; | |
166 import org.eclipse.swt.graphics.Point; | |
167 | |
168 | |
169 /** | |
170 * Interface of a control presenting information. The information is given in | |
171 * the form of an input object. It can be either the content itself or a | |
172 * description of the content. The specification of what is required from an | |
173 * input object is left to the implementers of this interface. | |
174 * <p> | |
175 * <em>If this information control is used by a {@link AbstractHoverInformationControlManager} | |
176 * then that manager will own this control and override any properties that | |
177 * may have been set before by any other client.</em></p> | |
178 * <p> | |
179 * The information control must not grab focus when made visible using | |
180 * <code>setVisible(true)</code>. | |
181 * | |
182 * In order to provide backward compatibility for clients of | |
183 * <code>IInformationControl</code>, extension interfaces are used as a means | |
184 * of evolution. The following extension interfaces exist: | |
185 * <ul> | |
186 * <li>{@link org.eclipse.jface.text.IInformationControlExtension} since | |
187 * version 2.0 introducing the predicate of whether the control has anything to | |
188 * show or would be empty</li> | |
189 * <li>{@link org.eclipse.jface.text.IInformationControlExtension2} since | |
190 * version 2.1 replacing the original concept of textual input by general input | |
191 * objects.</li> | |
192 * <li>{@link org.eclipse.jface.text.IInformationControlExtension3} since | |
193 * version 3.0 providing access to the control's bounds and introducing | |
194 * the concept of persistent size and location.</li> | |
195 * <li>{@link org.eclipse.jface.text.IInformationControlExtension4} since | |
196 * version 3.3, adding API which allows to set this information control's status field text.</li> | |
197 * <li>{@link org.eclipse.jface.text.IInformationControlExtension5} since | |
198 * version 3.4, adding API to get the visibility of the control, to | |
199 * test whether another control is a child of the information control, | |
200 * to compute size constraints based on the information control's main font | |
201 * and to return a control creator for an enriched version of this information control.</li> | |
202 * </ul> | |
203 * <p> | |
204 * Clients can implement this interface and its extension interfaces, | |
205 * subclass {@link AbstractInformationControl}, or use the (text-based) | |
206 * default implementation {@link DefaultInformationControl}. | |
207 * | |
208 * @see org.eclipse.jface.text.IInformationControlExtension | |
209 * @see org.eclipse.jface.text.IInformationControlExtension2 | |
210 * @see org.eclipse.jface.text.IInformationControlExtension3 | |
211 * @see org.eclipse.jface.text.IInformationControlExtension4 | |
212 * @see org.eclipse.jface.text.IInformationControlExtension5 | |
213 * @see AbstractInformationControl | |
214 * @see DefaultInformationControl | |
215 * @since 2.0 | |
216 */ | |
217 public interface IInformationControl { | |
218 | |
219 /** | |
220 * Sets the information to be presented by this information control. | |
221 * <p> | |
222 * Replaced by {@link IInformationControlExtension2#setInput(Object)}. | |
223 * | |
224 * @param information the information to be presented | |
225 */ | |
226 void setInformation(String information); | |
227 | |
228 /** | |
229 * Sets the information control's size constraints. A constraint value of | |
230 * {@link SWT#DEFAULT} indicates no constraint. This method must be called before | |
231 * {@link #computeSizeHint()} is called. | |
232 * <p> | |
233 * Note: An information control which implements {@link IInformationControlExtension3} | |
234 * may ignore this method or use it as hint for its very first appearance. | |
235 * </p> | |
236 * @param maxWidth the maximal width of the control to present the information, or {@link SWT#DEFAULT} for not constraint | |
237 * @param maxHeight the maximal height of the control to present the information, or {@link SWT#DEFAULT} for not constraint | |
238 */ | |
239 void setSizeConstraints(int maxWidth, int maxHeight); | |
240 | |
241 /** | |
242 * Computes and returns a proposal for the size of this information control depending | |
243 * on the information to present. The method tries to honor known size constraints but might | |
244 * return a size that exceeds them. | |
245 * | |
246 * @return the computed size hint | |
247 */ | |
248 Point computeSizeHint(); | |
249 | |
250 /** | |
251 * Controls the visibility of this information control. | |
252 * <p> | |
253 * <strong>Note:</strong> The information control must not grab focus when | |
254 * made visible. | |
255 * </p> | |
256 * | |
257 * @param visible <code>true</code> if the control should be visible | |
258 */ | |
259 void setVisible(bool visible); | |
260 | |
261 /** | |
262 * Sets the size of this information control. | |
263 * | |
264 * @param width the width of the control | |
265 * @param height the height of the control | |
266 */ | |
267 void setSize(int width, int height); | |
268 | |
269 /** | |
270 * Sets the location of this information control. | |
271 * | |
272 * @param location the location | |
273 */ | |
274 void setLocation(Point location); | |
275 | |
276 /** | |
277 * Disposes this information control. | |
278 */ | |
279 void dispose(); | |
280 | |
281 /** | |
282 * Adds the given listener to the list of dispose listeners. | |
283 * If the listener is already registered it is not registered again. | |
284 * | |
285 * @param listener the listener to be added | |
286 */ | |
287 void addDisposeListener(DisposeListener listener); | |
288 | |
289 /** | |
290 * Removes the given listeners from the list of dispose listeners. | |
291 * If the listener is not registered this call has no effect. | |
292 * | |
293 * @param listener the listener to be removed | |
294 */ | |
295 void removeDisposeListener(DisposeListener listener); | |
296 | |
297 /** | |
298 * Sets the foreground color of this information control. | |
299 * | |
300 * @param foreground the foreground color of this information control | |
301 */ | |
302 void setForegroundColor(Color foreground); | |
303 | |
304 /** | |
305 * Sets the background color of this information control. | |
306 * | |
307 * @param background the background color of this information control | |
308 */ | |
309 void setBackgroundColor(Color background); | |
310 | |
311 /** | |
312 * Returns whether this information control (or one of its children) has the focus. | |
313 * The suggested implementation is like this (<code>fShell</code> is this information control's shell): | |
314 * <pre>return fShell.getDisplay().getActiveShell() is fShell</pre> | |
315 * | |
316 * @return <code>true</code> when the information control has the focus, otherwise <code>false</code> | |
317 */ | |
318 bool isFocusControl(); | |
319 | |
320 /** | |
321 * Sets the keyboard focus to this information control. | |
322 */ | |
323 void setFocus(); | |
324 | |
325 /** | |
326 * Adds the given listener to the list of focus listeners. | |
327 * If the listener is already registered it is not registered again. | |
328 * <p> | |
329 * The suggested implementation is to install listeners for {@link SWT#Activate} and {@link SWT#Deactivate} | |
330 * on the shell and forward events to the focus listeners. Clients are | |
331 * encouraged to subclass {@link AbstractInformationControl}, which does this | |
332 * for free. | |
333 * </p> | |
334 * | |
335 * @param listener the listener to be added | |
336 */ | |
337 void addFocusListener(FocusListener listener); | |
338 | |
339 /** | |
340 * Removes the given listeners from the list of focus listeners. | |
341 * If the listener is not registered this call has no affect. | |
342 * | |
343 * @param listener the listener to be removed | |
344 */ | |
345 void removeFocusListener(FocusListener listener); | |
346 } |