1 11 package org.eclipse.jdt.core; 12 13 import org.eclipse.jdt.internal.codeassist.InternalCompletionContext; 14 import org.eclipse.jdt.internal.codeassist.complete.CompletionOnJavadoc; 15 16 27 public final class CompletionContext extends InternalCompletionContext { 28 29 33 public static final int TOKEN_KIND_UNKNOWN = 0; 34 35 39 public static final int TOKEN_KIND_NAME = 1; 40 46 47 public static final int TOKEN_KIND_STRING_LITERAL = 2; 48 54 public boolean isInJavadoc() { 55 return this.javadoc != 0; 56 } 57 58 64 public boolean isInJavadocText() { 65 return (this.javadoc & CompletionOnJavadoc.TEXT) != 0; 66 } 67 68 83 public boolean isInJavadocFormalReference() { 84 return (this.javadoc & CompletionOnJavadoc.FORMAL_REFERENCE) != 0; 85 } 86 87 97 public char[][] getExpectedTypesSignatures() { 98 return this.expectedTypesSignatures; 99 } 100 110 public char[][] getExpectedTypesKeys() { 111 return this.expectedTypesKeys; 112 } 113 114 125 public char[] getToken() { 126 return this.token; 127 } 128 129 144 public int getTokenKind() { 145 return this.tokenKind; 146 } 147 148 162 public int getTokenStart() { 163 return this.tokenStart; 164 } 165 166 176 public int getTokenEnd() { 178 return this.tokenEnd; 179 } 180 181 188 public int getOffset() { 189 return this.offset; 190 } 191 192 public String toString() { 193 StringBuffer buffer = new StringBuffer (); 194 195 buffer.append("completion offset="); buffer.append(this.offset); 197 buffer.append('\n'); 198 199 buffer.append("completion range=["); buffer.append(this.tokenStart); 201 buffer.append(", "); buffer.append(this.tokenEnd); 203 buffer.append("]\n"); 205 buffer.append("completion token="); String string = "null"; if(token == null) { 208 buffer.append(string); 209 } else { 210 buffer.append('\"'); 211 buffer.append(this.token); 212 buffer.append('\"'); 213 } 214 buffer.append('\n'); 215 216 buffer.append("expectedTypesSignatures="); if(this.expectedTypesSignatures == null) { 218 buffer.append(string); 219 } else { 220 buffer.append('{'); 221 for (int i = 0; i < this.expectedTypesSignatures.length; i++) { 222 if(i > 0) buffer.append(','); 223 buffer.append(this.expectedTypesSignatures[i]); 224 225 } 226 buffer.append('}'); 227 } 228 buffer.append('\n'); 229 230 buffer.append("expectedTypesKeys="); if(expectedTypesSignatures == null) { 232 buffer.append(string); 233 } else { 234 buffer.append('{'); 235 for (int i = 0; i < this.expectedTypesKeys.length; i++) { 236 if(i > 0) buffer.append(','); 237 buffer.append(this.expectedTypesKeys[i]); 238 239 } 240 buffer.append('}'); 241 } 242 buffer.append('\n'); 243 244 return buffer.toString(); 245 } 246 } 247 | Popular Tags |