View | Details | Raw Unified | Return to bug 245835
Collapse All | Expand All

(-)codeassist/org/eclipse/jdt/internal/codeassist/InternalCompletionContext.java (-1 / +263 lines)
Lines 10-17 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.jdt.internal.codeassist;
11
package org.eclipse.jdt.internal.codeassist;
12
12
13
import org.eclipse.jdt.core.CompletionContext;
14
import org.eclipse.jdt.core.ICompilationUnit;
15
import org.eclipse.jdt.core.IField;
16
import org.eclipse.jdt.core.IJavaElement;
17
import org.eclipse.jdt.core.ILocalVariable;
18
import org.eclipse.jdt.core.IMember;
19
import org.eclipse.jdt.core.IMethod;
13
import org.eclipse.jdt.core.ITypeRoot;
20
import org.eclipse.jdt.core.ITypeRoot;
21
import org.eclipse.jdt.core.Signature;
14
import org.eclipse.jdt.core.WorkingCopyOwner;
22
import org.eclipse.jdt.core.WorkingCopyOwner;
23
import org.eclipse.jdt.internal.codeassist.complete.CompletionOnJavadoc;
15
import org.eclipse.jdt.internal.codeassist.complete.CompletionParser;
24
import org.eclipse.jdt.internal.codeassist.complete.CompletionParser;
16
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
25
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
17
import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
26
import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
Lines 23-29 Link Here
23
 * Internal completion context
32
 * Internal completion context
24
 * @since 3.1
33
 * @since 3.1
25
 */
34
 */
26
public class InternalCompletionContext {
35
public class InternalCompletionContext extends CompletionContext {
27
	protected char[][] expectedTypesSignatures;
36
	protected char[][] expectedTypesSignatures;
28
	protected char[][] expectedTypesKeys;
37
	protected char[][] expectedTypesKeys;
29
	protected int javadoc;
38
	protected int javadoc;
Lines 106-109 Link Here
106
			this.tokenEnd = 0;
115
			this.tokenEnd = 0;
107
		}
116
		}
108
	}
117
	}
118
119
	/**
120
	 * Returns the innermost enclosing Java element which contains the completion location or <code>null</code> if this element cannot be computed.
121
	 * The returned Java element and all Java elements in the same compilation unit which can be navigated to from the returned Java element are special Java elements:
122
	 * <ul>
123
	 * <li>they are based on the current content of the compilation unit's buffer, they are not the result of a reconcile operation</li>
124
	 * <li>they are not updated if the buffer changes.</li>
125
	 * <li>they do not contain local types which are not visible from the completion location.</li>
126
	 * <li>they do not give information about categories. {@link IMember#getCategories()} will return an empty array</li>
127
	 * </ul>
128
	 *
129
	 * Reasons for returning <code>null</code> include:
130
	 * <ul>
131
	 * <li>the compilation unit no longer exists</li>
132
	 * <li>the completion occurred in a binary type. However this restriction might be relaxed in the future.</li>
133
	 * </ul>
134
	 *
135
	 * @return the innermost enclosing Java element which contains the completion location or <code>null</code> if this element cannot be computed.
136
	 *
137
	 * @exception UnsupportedOperationException if the context is not an extended context
138
	 *
139
	 * @since 3.4
140
	 */
141
	public IJavaElement getEnclosingElement() {
142
		if (!this.isExtended) throw new UnsupportedOperationException("Operation only supported in extended context"); //$NON-NLS-1$
143
	
144
		if (this.extendedContext == null) return null;
145
	
146
		return this.extendedContext.getEnclosingElement();
147
	}
148
149
	/**
150
	 * Return keys of expected types of a potential completion proposal at the completion position.
151
	 *
152
	 * It's not mandatory to a completion proposal to respect this expectation.
153
	 *
154
	 * @return keys of expected types of a potential completion proposal at the completion position or
155
	 * <code>null</code> if there is no expected types.
156
	 *
157
	 * @see org.eclipse.jdt.core.dom.ASTParser#createASTs(ICompilationUnit[], String[], org.eclipse.jdt.core.dom.ASTRequestor, org.eclipse.core.runtime.IProgressMonitor)
158
	 */
