KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > core > ICodeAssist


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 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.jdt.core;
12
13 /**
14  * Common protocol for Java elements that support source code assist and code
15  * resolve.
16  * <p>
17  * This interface is not intended to be implemented by clients.
18  * </p>
19  */

20 public interface ICodeAssist {
21
22     /**
23      * Performs code completion at the given offset position in this compilation unit,
24      * reporting results to the given completion requestor. The <code>offset</code>
25      * is the 0-based index of the character, after which code assist is desired.
26      * An <code>offset</code> of -1 indicates to code assist at the beginning of this
27      * compilation unit.
28      *
29      * @param offset the given offset position
30      * @param requestor the given completion requestor
31      *
32      * @exception JavaModelException if code assist could not be performed. Reasons include:<ul>
33      * <li>This Java element does not exist (ELEMENT_DOES_NOT_EXIST)</li>
34      * <li> The position specified is < -1 or is greater than this compilation unit's
35      * source length (INDEX_OUT_OF_BOUNDS)
36      * </ul>
37      *
38      * @exception IllegalArgumentException if <code>requestor</code> is <code>null</code>
39      * @deprecated Use {@link #codeComplete(int, ICompletionRequestor)} instead.
40      */

41     void codeComplete(int offset, ICodeCompletionRequestor requestor)
42         throws JavaModelException;
43     /**
44      * Performs code completion at the given offset position in this compilation unit,
45      * reporting results to the given completion requestor. The <code>offset</code>
46      * is the 0-based index of the character, after which code assist is desired.
47      * An <code>offset</code> of -1 indicates to code assist at the beginning of this
48      * compilation unit.
49      *
50      * @param offset the given offset position
51      * @param requestor the given completion requestor
52      * @exception JavaModelException if code assist could not be performed. Reasons include:<ul>
53      * <li>This Java element does not exist (ELEMENT_DOES_NOT_EXIST)</li>
54      * <li> The position specified is < -1 or is greater than this compilation unit's
55      * source length (INDEX_OUT_OF_BOUNDS)
56      * </ul>
57      *
58      * @exception IllegalArgumentException if <code>requestor</code> is <code>null</code>
59      * @since 2.0
60      * @deprecated Use {@link #codeComplete(int, CompletionRequestor)} instead.
61      */

62     void codeComplete(int offset, ICompletionRequestor requestor)
63         throws JavaModelException;
64     
65     /**
66      * Performs code completion at the given offset position in this compilation unit,
67      * reporting results to the given completion requestor. The <code>offset</code>
68      * is the 0-based index of the character, after which code assist is desired.
69      * An <code>offset</code> of -1 indicates to code assist at the beginning of this
70      * compilation unit.
71      * <p>
72      *
73      * @param offset the given offset position
74      * @param requestor the given completion requestor
75      * @exception JavaModelException if code assist could not be performed. Reasons include:<ul>
76      * <li>This Java element does not exist (ELEMENT_DOES_NOT_EXIST)</li>
77      * <li> The position specified is < -1 or is greater than this compilation unit's
78      * source length (INDEX_OUT_OF_BOUNDS)
79      * </ul>
80      *
81      * @exception IllegalArgumentException if <code>requestor</code> is <code>null</code>
82      * @since 3.0
83      */

84     void codeComplete(int offset, CompletionRequestor requestor)
85         throws JavaModelException;
86     
87     /**
88      * Performs code completion at the given offset position in this compilation unit,
89      * reporting results to the given completion requestor. The <code>offset</code>
90      * is the 0-based index of the character, after which code assist is desired.
91      * An <code>offset</code> of -1 indicates to code assist at the beginning of this
92      * compilation unit.
93      * It considers types in the working copies with the given owner first. In other words,
94      * the owner's working copies will take precedence over their original compilation units
95      * in the workspace.
96      * <p>
97      * Note that if a working copy is empty, it will be as if the original compilation
98      * unit had been deleted.
99      * </p>
100      *
101      * @param offset the given offset position
102      * @param requestor the given completion requestor
103      * @param owner the owner of working copies that take precedence over their original compilation units
104      * @exception JavaModelException if code assist could not be performed. Reasons include:<ul>
105      * <li>This Java element does not exist (ELEMENT_DOES_NOT_EXIST)</li>
106      * <li> The position specified is < -1 or is greater than this compilation unit's
107      * source length (INDEX_OUT_OF_BOUNDS)
108      * </ul>
109      *
110      * @exception IllegalArgumentException if <code>requestor</code> is <code>null</code>
111      * @since 3.0
112      * @deprecated Use {@link #codeComplete(int, CompletionRequestor, WorkingCopyOwner)} instead.
113      */

114     void codeComplete(int offset, ICompletionRequestor requestor, WorkingCopyOwner owner)
115         throws JavaModelException;
116
117     /**
118      * Performs code completion at the given offset position in this compilation unit,
119      * reporting results to the given completion requestor. The <code>offset</code>
120      * is the 0-based index of the character, after which code assist is desired.
121      * An <code>offset</code> of -1 indicates to code assist at the beginning of this
122      * compilation unit.
123      * It considers types in the working copies with the given owner first. In other words,
124      * the owner's working copies will take precedence over their original compilation units
125      * in the workspace.
126      * <p>
127      * Note that if a working copy is empty, it will be as if the original compilation
128      * unit had been deleted.
129      * </p>
130      *
131      * @param offset the given offset position
132      * @param requestor the given completion requestor
133      * @param owner the owner of working copies that take precedence over their original compilation units
134      * @exception JavaModelException if code assist could not be performed. Reasons include:<ul>
135      * <li>This Java element does not exist (ELEMENT_DOES_NOT_EXIST)</li>
136      * <li> The position specified is < -1 or is greater than this compilation unit's
137      * source length (INDEX_OUT_OF_BOUNDS)
138      * </ul>
139      *
140      * @exception IllegalArgumentException if <code>requestor</code> is <code>null</code>
141      * @since 3.0
142      */

143     void codeComplete(int offset, CompletionRequestor requestor, WorkingCopyOwner owner)
144         throws JavaModelException;
145
146     /**
147      * Returns the Java elements corresponding to the given selected text in this compilation unit.
148      * The <code>offset</code> is the 0-based index of the first selected character.
149      * The <code>length</code> is the number of selected characters.
150      * <p>
151      * Note that if the <code>length</code> is 0 and the <code>offset</code> is inside an identifier
152      * or the index just after an identifier then this identifier is considered as the selection.
153      * </p>
154      *
155      * @param offset the given offset position
156      * @param length the number of selected characters
157      * @return the Java elements corresponding to the given selected text
158      *
159      * @exception JavaModelException if code resolve could not be performed. Reasons include:
160      * <ul>
161      * <li>This Java element does not exist (ELEMENT_DOES_NOT_EXIST)</li>
162      * <li> The range specified is not within this element's
163      * source range (INDEX_OUT_OF_BOUNDS)
164      * </ul>
165      *
166      */

167     IJavaElement[] codeSelect(int offset, int length) throws JavaModelException;
168     /**
169      * Returns the Java elements corresponding to the given selected text in this compilation unit.
170      * The <code>offset</code> is the 0-based index of the first selected character.
171      * The <code>length</code> is the number of selected characters.
172      * It considers types in the working copies with the given owner first. In other words,
173      * the owner's working copies will take precedence over their original compilation units
174      * in the workspace.
175      * <p>
176      * Note that if the <code>length</code> is 0 and the <code>offset</code> is inside an identifier
177      * or the index just after an identifier then this identifier is considered as the selection.
178      * </p>
179      * <p>
180      * Note that if a working copy is empty, it will be as if the original compilation
181      * unit had been deleted.
182      * </p>
183      *
184      * @param offset the given offset position
185      * @param length the number of selected characters
186      * @param owner the owner of working copies that take precedence over their original compilation units
187      * @return the Java elements corresponding to the given selected text
188      *
189      * @exception JavaModelException if code resolve could not be performed. Reasons include:
190      * <ul>
191      * <li>This Java element does not exist (ELEMENT_DOES_NOT_EXIST)</li>
192      * <li> The range specified is not within this element's
193      * source range (INDEX_OUT_OF_BOUNDS)
194      * </ul>
195      * @since 3.0
196      */

197     IJavaElement[] codeSelect(int offset, int length, WorkingCopyOwner owner) throws JavaModelException;
198 }
199
Popular Tags