Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.

1 /*******************************************************************************2 * Copyright (c) 2000, 2006 IBM Corporation and others.3 * All rights reserved. This program and the accompanying materials4 * are made available under the terms of the Eclipse Public License v1.05 * which accompanies this distribution, and is available at6 * http://www.eclipse.org/legal/epl-v10.html7 *8 * Contributors:9 * IBM Corporation - initial API and implementation10 *******************************************************************************/11 package org.eclipse.jdt.core;12 13 /**14 * Common protocol for Java elements that support source code assist and code15 * resolve.16 * <p>17 * This interface is not intended to be implemented by clients.18 * </p>19 */20 publicinterface 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 this27 * compilation unit.28 * 29 * @param offset the given offset position30 * @param requestor the given completion requestor31 *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's35 * 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 throwsJavaModelException;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 this48 * compilation unit.49 *50 * @param offset the given offset position51 * @param requestor the given completion requestor52 * @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's55 * source length (INDEX_OUT_OF_BOUNDS)56 * </ul>57 *58 * @exception IllegalArgumentException if <code>requestor</code> is <code>null</code>59 * @since 2.060 * @deprecated Use {@link #codeComplete(int, CompletionRequestor)} instead.61 */62 void codeComplete(int offset, ICompletionRequestor requestor)63 throwsJavaModelException;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 this70 * compilation unit.71 * <p>72 *73 * @param offset the given offset position74 * @param requestor the given completion requestor75 * @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's78 * source length (INDEX_OUT_OF_BOUNDS)79 * </ul>80 *81 * @exception IllegalArgumentException if <code>requestor</code> is <code>null</code>82 * @since 3.083 */84 void codeComplete(int offset, CompletionRequestor requestor)85 throwsJavaModelException;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 this92 * 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 units95 * in the workspace.96 * <p>97 * Note that if a working copy is empty, it will be as if the original compilation98 * unit had been deleted.99 * </p>100 *101 * @param offset the given offset position102 * @param requestor the given completion requestor103 * @param owner the owner of working copies that take precedence over their original compilation units104 * @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's107 * source length (INDEX_OUT_OF_BOUNDS)108 * </ul>109 *110 * @exception IllegalArgumentException if <code>requestor</code> is <code>null</code>111 * @since 3.0112 * @deprecated Use {@link #codeComplete(int, CompletionRequestor, WorkingCopyOwner)} instead.113 */114 void codeComplete(int offset, ICompletionRequestor requestor, WorkingCopyOwner owner)115 throwsJavaModelException;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 this122 * 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 units125 * in the workspace.126 * <p>127 * Note that if a working copy is empty, it will be as if the original compilation128 * unit had been deleted.129 * </p>130 *131 * @param offset the given offset position132 * @param requestor the given completion requestor133 * @param owner the owner of working copies that take precedence over their original compilation units134 * @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's137 * source length (INDEX_OUT_OF_BOUNDS)138 * </ul>139 *140 * @exception IllegalArgumentException if <code>requestor</code> is <code>null</code>141 * @since 3.0142 */143 void codeComplete(int offset, CompletionRequestor requestor, WorkingCopyOwner owner)144 throwsJavaModelException;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 position156 * @param length the number of selected characters157 * @return the Java elements corresponding to the given selected text158 *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's163 * source range (INDEX_OUT_OF_BOUNDS)164 * </ul>165 *166 */167 IJavaElement[] codeSelect(int offset, int length) throwsJavaModelException;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 units174 * 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 compilation181 * unit had been deleted.182 * </p>183 * 184 * @param offset the given offset position185 * @param length the number of selected characters186 * @param owner the owner of working copies that take precedence over their original compilation units187 * @return the Java elements corresponding to the given selected text188 *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's193 * source range (INDEX_OUT_OF_BOUNDS)194 * </ul>195 * @since 3.0196 */197 IJavaElement[] codeSelect(int offset, int length, WorkingCopyOwner owner) throwsJavaModelException;198 }199