159
	public char[][] getExpectedTypesKeys() {
160
		return this.expectedTypesKeys;
161
	}
162
163
	/**
164
	 * Return signatures of expected types of a potential completion proposal at the completion position.
165
	 *
166
	 * It's not mandatory to a completion proposal to respect this expectation.
167
	 *
168
	 * @return signatures expected types of a potential completion proposal at the completion position or
169
	 * <code>null</code> if there is no expected types.
170
	 *
171
	 * @see Signature
172
	 */
173
	public char[][] getExpectedTypesSignatures() {
174
		return this.expectedTypesSignatures;
175
	}
176
177
	/**
178
	 * Returns the offset position in the source file buffer
179
	 * after which code assist is requested.
180
	 *
181
	 * @return offset position in the source file buffer
182
	 * @since 3.2
183
	 */
184
	public int getOffset() {
185
		return this.offset;
186
	}
187
188
	/**
189
	 * Returns the completed token.
190
	 * This token is either the identifier or Java language keyword
191
	 * or the string literal under, immediately preceding,
192
	 * the original request offset. If the original request offset
193
	 * is not within or immediately after an identifier or keyword or
194
	 * a string literal then the returned value is <code>null</code>.
195
	 *
196
	 * @return completed token or <code>null</code>
197
	 * @since 3.2
198
	 */
199
	public char[] getToken() {
200
		return this.token;
201
	}
202
203
	/**
204
	 * Returns the character index of the end (exclusive) of the subrange
205
	 * in the source file buffer containing the
206
	 * relevant token. When there is no relevant token, the
207
	 * range is empty
208
	 * (<code>getTokenEnd() == getTokenStart() - 1</code>).
209
	 *
210
	 * @return character index of token end position (exclusive)
211
	 * @since 3.2
212
	 */
213
	// TODO (david) https://bugs.eclipse.org/bugs/show_bug.cgi?id=132558
214
	public int getTokenEnd() {
215
		return this.tokenEnd;
216
	}
217
218
	/**
219
	 * Returns the kind of completion token being proposed.
220
	 * <p>
221
	 * The set of different kinds of completion token is
222
	 * expected to change over time. It is strongly recommended
223
	 * that clients do <b>not</b> assume that the kind is one of the
224
	 * ones they know about, and code defensively for the
225
	 * possibility of unexpected future growth.
226
	 * </p>
227
	 *
228
	 * @return the kind; one of the kind constants declared on
229
	 * this class whose name starts with <code>TOKEN_KIND</code>,
230
	 * or possibly a kind unknown to the caller
231
	 * @since 3.2
232
	 */
233
	public int getTokenKind() {
234
		return this.tokenKind;
235
	}
236
237
	/**
238
	 * Returns the location of completion token being proposed.
239
	 * The returned location is a bit mask which can contain some values
240
	 * of the constants declared on this class whose name starts with <code>TL</code>,
241
	 * or possibly values unknown to the caller.
242
	 *
243
	 * <p>
244
	 * The set of different location values is expected to change over time.
245
	 * It is strongly recommended that clients do <b>not</b> assume that
246
	 * the location contains only known value, and code defensively for
247
	 * the possibility of unexpected future growth.
248
	 * </p>
249
	 *
250
	 * @return the location
251
	 *
252
	 * @since 3.4
253
	 */
254
	public int getTokenLocation() {
255
		return this.tokenLocation;
256
	}
