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.IContentAssistProcessor;
|
|
14
|
|
15 import dwt.dwthelper.utils;
|
|
16
|
|
17 import dwtx.jface.text.ITextViewer;
|
|
18
|
|
19
|
|
20 /**
|
|
21 * A content assist processor proposes completions and
|
|
22 * computes context information for a particular content type.
|
|
23 * A content assist processor is a {@link dwtx.jface.text.contentassist.IContentAssistant}
|
|
24 * plug-in.
|
|
25 * <p>
|
|
26 * This interface must be implemented by clients. Implementers should be
|
|
27 * registered with a content assistant in order to get involved in the
|
|
28 * assisting process.
|
|
29 * </p>
|
|
30 */
|
|
31 public interface IContentAssistProcessor {
|
|
32
|
|
33 /**
|
|
34 * Returns a list of completion proposals based on the
|
|
35 * specified location within the document that corresponds
|
|
36 * to the current cursor position within the text viewer.
|
|
37 *
|
|
38 * @param viewer the viewer whose document is used to compute the proposals
|
|
39 * @param offset an offset within the document for which completions should be computed
|
|
40 * @return an array of completion proposals or <code>null</code> if no proposals are possible
|
|
41 */
|
|
42 ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset);
|
|
43
|
|
44 /**
|
|
45 * Returns information about possible contexts based on the
|
|
46 * specified location within the document that corresponds
|
|
47 * to the current cursor position within the text viewer.
|
|
48 *
|
|
49 * @param viewer the viewer whose document is used to compute the possible contexts
|
|
50 * @param offset an offset within the document for which context information should be computed
|
|
51 * @return an array of context information objects or <code>null</code> if no context could be found
|
|
52 */
|
|
53 IContextInformation[] computeContextInformation(ITextViewer viewer, int offset);
|
|
54
|
|
55 /**
|
|
56 * Returns the characters which when entered by the user should
|
|
57 * automatically trigger the presentation of possible completions.
|
|
58 *
|
|
59 * @return the auto activation characters for completion proposal or <code>null</code>
|
|
60 * if no auto activation is desired
|
|
61 */
|
|
62 char[] getCompletionProposalAutoActivationCharacters();
|
|
63
|
|
64 /**
|
|
65 * Returns the characters which when entered by the user should
|
|
66 * automatically trigger the presentation of context information.
|
|
67 *
|
|
68 * @return the auto activation characters for presenting context information
|
|
69 * or <code>null</code> if no auto activation is desired
|
|
70 */
|
|
71 char[] getContextInformationAutoActivationCharacters();
|
|
72
|
|
73 /**
|
|
74 * Returns the reason why this content assist processor
|
|
75 * was unable to produce any completion proposals or context information.
|
|
76 *
|
|
77 * @return an error message or <code>null</code> if no error occurred
|
|
78 */
|
|
79 String getErrorMessage();
|
|
80
|
|
81 /**
|
|
82 * Returns a validator used to determine when displayed context information
|
|
83 * should be dismissed. May only return <code>null</code> if the processor is
|
|
84 * incapable of computing context information. <p>
|
|
85 *
|
|
86 * @return a context information validator, or <code>null</code> if the processor
|
|
87 * is incapable of computing context information
|
|
88 */
|
|
89 IContextInformationValidator getContextInformationValidator();
|
|
90 }
|