1 /*******************************************************************************
2 * Copyright (c) 2000, 2004 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package net.sourceforge.phpdt.core;
14 * Common protocol for Java elements that support source code assist and code
17 * This interface is not intended to be implemented by clients.
20 public interface ICodeAssist {
23 * Performs code completion at the given offset position in this compilation
24 * unit, reporting results to the given completion requestor. The
25 * <code>offset</code> is the 0-based index of the character, after which
26 * code assist is desired. An <code>offset</code> of -1 indicates to code
27 * assist at the beginning of this compilation unit.
30 * the given offset position
32 * the given completion requestor
34 * @exception JavaModelException
35 * if code assist could not be performed. Reasons include:
37 * <li>This Java element does not exist
38 * (ELEMENT_DOES_NOT_EXIST)</li>
39 * <li> The position specified is < -1 or is greater than
40 * this compilation unit's source length
41 * (INDEX_OUT_OF_BOUNDS)
44 * @exception IllegalArgumentException
45 * if <code>requestor</code> is <code>null</code>
46 * @deprecated Use {@link #codeComplete(int, ICompletionRequestor)} instead.
48 void codeComplete(int offset, ICodeCompletionRequestor requestor)
49 throws JavaModelException;
52 * Performs code completion at the given offset position in this compilation
53 * unit, reporting results to the given completion requestor. The
54 * <code>offset</code> is the 0-based index of the character, after which
55 * code assist is desired. An <code>offset</code> of -1 indicates to code
56 * assist at the beginning of this compilation unit.
59 * the given offset position
61 * the given completion requestor
62 * @exception JavaModelException
63 * if code assist could not be performed. Reasons include:
65 * <li>This Java element does not exist
66 * (ELEMENT_DOES_NOT_EXIST)</li>
67 * <li> The position specified is < -1 or is greater than
68 * this compilation unit's source length
69 * (INDEX_OUT_OF_BOUNDS)
72 * @exception IllegalArgumentException
73 * if <code>requestor</code> is <code>null</code>
76 // TODO (jerome - once CompletionRequestor is working) @ deprecated Use
77 // {@link #codeComplete(int, CompletionRequestor)} instead.
78 void codeComplete(int offset, ICompletionRequestor requestor)
79 throws JavaModelException;
82 * <b>DO NOT USE</b>: This API element was added in anticipation of J2SE
83 * 1.5 support, which is planned for the next release of Eclipse after 3.0.
84 * It is currently unimplemented, and the API may change slightly before
85 * reaching its final form.
87 * Performs code completion at the given offset position in this compilation
88 * unit, reporting results to the given completion requestor. The
89 * <code>offset</code> is the 0-based index of the character, after which
90 * code assist is desired. An <code>offset</code> of -1 indicates to code
91 * assist at the beginning of this compilation unit.
95 * the given offset position
97 * the given completion requestor
98 * @exception JavaModelException
99 * if code assist could not be performed. Reasons include:
101 * <li>This Java element does not exist
102 * (ELEMENT_DOES_NOT_EXIST)</li>
103 * <li> The position specified is < -1 or is greater than
104 * this compilation unit's source length
105 * (INDEX_OUT_OF_BOUNDS)
108 * @exception IllegalArgumentException
109 * if <code>requestor</code> is <code>null</code>
112 void codeComplete(int offset, CompletionRequestor requestor)
113 throws JavaModelException;
116 * Performs code completion at the given offset position in this compilation
117 * unit, reporting results to the given completion requestor. The
118 * <code>offset</code> is the 0-based index of the character, after which
119 * code assist is desired. An <code>offset</code> of -1 indicates to code
120 * assist at the beginning of this compilation unit. It considers types in
121 * the working copies with the given owner first. In other words, the
122 * owner's working copies will take precedence over their original
123 * compilation units in the workspace.
125 * Note that if a working copy is empty, it will be as if the original
126 * compilation unit had been deleted.
130 * the given offset position
132 * the given completion requestor
134 * the owner of working copies that take precedence over their
135 * original compilation units
136 * @exception JavaModelException
137 * if code assist could not be performed. Reasons include:
139 * <li>This Java element does not exist
140 * (ELEMENT_DOES_NOT_EXIST)</li>
141 * <li> The position specified is < -1 or is greater than
142 * this compilation unit's source length
143 * (INDEX_OUT_OF_BOUNDS)
146 * @exception IllegalArgumentException
147 * if <code>requestor</code> is <code>null</code>
150 // TODO (jerome - once CompletionRequestor is working) @ deprecated Use
151 // {@link #codeComplete(int, CompletionRequestor, WorkingCopyOwner)}
153 void codeComplete(int offset, ICompletionRequestor requestor,
154 WorkingCopyOwner owner) throws JavaModelException;
157 * <b>DO NOT USE</b>: This API element was added in anticipation of J2SE
158 * 1.5 support, which is planned for the next release of Eclipse after 3.0.
159 * It is currently unimplemented, and the API may change slightly before
160 * reaching its final form.
162 * Performs code completion at the given offset position in this compilation
163 * unit, reporting results to the given completion requestor. The
164 * <code>offset</code> is the 0-based index of the character, after which
165 * code assist is desired. An <code>offset</code> of -1 indicates to code
166 * assist at the beginning of this compilation unit. It considers types in
167 * the working copies with the given owner first. In other words, the
168 * owner's working copies will take precedence over their original
169 * compilation units in the workspace.
171 * Note that if a working copy is empty, it will be as if the original
172 * compilation unit had been deleted.
176 * the given offset position
178 * the given completion requestor
180 * the owner of working copies that take precedence over their
181 * original compilation units
182 * @exception JavaModelException
183 * if code assist could not be performed. Reasons include:
185 * <li>This Java element does not exist
186 * (ELEMENT_DOES_NOT_EXIST)</li>
187 * <li> The position specified is < -1 or is greater than
188 * this compilation unit's source length
189 * (INDEX_OUT_OF_BOUNDS)
192 * @exception IllegalArgumentException
193 * if <code>requestor</code> is <code>null</code>
196 void codeComplete(int offset, CompletionRequestor requestor,
197 WorkingCopyOwner owner) throws JavaModelException;
200 * Returns the Java elements correspondiing to the given selected text in
201 * this compilation unit. The <code>offset</code> is the 0-based index of
202 * the first selected character. The <code>length</code> is the number of
203 * selected characters.
206 * the given offset position
208 * the number of selected characters
209 * @return the Java elements correspondiing to the given selected text
211 * @exception JavaModelException
212 * if code resolve could not be performed. Reasons include:
213 * <li>This Java element does not exist
214 * (ELEMENT_DOES_NOT_EXIST)</li>
215 * <li> The range specified is not within this element's
216 * source range (INDEX_OUT_OF_BOUNDS)
220 IJavaElement[] codeSelect(int offset, int length) throws JavaModelException;
223 * Returns the Java elements correspondiing to the given selected text in
224 * this compilation unit. The <code>offset</code> is the 0-based index of
225 * the first selected character. The <code>length</code> is the number of
226 * selected characters. It considers types in the working copies with the
227 * given owner first. In other words, the owner's working copies will take
228 * precedence over their original compilation units in the workspace.
230 * Note that if a working copy is empty, it will be as if the original
231 * compilation unit had been deleted.
235 * the given offset position
237 * the number of selected characters
239 * the owner of working copies that take precedence over their
240 * original compilation units
241 * @return the Java elements correspondiing to the given selected text
243 * @exception JavaModelException
244 * if code resolve could not be performed. Reasons include:
245 * <li>This Java element does not exist
246 * (ELEMENT_DOES_NOT_EXIST)</li>
247 * <li> The range specified is not within this element's
248 * source range (INDEX_OUT_OF_BOUNDS)
252 IJavaElement[] codeSelect(int offset, int length, WorkingCopyOwner owner)
253 throws JavaModelException;