257
258
	/**
259
	 * Returns the character index of the start of the
260
	 * subrange in the source file buffer containing the
261
	 * relevant token being completed. This
262
	 * token is either the identifier or Java language keyword
263
	 * under, or immediately preceding, the original request
264
	 * offset. If the original request offset is not within
265
	 * or immediately after an identifier or keyword, then the
266
	 * position returned is original request offset and the
267
	 * token range is empty.
268
	 *
269
	 * @return character index of token start position (inclusive)
270
	 * @since 3.2
271
	 */
272
	public int getTokenStart() {
273
		return this.tokenStart;
274
	}
275
276
	/**
277
	 * Return the elements which are visible from the completion location and which can be assigned to the given type.
278
	 * An element is assignable if its type can be assigned to a variable
279
	 * of the given type, as specified in section 5.2 of <em>The Java Language
280
	 * Specification, Third Edition</em> (JLS3).
281
	 * A visible element is either:
282
	 * <ul>
283
	 * <li>a {@link ILocalVariable} - the element type is {@link ILocalVariable#getTypeSignature()}</li>
284
	 * <li>a {@link IField} - the element type is {@link IField#getTypeSignature()}</li>
285
	 * <li>a {@link IMethod} - the element type is {@link IMethod#getReturnType()}</li>
286
	 * </ul>
287
	 *
288
	 * Returned elements defined in the completed compilation unit are special Java elements:
289
	 * <ul>
290
	 * <li>they are based on the current content of the compilation unit's buffer, they are not the result of a reconcile operation</li>
291
	 * <li>they are not updated if the buffer changes.</li>
292
	 * <li>they do not contain local types which are not visible from the completion location.</li>
293
	 * <li>they do not give information about categories. {@link IMember#getCategories()} will return an empty array</li>
294
	 * </ul>
295
	 *
296
	 * Note the array can be empty if:
297
	 * <ul>
298
	 * <li>the compilation unit no longer exists</li>
299
	 * <li>the completion occurred in a binary type. However this restriction might be relaxed in the future.</li>
300
	 * </ul>
301
	 *
302
	 * @param typeSignature elements which can be assigned to this type are returned.
303
	 * 		If <code>null</code> there is no constraint on the type of the returned elements.
304
	 *
305
	 * @return elements which are visible from the completion location and which can be assigned to the given type.
306
	 *
307
	 * @exception UnsupportedOperationException if the context is not an extended context
308
	 *
309
	 * @see #isExtended()
310
	 *
311
	 * @since 3.4
312
	 */
313
	public IJavaElement[] getVisibleElements(String typeSignature) {
314
		if (!this.isExtended) throw new UnsupportedOperationException("Operation only supported in extended context"); //$NON-NLS-1$
315
	
316
		if (this.extendedContext == null) return new IJavaElement[0];
317
	
318
		return this.extendedContext.getVisibleElements(typeSignature);
319
	}
320
321
	/**
322
	 * Returns whether this completion context is an extended context.
323
	 * Some methods of this context can be used only if this context is an extended context but an extended context consumes more memory.
324
	 *
325
	 * @return <code>true</code> if this completion context is an extended context.
326
	 *
327
	 * @since 3.4
328
	 */
329
	public boolean isExtended() {
330
		return this.isExtended;
331
	}
332
333
	/**
334
	 * Tell user whether completion takes place in a javadoc comment or not.
335
	 *
336
	 * @return boolean true if completion takes place in a javadoc comment, false otherwise.
337
	 * @since 3.2
338
	 */
339
	public boolean isInJavadoc() {
340
		return this.javadoc != 0;
341
	}
342
343
	/**
344
	 * Tell user whether completion takes place in a formal reference of a javadoc tag or not.
345
	 * Tags with formal reference are:
346
	 * <ul>
347
	 * 	<li>&#64;see</li>
348
	 * 	<li>&#64;throws</li>
349
	 * 	<li>&#64;exception</li>
350
	 * 	<li>{&#64;link Object}</li>
351
	 * 	<li>{&#64;linkplain Object}</li>
352
	 * 	<li>{&#64;value} when compiler compliance is set at leats to 1.5</li>
353
	 * </ul>
354
	 *
355
	 * @return boolean true if completion takes place in formal reference of a javadoc tag, false otherwise.
356
	 * @since 3.2
357
	 */
