KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > text > contentassist > IContentAssistProcessor


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  *******************************************************************************/

11 package org.eclipse.jface.text.contentassist;
12
13 import org.eclipse.jface.text.ITextViewer;
14
15
16 /**
17  * A content assist processor proposes completions and
18  * computes context information for a particular content type.
19  * A content assist processor is a {@link org.eclipse.jface.text.contentassist.IContentAssistant}
20  * plug-in.
21  * <p>
22  * This interface must be implemented by clients. Implementers should be
23  * registered with a content assistant in order to get involved in the
24  * assisting process.
25  * </p>
26 */

27 public interface IContentAssistProcessor {
28
29     /**
30      * Returns a list of completion proposals based on the
31      * specified location within the document that corresponds
32      * to the current cursor position within the text viewer.
33      *
34      * @param viewer the viewer whose document is used to compute the proposals
35      * @param offset an offset within the document for which completions should be computed
36      * @return an array of completion proposals or <code>null</code> if no proposals are possible
37      */

38     ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset);
39
40     /**
41      * Returns information about possible contexts based on the
42      * specified location within the document that corresponds
43      * to the current cursor position within the text viewer.
44      *
45      * @param viewer the viewer whose document is used to compute the possible contexts
46      * @param offset an offset within the document for which context information should be computed
47      * @return an array of context information objects or <code>null</code> if no context could be found
48      */

49     IContextInformation[] computeContextInformation(ITextViewer viewer, int offset);
50
51     /**
52      * Returns the characters which when entered by the user should
53      * automatically trigger the presentation of possible completions.
54      *
55      * @return the auto activation characters for completion proposal or <code>null</code>
56      * if no auto activation is desired
57      */

58     char[] getCompletionProposalAutoActivationCharacters();
59
60     /**
61      * Returns the characters which when entered by the user should
62      * automatically trigger the presentation of context information.
63      *
64      * @return the auto activation characters for presenting context information
65      * or <code>null</code> if no auto activation is desired
66      */

67     char[] getContextInformationAutoActivationCharacters();
68
69     /**
70      * Returns the reason why this content assist processor
71      * was unable to produce any completion proposals or context information.
72      *
73      * @return an error message or <code>null</code> if no error occurred
74      */

75     String JavaDoc getErrorMessage();
76
77     /**
78      * Returns a validator used to determine when displayed context information
79      * should be dismissed. May only return <code>null</code> if the processor is
80      * incapable of computing context information. <p>
81      *
82      * @return a context information validator, or <code>null</code> if the processor
83      * is incapable of computing context information
84      */

85     IContextInformationValidator getContextInformationValidator();
86 }
87
Popular Tags