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