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 module dwtx.jface.text.contentassist.ICompletionProposalExtension;
|
|
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.IContentAssistant; // packageimport
|
|
19 import dwtx.jface.text.contentassist.CompletionProposal; // packageimport
|
|
20 import dwtx.jface.text.contentassist.ICompletionProposalExtension5; // packageimport
|
|
21 import dwtx.jface.text.contentassist.IContextInformationValidator; // packageimport
|
|
22 import dwtx.jface.text.contentassist.IContentAssistListener; // packageimport
|
|
23 import dwtx.jface.text.contentassist.ICompletionProposalExtension6; // packageimport
|
|
24 import dwtx.jface.text.contentassist.ICompletionListener; // packageimport
|
|
25 import dwtx.jface.text.contentassist.ICompletionProposalExtension2; // packageimport
|
|
26 import dwtx.jface.text.contentassist.IContentAssistantExtension4; // packageimport
|
|
27 import dwtx.jface.text.contentassist.ContextInformation; // packageimport
|
|
28 import dwtx.jface.text.contentassist.ICompletionProposalExtension3; // packageimport
|
|
29 import dwtx.jface.text.contentassist.ContextInformationValidator; // packageimport
|
|
30 import dwtx.jface.text.contentassist.ICompletionProposal; // packageimport
|
|
31 import dwtx.jface.text.contentassist.IContentAssistProcessor; // packageimport
|
|
32 import dwtx.jface.text.contentassist.AdditionalInfoController; // packageimport
|
|
33 import dwtx.jface.text.contentassist.IContextInformationPresenter; // packageimport
|
|
34 import dwtx.jface.text.contentassist.ICompletionProposalExtension4; // packageimport
|
|
35 import dwtx.jface.text.contentassist.ICompletionListenerExtension; // packageimport
|
|
36 import dwtx.jface.text.contentassist.ContextInformationPopup; // packageimport
|
|
37 import dwtx.jface.text.contentassist.IContextInformationExtension; // packageimport
|
|
38 import dwtx.jface.text.contentassist.IContentAssistantExtension2; // packageimport
|
|
39 import dwtx.jface.text.contentassist.ContentAssistSubjectControlAdapter; // packageimport
|
|
40 import dwtx.jface.text.contentassist.CompletionProposalPopup; // 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.IDocument;
|
|
51
|
|
52
|
|
53 /**
|
|
54 * Extends {@link dwtx.jface.text.contentassist.ICompletionProposal}
|
|
55 * with the following functions:
|
|
56 * <ul>
|
|
57 * <li>handling of trigger characters other than ENTER</li>
|
|
58 * <li>completion proposal validation for a given offset</li>
|
|
59 * <li>context information can be freely positioned</li>
|
|
60 * </ul>
|
|
61 *
|
|
62 * @since 2.0
|
|
63 */
|
|
64 public interface ICompletionProposalExtension {
|
|
65
|
|
66 /**
|
|
67 * Applies the proposed completion to the given document. The insertion
|
|
68 * has been triggered by entering the given character at the given offset.
|
|
69 * This method assumes that {@link #isValidFor(IDocument, int)} returns
|
|
70 * <code>true</code> if called for <code>offset</code>.
|
|
71 *
|
|
72 * @param document the document into which to insert the proposed completion
|
|
73 * @param trigger the trigger to apply the completion
|
|
74 * @param offset the offset at which the trigger has been activated
|
|
75 */
|
|
76 void apply(IDocument document, char trigger, int offset);
|
|
77
|
|
78 /**
|
|
79 * Returns whether this completion proposal is valid for the given
|
|
80 * position in the given document.
|
|
81 *
|
|
82 * @param document the document for which the proposal is tested
|
|
83 * @param offset the offset for which the proposal is tested
|
|
84 * @return <code>true</code> iff valid
|
|
85 */
|
|
86 bool isValidFor(IDocument document, int offset);
|
|
87
|
|
88 /**
|
|
89 * Returns the characters which trigger the application of this completion proposal.
|
|
90 *
|
|
91 * @return the completion characters for this completion proposal or <code>null</code>
|
|
92 * if no completion other than the new line character is possible
|
|
93 */
|
|
94 char[] getTriggerCharacters();
|
|
95
|
|
96 /**
|
|
97 * Returns the position to which the computed context information refers to or
|
|
98 * <code>-1</code> if no context information can be provided by this completion proposal.
|
|
99 *
|
|
100 * @return the position to which the context information refers to or <code>-1</code> for no information
|
|
101 */
|
|
102 int getContextInformationPosition();
|
|
103 }
|