358
	public boolean isInJavadocFormalReference() {
359
		return (this.javadoc & CompletionOnJavadoc.FORMAL_REFERENCE) != 0;
360
	}
361
362
	/**
363
	 * Tell user whether completion takes place in text area of a javadoc comment or not.
364
	 *
365
	 * @return boolean true if completion takes place in a text area of a javadoc comment, false otherwise.
366
	 * @since 3.2
367
	 */
368
	public boolean isInJavadocText() {
369
		return (this.javadoc & CompletionOnJavadoc.TEXT) != 0;
370
	}
109
}
371
}
(-)codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java (-6 / +6 lines)
Lines 868-874 Link Here
868
			CompilationUnitDeclaration compilationUnitDeclaration,
868
			CompilationUnitDeclaration compilationUnitDeclaration,
869
			Binding qualifiedBinding,
869
			Binding qualifiedBinding,
870
			Scope scope) {
870
			Scope scope) {
871
		CompletionContext context = new CompletionContext();
871
		InternalCompletionContext context = new InternalCompletionContext();
872
		if (this.requestor.isExtendedContextRequired()) {
872
		if (this.requestor.isExtendedContextRequired()) {
873
			context.setExtendedData(
873
			context.setExtendedData(
874
					this.typeRoot,
874
					this.typeRoot,
Lines 938-944 Link Here
938
		this.requestor.acceptContext(context);
938
		this.requestor.acceptContext(context);
939
	}
939
	}
940
940
941
	private void buildTokenLocationContext(CompletionContext context, Scope scope, ASTNode astNode, ASTNode astNodeParent) {
941
	private void buildTokenLocationContext(InternalCompletionContext context, Scope scope, ASTNode astNode, ASTNode astNodeParent) {
942
		if (scope == null || context.isInJavadoc()) return;
942
		if (scope == null || context.isInJavadoc()) return;
943
943
944
		if (astNode instanceof CompletionOnFieldType) {
944
		if (astNode instanceof CompletionOnFieldType) {
Lines 2311-2317 Link Here
2311
				if(this.noProposal && this.problem != null) {
2311
				if(this.noProposal && this.problem != null) {
2312
					if(!contextAccepted) {
2312
					if(!contextAccepted) {
2313
						contextAccepted = true;
2313
						contextAccepted = true;
2314
						CompletionContext context = new CompletionContext();
2314
						InternalCompletionContext context = new InternalCompletionContext();
2315
						if (this.requestor.isExtendedContextRequired()) context.setExtended();
2315
						if (this.requestor.isExtendedContextRequired()) context.setExtended();
2316
						this.requestor.acceptContext(context);
2316
						this.requestor.acceptContext(context);
2317
					}
2317
					}
Lines 2346-2352 Link Here
2346
		}
2346
		}
2347
		if(!contextAccepted) {
2347
		if(!contextAccepted) {
2348
			contextAccepted = true;
2348
			contextAccepted = true;
2349
			CompletionContext context = new CompletionContext();
2349
			InternalCompletionContext context = new InternalCompletionContext();
2350
			if (this.requestor.isExtendedContextRequired()) context.setExtended();
2350
			if (this.requestor.isExtendedContextRequired()) context.setExtended();
2351
			this.requestor.acceptContext(context);
2351
			this.requestor.acceptContext(context);
2352
		}
2352
		}
Lines 2567-2573 Link Here
2567
			if(this.noProposal && this.problem != null) {
2567
			if(this.noProposal && this.problem != null) {
2568
				if(!contextAccepted) {
2568
				if(!contextAccepted) {
2569
					contextAccepted = true;
2569
					contextAccepted = true;
2570
					CompletionContext context = new CompletionContext();
2570
					InternalCompletionContext context = new InternalCompletionContext();
2571
					context.setOffset(completionPosition - this.offset);
2571
					context.setOffset(completionPosition - this.offset);
2572
					context.setTokenKind(CompletionContext.TOKEN_KIND_UNKNOWN);
2572
					context.setTokenKind(CompletionContext.TOKEN_KIND_UNKNOWN);
2573
					if (this.requestor.isExtendedContextRequired()) context.setExtended();
2573
					if (this.requestor.isExtendedContextRequired()) context.setExtended();
Lines 2613-2619 Link Here
2613
			reset();
2613
			reset();
2614
			if(!contextAccepted) {
2614
			if(!contextAccepted) {
2615
				contextAccepted = true;
2615
				contextAccepted = true;
2616
				CompletionContext context = new CompletionContext();
2616
				InternalCompletionContext context = new InternalCompletionContext();
2617
				context.setTokenKind(CompletionContext.TOKEN_KIND_UNKNOWN);
2617
				context.setTokenKind(CompletionContext.TOKEN_KIND_UNKNOWN);
2618
				context.setOffset(completionPosition - this.offset);
2618
				context.setOffset(completionPosition - this.offset);
2619
				if (this.requestor.isExtendedContextRequired()) context.setExtended();
2619
				if (this.requestor.isExtendedContextRequired()) context.setExtended();
(-)model/org/eclipse/jdt/core/CompletionContext.java (-100 / +17 lines)
Lines 10-18 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.jdt.core;
11
package org.eclipse.jdt.core;
12
12
13
import org.eclipse.jdt.internal.codeassist.InternalCompletionContext;
14
import org.eclipse.jdt.internal.codeassist.complete.CompletionOnJavadoc;
15
16
/**
13
/**
17
 * Completion context.
14
 * Completion context.
18
 *
15
 *
Lines 22-28 Link Here
22
 * @since 3.1
19
 * @since 3.1
23
 * @noinstantiate This class is not intended to be instantiated by clients.
20
 * @noinstantiate This class is not intended to be instantiated by clients.
24
 */
21
 */
25
public final class CompletionContext extends InternalCompletionContext {
22
public class CompletionContext {
26
23
27
	/**
24
	/**
28
	 * The completed token is the first token of a member declaration.<br>
25
	 * The completed token is the first token of a member declaration.<br>
Lines 82-88 Link Here
82
	 * @since 3.2
79
	 * @since 3.2
83
	 */
80
	 */
84
	public boolean isInJavadoc() {
81
	public boolean isInJavadoc() {
85
		return this.javadoc != 0;
82
		return false; // default overridden by concrete implementation
86
	}
83
	}
87
84
88
	/**
85
	/**
Lines 91-98 Link Here
91
	 * @return boolean true if completion takes place in a text area of a javadoc comment, false otherwise.
88
	 * @return boolean true if completion takes place in a text area of a javadoc comment, false otherwise.
92
	 * @since 3.2
89
	 * @since 3.2
93
	 */
90
	 */
94
	public boolean isInJavadocText() {
91
	public  boolean isInJavadocText() {
95
		return (this.javadoc & CompletionOnJavadoc.TEXT) != 0;
92
		return false; // default overridden by concrete implementation
96
	}
93
	}
97
94
98
	/**
95
	/**
Lines 111-117 Link Here
111
	 * @since 3.2
108
	 * @since 3.2
112
	 */
109
	 */
113
	public boolean isInJavadocFormalReference() {
110
	public boolean isInJavadocFormalReference() {
114
		return (this.javadoc & CompletionOnJavadoc.FORMAL_REFERENCE) != 0;
111
		return false; // default overridden by concrete implementation
115
	}
112
	}
116
113
117
	/**
114
	/**
Lines 123-129 Link Here
123
	 * @since 3.4
120
	 * @since 3.4
124
	 */
121
	 */
125
	public boolean isExtended() {
122
	public boolean isExtended() {
126
		return this.isExtended;
123
		return false; // default overridden by concrete implementation
127
	}
124
	}
128
125
129
	/**
126
	/**
Lines 137-144 Link Here
137
	 * @see Signature
134
	 * @see Signature
138
	 */
135
	 */
139
	public char[][] getExpectedTypesSignatures() {
136
	public char[][] getExpectedTypesSignatures() {
140
		return this.expectedTypesSignatures;
137
		return null; // default overridden by concrete implementation
141
	}
138
	}
139
	
142
	/**
140
	/**
143
	 * Return keys of expected types of a potential completion proposal at the completion position.
141
	 * Return keys of expected types of a potential completion proposal at the completion position.
144
	 *
142
	 *
Lines 150-156 Link Here
150
	 * @see org.eclipse.jdt.core.dom.ASTParser#createASTs(ICompilationUnit[], String[], org.eclipse.jdt.core.dom.ASTRequestor, org.eclipse.core.runtime.IProgressMonitor)
148
	 * @see org.eclipse.jdt.core.dom.ASTParser#createASTs(ICompilationUnit[], String[], org.eclipse.jdt.core.dom.ASTRequestor, org.eclipse.core.runtime.IProgressMonitor)
151
	 */
149
	 */
152
	public char[][] getExpectedTypesKeys() {
150
	public char[][] getExpectedTypesKeys() {
153
		return this.expectedTypesKeys;
151
		return null; // default overridden by concrete implementation
154
	}
152
	}
155
153
156
	/**
154
	/**
Lines 165-171 Link Here
165
	 * @since 3.2
163
	 * @since 3.2
166
	 */
164
	 */
167
	public char[] getToken() {
165
	public char[] getToken() {
168
		return this.token;
166
		return null; // default overridden by concrete implementation
169
	}
167
	}
170
168
171
	/**
169
	/**
Lines 184-190 Link Here
184
	 * @since 3.2
182
	 * @since 3.2
185
	 */
183
	 */
186
	public int getTokenKind() {
184
	public int getTokenKind() {
187
		return this.tokenKind;
185
		return -1; // default overridden by concrete implementation
188
	}
186
	}
189
187
190
	/**
188
	/**
Lines 205-211 Link Here
205
	 * @since 3.4
203
	 * @since 3.4
206
	 */
204
	 */
207
	public int getTokenLocation() {
205
	public int getTokenLocation() {
208
		return this.tokenLocation;
206
		return -1; // default overridden by concrete implementation
209
	}
207
	}
210
208
211
	/**
209
	/**
Lines 223-229 Link Here
223
	 * @since 3.2
221
	 * @since 3.2
224
	 */
222
	 */
225
	public int getTokenStart() {
223
	public int getTokenStart() {
226
		return this.tokenStart;
224
		return -1; // default overridden by concrete implementation
227
	}
225
	}
228
226
229
	/**
227
	/**
Lines 238-244 Link Here
238
	 */
236
	 */
239
	// TODO (david) https://bugs.eclipse.org/bugs/show_bug.cgi?id=132558
237
	// TODO (david) https://bugs.eclipse.org/bugs/show_bug.cgi?id=132558
240
	public int getTokenEnd() {
238
	public int getTokenEnd() {
241
		return this.tokenEnd;
239
		return -1; // default overridden by concrete implementation
242
	}
240
	}
243
241
244
	/**
242
	/**
Lines 249-255 Link Here
249
	 * @since 3.2
247
	 * @since 3.2
250
	 */
248
	 */
251
	public int getOffset() {
249
	public int getOffset() {
252
		return this.offset;
250
		return -1; // default overridden by concrete implementation
253
	}
251
	}
254
252
255
	/**
253
	/**
Lines 275-285 Link Here
275
	 * @since 3.4
273
	 * @since 3.4
276
	 */
274
	 */
277
	public IJavaElement getEnclosingElement() {
275
	public IJavaElement getEnclosingElement() {
278
		if (!this.isExtended) throw new UnsupportedOperationException("Operation only supported in extended context"); //$NON-NLS-1$
276
		return null; // default overridden by concrete implementation
279
280
		if (this.extendedContext == null) return null;
281
282
		return this.extendedContext.getEnclosingElement();
283
	}
277
	}
284
278
285
	/**
279
	/**
Lines 320-403 Link Here
320
	 * @since 3.4
314
	 * @since 3.4
321
	 */
315
	 */
322
	public IJavaElement[] getVisibleElements(String typeSignature) {
316
	public IJavaElement[] getVisibleElements(String typeSignature) {
323
		if (!this.isExtended) throw new UnsupportedOperationException("Operation only supported in extended context"); //$NON-NLS-1$
317
		return null; // default overridden by concrete implementation
324
325
		if (this.extendedContext == null) return new IJavaElement[0];
326
327
		return this.extendedContext.getVisibleElements(typeSignature);
328
	}
318
	}
329
319
330
	public String toString() {
331
		StringBuffer buffer = new StringBuffer();
332
333
		buffer.append("completion offset="); //$NON-NLS-1$
334
		buffer.append(this.offset);
335
		buffer.append('\n');
336
337
		buffer.append("completion range=["); //$NON-NLS-1$
338
		buffer.append(this.tokenStart);
339
		buffer.append(", "); //$NON-NLS-1$
340
		buffer.append(this.tokenEnd);
341
		buffer.append("]\n"); //$NON-NLS-1$
342
343
		buffer.append("completion token="); //$NON-NLS-1$
344
		String string = "null"; //$NON-NLS-1$
345
		if(this.token == null) {
346
			buffer.append(string);
347
		} else {
348
			buffer.append('\"');
349
			buffer.append(this.token);
350
			buffer.append('\"');
351
		}
352
		buffer.append('\n');
353
354
		buffer.append("expectedTypesSignatures="); //$NON-NLS-1$
355
		if(this.expectedTypesSignatures == null) {
356
			buffer.append(string);
357
		} else {
358
			buffer.append('{');
359
			for (int i = 0; i < this.expectedTypesSignatures.length; i++) {
360
				if(i > 0) buffer.append(',');
361
				buffer.append(this.expectedTypesSignatures[i]);
362
363
			}
364
			buffer.append('}');
365
		}
366
		buffer.append('\n');
367
368
		buffer.append("expectedTypesKeys="); //$NON-NLS-1$
369
		if(this.expectedTypesSignatures == null) {
370
			buffer.append(string);
371
		} else {
372
			buffer.append('{');
373
			for (int i = 0; i < this.expectedTypesKeys.length; i++) {
374
				if(i > 0) buffer.append(',');
375
				buffer.append(this.expectedTypesKeys[i]);
376
377
			}
378
			buffer.append('}');
379
		}
380
		buffer.append('\n');
381
382
		if (this.tokenLocation == 0) {
383
			buffer.append("tokenLocation=UNKNOWN"); //$NON-NLS-1$
384
		} else {
385
			buffer.append("tokenLocation={"); //$NON-NLS-1$
386
			boolean first = true;
387
			if ((this.tokenLocation & CompletionContext.TL_MEMBER_START) != 0) {
388
				if (!first) buffer.append(',');
389
				buffer.append("MEMBER_START"); //$NON-NLS-1$
390
				first = false;
391
			}
392
			if ((this.tokenLocation & CompletionContext.TL_STATEMENT_START) != 0) {
393
				if (!first) buffer.append(',');
394
				buffer.append("STATEMENT_START"); //$NON-NLS-1$
395
				first = false;
396
			}
397
			buffer.append('}');
398
		}
399
		buffer.append('\n');
400
401
		return buffer.toString();
402
	}
403
}
320
}

Return to bug 245835