comparison dwtx/jface/text/contentassist/IContentAssistant.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, 2007 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.contentassist.IContentAssistant;
14
15 import dwt.dwthelper.utils;
16
17 import dwtx.jface.text.ITextViewer;
18
19
20 /**
21 * An <code>IContentAssistant</code> provides support on interactive content completion.
22 * The content assistant is a {@link dwtx.jface.text.ITextViewer} add-on. Its
23 * purpose is to propose, display, and insert completions of the content
24 * of the text viewer's document at the viewer's cursor position. In addition
25 * to handle completions, a content assistant can also be requested to provide
26 * context information. Context information is shown in a tool tip like popup.
27 * As it is not always possible to determine the exact context at a given
28 * document offset, a content assistant displays the possible contexts and requests
29 * the user to choose the one whose information should be displayed.
30 * <p>
31 * A content assistant has a list of {@link dwtx.jface.text.contentassist.IContentAssistProcessor}
32 * objects each of which is registered for a particular document content
33 * type. The content assistant uses the processors to react on the request
34 * of completing documents or presenting context information.
35 * </p>
36 * <p>
37 * In order to provide backward compatibility for clients of <code>IContentAssistant</code>, extension
38 * interfaces are used to provide a means of evolution. The following extension interfaces exist:
39 * <ul>
40 * <li>{@link dwtx.jface.text.contentassist.IContentAssistantExtension} since version 3.0 introducing
41 * the following functions:
42 * <ul>
43 * <li>handle documents with multiple partitions</li>
44 * <li>insertion of common completion prefixes</li>
45 * </ul>
46 * </li>
47 * <li>{@link dwtx.jface.text.contentassist.IContentAssistantExtension2} since version 3.2 introducing
48 * the following functions:
49 * <ul>
50 * <li>repeated invocation (cycling) mode</li>
51 * <li>completion listeners</li>
52 * <li>a local status line for the completion popup</li>
53 * <li>control over the behavior when no proposals are available</li>
54 * </ul>
55 * </li>
56 * <li>{@link dwtx.jface.text.contentassist.IContentAssistantExtension3} since version 3.2 introducing
57 * the following function:
58 * <ul>
59 * <li>a key-sequence to listen for in repeated invocation mode</li>
60 * </ul>
61 * </li>
62 * <li>{@link dwtx.jface.text.contentassist.IContentAssistantExtension4} since version 3.4 introducing
63 * the following function:
64 * <ul>
65 * <li>allows to get a handler for the given command identifier</li>
66 * </ul>
67 * </li>
68 * </ul>
69 * </p>
70 * <p>
71 * The interface can be implemented by clients. By default, clients use
72 * {@link dwtx.jface.text.contentassist.ContentAssistant} as the standard
73 * implementer of this interface.
74 * </p>
75 *
76 * @see dwtx.jface.text.ITextViewer
77 * @see dwtx.jface.text.contentassist.IContentAssistProcessor
78 */
79 public interface IContentAssistant {
80
81 //------ proposal popup orientation styles ------------
82 /** The context info list will overlay the list of completion proposals. */
83 public final static int PROPOSAL_OVERLAY= 10;
84 /** The completion proposal list will be removed before the context info list will be shown. */
85 public final static int PROPOSAL_REMOVE= 11;
86 /** The context info list will be presented without hiding or overlapping the completion proposal list. */
87 public final static int PROPOSAL_STACKED= 12;
88
89 //------ context info box orientation styles ----------
90 /** Context info will be shown above the location it has been requested for without hiding the location. */
91 public final static int CONTEXT_INFO_ABOVE= 20;
92 /** Context info will be shown below the location it has been requested for without hiding the location. */
93 public final static int CONTEXT_INFO_BELOW= 21;
94
95
96 /**
97 * Installs content assist support on the given text viewer.
98 *
99 * @param textViewer the text viewer on which content assist will work
100 */
101 void install(ITextViewer textViewer);
102
103 /**
104 * Uninstalls content assist support from the text viewer it has
105 * previously be installed on.
106 */
107 void uninstall();
108
109 /**
110 * Shows all possible completions of the content at the viewer's cursor position.
111 *
112 * @return an optional error message if no proposals can be computed
113 */
114 String showPossibleCompletions();
115
116 /**
117 * Shows context information for the content at the viewer's cursor position.
118 *
119 * @return an optional error message if no context information can be computed
120 */
121 String showContextInformation();
122
123 /**
124 * Returns the content assist processor to be used for the given content type.
125 *
126 * @param contentType the type of the content for which this
127 * content assistant is to be requested
128 * @return an instance content assist processor or
129 * <code>null</code> if none exists for the specified content type
130 */
131 IContentAssistProcessor getContentAssistProcessor(String contentType);
132 }