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

(-)codeassist/org/eclipse/jdt/internal/codeassist/InternalCompletionProposal.java (-17 / +1477 lines)
Lines 10-19 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.jdt.internal.codeassist;
11
package org.eclipse.jdt.internal.codeassist;
12
12
13
import org.eclipse.core.runtime.IProgressMonitor;
14
import org.eclipse.jdt.core.CompletionFlags;
15
import org.eclipse.jdt.core.CompletionProposal;
16
import org.eclipse.jdt.core.CompletionRequestor;
17
import org.eclipse.jdt.core.Flags;
13
import org.eclipse.jdt.core.IAccessRule;
18
import org.eclipse.jdt.core.IAccessRule;
19
import org.eclipse.jdt.core.ICodeAssist;
20
import org.eclipse.jdt.core.ICompilationUnit;
14
import org.eclipse.jdt.core.IMethod;
21
import org.eclipse.jdt.core.IMethod;
15
import org.eclipse.jdt.core.IType;
22
import org.eclipse.jdt.core.IType;
16
import org.eclipse.jdt.core.JavaModelException;
23
import org.eclipse.jdt.core.JavaModelException;
24
import org.eclipse.jdt.core.Signature;
17
import org.eclipse.jdt.core.compiler.CharOperation;
25
import org.eclipse.jdt.core.compiler.CharOperation;
18
import org.eclipse.jdt.internal.core.BinaryType;
26
import org.eclipse.jdt.internal.core.BinaryType;
19
import org.eclipse.jdt.internal.core.NameLookup;
27
import org.eclipse.jdt.internal.core.NameLookup;
Lines 22-28 Link Here
22
 * Internal completion proposal
30
 * Internal completion proposal
23
 * @since 3.1
31
 * @since 3.1
24
 */
32
 */
25
public class InternalCompletionProposal {
33
public class InternalCompletionProposal extends CompletionProposal {
26
	private static Object NO_ATTACHED_SOURCE = new Object();
34
	private static Object NO_ATTACHED_SOURCE = new Object();
27
35
28
	static final char[] ARG = "arg".toCharArray();  //$NON-NLS-1$
36
	static final char[] ARG = "arg".toCharArray();  //$NON-NLS-1$
Lines 47-87 Link Here
47
55
48
	protected char[] originalSignature;
56
	protected char[] originalSignature;
49
57
58
	private boolean updateCompletion = false;
59
50
	protected int accessibility = IAccessRule.K_ACCESSIBLE;
60
	protected int accessibility = IAccessRule.K_ACCESSIBLE;
51
61
52
	protected boolean isConstructor = false;
62
	protected boolean isConstructor = false;
53
63
64
	/**
65
	 * Kind of completion request.
66
	 */
67
	private int completionKind;
68
69
	/**
70
	 * Offset in original buffer where ICodeAssist.codeComplete() was
71
	 * requested.
72
	 */
73
	private int completionLocation;
74
75
	/**
76
	 * Start position (inclusive) of source range in original buffer
77
	 * containing the relevant token
78
	 * defaults to empty subrange at [0,0).
79
	 */
80
	private int tokenStart = 0;
81
82
	/**
83
	 * End position (exclusive) of source range in original buffer
84
	 * containing the relevant token;
85
	 * defaults to empty subrange at [0,0).
86
	 */
87
	private int tokenEnd = 0;
88
89
	/**
90
	 * Completion string; defaults to empty string.
91
	 */
92
	private char[] completion = CharOperation.NO_CHAR;
93
94
	/**
95
	 * Start position (inclusive) of source range in original buffer
96
	 * to be replaced by completion string;
97
	 * defaults to empty subrange at [0,0).
98
	 */
99
	private int replaceStart = 0;
100
101
	/**
102
	 * End position (exclusive) of source range in original buffer
103
	 * to be replaced by completion string;
104
	 * defaults to empty subrange at [0,0).
105
	 */
106
	private int replaceEnd = 0;
107
108
	/**
109
	 * Relevance rating; positive; higher means better;
110
	 * defaults to minimum rating.
111
	 */
112
	private int relevance = 1;
113
114
	/**
115
	 * Signature of the relevant package or type declaration
116
	 * in the context, or <code>null</code> if none.
117
	 * Defaults to null.
118
	 */
119
	private char[] declarationSignature = null;
120
121
	/**
122
	 * Unique key of the relevant package or type declaration
123
	 * in the context, or <code>null</code> if none.
124
	 * Defaults to null.
125
	 */
126
	private char[] declarationKey = null;
127
128
	/**
129
	 * Simple name of the method, field,
130
	 * member, or variable relevant in the context, or
131
	 * <code>null</code> if none.
132
	 * Defaults to null.
133
	 */
134
	private char[] name = null;
135
136
	/**
137
	 * Signature of the method, field type, member type,
138
	 * relevant in the context, or <code>null</code> if none.
139
	 * Defaults to null.
140
	 */
141
	private char[] signature = null;
142
143
	/**
144
	 * Unique of the method, field type, member type,
145
	 * relevant in the context, or <code>null</code> if none.
146
	 * Defaults to null.
147
	 */
148
	private char[] key = null;
149
150
	/**
151
	 * Array of required completion proposals, or <code>null</code> if none.
152
	 * The proposal can not be applied if the required proposals aren't applied.
153
	 * Defaults to <code>null</code>.
154
	 */
155
	private CompletionProposal[] requiredProposals;
156
157
	/**
158
	 * Modifier flags relevant in the context, or
159
	 * <code>Flags.AccDefault</code> if none.
160
	 * Defaults to <code>Flags.AccDefault</code>.
161
	 */
162
	private int flags = Flags.AccDefault;
163
164
	/**
165
	 * Completion flags relevant in the context, or
166
	 * <code>CompletionFlags.Default</code> if none.
167
	 * Defaults to <code>CompletionFlags.Default</code>.
168
	 */
169
	private int additionalFlags = CompletionFlags.Default;
170
171
	/**
172
	 * Parameter names (for method completions), or
173
	 * <code>null</code> if none. Lazily computed.
174
	 * Defaults to <code>null</code>.
175
	 */
176
	private char[][] parameterNames = null;
177
178
	/**
179
	 * Indicates whether parameter names have been computed.
180
	 */
181
	private boolean parameterNamesComputed = false;
182
54
	protected char[][] createDefaultParameterNames(int length) {
183
	protected char[][] createDefaultParameterNames(int length) {
55
		char[][] parameterNames;
184
		char[][] parameters;
56
		switch (length) {
185
		switch (length) {
57
			case 0 :
186
			case 0 :
58
				parameterNames = new char[length][];
187
				parameters = new char[length][];
59
				break;
188
				break;
60
			case 1 :
189
			case 1 :
61
				parameterNames = ARGS1;
190
				parameters = ARGS1;
62
				break;
191
				break;
63
			case 2 :
192
			case 2 :
64
				parameterNames = ARGS2;
193
				parameters = ARGS2;
65
				break;
194
				break;
66
			case 3 :
195
			case 3 :
67
				parameterNames = ARGS3;
196
				parameters = ARGS3;
68
				break;
197
				break;
69
			case 4 :
198
			case 4 :
70
				parameterNames = ARGS4;
199
				parameters = ARGS4;
71
				break;
200
				break;
72
			default :
201
			default :
73
				parameterNames = new char[length][];
202
				parameters = new char[length][];
74
				for (int i = 0; i < length; i++) {
203
				for (int i = 0; i < length; i++) {
75
					parameterNames[i] = CharOperation.concat(ARG, String.valueOf(i).toCharArray());
204
					parameters[i] = CharOperation.concat(ARG, String.valueOf(i).toCharArray());
76
				}
205
				}
77
				break;
206
				break;
78
		}
207
		}
79
		return parameterNames;
208
		return parameters;
80
	}
209
	}
81
	protected char[][] findMethodParameterNames(char[] declaringTypePackageName, char[] declaringTypeName, char[] selector, char[][] paramTypeNames){
210
	protected char[][] findMethodParameterNames(char[] declaringTypePackageName, char[] declaringTypeName, char[] selector, char[][] paramTypeNames){
82
		if(paramTypeNames == null || declaringTypeName == null) return null;
211
		if(paramTypeNames == null || declaringTypeName == null) return null;
83
212
84
		char[][] parameterNames = null;
213
		char[][] parameters = null;
85
		int length = paramTypeNames.length;
214
		int length = paramTypeNames.length;
86
215
87
		char[] tName = CharOperation.concat(declaringTypePackageName,declaringTypeName,'.');
216
		char[] tName = CharOperation.concat(declaringTypePackageName,declaringTypeName,'.');
Lines 116-137 Link Here
116
			}
245
			}
117
			IMethod method = type.getMethod(new String(selector),args);
246
			IMethod method = type.getMethod(new String(selector),args);
118
			try{
247
			try{
119
				parameterNames = new char[length][];
248
				parameters = new char[length][];
120
				String[] params = method.getParameterNames();
249
				String[] params = method.getParameterNames();
121
				for(int i = 0;	i< length ; i++){
250
				for(int i = 0;	i< length ; i++){
122
					parameterNames[i] = params[i].toCharArray();
251
					parameters[i] = params[i].toCharArray();
123
				}
252
				}
124
			} catch(JavaModelException e){
253
			} catch(JavaModelException e){
125
				parameterNames = null;
254
				parameters = null;
126
			}
255
			}
127
		}
256
		}
128
257
129
		// default parameters name
258
		// default parameters name
130
		if(parameterNames == null) {
259
		if(parameters == null) {
131
			parameterNames = createDefaultParameterNames(length);
260
			parameters = createDefaultParameterNames(length);
132
		}
261
		}
133
262
134
		return parameterNames;
263
		return parameters;
135
	}
264
	}
136
265
137
	protected char[] getDeclarationPackageName() {
266
	protected char[] getDeclarationPackageName() {
Lines 193-196 Link Here
193
	public void setOriginalSignature(char[] originalSignature) {
322
	public void setOriginalSignature(char[] originalSignature) {
194
		this.originalSignature = originalSignature;
323
		this.originalSignature = originalSignature;
195
	}
324
	}
325
	/**
326
	 * Creates a basic completion proposal. All instance
327
	 * field have plausible default values unless otherwise noted.
328
	 * <p>
329
	 * Note that the constructors for this class are internal to the
330
	 * Java model implementation. Clients cannot directly create
331
	 * CompletionProposal objects.
332
	 * </p>
333
	 *
334
	 * @param kind one of the kind constants declared on this class
335
	 * @param completionLocation original offset of code completion request
336
	 */
337
	public InternalCompletionProposal(int kind, int completionLocation) {
338
		if ((kind < FIRST_KIND)
339
				|| (kind > LAST_KIND)) {
340
			throw new IllegalArgumentException();
341
		}
342
		if (this.completion == null || completionLocation < 0) {
343
			// Work around for bug 132558 (https://bugs.eclipse.org/bugs/show_bug.cgi?id=132558).
344
			// completionLocation can be -1 if the completion occur at the start of a file or
345
			// the start of a code snippet but this API isn't design to support negative position.
346
			if(this.completion == null || completionLocation != -1) {
347
				throw new IllegalArgumentException();
348
			}
349
			completionLocation = 0;
350
		}
351
		this.completionKind = kind;
352
		this.completionLocation = completionLocation;
353
	}
354
355
	/**
356
	 * Returns the completion flags relevant in the context, or
357
	 * <code>CompletionFlags.Default</code> if none.
358
	 * <p>
359
	 * This field is available for the following kinds of
360
	 * completion proposals:
361
	 * <ul>
362
	 * <li><code>FIELD_IMPORT</code> - completion flags
363
	 * of the attribute that is referenced. Completion flags for
364
	 * this proposal kind can only include <code>CompletionFlags.StaticImport</code></li>
365
	 * <li><code>METHOD_IMPORT</code> - completion flags
366
	 * of the attribute that is referenced. Completion flags for
367
	 * this proposal kind can only include <code>CompletionFlags.StaticImport</code></li>
368
	 * <li><code>TYPE_IMPORT</code> - completion flags
369
	 * of the attribute that is referenced. Completion flags for
370
	 * this proposal kind can only include <code>CompletionFlags.StaticImport</code></li>
371
	 * </ul>
372
	 * For other kinds of completion proposals, this method returns
373
	 * <code>CompletionFlags.Default</code>.
374
	 * </p>
375
	 *
376
	 * @return the completion flags, or
377
	 * <code>CompletionFlags.Default</code> if none
378
	 * @see CompletionFlags
379
	 *
380
	 * @since 3.3
381
	 */
382
	public int getAdditionalFlags() {
383
		return this.additionalFlags;
384
	}
385
386
	/**
387
	 * Sets the completion flags relevant in the context.
388
	 * <p>
389
	 * If not set, defaults to none.
390
	 * </p>
391
	 * <p>
392
	 * The completion engine creates instances of this class and sets
393
	 * its properties; this method is not intended to be used by other clients.
394
	 * </p>
395
	 *
396
	 * @param additionalFlags the completion flags, or
397
	 * <code>CompletionFlags.Default</code> if none
398
	 *
399
	 * @since 3.3
400
	 */
401
	public void setAdditionalFlags(int additionalFlags) {
402
		this.additionalFlags = additionalFlags;
403
	}
404
405
	/**
406
	 * Returns the kind of completion being proposed.
407
	 * <p>
408
	 * The set of different kinds of completion proposals is
409
	 * expected to change over time. It is strongly recommended
410
	 * that clients do <b>not</b> assume that the kind is one of the
411
	 * ones they know about, and code defensively for the
412
	 * possibility of unexpected future growth.
413
	 * </p>
414
	 *
415
	 * @return the kind; one of the kind constants
416
	 * declared on this class, or possibly a kind unknown
417
	 * to the caller
418
	 */
419
	public int getKind() {
420
		return this.completionKind;
421
	}
422
423
	/**
424
	 * Returns the character index in the source file buffer
425
	 * where source completion was requested (the
426
	 * <code>offset</code> parameter to
427
	 * <code>ICodeAssist.codeComplete</code> minus one).
428
	 *
429
	 * @return character index in source file buffer
430
	 * @see ICodeAssist#codeComplete(int,CompletionRequestor)
431
	 */
432
	// TODO (david) https://bugs.eclipse.org/bugs/show_bug.cgi?id=132558
433
	public int getCompletionLocation() {
434
		return this.completionLocation;
435
	}
436
437
	/**
438
	 * Returns the character index of the start of the
439
	 * subrange in the source file buffer containing the
440
	 * relevant token being completed. This
441
	 * token is either the identifier or Java language keyword
442
	 * under, or immediately preceding, the original request
443
	 * offset. If the original request offset is not within
444
	 * or immediately after an identifier or keyword, then the
445
	 * position returned is original request offset and the
446
	 * token range is empty.
447
	 *
448
	 * @return character index of token start position (inclusive)
449
	 */
450
	public int getTokenStart() {
451
		return this.tokenStart;
452
	}
453
454
	/**
455
	 * Returns the character index of the end (exclusive) of the subrange
456
	 * in the source file buffer containing the
457
	 * relevant token. When there is no relevant token, the
458
	 * range is empty
459
	 * (<code>getEndToken() == getStartToken()</code>).
460
	 *
461
	 * @return character index of token end position (exclusive)
462
	 */
463
	public int getTokenEnd() {
464
		return this.tokenEnd;
465
	}
466
467
	/**
468
	 * Sets the character indices of the subrange in the
469
	 * source file buffer containing the relevant token being
470
	 * completed. This token is either the identifier or
471
	 * Java language keyword under, or immediately preceding,
472
	 * the original request offset. If the original request
473
	 * offset is not within or immediately after an identifier
474
	 * or keyword, then the source range begins at original
475
	 * request offset and is empty.
476
	 * <p>
477
	 * If not set, defaults to empty subrange at [0,0).
478
	 * </p>
479
	 *
480
	 * @param startIndex character index of token start position (inclusive)
481
	 * @param endIndex character index of token end position (exclusive)
482
	 */
483
	public void setTokenRange(int startIndex, int endIndex) {
484
		if (startIndex < 0 || endIndex < startIndex) {
485
			throw new IllegalArgumentException();
486
		}
487
		this.tokenStart = startIndex;
488
		this.tokenEnd = endIndex;
489
	}
490
491
	/**
492
	 * Returns the proposed sequence of characters to insert into the
493
	 * source file buffer, replacing the characters at the specified
494
	 * source range. The string can be arbitrary; for example, it might
495
	 * include not only the name of a method but a set of parentheses.
496
	 * <p>
497
	 * The client must not modify the array returned.
498
	 * </p>
499
	 *
500
	 * @return the completion string
501
	 */
502
	public char[] getCompletion() {
503
		if(this.completionKind == METHOD_DECLARATION) {
504
			findParameterNames(null);
505
			if(this.updateCompletion) {
506
				this.updateCompletion = false;
507
508
				if(this.parameterNames != null) {
509
					int length = this.parameterNames.length;
510
					StringBuffer completionBuffer = new StringBuffer(this.completion.length);
511
512
					int start = 0;
513
					int end = CharOperation.indexOf('%', this.completion);
514
515
					completionBuffer.append(this.completion, start, end - start);
516
517
					for(int i = 0 ; i < length ; i++){
518
						completionBuffer.append(this.parameterNames[i]);
519
						start = end + 1;
520
						end = CharOperation.indexOf('%', this.completion, start);
521
						if(end > -1){
522
							completionBuffer.append(this.completion, start, end - start);
523
						} else {
524
							completionBuffer.append(this.completion, start, this.completion.length - start);
525
						}
526
					}
527
					int nameLength = completionBuffer.length();
528
					this.completion = new char[nameLength];
529
					completionBuffer.getChars(0, nameLength, this.completion, 0);
530
				}
531
			}
532
		}
533
		return this.completion;
534
	}
535
536
	/**
537
	 * Sets the proposed sequence of characters to insert into the
538
	 * source file buffer, replacing the characters at the specified
539
	 * source range. The string can be arbitrary; for example, it might
540
	 * include not only the name of a method but a set of parentheses.
541
	 * <p>
542
	 * If not set, defaults to an empty character array.
543
	 * </p>
544
	 * <p>
545
	 * The completion engine creates instances of this class and sets
546
	 * its properties; this method is not intended to be used by other clients.
547
	 * </p>
548
	 *
549
	 * @param completion the completion string
550
	 */
551
	public void setCompletion(char[] completion) {
552
		this.completion = completion;
553
	}
554
555
	/**
556
	 * Returns the character index of the start of the
557
	 * subrange in the source file buffer to be replaced
558
	 * by the completion string. If the subrange is empty
559
	 * (<code>getReplaceEnd() == getReplaceStart()</code>),
560
	 * the completion string is to be inserted at this
561
	 * index.
562
	 * <p>
563
	 * Note that while the token subrange is precisely
564
	 * specified, the replacement range is loosely
565
	 * constrained and may not bear any direct relation
566
	 * to the original request offset. For example,
567
	 * it would be possible for a type completion to
568
	 * propose inserting an import declaration at the
569
	 * top of the compilation unit; or the completion
570
	 * might include trailing parentheses and
571
	 * punctuation for a method completion.
572
	 * </p>
573
	 *
574
	 * @return replacement start position (inclusive)
575
	 */
576
	public int getReplaceStart() {
577
		return this.replaceStart;
578
	}
579
580
	/**
581
	 * Returns the character index of the end of the
582
	 * subrange in the source file buffer to be replaced
583
	 * by the completion string. If the subrange is empty
584
	 * (<code>getReplaceEnd() == getReplaceStart()</code>),
585
	 * the completion string is to be inserted at this
586
	 * index.
587
	 *
588
	 * @return replacement end position (exclusive)
589
	 */
590
	public int getReplaceEnd() {
591
		return this.replaceEnd;
592
	}
593
594
	/**
595
	 * Sets the character indices of the subrange in the
596
	 * source file buffer to be replaced by the completion
597
	 * string. If the subrange is empty
598
	 * (<code>startIndex == endIndex</code>),
599
	 * the completion string is to be inserted at this
600
	 * index.
601
	 * <p>
602
	 * If not set, defaults to empty subrange at [0,0).
603
	 * </p>
604
	 * <p>
605
	 * The completion engine creates instances of this class and sets
606
	 * its properties; this method is not intended to be used by other clients.
607
	 * </p>
608
	 *
609
	 * @param startIndex character index of replacement start position (inclusive)
610
	 * @param endIndex character index of replacement end position (exclusive)
611
	 */
612
	public void setReplaceRange(int startIndex, int endIndex) {
613
		if (startIndex < 0 || endIndex < startIndex) {
614
			throw new IllegalArgumentException();
615
		}
616
		this.replaceStart = startIndex;
617
		this.replaceEnd = endIndex;
618
	}
619
620
	/**
621
	 * Returns the relative relevance rating of this proposal.
622
	 *
623
	 * @return relevance rating of this proposal; ratings are positive; higher means better
624
	 */
625
	public int getRelevance() {
626
		return this.relevance;
627
	}
628
629
	/**
630
	 * Sets the relative relevance rating of this proposal.
631
	 * <p>
632
	 * If not set, defaults to the lowest possible rating (1).
633
	 * </p>
634
	 * <p>
635
	 * The completion engine creates instances of this class and sets
636
	 * its properties; this method is not intended to be used by other clients.
637
	 * </p>
638
	 *
639
	 * @param rating relevance rating of this proposal; ratings are positive; higher means better
640
	 */
641
	public void setRelevance(int rating) {
642
		if (rating <= 0) {
643
			throw new IllegalArgumentException();
644
		}
645
		this.relevance = rating;
646
	}
647
648
	/**
649
	 * Returns the type signature or package name of the relevant
650
	 * declaration in the context, or <code>null</code> if none.
651
	 * <p>
652
	 * This field is available for the following kinds of
653
	 * completion proposals:
654
	 * <ul>
655
	 *  <li><code>ANNOTATION_ATTRIBUT_REF</code> - type signature
656
	 * of the annotation that declares the attribute that is referenced</li>
657
	 * <li><code>ANONYMOUS_CLASS_DECLARATION</code> - type signature
658
	 * of the type that is being subclassed or implemented</li>
659
	 * 	<li><code>FIELD_IMPORT</code> - type signature
660
	 * of the type that declares the field that is imported</li>
661
	 *  <li><code>FIELD_REF</code> - type signature
662
	 * of the type that declares the field that is referenced</li>
663
	 *  <li><code>FIELD_REF_WITH_CASTED_RECEIVER</code> - type signature
664
	 * of the type that declares the field that is referenced</li>
665
	 * 	<li><code>METHOD_IMPORT</code> - type signature
666
	 * of the type that declares the method that is imported</li>
667
	 *  <li><code>METHOD_REF</code> - type signature
668
	 * of the type that declares the method that is referenced</li>
669
	 *  <li><code>METHOD_REF_WITH_CASTED_RECEIVER</code> - type signature
670
	 * of the type that declares the method that is referenced</li>
671
	 * 	<li><code>METHOD_DECLARATION</code> - type signature
672
	 * of the type that declares the method that is being
673
	 * implemented or overridden</li>
674
	 * 	<li><code>PACKAGE_REF</code> - dot-based package
675
	 * name of the package that is referenced</li>
676
	 * 	<li><code>TYPE_IMPORT</code> - dot-based package
677
	 * name of the package containing the type that is imported</li>
678
	 *  <li><code>TYPE_REF</code> - dot-based package
679
	 * name of the package containing the type that is referenced</li>
680
	 *  <li><code>POTENTIAL_METHOD_DECLARATION</code> - type signature
681
	 * of the type that declares the method that is being created</li>
682
	 * </ul>
683
	 * For kinds of completion proposals, this method returns
684
	 * <code>null</code>. Clients must not modify the array
685
	 * returned.
686
	 * </p>
687
	 *
688
	 * @return a type signature or a package name (depending
689
	 * on the kind of completion), or <code>null</code> if none
690
	 * @see Signature
691
	 */
692
	public char[] getDeclarationSignature() {
693
		return this.declarationSignature;
694
	}
695
696
	/**
697
	 * Returns the key of the relevant
698
	 * declaration in the context, or <code>null</code> if none.
699
	 * <p>
700
	 * This field is available for the following kinds of
701
	 * completion proposals:
702
	 * <ul>
703
	 * <li><code>ANONYMOUS_CLASS_DECLARATION</code> - key
704
	 * of the type that is being subclassed or implemented</li>
705
	 * 	<li><code>METHOD_DECLARATION</code> - key
706
	 * of the type that declares the method that is being
707
	 * implemented or overridden</li>
708
	 * </ul>
709
	 * For kinds of completion proposals, this method returns
710
	 * <code>null</code>. Clients must not modify the array
711
	 * returned.
712
	 * </p>
713
	 *
714
	 * @return a key, or <code>null</code> if none
715
	 * @see org.eclipse.jdt.core.dom.ASTParser#createASTs(ICompilationUnit[], String[], org.eclipse.jdt.core.dom.ASTRequestor, IProgressMonitor)
716
     * @since 3.1
717
	 */
718
	public char[] getDeclarationKey() {
719
		return this.declarationKey;
720
	}
721
722
	/**
723
	 * Sets the type or package signature of the relevant
724
	 * declaration in the context, or <code>null</code> if none.
725
	 * <p>
726
	 * If not set, defaults to none.
727
	 * </p>
728
	 * <p>
729
	 * The completion engine creates instances of this class and sets
730
	 * its properties; this method is not intended to be used by other clients.
731
	 * </p>
732
	 *
733
	 * @param signature the type or package signature, or
734
	 * <code>null</code> if none
735
	 */
736
	public void setDeclarationSignature(char[] signature) {
737
		this.declarationSignature = signature;
738
	}
739
740
	/**
741
	 * Sets the type or package key of the relevant
742
	 * declaration in the context, or <code>null</code> if none.
743
	 * <p>
744
	 * If not set, defaults to none.
745
	 * </p>
746
	 * <p>
747
	 * The completion engine creates instances of this class and sets
748
	 * its properties; this method is not intended to be used by other clients.
749
	 * </p>
750
	 *
751
	 * @param key the type or package key, or
752
	 * <code>null</code> if none
753
     * @since 3.1
754
	 */
755
	public void setDeclarationKey(char[] key) {
756
		this.declarationKey = key;
757
	}
758
759
	/**
760
	 * Returns the simple name of the method, field,
761
	 * member, or variable relevant in the context, or
762
	 * <code>null</code> if none.
763
	 * <p>
764
	 * This field is available for the following kinds of
765
	 * completion proposals:
766
	 * <ul>
767
	 *  <li><code>ANNOTATION_ATTRIBUT_REF</code> - the name of the attribute</li>
768
	 * 	<li><code>FIELD_IMPORT</code> - the name of the field</li>
769
	 *  <li><code>FIELD_REF</code> - the name of the field</li>
770
	 *  <li><code>FIELD_REF_WITH_CASTED_RECEIVER</code> - the name of the field</li>
771
	 * 	<li><code>KEYWORD</code> - the keyword</li>
772
	 * 	<li><code>LABEL_REF</code> - the name of the label</li>
773
	 * 	<li><code>LOCAL_VARIABLE_REF</code> - the name of the local variable</li>
774
	 * 	<li><code>METHOD_IMPORT</code> - the name of the method</li>
775
	 *  <li><code>METHOD_REF</code> - the name of the method (the type simple name for constructor)</li>
776
	 *  <li><code>METHOD_REF_WITH_CASTED_RECEIVER</code> - the name of the method</li>
777
	 * 	<li><code>METHOD_DECLARATION</code> - the name of the method (the type simple name for constructor)</li>
778
	 * 	<li><code>VARIABLE_DECLARATION</code> - the name of the variable</li>
779
	 *  <li><code>POTENTIAL_METHOD_DECLARATION</code> - the name of the method</li>
780
	 * </ul>
781
	 * For kinds of completion proposals, this method returns
782
	 * <code>null</code>. Clients must not modify the array
783
	 * returned.
784
	 * </p>
785
	 *
786
	 * @return the keyword, field, method, local variable, or member
787
	 * name, or <code>null</code> if none
788
	 */
789
	public char[] getName() {
790
		return this.name;
791
	}
792
793
794
	/**
795
	 * Sets the simple name of the method (type simple name for constructor), field,
796
	 * member, or variable relevant in the context, or
797
	 * <code>null</code> if none.
798
	 * <p>
799
	 * If not set, defaults to none.
800
	 * </p>
801
	 * <p>
802
	 * The completion engine creates instances of this class and sets
803
	 * its properties; this method is not intended to be used by other clients.
804
	 * </p>
805
	 *
806
	 * @param name the keyword, field, method, local variable,
807
	 * or member name, or <code>null</code> if none
808
	 */
809
	public void setName(char[] name) {
810
		this.name = name;
811
	}
812
813
	/**
814
	 * Returns the signature of the method or type
815
	 * relevant in the context, or <code>null</code> if none.
816
	 * <p>
817
	 * This field is available for the following kinds of
818
	 * completion proposals:
819
	 * <ul>
820
	 * <li><code>ANNOTATION_ATTRIBUT_REF</code> - the type signature
821
	 * of the referenced attribute's type</li>
822
	 * <li><code>ANONYMOUS_CLASS_DECLARATION</code> - method signature
823
	 * of the constructor that is being invoked</li>
824
	 * 	<li><code>FIELD_IMPORT</code> - the type signature
825
	 * of the referenced field's type</li>
826
	 *  <li><code>FIELD_REF</code> - the type signature
827
	 * of the referenced field's type</li>
828
	 *  <li><code>FIELD_REF_WITH_CASTED_RECEIVER</code> - the type signature
829
	 * of the referenced field's type</li>
830
	 * 	<li><code>LOCAL_VARIABLE_REF</code> - the type signature
831
	 * of the referenced local variable's type</li>
832
	 * 	<li><code>METHOD_IMPORT</code> - method signature
833
	 * of the method that is imported</li>
834
	 *  <li><code>METHOD_REF</code> - method signature
835
	 * of the method that is referenced</li>
836
	 *  <li><code>METHOD_REF_WITH_CASTED_RECEIVER</code> - method signature
837
	 * of the method that is referenced</li>
838
	 * 	<li><code>METHOD_DECLARATION</code> - method signature
839
	 * of the method that is being implemented or overridden</li>
840
	 * 	<li><code>TYPE_IMPORT</code> - type signature
841
	 * of the type that is imported</li>
842
	 * 	<li><code>TYPE_REF</code> - type signature
843
	 * of the type that is referenced</li>
844
	 * 	<li><code>VARIABLE_DECLARATION</code> - the type signature
845
	 * of the type of the variable being declared</li>
846
	 *  <li><code>POTENTIAL_METHOD_DECLARATION</code> - method signature
847
	 * of the method that is being created</li>
848
	 * </ul>
849
	 * For kinds of completion proposals, this method returns
850
	 * <code>null</code>. Clients must not modify the array
851
	 * returned.
852
	 * </p>
853
	 *
854
	 * @return the signature, or <code>null</code> if none
855
	 * @see Signature
856
	 */
857
	public char[] getSignature() {
858
		return this.signature;
859
	}
860
861
	/**
862
	 * Returns the key relevant in the context,
863
	 * or <code>null</code> if none.
864
	 * <p>
865
	 * This field is available for the following kinds of
866
	 * completion proposals:
867
	 * <ul>
868
	 * <li><code>ANONYMOUS_CLASS_DECLARATION</code> - method key
869
	 * of the constructor that is being invoked, or <code>null</code> if
870
	 * the declaring type is an interface</li>
871
	 * 	<li><code>METHOD_DECLARATION</code> - method key
872
	 * of the method that is being implemented or overridden</li>
873
	 * </ul>
874
	 * For kinds of completion proposals, this method returns
875
	 * <code>null</code>. Clients must not modify the array
876
	 * returned.
877
	 * </p>
878
	 *
879
	 * @return the key, or <code>null</code> if none
880
	 * @see org.eclipse.jdt.core.dom.ASTParser#createASTs(ICompilationUnit[], String[], org.eclipse.jdt.core.dom.ASTRequestor, IProgressMonitor)
881
     * @since 3.1
882
	 */
883
	public char[] getKey() {
884
		return this.key;
885
	}
886
887
//	/**
888
//	 * Returns the package name of the relevant
889
//	 * declaration in the context, or <code>null</code> if none.
890
//	 * <p>
891
//	 * This field is available for the following kinds of
892
//	 * completion proposals:
893
//	 * <ul>
894
//	 * <li><code>ANONYMOUS_CLASS_DECLARATION</code> - the dot-based package name
895
//	 * of the type that is being subclassed or implemented</li>
896
//	 * 	<li><code>FIELD_REF</code> - the dot-based package name
897
//	 * of the type that declares the field that is referenced</li>
898
//	 * 	<li><code>METHOD_REF</code> - the dot-based package name
899
//	 * of the type that declares the method that is referenced</li>
900
//	 * 	<li><code>METHOD_DECLARATION</code> - the dot-based package name
901
//	 * of the type that declares the method that is being
902
//	 * implemented or overridden</li>
903
//	 * </ul>
904
//	 * For kinds of completion proposals, this method returns
905
//	 * <code>null</code>. Clients must not modify the array
906
//	 * returned.
907
//	 * </p>
908
//	 *
909
//	 * @return the dot-based package name, or
910
//	 * <code>null</code> if none
911
//	 * @see #getDeclarationSignature()
912
//	 * @see #getSignature()
913
//	 *
914
//	 * @since 3.1
915
//	 */
916
//	public char[] getDeclarationPackageName() {
917
//		return this.declarationPackageName;
918
//	}
919
//
920
//	/**
921
//	 * Returns the type name of the relevant
922
//	 * declaration in the context without the package fragment,
923
//	 * or <code>null</code> if none.
924
//	 * <p>
925
//	 * This field is available for the following kinds of
926
//	 * completion proposals:
927
//	 * <ul>
928
//	 * <li><code>ANONYMOUS_CLASS_DECLARATION</code> - the dot-based type name
929
//	 * of the type that is being subclassed or implemented</li>
930
//	 * 	<li><code>FIELD_REF</code> - the dot-based type name
931
//	 * of the type that declares the field that is referenced
932
//	 * or an anonymous type instantiation ("new X(){}") if it is an anonymous type</li>
933
//	 * 	<li><code>METHOD_REF</code> - the dot-based type name
934
//	 * of the type that declares the method that is referenced
935
//	 * or an anonymous type instantiation ("new X(){}") if it is an anonymous type</li>
936
//	 * 	<li><code>METHOD_DECLARATION</code> - the dot-based type name
937
//	 * of the type that declares the method that is being
938
//	 * implemented or overridden</li>
939
//	 * </ul>
940
//	 * For kinds of completion proposals, this method returns
941
//	 * <code>null</code>. Clients must not modify the array
942
//	 * returned.
943
//	 * </p>
944
//	 *
945
//	 * @return the dot-based package name, or
946
//	 * <code>null</code> if none
947
//	 * @see #getDeclarationSignature()
948
//	 * @see #getSignature()
949
//	 *
950
//	 * @since 3.1
951
//	 */
952
//	public char[] getDeclarationTypeName() {
953
//		return this.declarationTypeName;
954
//	}
955
//
956
//	/**
957
//	 * Returns the package name of the method or type
958
//	 * relevant in the context, or <code>null</code> if none.
959
//	 * <p>
960
//	 * This field is available for the following kinds of
961
//	 * completion proposals:
962
//	 * <ul>
963
//	 * 	<li><code>FIELD_REF</code> - the dot-based package name
964
//	 * of the referenced field's type</li>
965
//	 * 	<li><code>LOCAL_VARIABLE_REF</code> - the dot-based package name
966
//	 * of the referenced local variable's type</li>
967
//	 * 	<li><code>METHOD_REF</code> -  the dot-based package name
968
//	 * of the return type of the method that is referenced</li>
969
//	 * 	<li><code>METHOD_DECLARATION</code> - the dot-based package name
970
//	 * of the return type of the method that is being implemented
971
//	 * or overridden</li>
972
//	 * 	<li><code>PACKAGE_REF</code> - the dot-based package name
973
//	 * of the package that is referenced</li>
974
//	 * 	<li><code>TYPE_REF</code> - the dot-based package name
975
//	 * of the type that is referenced</li>
976
//	 * 	<li><code>VARIABLE_DECLARATION</code> - the dot-based package name
977
//	 * of the type of the variable being declared</li>
978
//	 * </ul>
979
//	 * For kinds of completion proposals, this method returns
980
//	 * <code>null</code>. Clients must not modify the array
981
//	 * returned.
982
//	 * </p>
983
//	 *
984
//	 * @return the package name, or <code>null</code> if none
985
//	 *
986
//	 * @see #getDeclarationSignature()
987
//	 * @see #getSignature()
988
//	 *
989
//	 * @since 3.1
990
//	 */
991
//	public char[] getPackageName() {
992
//		return this.packageName;
993
//	}
994
//
995
//	/**
996
//	 * Returns the type name without the package fragment of the method or type
997
//	 * relevant in the context, or <code>null</code> if none.
998
//	 * <p>
999
//	 * This field is available for the following kinds of
1000
//	 * completion proposals:
1001
//	 * <ul>
1002
//	 * 	<li><code>FIELD_REF</code> - the dot-based type name
1003
//	 * of the referenced field's type</li>
1004
//	 * 	<li><code>LOCAL_VARIABLE_REF</code> - the dot-based type name
1005
//	 * of the referenced local variable's type</li>
1006
//	 * 	<li><code>METHOD_REF</code> -  the dot-based type name
1007
//	 * of the return type of the method that is referenced</li>
1008
//	 * 	<li><code>METHOD_DECLARATION</code> - the dot-based type name
1009
//	 * of the return type of the method that is being implemented
1010
//	 * or overridden</li>
1011
//	 * 	<li><code>TYPE_REF</code> - the dot-based type name
1012
//	 * of the type that is referenced</li>
1013
//	 * 	<li><code>VARIABLE_DECLARATION</code> - the dot-based package name
1014
//	 * of the type of the variable being declared</li>
1015
//	 * </ul>
1016
//	 * For kinds of completion proposals, this method returns
1017
//	 * <code>null</code>. Clients must not modify the array
1018
//	 * returned.
1019
//	 * </p>
1020
//	 *
1021
//	 * @return the package name, or <code>null</code> if none
1022
//	 *
1023
//	 * @see #getDeclarationSignature()
1024
//	 * @see #getSignature()
1025
//	 *
1026
//	 * @since 3.1
1027
//	 */
1028
//	public char[] getTypeName() {
1029
//		return this.typeName;
1030
//	}
1031
//
1032
//	/**
1033
//	 * Returns the parameter package names of the method
1034
//	 * relevant in the context, or <code>null</code> if none.
1035
//	 * <p>
1036
//	 * This field is available for the following kinds of
1037
//	 * completion proposals:
1038
//	 * <ul>
1039
//	 * 	<li><code>ANONYMOUS_CLASS_DECLARATION</code> - parameter package names
1040
//	 * of the constructor that is being invoked</li>
1041
//	 * 	<li><code>METHOD_REF</code> - parameter package names
1042
//	 * of the method that is referenced</li>
1043
//	 * 	<li><code>METHOD_DECLARATION</code> - parameter package names
1044
//	 * of the method that is being implemented or overridden</li>
1045
//	 * </ul>
1046
//	 * For kinds of completion proposals, this method returns
1047
//	 * <code>null</code>. Clients must not modify the array
1048
//	 * returned.
1049
//	 * </p>
1050
//	 *
1051
//	 * @return the package name, or <code>null</code> if none
1052
//	 *
1053
//	 * @see #getDeclarationSignature()
1054
//	 * @see #getSignature()
1055
//	 *
1056
//	 * @since 3.1
1057
//	 */
1058
//	public char[][] getParameterPackageNames() {
1059
//		return this.parameterPackageNames;
1060
//	}
1061
//
1062
//	/**
1063
//	 * Returns the parameter type names without the package fragment of
1064
//	 * the method relevant in the context, or <code>null</code> if none.
1065
//	 * <p>
1066
//	 * This field is available for the following kinds of
1067
//	 * completion proposals:
1068
//	 * <ul>
1069
//	 * 	<li><code>ANONYMOUS_CLASS_DECLARATION</code> - parameter type names
1070
//	 * of the constructor that is being invoked</li>
1071
//	 * 	<li><code>METHOD_REF</code> - parameter type names
1072
//	 * of the method that is referenced</li>
1073
//	 * 	<li><code>METHOD_DECLARATION</code> - parameter type names
1074
//	 * of the method that is being implemented or overridden</li>
1075
//	 * </ul>
1076
//	 * For kinds of completion proposals, this method returns
1077
//	 * <code>null</code>. Clients must not modify the array
1078
//	 * returned.
1079
//	 * </p>
1080
//	 *
1081
//	 * @return the package name, or <code>null</code> if none
1082
//	 *
1083
//	 * @see #getDeclarationSignature()
1084
//	 * @see #getSignature()
1085
//	 *
1086
//	 * @since 3.1
1087
//	 */
1088
//	public char[][] getParameterTypeNames() {
1089
//		return this.parameterTypeNames;
1090
//	}
1091
1092
	/**
1093
	 * Sets the signature of the method, field type, member type,
1094
	 * relevant in the context, or <code>null</code> if none.
1095
	 * <p>
1096
	 * If not set, defaults to none.
1097
	 * </p>
1098
	 * <p>
1099
	 * The completion engine creates instances of this class and sets
1100
	 * its properties; this method is not intended to be used by other clients.
1101
	 * </p>
1102
	 *
1103
	 * @param signature the signature, or <code>null</code> if none
1104
	 */
1105
	public void setSignature(char[] signature) {
1106
		this.signature = signature;
1107
	}
1108
1109
	/**
1110
	 * Sets the key of the method, field type, member type,
1111
	 * relevant in the context, or <code>null</code> if none.
1112
	 * <p>
1113
	 * If not set, defaults to none.
1114
	 * </p>
1115
	 * <p>
1116
	 * The completion engine creates instances of this class and sets
1117
	 * its properties; this method is not intended to be used by other clients.
1118
	 * </p>
1119
	 *
1120
	 * @param key the key, or <code>null</code> if none
1121
     * @since 3.1
1122
	 */
1123
	public void setKey(char[] key) {
1124
		this.key = key;
1125
	}
1126
1127
	/**
1128
	 * Returns the modifier flags relevant in the context, or
1129
	 * <code>Flags.AccDefault</code> if none.
1130
	 * <p>
1131
	 * This field is available for the following kinds of
1132
	 * completion proposals:
1133
	 * <ul>
1134
	 * <li><code>ANNOTATION_ATTRIBUT_REF</code> - modifier flags
1135
	 * of the attribute that is referenced;
1136
	 * <li><code>ANONYMOUS_CLASS_DECLARATION</code> - modifier flags
1137
	 * of the constructor that is referenced</li>
1138
	 * 	<li><code>FIELD_IMPORT</code> - modifier flags
1139
	 * of the field that is imported.</li>
1140
	 *  <li><code>FIELD_REF</code> - modifier flags
1141
	 * of the field that is referenced;
1142
	 * <code>Flags.AccEnum</code> can be used to recognize
1143
	 * references to enum constants
1144
	 * </li>
1145
	 *  <li><code>FIELD_REF_WITH_CASTED_RECEIVER</code> - modifier flags
1146
	 * of the field that is referenced.
1147
	 * </li>
1148
	 * 	<li><code>KEYWORD</code> - modifier flag
1149
	 * corresponding to the modifier keyword</li>
1150
	 * 	<li><code>LOCAL_VARIABLE_REF</code> - modifier flags
1151
	 * of the local variable that is referenced</li>
1152
	 *  <li><code>METHOD_IMPORT</code> - modifier flags
1153
	 * of the method that is imported;
1154
	 *  </li>
1155
	 * 	<li><code>METHOD_REF</code> - modifier flags
1156
	 * of the method that is referenced;
1157
	 * <code>Flags.AccAnnotation</code> can be used to recognize
1158
	 * references to annotation type members
1159
	 * </li>
1160
	 * <li><code>METHOD_REF_WITH_CASTED_RECEIVER</code> - modifier flags
1161
	 * of the method that is referenced.
1162
	 * </li>
1163
	 * <li><code>METHOD_DECLARATION</code> - modifier flags
1164
	 * for the method that is being implemented or overridden</li>
1165
	 * <li><code>TYPE_IMPORT</code> - modifier flags
1166
	 * of the type that is imported; <code>Flags.AccInterface</code>
1167
	 * can be used to recognize references to interfaces,
1168
	 * <code>Flags.AccEnum</code> enum types,
1169
	 * and <code>Flags.AccAnnotation</code> annotation types</li>
1170
	 * <li><code>TYPE_REF</code> - modifier flags
1171
	 * of the type that is referenced; <code>Flags.AccInterface</code>
1172
	 * can be used to recognize references to interfaces,
1173
	 * <code>Flags.AccEnum</code> enum types,
1174
	 * and <code>Flags.AccAnnotation</code> annotation types
1175
	 * </li>
1176
	 * 	<li><code>VARIABLE_DECLARATION</code> - modifier flags
1177
	 * for the variable being declared</li>
1178
	 * 	<li><code>POTENTIAL_METHOD_DECLARATION</code> - modifier flags
1179
	 * for the method that is being created</li>
1180
	 * </ul>
1181
	 * For other kinds of completion proposals, this method returns
1182
	 * <code>Flags.AccDefault</code>.
1183
	 * </p>
1184
	 *
1185
	 * @return the modifier flags, or
1186
	 * <code>Flags.AccDefault</code> if none
1187
	 * @see Flags
1188
	 */
1189
	public int getFlags() {
1190
		return this.flags;
1191
	}
1192
1193
	/**
1194
	 * Sets the modifier flags relevant in the context.
1195
	 * <p>
1196
	 * If not set, defaults to none.
1197
	 * </p>
1198
	 * <p>
1199
	 * The completion engine creates instances of this class and sets
1200
	 * its properties; this method is not intended to be used by other clients.
1201
	 * </p>
1202
	 *
1203
	 * @param flags the modifier flags, or
1204
	 * <code>Flags.AccDefault</code> if none
1205
	 */
1206
	public void setFlags(int flags) {
1207
		this.flags = flags;
1208
	}
1209
1210
	/**
1211
	 * Returns the required completion proposals.
1212
	 * The proposal can be apply only if these required completion proposals are also applied.
1213
	 * If the required proposal aren't applied the completion could create completion problems.
1214
	 *
1215
	 * <p>
1216
	 * This field is available for the following kinds of
1217
	 * completion proposals:
1218
	 * <ul>
1219
	 * 	<li><code>FIELD_REF</code> - The allowed required proposals for this kind are:
1220
	 *   <ul>
1221
	 *    <li><code>TYPE_REF</code></li>
1222
	 *    <li><code>TYPE_IMPORT</code></li>
1223
	 *    <li><code>FIELD_IMPORT</code></li>
1224
	 *   </ul>
1225
	 * </li>
1226
	 * 	<li><code>METHOD_REF</code> - The allowed required proposals for this kind are:
1227
	 *   <ul>
1228
	 *    <li><code>TYPE_REF</code></li>
1229
	 *    <li><code>TYPE_IMPORT</code></li>
1230
	 *    <li><code>METHOD_IMPORT</code></li>
1231
	 *   </ul>
1232
	 *  </li>
1233
	 * </li>
1234
	 * 	<li><code>TYPE_REF</code> - The allowed required proposals for this kind are:
1235
	 *   <ul>
1236
	 *    <li><code>TYPE_REF</code></li>
1237
	 *   </ul>
1238
	 *  </li>
1239
	 * </ul>
1240
	 * </p>
1241
	 * <p>
1242
	 * Other kinds of required proposals will be returned in the future, therefore clients of this
1243
	 * API must allow with {@link CompletionRequestor#setAllowsRequiredProposals(int, int, boolean)}
1244
	 * only kinds which are in this list to avoid unexpected results in the future.
1245
	 * </p>
1246
	 * <p>
1247
	 * A required proposal of a given kind is proposed even if {@link CompletionRequestor#isIgnored(int)}
1248
	 * return <code>true</code> for that kind.
1249
	 * </p>
1250
	 * <p>
1251
	 * A required completion proposal cannot have required completion proposals.
1252
	 * </p>
1253
	 *
1254
	 * @return the required completion proposals, or <code>null</code> if none.
1255
	 *
1256
	 * @see CompletionRequestor#setAllowsRequiredProposals(int, int,boolean)
1257
	 *
1258
	 * @since 3.3
1259
	 */
1260
	public CompletionProposal[] getRequiredProposals() {
1261
		return this.requiredProposals;
1262
	}
1263
1264
1265
	/**
1266
	 * Sets the list of required completion proposals, or <code>null</code> if none.
1267
	 * <p>
1268
	 * If not set, defaults to none.
1269
	 * </p>
1270
	 * <p>
1271
	 * The completion engine creates instances of this class and sets
1272
	 * its properties; this method is not intended to be used by other clients.
1273
	 * </p>
1274
	 *
1275
	 * @param proposals the list of required completion proposals, or
1276
	 * <code>null</code> if none
1277
     * @since 3.3
1278
	 */
1279
	public void setRequiredProposals(CompletionProposal[] proposals) {
1280
		this.requiredProposals = proposals;
1281
	}
1282
1283
	/**
1284
	 * Finds the method parameter names.
1285
	 * This information is relevant to method reference (and
1286
	 * method declaration proposals). Returns <code>null</code>
1287
	 * if not available or not relevant.
1288
	 * <p>
1289
	 * The client must not modify the array returned.
1290
	 * </p>
1291
	 * <p>
1292
	 * <b>Note that this is an expensive thing to compute, which may require
1293
	 * parsing Java source files, etc. Use sparingly.</b>
1294
	 * </p>
1295
	 *
1296
	 * @param monitor the progress monitor, or <code>null</code> if none
1297
	 * @return the parameter names, or <code>null</code> if none
1298
	 * or not available or not relevant
1299
	 */
1300
	public char[][] findParameterNames(IProgressMonitor monitor) {
1301
		if (!this.parameterNamesComputed) {
1302
			this.parameterNamesComputed = true;
1303
1304
			switch(this.completionKind) {
1305
				case ANONYMOUS_CLASS_DECLARATION:
1306
					try {
1307
						this.parameterNames = findMethodParameterNames(
1308
								this.declarationPackageName,
1309
								this.declarationTypeName,
1310
								CharOperation.lastSegment(this.declarationTypeName, '.'),
1311
								Signature.getParameterTypes(this.originalSignature == null ? this.signature : this.originalSignature));
1312
					} catch(IllegalArgumentException e) {
1313
						// protection for invalid signature
1314
						if(this.parameterTypeNames != null) {
1315
							this.parameterNames =  createDefaultParameterNames(this.parameterTypeNames.length);
1316
						} else {
1317
							this.parameterNames = null;
1318
						}
1319
					}
1320
					break;
1321
				case METHOD_REF:
1322
				case METHOD_REF_WITH_CASTED_RECEIVER:
1323
					try {
1324
						this.parameterNames = findMethodParameterNames(
1325
								this.declarationPackageName,
1326
								this.declarationTypeName,
1327
								this.name,
1328
								Signature.getParameterTypes(this.originalSignature == null ? this.signature : this.originalSignature));
1329
					} catch(IllegalArgumentException e) {
1330
						// protection for invalid signature
1331
						if(this.parameterTypeNames != null) {
1332
							this.parameterNames =  createDefaultParameterNames(this.parameterTypeNames.length);
1333
						} else {
1334
							this.parameterNames = null;
1335
						}
1336
					}
1337
					break;
1338
				case METHOD_DECLARATION:
1339
					try {
1340
						this.parameterNames = findMethodParameterNames(
1341
								this.declarationPackageName,
1342
								this.declarationTypeName,
1343
								this.name,
1344
								Signature.getParameterTypes(this.originalSignature == null ? this.signature : this.originalSignature));
1345
					} catch(IllegalArgumentException e) {
1346
						// protection for invalid signature
1347
						if(this.parameterTypeNames != null) {
1348
							this.parameterNames =  createDefaultParameterNames(this.parameterTypeNames.length);
1349
						} else {
1350
							this.parameterNames = null;
1351
						}
1352
					}
1353
					if(this.parameterNames != null) {
1354
						this.updateCompletion = true;
1355
					}
1356
					break;
1357
			}
1358
		}
1359
		return this.parameterNames;
1360
	}
1361
1362
	/**
1363
	 * Sets the method parameter names.
1364
	 * This information is relevant to method reference (and
1365
	 * method declaration proposals).
1366
	 * <p>
1367
	 * The completion engine creates instances of this class and sets
1368
	 * its properties; this method is not intended to be used by other clients.
1369
	 * </p>
1370
	 *
1371
	 * @param parameterNames the parameter names, or <code>null</code> if none
1372
	 */
1373
	public void setParameterNames(char[][] parameterNames) {
1374
		this.parameterNames = parameterNames;
1375
		this.parameterNamesComputed = true;
1376
	}
1377
1378
	/**
1379
	 * Returns the accessibility of the proposal.
1380
	 * <p>
1381
	 * This field is available for the following kinds of
1382
	 * completion proposals:
1383
	 * <ul>
1384
	 * 	<li><code>TYPE_REF</code> - accessibility of the type</li>
1385
	 * </ul>
1386
	 * For these kinds of completion proposals, this method returns
1387
	 * {@link IAccessRule#K_ACCESSIBLE} or {@link IAccessRule#K_DISCOURAGED}
1388
	 * or {@link IAccessRule#K_NON_ACCESSIBLE}.
1389
	 * By default this method return {@link IAccessRule#K_ACCESSIBLE}.
1390
	 * </p>
1391
	 *
1392
	 * @see IAccessRule
1393
	 *
1394
	 * @return the accessibility of the proposal
1395
	 *
1396
	 * @since 3.1
1397
	 */
1398
	public int getAccessibility() {
1399
		return this.accessibility;
1400
	}
1401
1402
	/**
1403
	 * Returns whether this proposal is a constructor.
1404
	 * <p>
1405
	 * This field is available for the following kinds of
1406
	 * completion proposals:
1407
	 * <ul>
1408
	 * <li><code>METHOD_REF</code> - return <code>true</code>
1409
	 * if the referenced method is a constructor</li>
1410
	 * 	<li><code>METHOD_DECLARATION</code> - return <code>true</code>
1411
	 * if the declared method is a constructor</li>
1412
	 * </ul>
1413
	 * For kinds of completion proposals, this method returns
1414
	 * <code>false</code>.
1415
	 * </p>
1416
	 *
1417
	 * @return <code>true</code> if the proposal is a constructor.
1418
	 * @since 3.1
1419
	 */
1420
	public boolean isConstructor() {
1421
		return this.isConstructor;
1422
	}
1423
1424
	private int receiverStart;
1425
	private int receiverEnd;
1426
	private char[] receiverSignature;
1427
1428
	/**
1429
	 * Returns the type signature or package name of the relevant
1430
	 * receiver in the context, or <code>null</code> if none.
1431
	 * <p>
1432
	 * This field is available for the following kinds of
1433
	 * completion proposals:
1434
	 * <ul>
1435
	 *  <li><code>FIELD_REF_WITH_CASTED_RECEIVER</code> - type signature
1436
	 * of the type that cast the receiver of the field that is referenced</li>
1437
	 *  <li><code>METHOD_REF_WITH_CASTED_RECEIVER</code> - type signature
1438
	 * of the type that cast the receiver of the method that is referenced</li>
1439
	 * </ul>
1440
	 * For kinds of completion proposals, this method returns
1441
	 * <code>null</code>. Clients must not modify the array
1442
	 * returned.
1443
	 * </p>
1444
	 *
1445
	 * @return a type signature or a package name (depending
1446
	 * on the kind of completion), or <code>null</code> if none
1447
	 * @see Signature
1448
	 *
1449
	 * @since 3.4
1450
	 */
1451
	public char[] getReceiverSignature() {
1452
		return this.receiverSignature;
1453
	}
1454
1455
	/**
1456
	 * Returns the character index of the start of the
1457
	 * subrange in the source file buffer containing the
1458
	 * relevant receiver of the member being completed. This
1459
	 * receiver is an expression.
1460
	 *
1461
	 * <p>
1462
	 * This field is available for the following kinds of
1463
	 * completion proposals:
1464
	 * <ul>
1465
	 *  <li><code>FIELD_REF_WITH_CASTED_RECEIVER</code></li>
1466
	 *  <li><code>METHOD_REF_WITH_CASTED_RECEIVER</code></li>
1467
	 * </ul>
1468
	 * For kinds of completion proposals, this method returns <code>0</code>.
1469
	 * </p>
1470
	 *
1471
	 * @return character index of receiver start position (inclusive)
1472
	 *
1473
	 * @since 3.4
1474
	 */
1475
	public int getReceiverStart() {
1476
		return this.receiverStart;
1477
	}
1478
1479
	/**
1480
	 * Returns the character index of the end (exclusive) of the subrange
1481
	 * in the source file buffer containing the
1482
	 * relevant receiver of the member being completed.
1483
	 *
1484
	 * * <p>
1485
	 * This field is available for the following kinds of
1486
	 * completion proposals:
1487
	 * <ul>
1488
	 *  <li><code>FIELD_REF_WITH_CASTED_RECEIVER</code></li>
1489
	 *  <li><code>METHOD_REF_WITH_CASTED_RECEIVER</code></li>
1490
	 * </ul>
1491
	 * For kinds of completion proposals, this method returns <code>0</code>.
1492
	 * </p>
1493
	 *
1494
	 * @return character index of receiver end position (exclusive)
1495
	 *
1496
	 * @since 3.4
1497
	 */
1498
	public int getReceiverEnd() {
1499
		return this.receiverEnd;
1500
	}
1501
1502
	/**
1503
	 * Sets the type or package signature of the relevant
1504
	 * receiver in the context, or <code>null</code> if none.
1505
	 * <p>
1506
	 * If not set, defaults to none.
1507
	 * </p>
1508
	 * <p>
1509
	 * The completion engine creates instances of this class and sets
1510
	 * its properties; this method is not intended to be used by other clients.
1511
	 * </p>
1512
	 *
1513
	 * @param signature the type or package signature, or
1514
	 * <code>null</code> if none
1515
	 *
1516
	 * @since 3.4
1517
	 */
1518
	public void setReceiverSignature(char[] signature) {
1519
		this.receiverSignature = signature;
1520
	}
1521
1522
	/**
1523
	 * Sets the character indices of the subrange in the
1524
	 * source file buffer containing the relevant receiver
1525
	 * of the member being completed.
1526
	 *
1527
	 * <p>
1528
	 * If not set, defaults to empty subrange at [0,0).
1529
	 * </p>
1530
	 *
1531
	 * @param startIndex character index of receiver start position (inclusive)
1532
	 * @param endIndex character index of receiver end position (exclusive)
1533
	 *
1534
	 * @since 3.4
1535
	 */
1536
	public void setReceiverRange(int startIndex, int endIndex) {
1537
		this.receiverStart = startIndex;
1538
		this.receiverEnd = endIndex;
1539
	}
1540
1541
	public String toString() {
1542
		StringBuffer buffer = new StringBuffer();
1543
		buffer.append('[');
1544
		switch(this.completionKind) {
1545
			case CompletionProposal.ANONYMOUS_CLASS_DECLARATION :
1546
				buffer.append("ANONYMOUS_CLASS_DECLARATION"); //$NON-NLS-1$
1547
				break;
1548
			case CompletionProposal.FIELD_REF :
1549
				buffer.append("FIELD_REF"); //$NON-NLS-1$
1550
				break;
1551
			case CompletionProposal.KEYWORD :
1552
				buffer.append("KEYWORD"); //$NON-NLS-1$
1553
				break;
1554
			case CompletionProposal.LABEL_REF :
1555
				buffer.append("LABEL_REF"); //$NON-NLS-1$
1556
				break;
1557
			case CompletionProposal.LOCAL_VARIABLE_REF :
1558
				buffer.append("LOCAL_VARIABLE_REF"); //$NON-NLS-1$
1559
				break;
1560
			case CompletionProposal.METHOD_DECLARATION :
1561
				buffer.append("METHOD_DECLARATION"); //$NON-NLS-1$
1562
				if(this.isConstructor) {
1563
					buffer.append("<CONSTRUCTOR>"); //$NON-NLS-1$
1564
				}
1565
				break;
1566
			case CompletionProposal.METHOD_REF :
1567
				buffer.append("METHOD_REF"); //$NON-NLS-1$
1568
				if(this.isConstructor) {
1569
					buffer.append("<CONSTRUCTOR>"); //$NON-NLS-1$
1570
				}
1571
				break;
1572
			case CompletionProposal.PACKAGE_REF :
1573
				buffer.append("PACKAGE_REF"); //$NON-NLS-1$
1574
				break;
1575
			case CompletionProposal.TYPE_REF :
1576
				buffer.append("TYPE_REF"); //$NON-NLS-1$
1577
				break;
1578
			case CompletionProposal.VARIABLE_DECLARATION :
1579
				buffer.append("VARIABLE_DECLARATION"); //$NON-NLS-1$
1580
				break;
1581
			case CompletionProposal.POTENTIAL_METHOD_DECLARATION :
1582
				buffer.append("POTENTIAL_METHOD_DECLARATION"); //$NON-NLS-1$
1583
				break;
1584
			case CompletionProposal.METHOD_NAME_REFERENCE :
1585
				buffer.append("METHOD_IMPORT"); //$NON-NLS-1$
1586
				break;
1587
			case CompletionProposal.ANNOTATION_ATTRIBUTE_REF :
1588
				buffer.append("ANNOTATION_ATTRIBUTE_REF"); //$NON-NLS-1$
1589
				break;
1590
			case CompletionProposal.JAVADOC_BLOCK_TAG :
1591
				buffer.append("JAVADOC_BLOCK_TAG"); //$NON-NLS-1$
1592
				break;
1593
			case CompletionProposal.JAVADOC_INLINE_TAG :
1594
				buffer.append("JAVADOC_INLINE_TAG"); //$NON-NLS-1$
1595
				break;
1596
			case CompletionProposal.JAVADOC_FIELD_REF:
1597
				buffer.append("JAVADOC_FIELD_REF"); //$NON-NLS-1$
1598
				break;
1599
			case CompletionProposal.JAVADOC_METHOD_REF :
1600
				buffer.append("JAVADOC_METHOD_REF"); //$NON-NLS-1$
1601
				break;
1602
			case CompletionProposal.JAVADOC_TYPE_REF :
1603
				buffer.append("JAVADOC_TYPE_REF"); //$NON-NLS-1$
1604
				break;
1605
			case CompletionProposal.JAVADOC_PARAM_REF :
1606
				buffer.append("JAVADOC_PARAM_REF"); //$NON-NLS-1$
1607
				break;
1608
			case CompletionProposal.JAVADOC_VALUE_REF :
1609
				buffer.append("JAVADOC_VALUE_REF"); //$NON-NLS-1$
1610
				break;
1611
			case CompletionProposal.FIELD_IMPORT :
1612
				buffer.append("FIELD_IMPORT"); //$NON-NLS-1$
1613
				break;
1614
			case CompletionProposal.METHOD_IMPORT :
1615
				buffer.append("METHOD_IMPORT"); //$NON-NLS-1$
1616
				break;
1617
			case CompletionProposal.TYPE_IMPORT :
1618
				buffer.append("TYPE_IMPORT"); //$NON-NLS-1$
1619
				break;
1620
			case CompletionProposal.METHOD_REF_WITH_CASTED_RECEIVER :
1621
				buffer.append("METHOD_REF_WITH_CASTED_RECEIVER"); //$NON-NLS-1$
1622
				break;
1623
			case CompletionProposal.FIELD_REF_WITH_CASTED_RECEIVER :
1624
				buffer.append("FIELD_REF_WITH_CASTED_RECEIVER"); //$NON-NLS-1$
1625
				break;
1626
			default :
1627
				buffer.append("PROPOSAL"); //$NON-NLS-1$
1628
				break;
1629
1630
		}
1631
		buffer.append("]{completion:"); //$NON-NLS-1$
1632
		if (this.completion != null) buffer.append(this.completion);
1633
		buffer.append(", declSign:"); //$NON-NLS-1$
1634
		if (this.declarationSignature != null) buffer.append(this.declarationSignature);
1635
		buffer.append(", sign:"); //$NON-NLS-1$
1636
		if (this.signature != null) buffer.append(this.signature);
1637
		buffer.append(", declKey:"); //$NON-NLS-1$
1638
		if (this.declarationKey != null) buffer.append(this.declarationKey);
1639
		buffer.append(", key:"); //$NON-NLS-1$
1640
		if (this.key != null) buffer.append(this.key);
1641
		buffer.append(", name:"); //$NON-NLS-1$
1642
		if (this.name != null) buffer.append(this.name);
1643
		buffer.append(", replace:["); //$NON-NLS-1$
1644
		buffer.append(this.replaceStart);
1645
		buffer.append(',');
1646
		buffer.append(this.replaceEnd);
1647
		buffer.append("], token:["); //$NON-NLS-1$
1648
		buffer.append(this.tokenStart);
1649
		buffer.append(',');
1650
		buffer.append(this.tokenEnd);
1651
		buffer.append("], relevance:"); //$NON-NLS-1$
1652
		buffer.append(this.relevance);
1653
		buffer.append('}');
1654
		return buffer.toString();
1655
	}
196
}
1656
}
(-)codeassist/org/eclipse/jdt/internal/codeassist/CompletionRequestorWrapper.java (-181 / +182 lines)
Lines 31-285 Link Here
31
	}
31
	}
32
32
33
	public void accept(CompletionProposal proposal) {
33
	public void accept(CompletionProposal proposal) {
34
		switch(proposal.getKind()) {
34
		InternalCompletionProposal internalCompletionProposal = (InternalCompletionProposal) proposal;
35
		switch(internalCompletionProposal.getKind()) {
35
			case CompletionProposal.KEYWORD:
36
			case CompletionProposal.KEYWORD:
36
				this.requestor.acceptKeyword(
37
				this.requestor.acceptKeyword(
37
						proposal.getName(),
38
						internalCompletionProposal.getName(),
38
						proposal.getReplaceStart(),
39
						internalCompletionProposal.getReplaceStart(),
39
						proposal.getReplaceEnd(),
40
						internalCompletionProposal.getReplaceEnd(),
40
						proposal.getRelevance());
41
						internalCompletionProposal.getRelevance());
41
				break;
42
				break;
42
			case CompletionProposal.PACKAGE_REF:
43
			case CompletionProposal.PACKAGE_REF:
43
				if(DECODE_SIGNATURE) {
44
				if(DECODE_SIGNATURE) {
44
					this.requestor.acceptPackage(
45
					this.requestor.acceptPackage(
45
							proposal.getDeclarationSignature(),
46
							internalCompletionProposal.getDeclarationSignature(),
46
							proposal.getCompletion(),
47
							internalCompletionProposal.getCompletion(),
47
							proposal.getReplaceStart(),
48
							internalCompletionProposal.getReplaceStart(),
48
							proposal.getReplaceEnd(),
49
							internalCompletionProposal.getReplaceEnd(),
49
							proposal.getRelevance());
50
							internalCompletionProposal.getRelevance());
50
				} else {
51
				} else {
51
					this.requestor.acceptPackage(
52
					this.requestor.acceptPackage(
52
							proposal.getPackageName(),
53
							internalCompletionProposal.getPackageName(),
53
							proposal.getCompletion(),
54
							internalCompletionProposal.getCompletion(),
54
							proposal.getReplaceStart(),
55
							internalCompletionProposal.getReplaceStart(),
55
							proposal.getReplaceEnd(),
56
							internalCompletionProposal.getReplaceEnd(),
56
							proposal.getRelevance());
57
							internalCompletionProposal.getRelevance());
57
				}
58
				}
58
				break;
59
				break;
59
			case CompletionProposal.TYPE_REF:
60
			case CompletionProposal.TYPE_REF:
60
				if((proposal.getFlags() & Flags.AccEnum) != 0) {
61
				if((internalCompletionProposal.getFlags() & Flags.AccEnum) != 0) {
61
					// does not exist for old requestor
62
					// does not exist for old requestor
62
				} else if((proposal.getFlags() & Flags.AccInterface) != 0) {
63
				} else if((internalCompletionProposal.getFlags() & Flags.AccInterface) != 0) {
63
					if(DECODE_SIGNATURE) {
64
					if(DECODE_SIGNATURE) {
64
						this.requestor.acceptInterface(
65
						this.requestor.acceptInterface(
65
								proposal.getDeclarationSignature(),
66
								internalCompletionProposal.getDeclarationSignature(),
66
								Signature.getSignatureSimpleName(proposal.getSignature()),
67
								Signature.getSignatureSimpleName(internalCompletionProposal.getSignature()),
67
								proposal.getCompletion(),
68
								internalCompletionProposal.getCompletion(),
68
								proposal.getFlags() & ~Flags.AccInterface,
69
								internalCompletionProposal.getFlags() & ~Flags.AccInterface,
69
								proposal.getReplaceStart(),
70
								internalCompletionProposal.getReplaceStart(),
70
								proposal.getReplaceEnd(),
71
								internalCompletionProposal.getReplaceEnd(),
71
								proposal.getRelevance());
72
								internalCompletionProposal.getRelevance());
72
					} else {
73
					} else {
73
						this.requestor.acceptInterface(
74
						this.requestor.acceptInterface(
74
								proposal.getPackageName() == null ? CharOperation.NO_CHAR : proposal.getPackageName(),
75
								internalCompletionProposal.getPackageName() == null ? CharOperation.NO_CHAR : internalCompletionProposal.getPackageName(),
75
								proposal.getTypeName(),
76
								internalCompletionProposal.getTypeName(),
76
								proposal.getCompletion(),
77
								internalCompletionProposal.getCompletion(),
77
								proposal.getFlags() & ~Flags.AccInterface,
78
								internalCompletionProposal.getFlags() & ~Flags.AccInterface,
78
								proposal.getReplaceStart(),
79
								internalCompletionProposal.getReplaceStart(),
79
								proposal.getReplaceEnd(),
80
								internalCompletionProposal.getReplaceEnd(),
80
								proposal.getRelevance());
81
								internalCompletionProposal.getRelevance());
81
					}
82
					}
82
				} else {
83
				} else {
83
					if(DECODE_SIGNATURE) {
84
					if(DECODE_SIGNATURE) {
84
						this.requestor.acceptClass(
85
						this.requestor.acceptClass(
85
								proposal.getDeclarationSignature(),
86
								internalCompletionProposal.getDeclarationSignature(),
86
								Signature.getSignatureSimpleName(proposal.getSignature()),
87
								Signature.getSignatureSimpleName(internalCompletionProposal.getSignature()),
87
								proposal.getCompletion(),
88
								internalCompletionProposal.getCompletion(),
88
								proposal.getFlags(),
89
								internalCompletionProposal.getFlags(),
89
								proposal.getReplaceStart(),
90
								internalCompletionProposal.getReplaceStart(),
90
								proposal.getReplaceEnd(),
91
								internalCompletionProposal.getReplaceEnd(),
91
								proposal.getRelevance());
92
								internalCompletionProposal.getRelevance());
92
					} else {
93
					} else {
93
						this.requestor.acceptClass(
94
						this.requestor.acceptClass(
94
								proposal.getPackageName() == null ? CharOperation.NO_CHAR : proposal.getPackageName(),
95
								internalCompletionProposal.getPackageName() == null ? CharOperation.NO_CHAR : internalCompletionProposal.getPackageName(),
95
								proposal.getTypeName(),
96
								internalCompletionProposal.getTypeName(),
96
								proposal.getCompletion(),
97
								internalCompletionProposal.getCompletion(),
97
								proposal.getFlags(),
98
								internalCompletionProposal.getFlags(),
98
								proposal.getReplaceStart(),
99
								internalCompletionProposal.getReplaceStart(),
99
								proposal.getReplaceEnd(),
100
								internalCompletionProposal.getReplaceEnd(),
100
								proposal.getRelevance());
101
								internalCompletionProposal.getRelevance());
101
					}
102
					}
102
				}
103
				}
103
				break;
104
				break;
104
			case CompletionProposal.FIELD_REF:
105
			case CompletionProposal.FIELD_REF:
105
				if(DECODE_SIGNATURE) {
106
				if(DECODE_SIGNATURE) {
106
					this.requestor.acceptField(
107
					this.requestor.acceptField(
107
							Signature.getSignatureQualifier(proposal.getDeclarationSignature()),
108
							Signature.getSignatureQualifier(internalCompletionProposal.getDeclarationSignature()),
108
							Signature.getSignatureSimpleName(proposal.getDeclarationSignature()),
109
							Signature.getSignatureSimpleName(internalCompletionProposal.getDeclarationSignature()),
109
							proposal.getName(),
110
							internalCompletionProposal.getName(),
110
							Signature.getSignatureQualifier(proposal.getSignature()),
111
							Signature.getSignatureQualifier(internalCompletionProposal.getSignature()),
111
							Signature.getSignatureSimpleName(proposal.getSignature()),
112
							Signature.getSignatureSimpleName(internalCompletionProposal.getSignature()),
112
							proposal.getCompletion(),
113
							internalCompletionProposal.getCompletion(),
113
							proposal.getFlags(),
114
							internalCompletionProposal.getFlags(),
114
							proposal.getReplaceStart(),
115
							internalCompletionProposal.getReplaceStart(),
115
							proposal.getReplaceEnd(),
116
							internalCompletionProposal.getReplaceEnd(),
116
							proposal.getRelevance()
117
							internalCompletionProposal.getRelevance()
117
					);
118
					);
118
				} else {
119
				} else {
119
					this.requestor.acceptField(
120
					this.requestor.acceptField(
120
							proposal.getDeclarationPackageName() == null ? CharOperation.NO_CHAR : proposal.getDeclarationPackageName(),
121
							internalCompletionProposal.getDeclarationPackageName() == null ? CharOperation.NO_CHAR : internalCompletionProposal.getDeclarationPackageName(),
121
							proposal.getDeclarationTypeName() == null ? CharOperation.NO_CHAR : proposal.getDeclarationTypeName(),
122
							internalCompletionProposal.getDeclarationTypeName() == null ? CharOperation.NO_CHAR : internalCompletionProposal.getDeclarationTypeName(),
122
							proposal.getName(),
123
							internalCompletionProposal.getName(),
123
							proposal.getPackageName() == null ? CharOperation.NO_CHAR : proposal.getPackageName(),
124
							internalCompletionProposal.getPackageName() == null ? CharOperation.NO_CHAR : internalCompletionProposal.getPackageName(),
124
							proposal.getTypeName() == null ? CharOperation.NO_CHAR : proposal.getTypeName(),
125
							internalCompletionProposal.getTypeName() == null ? CharOperation.NO_CHAR : internalCompletionProposal.getTypeName(),
125
							proposal.getCompletion(),
126
							internalCompletionProposal.getCompletion(),
126
							proposal.getFlags(),
127
							internalCompletionProposal.getFlags(),
127
							proposal.getReplaceStart(),
128
							internalCompletionProposal.getReplaceStart(),
128
							proposal.getReplaceEnd(),
129
							internalCompletionProposal.getReplaceEnd(),
129
							proposal.getRelevance()
130
							internalCompletionProposal.getRelevance()
130
					);
131
					);
131
				}
132
				}
132
				break;
133
				break;
133
			case CompletionProposal.METHOD_REF:
134
			case CompletionProposal.METHOD_REF:
134
				if(DECODE_SIGNATURE) {
135
				if(DECODE_SIGNATURE) {
135
					this.requestor.acceptMethod(
136
					this.requestor.acceptMethod(
136
							Signature.getSignatureQualifier(proposal.getDeclarationSignature()),
137
							Signature.getSignatureQualifier(internalCompletionProposal.getDeclarationSignature()),
137
							Signature.getSignatureSimpleName(proposal.getDeclarationSignature()),
138
							Signature.getSignatureSimpleName(internalCompletionProposal.getDeclarationSignature()),
138
							proposal.getName(),
139
							internalCompletionProposal.getName(),
139
							getParameterPackages(proposal.getSignature()),
140
							getParameterPackages(internalCompletionProposal.getSignature()),
140
							getParameterTypes(proposal.getSignature()),
141
							getParameterTypes(internalCompletionProposal.getSignature()),
141
							proposal.findParameterNames(null) == null ? CharOperation.NO_CHAR_CHAR : proposal.findParameterNames(null),
142
							internalCompletionProposal.findParameterNames(null) == null ? CharOperation.NO_CHAR_CHAR : internalCompletionProposal.findParameterNames(null),
142
							Signature.getSignatureQualifier(Signature.getReturnType(proposal.getSignature())),
143
							Signature.getSignatureQualifier(Signature.getReturnType(internalCompletionProposal.getSignature())),
143
							Signature.getSignatureSimpleName(Signature.getReturnType(proposal.getSignature())),
144
							Signature.getSignatureSimpleName(Signature.getReturnType(internalCompletionProposal.getSignature())),
144
							proposal.getCompletion(),
145
							internalCompletionProposal.getCompletion(),
145
							proposal.getFlags(),
146
							internalCompletionProposal.getFlags(),
146
							proposal.getReplaceStart(),
147
							internalCompletionProposal.getReplaceStart(),
147
							proposal.getReplaceEnd(),
148
							internalCompletionProposal.getReplaceEnd(),
148
							proposal.getRelevance()
149
							internalCompletionProposal.getRelevance()
149
						);
150
						);
150
				} else {
151
				} else {
151
					this.requestor.acceptMethod(
152
					this.requestor.acceptMethod(
152
							proposal.getDeclarationPackageName() == null ? CharOperation.NO_CHAR : proposal.getDeclarationPackageName(),
153
							internalCompletionProposal.getDeclarationPackageName() == null ? CharOperation.NO_CHAR : internalCompletionProposal.getDeclarationPackageName(),
153
							proposal.getDeclarationTypeName() == null ? CharOperation.NO_CHAR : proposal.getDeclarationTypeName(),
154
							internalCompletionProposal.getDeclarationTypeName() == null ? CharOperation.NO_CHAR : internalCompletionProposal.getDeclarationTypeName(),
154
							proposal.getName(),
155
							internalCompletionProposal.getName(),
155
							proposal.getParameterPackageNames() == null ? CharOperation.NO_CHAR_CHAR : proposal.getParameterPackageNames(),
156
							internalCompletionProposal.getParameterPackageNames() == null ? CharOperation.NO_CHAR_CHAR : internalCompletionProposal.getParameterPackageNames(),
156
							proposal.getParameterTypeNames() == null ? CharOperation.NO_CHAR_CHAR : proposal.getParameterTypeNames(),
157
							internalCompletionProposal.getParameterTypeNames() == null ? CharOperation.NO_CHAR_CHAR : internalCompletionProposal.getParameterTypeNames(),
157
							proposal.findParameterNames(null) == null ? CharOperation.NO_CHAR_CHAR : proposal.findParameterNames(null),
158
							internalCompletionProposal.findParameterNames(null) == null ? CharOperation.NO_CHAR_CHAR : internalCompletionProposal.findParameterNames(null),
158
							proposal.getPackageName() == null ? CharOperation.NO_CHAR : proposal.getPackageName(),
159
							internalCompletionProposal.getPackageName() == null ? CharOperation.NO_CHAR : internalCompletionProposal.getPackageName(),
159
							proposal.getTypeName() == null ? CharOperation.NO_CHAR : proposal.getTypeName(),
160
							internalCompletionProposal.getTypeName() == null ? CharOperation.NO_CHAR : internalCompletionProposal.getTypeName(),
160
							proposal.getCompletion(),
161
							internalCompletionProposal.getCompletion(),
161
							proposal.getFlags(),
162
							internalCompletionProposal.getFlags(),
162
							proposal.getReplaceStart(),
163
							internalCompletionProposal.getReplaceStart(),
163
							proposal.getReplaceEnd(),
164
							internalCompletionProposal.getReplaceEnd(),
164
							proposal.getRelevance()
165
							internalCompletionProposal.getRelevance()
165
					);
166
					);
166
				}
167
				}
167
				break;
168
				break;
168
			case CompletionProposal.METHOD_DECLARATION:
169
			case CompletionProposal.METHOD_DECLARATION:
169
				if(DECODE_SIGNATURE) {
170
				if(DECODE_SIGNATURE) {
170
					this.requestor.acceptMethodDeclaration(
171
					this.requestor.acceptMethodDeclaration(
171
							Signature.getSignatureQualifier(proposal.getDeclarationSignature()),
172
							Signature.getSignatureQualifier(internalCompletionProposal.getDeclarationSignature()),
172
							Signature.getSignatureSimpleName(proposal.getDeclarationSignature()),
173
							Signature.getSignatureSimpleName(internalCompletionProposal.getDeclarationSignature()),
173
							proposal.getName(),
174
							internalCompletionProposal.getName(),
174
							getParameterPackages(proposal.getSignature()),
175
							getParameterPackages(internalCompletionProposal.getSignature()),
175
							getParameterTypes(proposal.getSignature()),
176
							getParameterTypes(internalCompletionProposal.getSignature()),
176
							proposal.findParameterNames(null) == null ? CharOperation.NO_CHAR_CHAR : proposal.findParameterNames(null),
177
							internalCompletionProposal.findParameterNames(null) == null ? CharOperation.NO_CHAR_CHAR : internalCompletionProposal.findParameterNames(null),
177
							Signature.getSignatureQualifier(Signature.getReturnType(proposal.getSignature())),
178
							Signature.getSignatureQualifier(Signature.getReturnType(internalCompletionProposal.getSignature())),
178
							Signature.getSignatureSimpleName(Signature.getReturnType(proposal.getSignature())),
179
							Signature.getSignatureSimpleName(Signature.getReturnType(internalCompletionProposal.getSignature())),
179
							proposal.getCompletion(),
180
							internalCompletionProposal.getCompletion(),
180
							proposal.getFlags(),
181
							internalCompletionProposal.getFlags(),
181
							proposal.getReplaceStart(),
182
							internalCompletionProposal.getReplaceStart(),
182
							proposal.getReplaceEnd(),
183
							internalCompletionProposal.getReplaceEnd(),
183
							proposal.getRelevance()
184
							internalCompletionProposal.getRelevance()
184
					);
185
					);
185
				} else {
186
				} else {
186
					this.requestor.acceptMethodDeclaration(
187
					this.requestor.acceptMethodDeclaration(
187
							proposal.getDeclarationPackageName(),
188
							internalCompletionProposal.getDeclarationPackageName(),
188
							proposal.getDeclarationTypeName(),
189
							internalCompletionProposal.getDeclarationTypeName(),
189
							proposal.getName(),
190
							internalCompletionProposal.getName(),
190
							proposal.getParameterPackageNames() == null ? CharOperation.NO_CHAR_CHAR : proposal.getParameterPackageNames(),
191
							internalCompletionProposal.getParameterPackageNames() == null ? CharOperation.NO_CHAR_CHAR : internalCompletionProposal.getParameterPackageNames(),
191
							proposal.getParameterTypeNames() == null ? CharOperation.NO_CHAR_CHAR : proposal.getParameterTypeNames(),
192
							internalCompletionProposal.getParameterTypeNames() == null ? CharOperation.NO_CHAR_CHAR : internalCompletionProposal.getParameterTypeNames(),
192
							proposal.findParameterNames(null) == null ? CharOperation.NO_CHAR_CHAR : proposal.findParameterNames(null),
193
							internalCompletionProposal.findParameterNames(null) == null ? CharOperation.NO_CHAR_CHAR : internalCompletionProposal.findParameterNames(null),
193
							proposal.getPackageName(),
194
							internalCompletionProposal.getPackageName(),
194
							proposal.getTypeName(),
195
							internalCompletionProposal.getTypeName(),
195
							proposal.getCompletion(),
196
							internalCompletionProposal.getCompletion(),
196
							proposal.getFlags(),
197
							internalCompletionProposal.getFlags(),
197
							proposal.getReplaceStart(),
198
							internalCompletionProposal.getReplaceStart(),
198
							proposal.getReplaceEnd(),
199
							internalCompletionProposal.getReplaceEnd(),
199
							proposal.getRelevance()
200
							internalCompletionProposal.getRelevance()
200
					);
201
					);
201
				}
202
				}
202
				break;
203
				break;
203
			case CompletionProposal.ANONYMOUS_CLASS_DECLARATION:
204
			case CompletionProposal.ANONYMOUS_CLASS_DECLARATION:
204
				if(DECODE_SIGNATURE) {
205
				if(DECODE_SIGNATURE) {
205
					this.requestor.acceptAnonymousType(
206
					this.requestor.acceptAnonymousType(
206
							Signature.getSignatureQualifier(proposal.getDeclarationSignature()),
207
							Signature.getSignatureQualifier(internalCompletionProposal.getDeclarationSignature()),
207
							Signature.getSignatureSimpleName(proposal.getDeclarationSignature()),
208
							Signature.getSignatureSimpleName(internalCompletionProposal.getDeclarationSignature()),
208
							getParameterPackages(proposal.getSignature()),
209
							getParameterPackages(internalCompletionProposal.getSignature()),
209
							getParameterTypes(proposal.getSignature()),
210
							getParameterTypes(internalCompletionProposal.getSignature()),
210
							proposal.findParameterNames(null) == null ? CharOperation.NO_CHAR_CHAR : proposal.findParameterNames(null),
211
							internalCompletionProposal.findParameterNames(null) == null ? CharOperation.NO_CHAR_CHAR : internalCompletionProposal.findParameterNames(null),
211
							proposal.getCompletion(),
212
							internalCompletionProposal.getCompletion(),
212
							proposal.getFlags(),
213
							internalCompletionProposal.getFlags(),
213
							proposal.getReplaceStart(),
214
							internalCompletionProposal.getReplaceStart(),
214
							proposal.getReplaceEnd(),
215
							internalCompletionProposal.getReplaceEnd(),
215
							proposal.getRelevance()
216
							internalCompletionProposal.getRelevance()
216
						);
217
						);
217
				} else {
218
				} else {
218
					this.requestor.acceptAnonymousType(
219
					this.requestor.acceptAnonymousType(
219
						proposal.getDeclarationPackageName(),
220
						internalCompletionProposal.getDeclarationPackageName(),
220
						proposal.getDeclarationTypeName(),
221
						internalCompletionProposal.getDeclarationTypeName(),
221
						proposal.getParameterPackageNames() == null ? CharOperation.NO_CHAR_CHAR : proposal.getParameterPackageNames(),
222
						internalCompletionProposal.getParameterPackageNames() == null ? CharOperation.NO_CHAR_CHAR : internalCompletionProposal.getParameterPackageNames(),
222
						proposal.getParameterTypeNames() == null ? CharOperation.NO_CHAR_CHAR : proposal.getParameterTypeNames(),
223
						internalCompletionProposal.getParameterTypeNames() == null ? CharOperation.NO_CHAR_CHAR : internalCompletionProposal.getParameterTypeNames(),
223
						proposal.findParameterNames(null) == null ? CharOperation.NO_CHAR_CHAR : proposal.findParameterNames(null),
224
						internalCompletionProposal.findParameterNames(null) == null ? CharOperation.NO_CHAR_CHAR : internalCompletionProposal.findParameterNames(null),
224
						proposal.getCompletion(),
225
						internalCompletionProposal.getCompletion(),
225
						proposal.getFlags(),
226
						internalCompletionProposal.getFlags(),
226
						proposal.getReplaceStart(),
227
						internalCompletionProposal.getReplaceStart(),
227
						proposal.getReplaceEnd(),
228
						internalCompletionProposal.getReplaceEnd(),
228
						proposal.getRelevance()
229
						internalCompletionProposal.getRelevance()
229
					);
230
					);
230
				}
231
				}
231
				break;
232
				break;
232
			case CompletionProposal.LABEL_REF :
233
			case CompletionProposal.LABEL_REF :
233
				this.requestor.acceptLabel(
234
				this.requestor.acceptLabel(
234
					proposal.getCompletion(),
235
					internalCompletionProposal.getCompletion(),
235
					proposal.getReplaceStart(),
236
					internalCompletionProposal.getReplaceStart(),
236
					proposal.getReplaceEnd(),
237
					internalCompletionProposal.getReplaceEnd(),
237
					proposal.getRelevance()
238
					internalCompletionProposal.getRelevance()
238
				);
239
				);
239
				break;
240
				break;
240
			case CompletionProposal.LOCAL_VARIABLE_REF:
241
			case CompletionProposal.LOCAL_VARIABLE_REF:
241
				if(DECODE_SIGNATURE) {
242
				if(DECODE_SIGNATURE) {
242
					this.requestor.acceptLocalVariable(
243
					this.requestor.acceptLocalVariable(
243
							proposal.getCompletion(),
244
							internalCompletionProposal.getCompletion(),
244
							Signature.getSignatureQualifier(proposal.getSignature()),
245
							Signature.getSignatureQualifier(internalCompletionProposal.getSignature()),
245
							Signature.getSignatureSimpleName(proposal.getSignature()),
246
							Signature.getSignatureSimpleName(internalCompletionProposal.getSignature()),
246
							proposal.getFlags(),
247
							internalCompletionProposal.getFlags(),
247
							proposal.getReplaceStart(),
248
							internalCompletionProposal.getReplaceStart(),
248
							proposal.getReplaceEnd(),
249
							internalCompletionProposal.getReplaceEnd(),
249
							proposal.getRelevance()
250
							internalCompletionProposal.getRelevance()
250
					);
251
					);
251
				} else {
252
				} else {
252
					this.requestor.acceptLocalVariable(
253
					this.requestor.acceptLocalVariable(
253
							proposal.getCompletion(),
254
							internalCompletionProposal.getCompletion(),
254
							proposal.getPackageName() == null ? CharOperation.NO_CHAR : proposal.getPackageName(),
255
							internalCompletionProposal.getPackageName() == null ? CharOperation.NO_CHAR : internalCompletionProposal.getPackageName(),
255
							proposal.getTypeName(),
256
							internalCompletionProposal.getTypeName(),
256
							proposal.getFlags(),
257
							internalCompletionProposal.getFlags(),
257
							proposal.getReplaceStart(),
258
							internalCompletionProposal.getReplaceStart(),
258
							proposal.getReplaceEnd(),
259
							internalCompletionProposal.getReplaceEnd(),
259
							proposal.getRelevance()
260
							internalCompletionProposal.getRelevance()
260
					);
261
					);
261
				}
262
				}
262
				break;
263
				break;
263
			case CompletionProposal.VARIABLE_DECLARATION:
264
			case CompletionProposal.VARIABLE_DECLARATION:
264
				if(DECODE_SIGNATURE) {
265
				if(DECODE_SIGNATURE) {
265
					this.requestor.acceptLocalVariable(
266
					this.requestor.acceptLocalVariable(
266
							proposal.getCompletion(),
267
							internalCompletionProposal.getCompletion(),
267
							Signature.getSignatureQualifier(proposal.getSignature()),
268
							Signature.getSignatureQualifier(internalCompletionProposal.getSignature()),
268
							Signature.getSignatureSimpleName(proposal.getSignature()),
269
							Signature.getSignatureSimpleName(internalCompletionProposal.getSignature()),
269
							proposal.getFlags(),
270
							internalCompletionProposal.getFlags(),
270
							proposal.getReplaceStart(),
271
							internalCompletionProposal.getReplaceStart(),
271
							proposal.getReplaceEnd(),
272
							internalCompletionProposal.getReplaceEnd(),
272
							proposal.getRelevance()
273
							internalCompletionProposal.getRelevance()
273
						);
274
						);
274
				} else {
275
				} else {
275
					this.requestor.acceptLocalVariable(
276
					this.requestor.acceptLocalVariable(
276
						proposal.getCompletion(),
277
						internalCompletionProposal.getCompletion(),
277
						proposal.getPackageName(),
278
						internalCompletionProposal.getPackageName(),
278
						proposal.getTypeName(),
279
						internalCompletionProposal.getTypeName(),
279
						proposal.getFlags(),
280
						internalCompletionProposal.getFlags(),
280
						proposal.getReplaceStart(),
281
						internalCompletionProposal.getReplaceStart(),
281
						proposal.getReplaceEnd(),
282
						internalCompletionProposal.getReplaceEnd(),
282
						proposal.getRelevance()
283
						internalCompletionProposal.getRelevance()
283
					);
284
					);
284
				}
285
				}
285
				break;
286
				break;
Lines 288-308 Link Here
288
					IExtendedCompletionRequestor r = (IExtendedCompletionRequestor) this.requestor;
289
					IExtendedCompletionRequestor r = (IExtendedCompletionRequestor) this.requestor;
289
					if(DECODE_SIGNATURE) {
290
					if(DECODE_SIGNATURE) {
290
						r.acceptPotentialMethodDeclaration(
291
						r.acceptPotentialMethodDeclaration(
291
								Signature.getSignatureQualifier(proposal.getDeclarationSignature()),
292
								Signature.getSignatureQualifier(internalCompletionProposal.getDeclarationSignature()),
292
								Signature.getSignatureSimpleName(proposal.getDeclarationSignature()),
293
								Signature.getSignatureSimpleName(internalCompletionProposal.getDeclarationSignature()),
293
								proposal.getName(),
294
								internalCompletionProposal.getName(),
294
								proposal.getReplaceStart(),
295
								internalCompletionProposal.getReplaceStart(),
295
								proposal.getReplaceEnd(),
296
								internalCompletionProposal.getReplaceEnd(),
296
								proposal.getRelevance()
297
								internalCompletionProposal.getRelevance()
297
						);
298
						);
298
					} else {
299
					} else {
299
						r.acceptPotentialMethodDeclaration(
300
						r.acceptPotentialMethodDeclaration(
300
								proposal.getDeclarationPackageName(),
301
								internalCompletionProposal.getDeclarationPackageName(),
301
								proposal.getDeclarationTypeName(),
302
								internalCompletionProposal.getDeclarationTypeName(),
302
								proposal.getName(),
303
								internalCompletionProposal.getName(),
303
								proposal.getReplaceStart(),
304
								internalCompletionProposal.getReplaceStart(),
304
								proposal.getReplaceEnd(),
305
								internalCompletionProposal.getReplaceEnd(),
305
								proposal.getRelevance()
306
								internalCompletionProposal.getRelevance()
306
						);
307
						);
307
					}
308
					}
308
				}
309
				}
(-)codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java (-58 / +58 lines)
Lines 693-699 Link Here
693
		relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); // no access restriction for local variable
693
		relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); // no access restriction for local variable
694
		CompletionEngine.this.noProposal = false;
694
		CompletionEngine.this.noProposal = false;
695
		if(!CompletionEngine.this.requestor.isIgnored(CompletionProposal.LOCAL_VARIABLE_REF)) {
695
		if(!CompletionEngine.this.requestor.isIgnored(CompletionProposal.LOCAL_VARIABLE_REF)) {
696
			CompletionProposal proposal = CompletionEngine.this.createProposal(CompletionProposal.LOCAL_VARIABLE_REF, CompletionEngine.this.actualCompletionPosition);
696
			InternalCompletionProposal proposal = CompletionEngine.this.createProposal(CompletionProposal.LOCAL_VARIABLE_REF, CompletionEngine.this.actualCompletionPosition);
697
			proposal.setSignature(JAVA_LANG_OBJECT_SIGNATURE);
697
			proposal.setSignature(JAVA_LANG_OBJECT_SIGNATURE);
698
			proposal.setPackageName(JAVA_LANG_NAME);
698
			proposal.setPackageName(JAVA_LANG_NAME);
699
			proposal.setTypeName(OBJECT);
699
			proposal.setTypeName(OBJECT);
Lines 848-854 Link Here
848
848
849
		this.noProposal = false;
849
		this.noProposal = false;
850
		if(!this.requestor.isIgnored(CompletionProposal.PACKAGE_REF)) {
850
		if(!this.requestor.isIgnored(CompletionProposal.PACKAGE_REF)) {
851
			CompletionProposal proposal = createProposal(CompletionProposal.PACKAGE_REF, this.actualCompletionPosition);
851
			InternalCompletionProposal proposal = createProposal(CompletionProposal.PACKAGE_REF, this.actualCompletionPosition);
852
			proposal.setDeclarationSignature(packageName);
852
			proposal.setDeclarationSignature(packageName);
853
			proposal.setPackageName(packageName);
853
			proposal.setPackageName(packageName);
854
			proposal.setCompletion(completion);
854
			proposal.setCompletion(completion);
Lines 2726-2732 Link Here
2726
2726
2727
			this.noProposal = false;
2727
			this.noProposal = false;
2728
			if(!this.requestor.isIgnored(CompletionProposal.ANONYMOUS_CLASS_DECLARATION)) {
2728
			if(!this.requestor.isIgnored(CompletionProposal.ANONYMOUS_CLASS_DECLARATION)) {
2729
				CompletionProposal proposal = createProposal(CompletionProposal.ANONYMOUS_CLASS_DECLARATION, this.actualCompletionPosition);
2729
				InternalCompletionProposal proposal = createProposal(CompletionProposal.ANONYMOUS_CLASS_DECLARATION, this.actualCompletionPosition);
2730
				proposal.setDeclarationSignature(getSignature(currentType));
2730
				proposal.setDeclarationSignature(getSignature(currentType));
2731
				proposal.setDeclarationKey(currentType.computeUniqueKey());
2731
				proposal.setDeclarationKey(currentType.computeUniqueKey());
2732
				proposal.setSignature(
2732
				proposal.setSignature(
Lines 2791-2797 Link Here
2791
2791
2792
			this.noProposal = false;
2792
			this.noProposal = false;
2793
			if(!isIgnored(CompletionProposal.FIELD_REF, missingElements != null)) {
2793
			if(!isIgnored(CompletionProposal.FIELD_REF, missingElements != null)) {
2794
				CompletionProposal proposal = createProposal(CompletionProposal.FIELD_REF, this.actualCompletionPosition);
2794
				InternalCompletionProposal proposal = createProposal(CompletionProposal.FIELD_REF, this.actualCompletionPosition);
2795
				//proposal.setDeclarationSignature(null);
2795
				//proposal.setDeclarationSignature(null);
2796
				char[] signature =
2796
				char[] signature =
2797
					createNonGenericTypeSignature(
2797
					createNonGenericTypeSignature(
Lines 2884-2890 Link Here
2884
				char[] completion = fieldName;
2884
				char[] completion = fieldName;
2885
2885
2886
				if(!this.requestor.isIgnored(CompletionProposal.FIELD_REF)) {
2886
				if(!this.requestor.isIgnored(CompletionProposal.FIELD_REF)) {
2887
					CompletionProposal proposal = createProposal(CompletionProposal.FIELD_REF, this.actualCompletionPosition);
2887
					InternalCompletionProposal proposal = createProposal(CompletionProposal.FIELD_REF, this.actualCompletionPosition);
2888
					proposal.setDeclarationSignature(getSignature(field.declaringClass));
2888
					proposal.setDeclarationSignature(getSignature(field.declaringClass));
2889
					proposal.setSignature(getSignature(field.type));
2889
					proposal.setSignature(getSignature(field.type));
2890
					proposal.setDeclarationPackageName(field.declaringClass.qualifiedPackageName());
2890
					proposal.setDeclarationPackageName(field.declaringClass.qualifiedPackageName());
Lines 2911-2917 Link Here
2911
2911
2912
				if (!needImport) {
2912
				if (!needImport) {
2913
					if(!this.requestor.isIgnored(CompletionProposal.FIELD_REF)) {
2913
					if(!this.requestor.isIgnored(CompletionProposal.FIELD_REF)) {
2914
						CompletionProposal proposal = createProposal(CompletionProposal.FIELD_REF, this.actualCompletionPosition);
2914
						InternalCompletionProposal proposal = createProposal(CompletionProposal.FIELD_REF, this.actualCompletionPosition);
2915
						proposal.setDeclarationSignature(getSignature(field.declaringClass));
2915
						proposal.setDeclarationSignature(getSignature(field.declaringClass));
2916
						proposal.setSignature(getSignature(field.type));
2916
						proposal.setSignature(getSignature(field.type));
2917
						proposal.setDeclarationPackageName(field.declaringClass.qualifiedPackageName());
2917
						proposal.setDeclarationPackageName(field.declaringClass.qualifiedPackageName());
Lines 2937-2943 Link Here
2937
2937
2938
						ReferenceBinding fieldType = (ReferenceBinding)field.type;
2938
						ReferenceBinding fieldType = (ReferenceBinding)field.type;
2939
2939
2940
						CompletionProposal proposal = createProposal(CompletionProposal.FIELD_REF, this.actualCompletionPosition);
2940
						InternalCompletionProposal proposal = createProposal(CompletionProposal.FIELD_REF, this.actualCompletionPosition);
2941
						proposal.setDeclarationSignature(getSignature(field.declaringClass));
2941
						proposal.setDeclarationSignature(getSignature(field.declaringClass));
2942
						proposal.setSignature(getSignature(field.type));
2942
						proposal.setSignature(getSignature(field.type));
2943
						proposal.setDeclarationPackageName(field.declaringClass.qualifiedPackageName());
2943
						proposal.setDeclarationPackageName(field.declaringClass.qualifiedPackageName());
Lines 2953-2959 Link Here
2953
2953
2954
						char[] typeImportCompletion = createImportCharArray(CharOperation.concatWith(fieldType.compoundName, '.'), false, false);
2954
						char[] typeImportCompletion = createImportCharArray(CharOperation.concatWith(fieldType.compoundName, '.'), false, false);
2955
2955
2956
						CompletionProposal typeImportProposal = createProposal(CompletionProposal.TYPE_IMPORT, this.actualCompletionPosition);
2956
						InternalCompletionProposal typeImportProposal = createProposal(CompletionProposal.TYPE_IMPORT, this.actualCompletionPosition);
2957
						typeImportProposal.nameLookup = this.nameEnvironment.nameLookup;
2957
						typeImportProposal.nameLookup = this.nameEnvironment.nameLookup;
2958
						typeImportProposal.completionEngine = this;
2958
						typeImportProposal.completionEngine = this;
2959
						char[] packageName = fieldType.qualifiedPackageName();
2959
						char[] packageName = fieldType.qualifiedPackageName();
Lines 3280-3286 Link Here
3280
3280
3281
					this.noProposal = false;
3281
					this.noProposal = false;
3282
					if(!this.requestor.isIgnored(CompletionProposal.METHOD_REF)) {
3282
					if(!this.requestor.isIgnored(CompletionProposal.METHOD_REF)) {
3283
						CompletionProposal proposal = createProposal(CompletionProposal.METHOD_REF, this.actualCompletionPosition);
3283
						InternalCompletionProposal proposal =  createProposal(CompletionProposal.METHOD_REF, this.actualCompletionPosition);
3284
						proposal.setDeclarationSignature(getSignature(currentType));
3284
						proposal.setDeclarationSignature(getSignature(currentType));
3285
						proposal.setSignature(getSignature(constructor));
3285
						proposal.setSignature(getSignature(constructor));
3286
						MethodBinding original = constructor.original();
3286
						MethodBinding original = constructor.original();
Lines 3366-3372 Link Here
3366
3366
3367
						this.noProposal = false;
3367
						this.noProposal = false;
3368
						if(!this.requestor.isIgnored(CompletionProposal.ANONYMOUS_CLASS_DECLARATION)) {
3368
						if(!this.requestor.isIgnored(CompletionProposal.ANONYMOUS_CLASS_DECLARATION)) {
3369
							CompletionProposal proposal = createProposal(CompletionProposal.ANONYMOUS_CLASS_DECLARATION, this.actualCompletionPosition);
3369
							InternalCompletionProposal proposal = createProposal(CompletionProposal.ANONYMOUS_CLASS_DECLARATION, this.actualCompletionPosition);
3370
							proposal.setDeclarationSignature(getSignature(currentType));
3370
							proposal.setDeclarationSignature(getSignature(currentType));
3371
							proposal.setDeclarationKey(currentType.computeUniqueKey());
3371
							proposal.setDeclarationKey(currentType.computeUniqueKey());
3372
							proposal.setSignature(getSignature(constructor));
3372
							proposal.setSignature(getSignature(constructor));
Lines 3454-3460 Link Here
3454
						// Create standard proposal
3454
						// Create standard proposal
3455
						this.noProposal = false;
3455
						this.noProposal = false;
3456
						if(!this.requestor.isIgnored(CompletionProposal.METHOD_REF) && (this.assistNodeInJavadoc & CompletionOnJavadoc.ONLY_INLINE_TAG) == 0) {
3456
						if(!this.requestor.isIgnored(CompletionProposal.METHOD_REF) && (this.assistNodeInJavadoc & CompletionOnJavadoc.ONLY_INLINE_TAG) == 0) {
3457
							CompletionProposal proposal = createProposal(CompletionProposal.METHOD_REF, this.actualCompletionPosition);
3457
							InternalCompletionProposal proposal =  createProposal(CompletionProposal.METHOD_REF, this.actualCompletionPosition);
3458
							proposal.setDeclarationSignature(getSignature(currentType));
3458
							proposal.setDeclarationSignature(getSignature(currentType));
3459
							proposal.setSignature(getSignature(constructor));
3459
							proposal.setSignature(getSignature(constructor));
3460
							MethodBinding original = constructor.original();
3460
							MethodBinding original = constructor.original();
Lines 3483-3489 Link Here
3483
						}
3483
						}
3484
						if ((this.assistNodeInJavadoc & CompletionOnJavadoc.TEXT) != 0 && !this.requestor.isIgnored(CompletionProposal.JAVADOC_METHOD_REF)) {
3484
						if ((this.assistNodeInJavadoc & CompletionOnJavadoc.TEXT) != 0 && !this.requestor.isIgnored(CompletionProposal.JAVADOC_METHOD_REF)) {
3485
							char[] javadocCompletion = inlineTagCompletion(completion, JavadocTagConstants.TAG_LINK);
3485
							char[] javadocCompletion = inlineTagCompletion(completion, JavadocTagConstants.TAG_LINK);
3486
							CompletionProposal proposal = createProposal(CompletionProposal.JAVADOC_METHOD_REF, this.actualCompletionPosition);
3486
							InternalCompletionProposal proposal =  createProposal(CompletionProposal.JAVADOC_METHOD_REF, this.actualCompletionPosition);
3487
							proposal.setDeclarationSignature(getSignature(currentType));
3487
							proposal.setDeclarationSignature(getSignature(currentType));
3488
							proposal.setSignature(getSignature(constructor));
3488
							proposal.setSignature(getSignature(constructor));
3489
							MethodBinding original = constructor.original();
3489
							MethodBinding original = constructor.original();
Lines 3716-3722 Link Here
3716
			if (castedReceiver == null) {
3716
			if (castedReceiver == null) {
3717
				// Standard proposal
3717
				// Standard proposal
3718
				if (!this.isIgnored(CompletionProposal.FIELD_REF, missingElements != null) && (this.assistNodeInJavadoc & CompletionOnJavadoc.ONLY_INLINE_TAG) == 0) {
3718
				if (!this.isIgnored(CompletionProposal.FIELD_REF, missingElements != null) && (this.assistNodeInJavadoc & CompletionOnJavadoc.ONLY_INLINE_TAG) == 0) {
3719
					CompletionProposal proposal = createProposal(CompletionProposal.FIELD_REF, this.actualCompletionPosition);
3719
					InternalCompletionProposal proposal =  createProposal(CompletionProposal.FIELD_REF, this.actualCompletionPosition);
3720
					proposal.setDeclarationSignature(getSignature(field.declaringClass));
3720
					proposal.setDeclarationSignature(getSignature(field.declaringClass));
3721
					proposal.setSignature(getSignature(field.type));
3721
					proposal.setSignature(getSignature(field.type));
3722
					proposal.setDeclarationPackageName(field.declaringClass.qualifiedPackageName());
3722
					proposal.setDeclarationPackageName(field.declaringClass.qualifiedPackageName());
Lines 3750-3756 Link Here
3750
				// Javadoc completions
3750
				// Javadoc completions
3751
				if ((this.assistNodeInJavadoc & CompletionOnJavadoc.TEXT) != 0 && !this.requestor.isIgnored(CompletionProposal.JAVADOC_FIELD_REF)) {
3751
				if ((this.assistNodeInJavadoc & CompletionOnJavadoc.TEXT) != 0 && !this.requestor.isIgnored(CompletionProposal.JAVADOC_FIELD_REF)) {
3752
					char[] javadocCompletion = inlineTagCompletion(completion, JavadocTagConstants.TAG_LINK);
3752
					char[] javadocCompletion = inlineTagCompletion(completion, JavadocTagConstants.TAG_LINK);
3753
					CompletionProposal proposal = createProposal(CompletionProposal.JAVADOC_FIELD_REF, this.actualCompletionPosition);
3753
					InternalCompletionProposal proposal =  createProposal(CompletionProposal.JAVADOC_FIELD_REF, this.actualCompletionPosition);
3754
					proposal.setDeclarationSignature(getSignature(field.declaringClass));
3754
					proposal.setDeclarationSignature(getSignature(field.declaringClass));
3755
					proposal.setSignature(getSignature(field.type));
3755
					proposal.setSignature(getSignature(field.type));
3756
					proposal.setDeclarationPackageName(field.declaringClass.qualifiedPackageName());
3756
					proposal.setDeclarationPackageName(field.declaringClass.qualifiedPackageName());
Lines 3771-3777 Link Here
3771
					// Javadoc value completion for static fields
3771
					// Javadoc value completion for static fields
3772
					if (field.isStatic() && !this.requestor.isIgnored(CompletionProposal.JAVADOC_VALUE_REF)) {
3772
					if (field.isStatic() && !this.requestor.isIgnored(CompletionProposal.JAVADOC_VALUE_REF)) {
3773
						javadocCompletion = inlineTagCompletion(completion, JavadocTagConstants.TAG_VALUE);
3773
						javadocCompletion = inlineTagCompletion(completion, JavadocTagConstants.TAG_VALUE);
3774
						CompletionProposal valueProposal = createProposal(CompletionProposal.JAVADOC_VALUE_REF, this.actualCompletionPosition);
3774
						InternalCompletionProposal valueProposal = createProposal(CompletionProposal.JAVADOC_VALUE_REF, this.actualCompletionPosition);
3775
						valueProposal.setDeclarationSignature(getSignature(field.declaringClass));
3775
						valueProposal.setDeclarationSignature(getSignature(field.declaringClass));
3776
						valueProposal.setSignature(getSignature(field.type));
3776
						valueProposal.setSignature(getSignature(field.type));
3777
						valueProposal.setDeclarationPackageName(field.declaringClass.qualifiedPackageName());
3777
						valueProposal.setDeclarationPackageName(field.declaringClass.qualifiedPackageName());
Lines 3792-3798 Link Here
3792
				}
3792
				}
3793
			} else {
3793
			} else {
3794
				if(!this.isIgnored(CompletionProposal.FIELD_REF_WITH_CASTED_RECEIVER, missingElements != null)) {
3794
				if(!this.isIgnored(CompletionProposal.FIELD_REF_WITH_CASTED_RECEIVER, missingElements != null)) {
3795
					CompletionProposal proposal = createProposal(CompletionProposal.FIELD_REF_WITH_CASTED_RECEIVER, this.actualCompletionPosition);
3795
					InternalCompletionProposal proposal = createProposal(CompletionProposal.FIELD_REF_WITH_CASTED_RECEIVER, this.actualCompletionPosition);
3796
					proposal.setDeclarationSignature(getSignature(field.declaringClass));
3796
					proposal.setDeclarationSignature(getSignature(field.declaringClass));
3797
					proposal.setSignature(getSignature(field.type));
3797
					proposal.setSignature(getSignature(field.type));
3798
					proposal.setReceiverSignature(getSignature(receiverType));
3798
					proposal.setReceiverSignature(getSignature(receiverType));
Lines 4069-4075 Link Here
4069
				this.noProposal = false;
4069
				this.noProposal = false;
4070
				if (castedReceiver == null) {
4070
				if (castedReceiver == null) {
4071
					if(!isIgnored(CompletionProposal.FIELD_REF, missingElements != null)) {
4071
					if(!isIgnored(CompletionProposal.FIELD_REF, missingElements != null)) {
4072
						CompletionProposal proposal = createProposal(CompletionProposal.FIELD_REF, this.actualCompletionPosition);
4072
						InternalCompletionProposal proposal =  createProposal(CompletionProposal.FIELD_REF, this.actualCompletionPosition);
4073
						proposal.setDeclarationSignature(getSignature(receiverType));
4073
						proposal.setDeclarationSignature(getSignature(receiverType));
4074
						proposal.setSignature(INT_SIGNATURE);
4074
						proposal.setSignature(INT_SIGNATURE);
4075
						proposal.setTypeName(INT);
4075
						proposal.setTypeName(INT);
Lines 4100-4106 Link Here
4100
					char[] completion = CharOperation.concat(castedReceiver, lengthField);
4100
					char[] completion = CharOperation.concat(castedReceiver, lengthField);
4101
4101
4102
					if(!this.isIgnored(CompletionProposal.FIELD_REF_WITH_CASTED_RECEIVER, missingElements != null)) {
4102
					if(!this.isIgnored(CompletionProposal.FIELD_REF_WITH_CASTED_RECEIVER, missingElements != null)) {
4103
						CompletionProposal proposal = createProposal(CompletionProposal.FIELD_REF_WITH_CASTED_RECEIVER, this.actualCompletionPosition);
4103
						InternalCompletionProposal proposal =  createProposal(CompletionProposal.FIELD_REF_WITH_CASTED_RECEIVER, this.actualCompletionPosition);
4104
						proposal.setDeclarationSignature(getSignature(receiverType));
4104
						proposal.setDeclarationSignature(getSignature(receiverType));
4105
						proposal.setSignature(INT_SIGNATURE);
4105
						proposal.setSignature(INT_SIGNATURE);
4106
						proposal.setReceiverSignature(getSignature(receiverType));
4106
						proposal.setReceiverSignature(getSignature(receiverType));
Lines 4164-4170 Link Here
4164
				this.noProposal = false;
4164
				this.noProposal = false;
4165
				if (castedReceiver == null) {
4165
				if (castedReceiver == null) {
4166
					if (!this.isIgnored(CompletionProposal.METHOD_REF, missingElements != null)) {
4166
					if (!this.isIgnored(CompletionProposal.METHOD_REF, missingElements != null)) {
4167
						CompletionProposal proposal = createProposal(CompletionProposal.METHOD_REF, this.actualCompletionPosition);
4167
						InternalCompletionProposal proposal =  createProposal(CompletionProposal.METHOD_REF, this.actualCompletionPosition);
4168
						proposal.setDeclarationSignature(getSignature(receiverType));
4168
						proposal.setDeclarationSignature(getSignature(receiverType));
4169
						proposal.setSignature(
4169
						proposal.setSignature(
4170
								this.compilerOptions.sourceLevel > ClassFileConstants.JDK1_4 && receiverType.isArrayType() ?
4170
								this.compilerOptions.sourceLevel > ClassFileConstants.JDK1_4 && receiverType.isArrayType() ?
Lines 4210-4216 Link Here
4210
					methodsFound.add(new Object[]{objectRef.getMethods(cloneMethod)[0], objectRef});
4210
					methodsFound.add(new Object[]{objectRef.getMethods(cloneMethod)[0], objectRef});
4211
				} else {
4211
				} else {
4212
					if(!this.isIgnored(CompletionProposal.METHOD_REF_WITH_CASTED_RECEIVER, missingElements != null)) {
4212
					if(!this.isIgnored(CompletionProposal.METHOD_REF_WITH_CASTED_RECEIVER, missingElements != null)) {
4213
						CompletionProposal proposal = createProposal(CompletionProposal.METHOD_REF_WITH_CASTED_RECEIVER, this.actualCompletionPosition);
4213
						InternalCompletionProposal proposal =  createProposal(CompletionProposal.METHOD_REF_WITH_CASTED_RECEIVER, this.actualCompletionPosition);
4214
						proposal.setDeclarationSignature(getSignature(receiverType));
4214
						proposal.setDeclarationSignature(getSignature(receiverType));
4215
						proposal.setSignature(
4215
						proposal.setSignature(
4216
								this.compilerOptions.sourceLevel > ClassFileConstants.JDK1_4 && receiverType.isArrayType() ?
4216
								this.compilerOptions.sourceLevel > ClassFileConstants.JDK1_4 && receiverType.isArrayType() ?
Lines 4630-4636 Link Here
4630
				if (!this.isIgnored(CompletionProposal.FIELD_REF, CompletionProposal.TYPE_IMPORT)) {
4630
				if (!this.isIgnored(CompletionProposal.FIELD_REF, CompletionProposal.TYPE_IMPORT)) {
4631
					char[] completion = CharOperation.concat(receiverType.sourceName, field.name, '.');
4631
					char[] completion = CharOperation.concat(receiverType.sourceName, field.name, '.');
4632
4632
4633
					CompletionProposal proposal = createProposal(CompletionProposal.FIELD_REF, this.actualCompletionPosition);
4633
					InternalCompletionProposal proposal =  createProposal(CompletionProposal.FIELD_REF, this.actualCompletionPosition);
4634
					proposal.setDeclarationSignature(getSignature(field.declaringClass));
4634
					proposal.setDeclarationSignature(getSignature(field.declaringClass));
4635
					proposal.setSignature(getSignature(field.type));
4635
					proposal.setSignature(getSignature(field.type));
4636
					proposal.setDeclarationPackageName(field.declaringClass.qualifiedPackageName());
4636
					proposal.setDeclarationPackageName(field.declaringClass.qualifiedPackageName());
Lines 4646-4652 Link Here
4646
4646
4647
					char[] typeImportCompletion = createImportCharArray(typeName, false, false);
4647
					char[] typeImportCompletion = createImportCharArray(typeName, false, false);
4648
4648
4649
					CompletionProposal typeImportProposal = createProposal(CompletionProposal.TYPE_IMPORT, this.actualCompletionPosition);
4649
					InternalCompletionProposal typeImportProposal = createProposal(CompletionProposal.TYPE_IMPORT, this.actualCompletionPosition);
4650
					typeImportProposal.nameLookup = this.nameEnvironment.nameLookup;
4650
					typeImportProposal.nameLookup = this.nameEnvironment.nameLookup;
4651
					typeImportProposal.completionEngine = this;
4651
					typeImportProposal.completionEngine = this;
4652
					char[] packageName = receiverType.qualifiedPackageName();
4652
					char[] packageName = receiverType.qualifiedPackageName();
Lines 4672-4678 Link Here
4672
				if (!this.isIgnored(CompletionProposal.FIELD_REF, CompletionProposal.FIELD_IMPORT)) {
4672
				if (!this.isIgnored(CompletionProposal.FIELD_REF, CompletionProposal.FIELD_IMPORT)) {
4673
					char[] completion = field.name;
4673
					char[] completion = field.name;
4674
4674
4675
					CompletionProposal proposal = createProposal(CompletionProposal.FIELD_REF, this.actualCompletionPosition);
4675
					InternalCompletionProposal proposal =  createProposal(CompletionProposal.FIELD_REF, this.actualCompletionPosition);
4676
					proposal.setDeclarationSignature(getSignature(field.declaringClass));
4676
					proposal.setDeclarationSignature(getSignature(field.declaringClass));
4677
					proposal.setSignature(getSignature(field.type));
4677
					proposal.setSignature(getSignature(field.type));
4678
					proposal.setDeclarationPackageName(field.declaringClass.qualifiedPackageName());
4678
					proposal.setDeclarationPackageName(field.declaringClass.qualifiedPackageName());
Lines 4688-4694 Link Here
4688
4688
4689
					char[] fieldImportCompletion = createImportCharArray(CharOperation.concat(typeName, field.name, '.'), true, false);
4689
					char[] fieldImportCompletion = createImportCharArray(CharOperation.concat(typeName, field.name, '.'), true, false);
4690
4690
4691
					CompletionProposal fieldImportProposal = createProposal(CompletionProposal.FIELD_IMPORT, this.actualCompletionPosition);
4691
					InternalCompletionProposal fieldImportProposal = createProposal(CompletionProposal.FIELD_IMPORT, this.actualCompletionPosition);
4692
					fieldImportProposal.setDeclarationSignature(getSignature(field.declaringClass));
4692
					fieldImportProposal.setDeclarationSignature(getSignature(field.declaringClass));
4693
					fieldImportProposal.setSignature(getSignature(field.type));
4693
					fieldImportProposal.setSignature(getSignature(field.type));
4694
					fieldImportProposal.setDeclarationPackageName(field.declaringClass.qualifiedPackageName());
4694
					fieldImportProposal.setDeclarationPackageName(field.declaringClass.qualifiedPackageName());
Lines 4848-4854 Link Here
4848
4848
4849
			this.noProposal = false;
4849
			this.noProposal = false;
4850
			if(!this.requestor.isIgnored(CompletionProposal.FIELD_REF)) {
4850
			if(!this.requestor.isIgnored(CompletionProposal.FIELD_REF)) {
4851
				CompletionProposal proposal = createProposal(CompletionProposal.FIELD_REF, this.actualCompletionPosition);
4851
				InternalCompletionProposal proposal =  createProposal(CompletionProposal.FIELD_REF, this.actualCompletionPosition);
4852
				proposal.setDeclarationSignature(getSignature(field.declaringClass));
4852
				proposal.setDeclarationSignature(getSignature(field.declaringClass));
4853
				proposal.setSignature(getSignature(field.type));
4853
				proposal.setSignature(getSignature(field.type));
4854
				proposal.setDeclarationPackageName(field.declaringClass.qualifiedPackageName());
4854
				proposal.setDeclarationPackageName(field.declaringClass.qualifiedPackageName());
Lines 4917-4923 Link Here
4917
4917
4918
			this.noProposal = false;
4918
			this.noProposal = false;
4919
			if(!this.requestor.isIgnored(CompletionProposal.METHOD_NAME_REFERENCE)) {
4919
			if(!this.requestor.isIgnored(CompletionProposal.METHOD_NAME_REFERENCE)) {
4920
				CompletionProposal proposal = createProposal(CompletionProposal.METHOD_NAME_REFERENCE, this.actualCompletionPosition);
4920
				InternalCompletionProposal proposal =  createProposal(CompletionProposal.METHOD_NAME_REFERENCE, this.actualCompletionPosition);
4921
				proposal.setDeclarationSignature(getSignature(method.declaringClass));
4921
				proposal.setDeclarationSignature(getSignature(method.declaringClass));
4922
				proposal.setSignature(getSignature(method));
4922
				proposal.setSignature(getSignature(method));
4923
				proposal.setDeclarationPackageName(method.declaringClass.qualifiedPackageName());
4923
				proposal.setDeclarationPackageName(method.declaringClass.qualifiedPackageName());
Lines 4956-4962 Link Here
4956
			this.noProposal = false;
4956
			this.noProposal = false;
4957
			if (!this.requestor.isIgnored(CompletionProposal.JAVADOC_BLOCK_TAG)) {
4957
			if (!this.requestor.isIgnored(CompletionProposal.JAVADOC_BLOCK_TAG)) {
4958
				char[] possibleTag = possibleTags[i];
4958
				char[] possibleTag = possibleTags[i];
4959
				CompletionProposal proposal = createProposal(CompletionProposal.JAVADOC_BLOCK_TAG, this.actualCompletionPosition);
4959
				InternalCompletionProposal proposal =  createProposal(CompletionProposal.JAVADOC_BLOCK_TAG, this.actualCompletionPosition);
4960
				proposal.setName(possibleTag);
4960
				proposal.setName(possibleTag);
4961
				int tagLength = possibleTag.length;
4961
				int tagLength = possibleTag.length;
4962
				char[] completion = new char[1+tagLength];
4962
				char[] completion = new char[1+tagLength];
Lines 4989-4995 Link Here
4989
			this.noProposal = false;
4989
			this.noProposal = false;
4990
			if (!this.requestor.isIgnored(CompletionProposal.JAVADOC_INLINE_TAG)) {
4990
			if (!this.requestor.isIgnored(CompletionProposal.JAVADOC_INLINE_TAG)) {
4991
				char[] possibleTag = possibleTags[i];
4991
				char[] possibleTag = possibleTags[i];
4992
				CompletionProposal proposal = createProposal(CompletionProposal.JAVADOC_INLINE_TAG, this.actualCompletionPosition);
4992
				InternalCompletionProposal proposal =  createProposal(CompletionProposal.JAVADOC_INLINE_TAG, this.actualCompletionPosition);
4993
				proposal.setName(possibleTag);
4993
				proposal.setName(possibleTag);
4994
				int tagLength = possibleTag.length;
4994
				int tagLength = possibleTag.length;
4995
//				boolean inlineTagStarted = javadocTag.completeInlineTagStarted();
4995
//				boolean inlineTagStarted = javadocTag.completeInlineTagStarted();
Lines 5036-5042 Link Here
5036
					}
5036
					}
5037
					this.noProposal = false;
5037
					this.noProposal = false;
5038
					if(!this.requestor.isIgnored(CompletionProposal.KEYWORD)) {
5038
					if(!this.requestor.isIgnored(CompletionProposal.KEYWORD)) {
5039
						CompletionProposal proposal = createProposal(CompletionProposal.KEYWORD, this.actualCompletionPosition);
5039
						InternalCompletionProposal proposal =  createProposal(CompletionProposal.KEYWORD, this.actualCompletionPosition);
5040
						proposal.setName(choices[i]);
5040
						proposal.setName(choices[i]);
5041
						proposal.setCompletion(choices[i]);
5041
						proposal.setCompletion(choices[i]);
5042
						proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset);
5042
						proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset);
Lines 5069-5075 Link Here
5069
5069
5070
				this.noProposal = false;
5070
				this.noProposal = false;
5071
				if(!this.requestor.isIgnored(CompletionProposal.KEYWORD)) {
5071
				if(!this.requestor.isIgnored(CompletionProposal.KEYWORD)) {
5072
					CompletionProposal proposal = createProposal(CompletionProposal.KEYWORD, this.actualCompletionPosition);
5072
					InternalCompletionProposal proposal =  createProposal(CompletionProposal.KEYWORD, this.actualCompletionPosition);
5073
					proposal.setName(choices[i]);
5073
					proposal.setName(choices[i]);
5074
					proposal.setCompletion(choices[i]);
5074
					proposal.setCompletion(choices[i]);
5075
					proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset);
5075
					proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset);
Lines 5231-5237 Link Here
5231
5231
5232
				this.noProposal = false;
5232
				this.noProposal = false;
5233
				if (!this.requestor.isIgnored(CompletionProposal.KEYWORD)) {
5233
				if (!this.requestor.isIgnored(CompletionProposal.KEYWORD)) {
5234
					CompletionProposal proposal = createProposal(CompletionProposal.KEYWORD, this.actualCompletionPosition);
5234
					InternalCompletionProposal proposal =  createProposal(CompletionProposal.KEYWORD, this.actualCompletionPosition);
5235
					proposal.setName(Keywords.THIS);
5235
					proposal.setName(Keywords.THIS);
5236
					proposal.setCompletion(Keywords.THIS);
5236
					proposal.setCompletion(Keywords.THIS);
5237
					proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset);
5237
					proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset);
Lines 5733-5739 Link Here
5733
5733
5734
				this.noProposal = false;
5734
				this.noProposal = false;
5735
				if (!this.requestor.isIgnored(CompletionProposal.JAVADOC_PARAM_REF)) {
5735
				if (!this.requestor.isIgnored(CompletionProposal.JAVADOC_PARAM_REF)) {
5736
					CompletionProposal proposal = createProposal(CompletionProposal.JAVADOC_PARAM_REF, this.actualCompletionPosition);
5736
					InternalCompletionProposal proposal =  createProposal(CompletionProposal.JAVADOC_PARAM_REF, this.actualCompletionPosition);
5737
					proposal.setName(argName);
5737
					proposal.setName(argName);
5738
					char[] completion = isTypeParam ? CharOperation.concat('<', argName, '>') : argName;
5738
					char[] completion = isTypeParam ? CharOperation.concat('<', argName, '>') : argName;
5739
					proposal.setCompletion(completion);
5739
					proposal.setCompletion(completion);
Lines 6191-6197 Link Here
6191
			if (castedReceiver == null) {
6191
			if (castedReceiver == null) {
6192
				// Standard proposal
6192
				// Standard proposal
6193
				if(!this.isIgnored(CompletionProposal.METHOD_REF, missingElements != null) && (this.assistNodeInJavadoc & CompletionOnJavadoc.ONLY_INLINE_TAG) == 0) {
6193
				if(!this.isIgnored(CompletionProposal.METHOD_REF, missingElements != null) && (this.assistNodeInJavadoc & CompletionOnJavadoc.ONLY_INLINE_TAG) == 0) {
6194
					CompletionProposal proposal = createProposal(CompletionProposal.METHOD_REF, this.actualCompletionPosition);
6194
					InternalCompletionProposal proposal =  createProposal(CompletionProposal.METHOD_REF, this.actualCompletionPosition);
6195
					proposal.setDeclarationSignature(getSignature(method.declaringClass));
6195
					proposal.setDeclarationSignature(getSignature(method.declaringClass));
6196
					proposal.setSignature(getSignature(method));
6196
					proposal.setSignature(getSignature(method));
6197
					MethodBinding original = method.original();
6197
					MethodBinding original = method.original();
Lines 6232-6238 Link Here
6232
				// Javadoc proposal
6232
				// Javadoc proposal
6233
				if ((this.assistNodeInJavadoc & CompletionOnJavadoc.TEXT) != 0 && !this.requestor.isIgnored(CompletionProposal.JAVADOC_METHOD_REF)) {
6233
				if ((this.assistNodeInJavadoc & CompletionOnJavadoc.TEXT) != 0 && !this.requestor.isIgnored(CompletionProposal.JAVADOC_METHOD_REF)) {
6234
					char[] javadocCompletion = inlineTagCompletion(completion, JavadocTagConstants.TAG_LINK);
6234
					char[] javadocCompletion = inlineTagCompletion(completion, JavadocTagConstants.TAG_LINK);
6235
					CompletionProposal proposal = createProposal(CompletionProposal.JAVADOC_METHOD_REF, this.actualCompletionPosition);
6235
					InternalCompletionProposal proposal =  createProposal(CompletionProposal.JAVADOC_METHOD_REF, this.actualCompletionPosition);
6236
					proposal.setDeclarationSignature(getSignature(method.declaringClass));
6236
					proposal.setDeclarationSignature(getSignature(method.declaringClass));
6237
					proposal.setSignature(getSignature(method));
6237
					proposal.setSignature(getSignature(method));
6238
					MethodBinding original = method.original();
6238
					MethodBinding original = method.original();
Lines 6260-6266 Link Here
6260
				}
6260
				}
6261
			} else {
6261
			} else {
6262
				if(!this.isIgnored(CompletionProposal.METHOD_REF_WITH_CASTED_RECEIVER, missingElements != null)) {
6262
				if(!this.isIgnored(CompletionProposal.METHOD_REF_WITH_CASTED_RECEIVER, missingElements != null)) {
6263
					CompletionProposal proposal = createProposal(CompletionProposal.METHOD_REF_WITH_CASTED_RECEIVER, this.actualCompletionPosition);
6263
					InternalCompletionProposal proposal =  createProposal(CompletionProposal.METHOD_REF_WITH_CASTED_RECEIVER, this.actualCompletionPosition);
6264
					proposal.setDeclarationSignature(getSignature(method.declaringClass));
6264
					proposal.setDeclarationSignature(getSignature(method.declaringClass));
6265
					proposal.setSignature(getSignature(method));
6265
					proposal.setSignature(getSignature(method));
6266
					MethodBinding original = method.original();
6266
					MethodBinding original = method.original();
Lines 6451-6457 Link Here
6451
						if (!isIgnored(CompletionProposal.METHOD_REF)) {
6451
						if (!isIgnored(CompletionProposal.METHOD_REF)) {
6452
							completion = CharOperation.concat(receiverType.sourceName, completion, '.');
6452
							completion = CharOperation.concat(receiverType.sourceName, completion, '.');
6453
6453
6454
							CompletionProposal proposal = createProposal(CompletionProposal.METHOD_REF, this.actualCompletionPosition);
6454
							InternalCompletionProposal proposal =  createProposal(CompletionProposal.METHOD_REF, this.actualCompletionPosition);
6455
							proposal.setDeclarationSignature(getSignature(method.declaringClass));
6455
							proposal.setDeclarationSignature(getSignature(method.declaringClass));
6456
							proposal.setSignature(getSignature(method));
6456
							proposal.setSignature(getSignature(method));
6457
							MethodBinding original = method.original();
6457
							MethodBinding original = method.original();
Lines 6480-6486 Link Here
6480
					} else if (!this.isIgnored(CompletionProposal.METHOD_REF, CompletionProposal.TYPE_IMPORT)) {
6480
					} else if (!this.isIgnored(CompletionProposal.METHOD_REF, CompletionProposal.TYPE_IMPORT)) {
6481
						completion = CharOperation.concat(receiverType.sourceName, completion, '.');
6481
						completion = CharOperation.concat(receiverType.sourceName, completion, '.');
6482
6482
6483
						CompletionProposal proposal = createProposal(CompletionProposal.METHOD_REF, this.actualCompletionPosition);
6483
						InternalCompletionProposal proposal =  createProposal(CompletionProposal.METHOD_REF, this.actualCompletionPosition);
6484
						proposal.setDeclarationSignature(getSignature(method.declaringClass));
6484
						proposal.setDeclarationSignature(getSignature(method.declaringClass));
6485
						proposal.setSignature(getSignature(method));
6485
						proposal.setSignature(getSignature(method));
6486
						MethodBinding original = method.original();
6486
						MethodBinding original = method.original();
Lines 6503-6509 Link Here
6503
6503
6504
						char[] typeImportCompletion = createImportCharArray(typeName, false, false);
6504
						char[] typeImportCompletion = createImportCharArray(typeName, false, false);
6505
6505
6506
						CompletionProposal typeImportProposal = createProposal(CompletionProposal.TYPE_IMPORT, this.actualCompletionPosition);
6506
						InternalCompletionProposal typeImportProposal = createProposal(CompletionProposal.TYPE_IMPORT, this.actualCompletionPosition);
6507
						typeImportProposal.nameLookup = this.nameEnvironment.nameLookup;
6507
						typeImportProposal.nameLookup = this.nameEnvironment.nameLookup;
6508
						typeImportProposal.completionEngine = this;
6508
						typeImportProposal.completionEngine = this;
6509
						char[] packageName = receiverType.qualifiedPackageName();
6509
						char[] packageName = receiverType.qualifiedPackageName();
Lines 6527-6533 Link Here
6527
					}
6527
					}
6528
				} else {
6528
				} else {
6529
					if (!this.isIgnored(CompletionProposal.METHOD_REF, CompletionProposal.METHOD_IMPORT)) {
6529
					if (!this.isIgnored(CompletionProposal.METHOD_REF, CompletionProposal.METHOD_IMPORT)) {
6530
						CompletionProposal proposal = createProposal(CompletionProposal.METHOD_REF, this.actualCompletionPosition);
6530
						InternalCompletionProposal proposal =  createProposal(CompletionProposal.METHOD_REF, this.actualCompletionPosition);
6531
						proposal.setDeclarationSignature(getSignature(method.declaringClass));
6531
						proposal.setDeclarationSignature(getSignature(method.declaringClass));
6532
						proposal.setSignature(getSignature(method));
6532
						proposal.setSignature(getSignature(method));
6533
						MethodBinding original = method.original();
6533
						MethodBinding original = method.original();
Lines 6550-6556 Link Here
6550
6550
6551
						char[] methodImportCompletion = createImportCharArray(CharOperation.concat(typeName, method.selector, '.'), true, false);
6551
						char[] methodImportCompletion = createImportCharArray(CharOperation.concat(typeName, method.selector, '.'), true, false);
6552
6552
6553
						CompletionProposal methodImportProposal = createProposal(CompletionProposal.METHOD_IMPORT, this.actualCompletionPosition);
6553
						InternalCompletionProposal methodImportProposal = createProposal(CompletionProposal.METHOD_IMPORT, this.actualCompletionPosition);
6554
						methodImportProposal.setDeclarationSignature(getSignature(method.declaringClass));
6554
						methodImportProposal.setDeclarationSignature(getSignature(method.declaringClass));
6555
						methodImportProposal.setSignature(getSignature(method));
6555
						methodImportProposal.setSignature(getSignature(method));
6556
						if(original != method) {
6556
						if(original != method) {
Lines 6586-6592 Link Here
6586
		}
6586
		}
6587
6587
6588
	private CompletionProposal createRequiredTypeProposal(Binding binding, int start, int end, int relevance) {
6588
	private CompletionProposal createRequiredTypeProposal(Binding binding, int start, int end, int relevance) {
6589
		CompletionProposal proposal = null;
6589
		InternalCompletionProposal proposal = null;
6590
		if (binding instanceof ReferenceBinding) {
6590
		if (binding instanceof ReferenceBinding) {
6591
			ReferenceBinding typeBinding = (ReferenceBinding) binding;
6591
			ReferenceBinding typeBinding = (ReferenceBinding) binding;
6592
6592
Lines 6714-6720 Link Here
6714
6714
6715
			this.noProposal = false;
6715
			this.noProposal = false;
6716
			if(!this.requestor.isIgnored(CompletionProposal.METHOD_REF)) {
6716
			if(!this.requestor.isIgnored(CompletionProposal.METHOD_REF)) {
6717
				CompletionProposal proposal = createProposal(CompletionProposal.METHOD_REF, this.actualCompletionPosition);
6717
				InternalCompletionProposal proposal =  createProposal(CompletionProposal.METHOD_REF, this.actualCompletionPosition);
6718
				proposal.setDeclarationSignature(getSignature(method.declaringClass));
6718
				proposal.setDeclarationSignature(getSignature(method.declaringClass));
6719
				proposal.setSignature(getSignature(method));
6719
				proposal.setSignature(getSignature(method));
6720
				MethodBinding original = method.original();
6720
				MethodBinding original = method.original();
Lines 6944-6950 Link Here
6944
6944
6945
				this.noProposal = false;
6945
				this.noProposal = false;
6946
				if(!this.requestor.isIgnored(CompletionProposal.LABEL_REF)) {
6946
				if(!this.requestor.isIgnored(CompletionProposal.LABEL_REF)) {
6947
					CompletionProposal proposal = createProposal(CompletionProposal.LABEL_REF, this.actualCompletionPosition);
6947
					InternalCompletionProposal proposal =  createProposal(CompletionProposal.LABEL_REF, this.actualCompletionPosition);
6948
					proposal.setName(choices[i]);
6948
					proposal.setName(choices[i]);
6949
					proposal.setCompletion(choices[i]);
6949
					proposal.setCompletion(choices[i]);
6950
					proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset);
6950
					proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset);
Lines 7064-7070 Link Here
7064
7064
7065
			this.noProposal = false;
7065
			this.noProposal = false;
7066
			if(!this.requestor.isIgnored(CompletionProposal.METHOD_DECLARATION)) {
7066
			if(!this.requestor.isIgnored(CompletionProposal.METHOD_DECLARATION)) {
7067
				CompletionProposal proposal = createProposal(CompletionProposal.METHOD_DECLARATION, this.actualCompletionPosition);
7067
				InternalCompletionProposal proposal =  createProposal(CompletionProposal.METHOD_DECLARATION, this.actualCompletionPosition);
7068
				proposal.setDeclarationSignature(getSignature(method.declaringClass));
7068
				proposal.setDeclarationSignature(getSignature(method.declaringClass));
7069
				proposal.setDeclarationKey(method.declaringClass.computeUniqueKey());
7069
				proposal.setDeclarationKey(method.declaringClass.computeUniqueKey());
7070
				proposal.setSignature(getSignature(method));
7070
				proposal.setSignature(getSignature(method));
Lines 8036-8042 Link Here
8036
8036
8037
							this.noProposal = false;
8037
							this.noProposal = false;
8038
							if(!this.requestor.isIgnored(CompletionProposal.TYPE_REF)) {
8038
							if(!this.requestor.isIgnored(CompletionProposal.TYPE_REF)) {
8039
								CompletionProposal proposal = createProposal(CompletionProposal.TYPE_REF, this.actualCompletionPosition);
8039
								InternalCompletionProposal proposal =  createProposal(CompletionProposal.TYPE_REF, this.actualCompletionPosition);
8040
								proposal.setDeclarationSignature(packageName);
8040
								proposal.setDeclarationSignature(packageName);
8041
								proposal.setSignature(getSignature(refBinding));
8041
								proposal.setSignature(getSignature(refBinding));
8042
								proposal.setPackageName(packageName);
8042
								proposal.setPackageName(packageName);
Lines 8299-8305 Link Here
8299
8299
8300
							this.noProposal = false;
8300
							this.noProposal = false;
8301
							if(!this.requestor.isIgnored(CompletionProposal.TYPE_REF)) {
8301
							if(!this.requestor.isIgnored(CompletionProposal.TYPE_REF)) {
8302
								CompletionProposal proposal = createProposal(CompletionProposal.TYPE_REF, this.actualCompletionPosition);
8302
								InternalCompletionProposal proposal =  createProposal(CompletionProposal.TYPE_REF, this.actualCompletionPosition);
8303
								proposal.setDeclarationSignature(typeBinding.qualifiedPackageName());
8303
								proposal.setDeclarationSignature(typeBinding.qualifiedPackageName());
8304
								proposal.setSignature(getSignature(typeBinding));
8304
								proposal.setSignature(getSignature(typeBinding));
8305
								proposal.setPackageName(typeBinding.qualifiedPackageName());
8305
								proposal.setPackageName(typeBinding.qualifiedPackageName());
Lines 8391-8397 Link Here
8391
							relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); // no access restriction for local variable
8391
							relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); // no access restriction for local variable
8392
							this.noProposal = false;
8392
							this.noProposal = false;
8393
							if(!this.requestor.isIgnored(CompletionProposal.LOCAL_VARIABLE_REF)) {
8393
							if(!this.requestor.isIgnored(CompletionProposal.LOCAL_VARIABLE_REF)) {
8394
								CompletionProposal proposal = createProposal(CompletionProposal.LOCAL_VARIABLE_REF, this.actualCompletionPosition);
8394
								InternalCompletionProposal proposal =  createProposal(CompletionProposal.LOCAL_VARIABLE_REF, this.actualCompletionPosition);
8395
								proposal.setSignature(
8395
								proposal.setSignature(
8396
									local.type == null
8396
									local.type == null
8397
									? createTypeSignature(
8397
									? createTypeSignature(
Lines 8693-8699 Link Here
8693
						// accept result
8693
						// accept result
8694
						CompletionEngine.this.noProposal = false;
8694
						CompletionEngine.this.noProposal = false;
8695
						if(!CompletionEngine.this.requestor.isIgnored(CompletionProposal.VARIABLE_DECLARATION)) {
8695
						if(!CompletionEngine.this.requestor.isIgnored(CompletionProposal.VARIABLE_DECLARATION)) {
8696
							CompletionProposal proposal = CompletionEngine.this.createProposal(CompletionProposal.VARIABLE_DECLARATION, CompletionEngine.this.actualCompletionPosition);
8696
							InternalCompletionProposal proposal =  CompletionEngine.this.createProposal(CompletionProposal.VARIABLE_DECLARATION, CompletionEngine.this.actualCompletionPosition);
8697
							proposal.setSignature(getSignature(type.resolvedType));
8697
							proposal.setSignature(getSignature(type.resolvedType));
8698
							proposal.setPackageName(type.resolvedType.qualifiedPackageName());
8698
							proposal.setPackageName(type.resolvedType.qualifiedPackageName());
8699
							proposal.setTypeName(type.resolvedType.qualifiedSourceName());
8699
							proposal.setTypeName(type.resolvedType.qualifiedSourceName());
Lines 8961-8967 Link Here
8961
					// accept result
8961
					// accept result
8962
					CompletionEngine.this.noProposal = false;
8962
					CompletionEngine.this.noProposal = false;
8963
					if(!CompletionEngine.this.requestor.isIgnored(CompletionProposal.VARIABLE_DECLARATION)) {
8963
					if(!CompletionEngine.this.requestor.isIgnored(CompletionProposal.VARIABLE_DECLARATION)) {
8964
						CompletionProposal proposal = CompletionEngine.this.createProposal(CompletionProposal.VARIABLE_DECLARATION, CompletionEngine.this.actualCompletionPosition);
8964
						InternalCompletionProposal proposal =  CompletionEngine.this.createProposal(CompletionProposal.VARIABLE_DECLARATION, CompletionEngine.this.actualCompletionPosition);
8965
						proposal.setSignature(getSignature(typeBinding));
8965
						proposal.setSignature(getSignature(typeBinding));
8966
						proposal.setPackageName(q);
8966
						proposal.setPackageName(q);
8967
						proposal.setTypeName(displayName);
8967
						proposal.setTypeName(displayName);
Lines 9921-9927 Link Here
9921
			relevance += computeRelevanceForInterestingProposal();
9921
			relevance += computeRelevanceForInterestingProposal();
9922
			relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); // no access restriction for new method
9922
			relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); // no access restriction for new method
9923
9923
9924
			CompletionProposal proposal = createProposal(CompletionProposal.POTENTIAL_METHOD_DECLARATION, this.actualCompletionPosition);
9924
			InternalCompletionProposal proposal =  createProposal(CompletionProposal.POTENTIAL_METHOD_DECLARATION, this.actualCompletionPosition);
9925
			proposal.setDeclarationSignature(getSignature(reference));
9925
			proposal.setDeclarationSignature(getSignature(reference));
9926
			proposal.setSignature(
9926
			proposal.setSignature(
9927
					createMethodSignature(
9927
					createMethodSignature(
Lines 10106-10113 Link Here
10106
				returnTypeSignature);
10106
				returnTypeSignature);
10107
	}
10107
	}
10108
10108
10109
	protected CompletionProposal createProposal(int kind, int completionOffset) {
10109
	protected InternalCompletionProposal createProposal(int kind, int completionOffset) {
10110
		CompletionProposal proposal = CompletionProposal.create(kind, completionOffset - this.offset);
10110
		InternalCompletionProposal proposal = (InternalCompletionProposal) CompletionProposal.create(kind, completionOffset - this.offset);
10111
		proposal.nameLookup = this.nameEnvironment.nameLookup;
10111
		proposal.nameLookup = this.nameEnvironment.nameLookup;
10112
		proposal.completionEngine = this;
10112
		proposal.completionEngine = this;
10113
		return proposal;
10113
		return proposal;
Lines 10120-10126 Link Here
10120
10120
10121
		// Create standard type proposal
10121
		// Create standard type proposal
10122
		if(!this.requestor.isIgnored(CompletionProposal.TYPE_REF) && (this.assistNodeInJavadoc & CompletionOnJavadoc.ONLY_INLINE_TAG) == 0) {
10122
		if(!this.requestor.isIgnored(CompletionProposal.TYPE_REF) && (this.assistNodeInJavadoc & CompletionOnJavadoc.ONLY_INLINE_TAG) == 0) {
10123
			CompletionProposal proposal = CompletionProposal.create(CompletionProposal.TYPE_REF, this.actualCompletionPosition - this.offset);
10123
			InternalCompletionProposal proposal = (InternalCompletionProposal) CompletionProposal.create(CompletionProposal.TYPE_REF, this.actualCompletionPosition - this.offset);
10124
			proposal.nameLookup = this.nameEnvironment.nameLookup;
10124
			proposal.nameLookup = this.nameEnvironment.nameLookup;
10125
			proposal.completionEngine = this;
10125
			proposal.completionEngine = this;
10126
			proposal.setDeclarationSignature(packageName);
10126
			proposal.setDeclarationSignature(packageName);
Lines 10142-10148 Link Here
10142
		// Create javadoc text proposal if necessary
10142
		// Create javadoc text proposal if necessary
10143
		if ((this.assistNodeInJavadoc & CompletionOnJavadoc.TEXT) != 0 && !this.requestor.isIgnored(CompletionProposal.JAVADOC_TYPE_REF)) {
10143
		if ((this.assistNodeInJavadoc & CompletionOnJavadoc.TEXT) != 0 && !this.requestor.isIgnored(CompletionProposal.JAVADOC_TYPE_REF)) {
10144
			char[] javadocCompletion= inlineTagCompletion(completionName, JavadocTagConstants.TAG_LINK);
10144
			char[] javadocCompletion= inlineTagCompletion(completionName, JavadocTagConstants.TAG_LINK);
10145
			CompletionProposal proposal = CompletionProposal.create(CompletionProposal.JAVADOC_TYPE_REF, this.actualCompletionPosition - this.offset);
10145
			InternalCompletionProposal proposal = (InternalCompletionProposal) CompletionProposal.create(CompletionProposal.JAVADOC_TYPE_REF, this.actualCompletionPosition - this.offset);
10146
			proposal.nameLookup = this.nameEnvironment.nameLookup;
10146
			proposal.nameLookup = this.nameEnvironment.nameLookup;
10147
			proposal.completionEngine = this;
10147
			proposal.completionEngine = this;
10148
			proposal.setDeclarationSignature(packageName);
10148
			proposal.setDeclarationSignature(packageName);
Lines 10179-10185 Link Here
10179
10179
10180
		// Create standard type proposal
10180
		// Create standard type proposal
10181
		if(!this.isIgnored(CompletionProposal.TYPE_REF, missingElements != null) && (this.assistNodeInJavadoc & CompletionOnJavadoc.ONLY_INLINE_TAG) == 0) {
10181
		if(!this.isIgnored(CompletionProposal.TYPE_REF, missingElements != null) && (this.assistNodeInJavadoc & CompletionOnJavadoc.ONLY_INLINE_TAG) == 0) {
10182
			CompletionProposal proposal = CompletionProposal.create(CompletionProposal.TYPE_REF, this.actualCompletionPosition - this.offset);
10182
			InternalCompletionProposal proposal = (InternalCompletionProposal) CompletionProposal.create(CompletionProposal.TYPE_REF, this.actualCompletionPosition - this.offset);
10183
			proposal.nameLookup = this.nameEnvironment.nameLookup;
10183
			proposal.nameLookup = this.nameEnvironment.nameLookup;
10184
			proposal.completionEngine = this;
10184
			proposal.completionEngine = this;
10185
			proposal.setDeclarationSignature(refBinding.qualifiedPackageName());
10185
			proposal.setDeclarationSignature(refBinding.qualifiedPackageName());
Lines 10212-10218 Link Here
10212
		// Create javadoc text proposal if necessary
10212
		// Create javadoc text proposal if necessary
10213
		if ((this.assistNodeInJavadoc & CompletionOnJavadoc.TEXT) != 0 && !this.requestor.isIgnored(CompletionProposal.JAVADOC_TYPE_REF)) {
10213
		if ((this.assistNodeInJavadoc & CompletionOnJavadoc.TEXT) != 0 && !this.requestor.isIgnored(CompletionProposal.JAVADOC_TYPE_REF)) {
10214
			char[] javadocCompletion= inlineTagCompletion(completionName, JavadocTagConstants.TAG_LINK);
10214
			char[] javadocCompletion= inlineTagCompletion(completionName, JavadocTagConstants.TAG_LINK);
10215
			CompletionProposal proposal = CompletionProposal.create(CompletionProposal.JAVADOC_TYPE_REF, this.actualCompletionPosition - this.offset);
10215
			InternalCompletionProposal proposal = (InternalCompletionProposal) CompletionProposal.create(CompletionProposal.JAVADOC_TYPE_REF, this.actualCompletionPosition - this.offset);
10216
			proposal.nameLookup = this.nameEnvironment.nameLookup;
10216
			proposal.nameLookup = this.nameEnvironment.nameLookup;
10217
			proposal.completionEngine = this;
10217
			proposal.completionEngine = this;
10218
			proposal.setDeclarationSignature(refBinding.qualifiedPackageName());
10218
			proposal.setDeclarationSignature(refBinding.qualifiedPackageName());
Lines 10240-10246 Link Here
10240
10240
10241
		// Create standard type proposal
10241
		// Create standard type proposal
10242
		if(!this.requestor.isIgnored(CompletionProposal.TYPE_REF)) {
10242
		if(!this.requestor.isIgnored(CompletionProposal.TYPE_REF)) {
10243
			CompletionProposal proposal = CompletionProposal.create(CompletionProposal.TYPE_REF, this.actualCompletionPosition - this.offset);
10243
			InternalCompletionProposal proposal = (InternalCompletionProposal) CompletionProposal.create(CompletionProposal.TYPE_REF, this.actualCompletionPosition - this.offset);
10244
			proposal.nameLookup = this.nameEnvironment.nameLookup;
10244
			proposal.nameLookup = this.nameEnvironment.nameLookup;
10245
			proposal.completionEngine = this;
10245
			proposal.completionEngine = this;
10246
			proposal.setSignature(getSignature(typeParameter.binding));
10246
			proposal.setSignature(getSignature(typeParameter.binding));
Lines 10259-10265 Link Here
10259
		// Create javadoc text proposal if necessary
10259
		// Create javadoc text proposal if necessary
10260
		if ((this.assistNodeInJavadoc & CompletionOnJavadoc.TEXT) != 0 && !this.requestor.isIgnored(CompletionProposal.JAVADOC_TYPE_REF)) {
10260
		if ((this.assistNodeInJavadoc & CompletionOnJavadoc.TEXT) != 0 && !this.requestor.isIgnored(CompletionProposal.JAVADOC_TYPE_REF)) {
10261
			char[] javadocCompletion= inlineTagCompletion(completionName, JavadocTagConstants.TAG_LINK);
10261
			char[] javadocCompletion= inlineTagCompletion(completionName, JavadocTagConstants.TAG_LINK);
10262
			CompletionProposal proposal = CompletionProposal.create(CompletionProposal.JAVADOC_TYPE_REF, this.actualCompletionPosition - this.offset);
10262
			InternalCompletionProposal proposal = (InternalCompletionProposal) CompletionProposal.create(CompletionProposal.JAVADOC_TYPE_REF, this.actualCompletionPosition - this.offset);
10263
			proposal.nameLookup = this.nameEnvironment.nameLookup;
10263
			proposal.nameLookup = this.nameEnvironment.nameLookup;
10264
			proposal.completionEngine = this;
10264
			proposal.completionEngine = this;
10265
			proposal.setSignature(getSignature(typeParameter.binding));
10265
			proposal.setSignature(getSignature(typeParameter.binding));
(-)model/org/eclipse/jdt/core/CompletionProposal.java (-616 / +41 lines)
Lines 11-17 Link Here
11
package org.eclipse.jdt.core;
11
package org.eclipse.jdt.core;
12
12
13
import org.eclipse.core.runtime.IProgressMonitor;
13
import org.eclipse.core.runtime.IProgressMonitor;
14
import org.eclipse.jdt.core.compiler.CharOperation;
15
import org.eclipse.jdt.internal.codeassist.InternalCompletionProposal;
14
import org.eclipse.jdt.internal.codeassist.InternalCompletionProposal;
16
15
17
/**
16
/**
Lines 49-57 Link Here
49
 * @see ICodeAssist#codeComplete(int, CompletionRequestor)
48
 * @see ICodeAssist#codeComplete(int, CompletionRequestor)
50
 * @since 3.0
49
 * @since 3.0
51
 * @noinstantiate This class is not intended to be instantiated by clients.
50
 * @noinstantiate This class is not intended to be instantiated by clients.
51
 * @noextend This class is not intended to be subclassed by clients.
52
 */
52
 */
53
public final class CompletionProposal extends InternalCompletionProposal {
53
public class CompletionProposal {
54
	private boolean updateCompletion = false;
55
54
56
	/**
55
	/**
57
	 * Completion is a declaration of an anonymous class.
56
	 * Completion is a declaration of an anonymous class.
Lines 809-933 Link Here
809
	protected static final int LAST_KIND = FIELD_REF_WITH_CASTED_RECEIVER;
808
	protected static final int LAST_KIND = FIELD_REF_WITH_CASTED_RECEIVER;
810
809
811
	/**
810
	/**
812
	 * Kind of completion request.
813
	 */
814
	private int completionKind;
815
816
	/**
817
	 * Offset in original buffer where ICodeAssist.codeComplete() was
818
	 * requested.
819
	 */
820
	private int completionLocation;
821
822
	/**
823
	 * Start position (inclusive) of source range in original buffer
824
	 * containing the relevant token
825
	 * defaults to empty subrange at [0,0).
826
	 */
827
	private int tokenStart = 0;
828
829
	/**
830
	 * End position (exclusive) of source range in original buffer
831
	 * containing the relevant token;
832
	 * defaults to empty subrange at [0,0).
833
	 */
834
	private int tokenEnd = 0;
835
836
	/**
837
	 * Completion string; defaults to empty string.
838
	 */
839
	private char[] completion = CharOperation.NO_CHAR;
840
841
	/**
842
	 * Start position (inclusive) of source range in original buffer
843
	 * to be replaced by completion string;
844
	 * defaults to empty subrange at [0,0).
845
	 */
846
	private int replaceStart = 0;
847
848
	/**
849
	 * End position (exclusive) of source range in original buffer
850
	 * to be replaced by completion string;
851
	 * defaults to empty subrange at [0,0).
852
	 */
853
	private int replaceEnd = 0;
854
855
	/**
856
	 * Relevance rating; positive; higher means better;
857
	 * defaults to minimum rating.
858
	 */
859
	private int relevance = 1;
860
861
	/**
862
	 * Signature of the relevant package or type declaration
863
	 * in the context, or <code>null</code> if none.
864
	 * Defaults to null.
865
	 */
866
	private char[] declarationSignature = null;
867
868
	/**
869
	 * Unique key of the relevant package or type declaration
870
	 * in the context, or <code>null</code> if none.
871
	 * Defaults to null.
872
	 */
873
	private char[] declarationKey = null;
874
875
	/**
876
	 * Simple name of the method, field,
877
	 * member, or variable relevant in the context, or
878
	 * <code>null</code> if none.
879
	 * Defaults to null.
880
	 */
881
	private char[] name = null;
882
883
	/**
884
	 * Signature of the method, field type, member type,
885
	 * relevant in the context, or <code>null</code> if none.
886
	 * Defaults to null.
887
	 */
888
	private char[] signature = null;
889
890
	/**
891
	 * Unique of the method, field type, member type,
892
	 * relevant in the context, or <code>null</code> if none.
893
	 * Defaults to null.
894
	 */
895
	private char[] key = null;
896
897
	/**
898
	 * Array of required completion proposals, or <code>null</code> if none.
899
	 * The proposal can not be applied if the required proposals aren't applied.
900
	 * Defaults to <code>null</code>.
901
	 */
902
	private CompletionProposal[] requiredProposals;
903
904
	/**
905
	 * Modifier flags relevant in the context, or
906
	 * <code>Flags.AccDefault</code> if none.
907
	 * Defaults to <code>Flags.AccDefault</code>.
908
	 */
909
	private int flags = Flags.AccDefault;
910
911
	/**
912
	 * Completion flags relevant in the context, or
913
	 * <code>CompletionFlags.Default</code> if none.
914
	 * Defaults to <code>CompletionFlags.Default</code>.
915
	 */
916
	private int additionalFlags = CompletionFlags.Default;
917
918
	/**
919
	 * Parameter names (for method completions), or
920
	 * <code>null</code> if none. Lazily computed.
921
	 * Defaults to <code>null</code>.
922
	 */
923
	private char[][] parameterNames = null;
924
925
	/**
926
	 * Indicates whether parameter names have been computed.
927
	 */
928
	private boolean parameterNamesComputed = false;
929
930
	/**
931
	 * Creates a basic completion proposal. All instance
811
	 * Creates a basic completion proposal. All instance
932
	 * field have plausible default values unless otherwise noted.
812
	 * field have plausible default values unless otherwise noted.
933
	 * <p>
813
	 * <p>
Lines 941-977 Link Here
941
	 * @return a new completion proposal
821
	 * @return a new completion proposal
942
	 */
822
	 */
943
	public static CompletionProposal create(int kind, int completionOffset) {
823
	public static CompletionProposal create(int kind, int completionOffset) {
944
		return new CompletionProposal(kind, completionOffset);
824
		return new InternalCompletionProposal(kind, completionOffset);
945
	}
946
947
	/**
948
	 * Creates a basic completion proposal. All instance
949
	 * field have plausible default values unless otherwise noted.
950
	 * <p>
951
	 * Note that the constructors for this class are internal to the
952
	 * Java model implementation. Clients cannot directly create
953
	 * CompletionProposal objects.
954
	 * </p>
955
	 *
956
	 * @param kind one of the kind constants declared on this class
957
	 * @param completionLocation original offset of code completion request
958
	 */
959
	CompletionProposal(int kind, int completionLocation) {
960
		if ((kind < CompletionProposal.FIRST_KIND)
961
				|| (kind > CompletionProposal.LAST_KIND)) {
962
			throw new IllegalArgumentException();
963
		}
964
		if (this.completion == null || completionLocation < 0) {
965
			// Work around for bug 132558 (https://bugs.eclipse.org/bugs/show_bug.cgi?id=132558).
966
			// completionLocation can be -1 if the completion occur at the start of a file or
967
			// the start of a code snippet but this API isn't design to support negative position.
968
			if(this.completion == null || completionLocation != -1) {
969
				throw new IllegalArgumentException();
970
			}
971
			completionLocation = 0;
972
		}
973
		this.completionKind = kind;
974
		this.completionLocation = completionLocation;
975
	}
825
	}
976
826
977
	/**
827
	/**
Lines 1002-1008 Link Here
1002
	 * @since 3.3
852
	 * @since 3.3
1003
	 */
853
	 */
1004
	public int getAdditionalFlags() {
854
	public int getAdditionalFlags() {
1005
		return this.additionalFlags;
855
		return -1; // default overridden by concrete implementation
1006
	}
856
	}
1007
857
1008
	/**
858
	/**
Lines 1021-1027 Link Here
1021
	 * @since 3.3
871
	 * @since 3.3
1022
	 */
872
	 */
1023
	public void setAdditionalFlags(int additionalFlags) {
873
	public void setAdditionalFlags(int additionalFlags) {
1024
		this.additionalFlags = additionalFlags;
874
		// default overridden by concrete implementation
1025
	}
875
	}
1026
876
1027
	/**
877
	/**
Lines 1039-1045 Link Here
1039
	 * to the caller
889
	 * to the caller
1040
	 */
890
	 */
1041
	public int getKind() {
891
	public int getKind() {
1042
		return this.completionKind;
892
		return -1; // default overridden by concrete implementation
1043
	}
893
	}
1044
894
1045
	/**
895
	/**
Lines 1053-1059 Link Here
1053
	 */
903
	 */
1054
	// TODO (david) https://bugs.eclipse.org/bugs/show_bug.cgi?id=132558
904
	// TODO (david) https://bugs.eclipse.org/bugs/show_bug.cgi?id=132558
1055
	public int getCompletionLocation() {
905
	public int getCompletionLocation() {
1056
		return this.completionLocation;
906
		return -1; // default overridden by concrete implementation
1057
	}
907
	}
1058
908
1059
	/**
909
	/**
Lines 1070-1076 Link Here
1070
	 * @return character index of token start position (inclusive)
920
	 * @return character index of token start position (inclusive)
1071
	 */
921
	 */
1072
	public int getTokenStart() {
922
	public int getTokenStart() {
1073
		return this.tokenStart;
923
		return -1; // default overridden by concrete implementation
1074
	}
924
	}
1075
925
1076
	/**
926
	/**
Lines 1083-1089 Link Here
1083
	 * @return character index of token end position (exclusive)
933
	 * @return character index of token end position (exclusive)
1084
	 */
934
	 */
1085
	public int getTokenEnd() {
935
	public int getTokenEnd() {
1086
		return this.tokenEnd;
936
		return -1; // default overridden by concrete implementation
1087
	}
937
	}
1088
938
1089
	/**
939
	/**
Lines 1103-1113 Link Here
1103
	 * @param endIndex character index of token end position (exclusive)
953
	 * @param endIndex character index of token end position (exclusive)
1104
	 */
954
	 */
1105
	public void setTokenRange(int startIndex, int endIndex) {
955
	public void setTokenRange(int startIndex, int endIndex) {
1106
		if (startIndex < 0 || endIndex < startIndex) {
956
		// default overridden by concrete implementation
1107
			throw new IllegalArgumentException();
1108
		}
1109
		this.tokenStart = startIndex;
1110
		this.tokenEnd = endIndex;
1111
	}
957
	}
1112
958
1113
	/**
959
	/**
Lines 1122-1158 Link Here
1122
	 * @return the completion string
968
	 * @return the completion string
1123
	 */
969
	 */
1124
	public char[] getCompletion() {
970
	public char[] getCompletion() {
1125
		if(this.completionKind == METHOD_DECLARATION) {
971
		return null; // default overridden by concrete implementation
1126
			findParameterNames(null);
1127
			if(this.updateCompletion) {
1128
				this.updateCompletion = false;
1129
1130
				if(this.parameterNames != null) {
1131
					int length = this.parameterNames.length;
1132
					StringBuffer completionBuffer = new StringBuffer(this.completion.length);
1133
1134
					int start = 0;
1135
					int end = CharOperation.indexOf('%', this.completion);
1136
1137
					completionBuffer.append(this.completion, start, end - start);
1138
1139
					for(int i = 0 ; i < length ; i++){
1140
						completionBuffer.append(this.parameterNames[i]);
1141
						start = end + 1;
1142
						end = CharOperation.indexOf('%', this.completion, start);
1143
						if(end > -1){
1144
							completionBuffer.append(this.completion, start, end - start);
1145
						} else {
1146
							completionBuffer.append(this.completion, start, this.completion.length - start);
1147
						}
1148
					}
1149
					int nameLength = completionBuffer.length();
1150
					this.completion = new char[nameLength];
1151
					completionBuffer.getChars(0, nameLength, this.completion, 0);
1152
				}
1153
			}
1154
		}
1155
		return this.completion;
1156
	}
972
	}
1157
973
1158
	/**
974
	/**
Lines 1171-1177 Link Here
1171
	 * @param completion the completion string
987
	 * @param completion the completion string
1172
	 */
988
	 */
1173
	public void setCompletion(char[] completion) {
989
	public void setCompletion(char[] completion) {
1174
		this.completion = completion;
990
		// default overridden by concrete implementation		
1175
	}
991
	}
1176
992
1177
	/**
993
	/**
Lines 1196-1202 Link Here
1196
	 * @return replacement start position (inclusive)
1012
	 * @return replacement start position (inclusive)
1197
	 */
1013
	 */
1198
	public int getReplaceStart() {
1014
	public int getReplaceStart() {
1199
		return this.replaceStart;
1015
		return -1; // default overridden by concrete implementation
1200
	}
1016
	}
1201
1017
1202
	/**
1018
	/**
Lines 1210-1216 Link Here
1210
	 * @return replacement end position (exclusive)
1026
	 * @return replacement end position (exclusive)
1211
	 */
1027
	 */
1212
	public int getReplaceEnd() {
1028
	public int getReplaceEnd() {
1213
		return this.replaceEnd;
1029
		return -1; // default overridden by concrete implementation
1214
	}
1030
	}
1215
1031
1216
	/**
1032
	/**
Lines 1232-1242 Link Here
1232
	 * @param endIndex character index of replacement end position (exclusive)
1048
	 * @param endIndex character index of replacement end position (exclusive)
1233
	 */
1049
	 */
1234
	public void setReplaceRange(int startIndex, int endIndex) {
1050
	public void setReplaceRange(int startIndex, int endIndex) {
1235
		if (startIndex < 0 || endIndex < startIndex) {
1051
		// default overridden by concrete implementation
1236
			throw new IllegalArgumentException();
1237
		}
1238
		this.replaceStart = startIndex;
1239
		this.replaceEnd = endIndex;
1240
	}
1052
	}
1241
1053
1242
	/**
1054
	/**
Lines 1245-1251 Link Here
1245
	 * @return relevance rating of this proposal; ratings are positive; higher means better
1057
	 * @return relevance rating of this proposal; ratings are positive; higher means better
1246
	 */
1058
	 */
1247
	public int getRelevance() {
1059
	public int getRelevance() {
1248
		return this.relevance;
1060
		return -1; // default overridden by concrete implementation
1249
	}
1061
	}
1250
1062
1251
	/**
1063
	/**
Lines 1261-1270 Link Here
1261
	 * @param rating relevance rating of this proposal; ratings are positive; higher means better
1073
	 * @param rating relevance rating of this proposal; ratings are positive; higher means better
1262
	 */
1074
	 */
1263
	public void setRelevance(int rating) {
1075
	public void setRelevance(int rating) {
1264
		if (rating <= 0) {
1076
		// default overridden by concrete implementation
1265
			throw new IllegalArgumentException();
1266
		}
1267
		this.relevance = rating;
1268
	}
1077
	}
1269
1078
1270
	/**
1079
	/**
Lines 1312-1318 Link Here
1312
	 * @see Signature
1121
	 * @see Signature
1313
	 */
1122
	 */
1314
	public char[] getDeclarationSignature() {
1123
	public char[] getDeclarationSignature() {
1315
		return this.declarationSignature;
1124
		return null; // default overridden by concrete implementation
1125
1316
	}
1126
	}
1317
1127
1318
	/**
1128
	/**
Lines 1338-1344 Link Here
1338
     * @since 3.1
1148
     * @since 3.1
1339
	 */
1149
	 */
1340
	public char[] getDeclarationKey() {
1150
	public char[] getDeclarationKey() {
1341
		return this.declarationKey;
1151
		return null; // default overridden by concrete implementation
1342
	}
1152
	}
1343
1153
1344
	/**
1154
	/**
Lines 1356-1362 Link Here
1356
	 * <code>null</code> if none
1166
	 * <code>null</code> if none
1357
	 */
1167
	 */
1358
	public void setDeclarationSignature(char[] signature) {
1168
	public void setDeclarationSignature(char[] signature) {
1359
		this.declarationSignature = signature;
1169
		// default overridden by concrete implementation
1360
	}
1170
	}
1361
1171
1362
	/**
1172
	/**
Lines 1375-1381 Link Here
1375
     * @since 3.1
1185
     * @since 3.1
1376
	 */
1186
	 */
1377
	public void setDeclarationKey(char[] key) {
1187
	public void setDeclarationKey(char[] key) {
1378
		this.declarationKey = key;
1188
		// default overridden by concrete implementation
1379
	}
1189
	}
1380
1190
1381
	/**
1191
	/**
Lines 1409-1415 Link Here
1409
	 * name, or <code>null</code> if none
1219
	 * name, or <code>null</code> if none
1410
	 */
1220
	 */
1411
	public char[] getName() {
1221
	public char[] getName() {
1412
		return this.name;
1222
		return null; // default overridden by concrete implementation
1413
	}
1223
	}
1414
1224
1415
1225
Lines 1429-1435 Link Here
1429
	 * or member name, or <code>null</code> if none
1239
	 * or member name, or <code>null</code> if none
1430
	 */
1240
	 */
1431
	public void setName(char[] name) {
1241
	public void setName(char[] name) {
1432
		this.name = name;
1242
		// default overridden by concrete implementation
1433
	}
1243
	}
1434
1244
1435
	/**
1245
	/**
Lines 1477-1483 Link Here
1477
	 * @see Signature
1287
	 * @see Signature
1478
	 */
1288
	 */
1479
	public char[] getSignature() {
1289
	public char[] getSignature() {
1480
		return this.signature;
1290
		return null; // default overridden by concrete implementation
1481
	}
1291
	}
1482
1292
1483
	/**
1293
	/**
Lines 1503-1716 Link Here
1503
     * @since 3.1
1313
     * @since 3.1
1504
	 */
1314
	 */
1505
	public char[] getKey() {
1315
	public char[] getKey() {
1506
		return this.key;
1316
		return null; // default overridden by concrete implementation
1507
	}
1317
	}
1508
1318
1509
//	/**
1510
//	 * Returns the package name of the relevant
1511
//	 * declaration in the context, or <code>null</code> if none.
1512
//	 * <p>
1513
//	 * This field is available for the following kinds of
1514
//	 * completion proposals:
1515
//	 * <ul>
1516
//	 * <li><code>ANONYMOUS_CLASS_DECLARATION</code> - the dot-based package name
1517
//	 * of the type that is being subclassed or implemented</li>
1518
//	 * 	<li><code>FIELD_REF</code> - the dot-based package name
1519
//	 * of the type that declares the field that is referenced</li>
1520
//	 * 	<li><code>METHOD_REF</code> - the dot-based package name
1521
//	 * of the type that declares the method that is referenced</li>
1522
//	 * 	<li><code>METHOD_DECLARATION</code> - the dot-based package name
1523
//	 * of the type that declares the method that is being
1524
//	 * implemented or overridden</li>
1525
//	 * </ul>
1526
//	 * For kinds of completion proposals, this method returns
1527
//	 * <code>null</code>. Clients must not modify the array
1528
//	 * returned.
1529
//	 * </p>
1530
//	 *
1531
//	 * @return the dot-based package name, or
1532
//	 * <code>null</code> if none
1533
//	 * @see #getDeclarationSignature()
1534
//	 * @see #getSignature()
1535
//	 *
1536
//	 * @since 3.1
1537
//	 */
1538
//	public char[] getDeclarationPackageName() {
1539
//		return this.declarationPackageName;
1540
//	}
1541
//
1542
//	/**
1543
//	 * Returns the type name of the relevant
1544
//	 * declaration in the context without the package fragment,
1545
//	 * or <code>null</code> if none.
1546
//	 * <p>
1547
//	 * This field is available for the following kinds of
1548
//	 * completion proposals:
1549
//	 * <ul>
1550
//	 * <li><code>ANONYMOUS_CLASS_DECLARATION</code> - the dot-based type name
1551
//	 * of the type that is being subclassed or implemented</li>
1552
//	 * 	<li><code>FIELD_REF</code> - the dot-based type name
1553
//	 * of the type that declares the field that is referenced
1554
//	 * or an anonymous type instantiation ("new X(){}") if it is an anonymous type</li>
1555
//	 * 	<li><code>METHOD_REF</code> - the dot-based type name
1556
//	 * of the type that declares the method that is referenced
1557
//	 * or an anonymous type instantiation ("new X(){}") if it is an anonymous type</li>
1558
//	 * 	<li><code>METHOD_DECLARATION</code> - the dot-based type name
1559
//	 * of the type that declares the method that is being
1560
//	 * implemented or overridden</li>
1561
//	 * </ul>
1562
//	 * For kinds of completion proposals, this method returns
1563
//	 * <code>null</code>. Clients must not modify the array
1564
//	 * returned.
1565
//	 * </p>
1566
//	 *
1567
//	 * @return the dot-based package name, or
1568
//	 * <code>null</code> if none
1569
//	 * @see #getDeclarationSignature()
1570
//	 * @see #getSignature()
1571
//	 *
1572
//	 * @since 3.1
1573
//	 */
1574
//	public char[] getDeclarationTypeName() {
1575
//		return this.declarationTypeName;
1576
//	}
1577
//
1578
//	/**
1579
//	 * Returns the package name of the method or type
1580
//	 * relevant in the context, or <code>null</code> if none.
1581
//	 * <p>
1582
//	 * This field is available for the following kinds of
1583
//	 * completion proposals:
1584
//	 * <ul>
1585
//	 * 	<li><code>FIELD_REF</code> - the dot-based package name
1586
//	 * of the referenced field's type</li>
1587
//	 * 	<li><code>LOCAL_VARIABLE_REF</code> - the dot-based package name
1588
//	 * of the referenced local variable's type</li>
1589
//	 * 	<li><code>METHOD_REF</code> -  the dot-based package name
1590
//	 * of the return type of the method that is referenced</li>
1591
//	 * 	<li><code>METHOD_DECLARATION</code> - the dot-based package name
1592
//	 * of the return type of the method that is being implemented
1593
//	 * or overridden</li>
1594
//	 * 	<li><code>PACKAGE_REF</code> - the dot-based package name
1595
//	 * of the package that is referenced</li>
1596
//	 * 	<li><code>TYPE_REF</code> - the dot-based package name
1597
//	 * of the type that is referenced</li>
1598
//	 * 	<li><code>VARIABLE_DECLARATION</code> - the dot-based package name
1599
//	 * of the type of the variable being declared</li>
1600
//	 * </ul>
1601
//	 * For kinds of completion proposals, this method returns
1602
//	 * <code>null</code>. Clients must not modify the array
1603
//	 * returned.
1604
//	 * </p>
1605
//	 *
1606
//	 * @return the package name, or <code>null</code> if none
1607
//	 *
1608
//	 * @see #getDeclarationSignature()
1609
//	 * @see #getSignature()
1610
//	 *
1611
//	 * @since 3.1
1612
//	 */
1613
//	public char[] getPackageName() {
1614
//		return this.packageName;
1615
//	}
1616
//
1617
//	/**
1618
//	 * Returns the type name without the package fragment of the method or type
1619
//	 * relevant in the context, or <code>null</code> if none.
1620
//	 * <p>
1621
//	 * This field is available for the following kinds of
1622
//	 * completion proposals:
1623
//	 * <ul>
1624
//	 * 	<li><code>FIELD_REF</code> - the dot-based type name
1625
//	 * of the referenced field's type</li>
1626
//	 * 	<li><code>LOCAL_VARIABLE_REF</code> - the dot-based type name
1627
//	 * of the referenced local variable's type</li>
1628
//	 * 	<li><code>METHOD_REF</code> -  the dot-based type name
1629
//	 * of the return type of the method that is referenced</li>
1630
//	 * 	<li><code>METHOD_DECLARATION</code> - the dot-based type name
1631
//	 * of the return type of the method that is being implemented
1632
//	 * or overridden</li>
1633
//	 * 	<li><code>TYPE_REF</code> - the dot-based type name
1634
//	 * of the type that is referenced</li>
1635
//	 * 	<li><code>VARIABLE_DECLARATION</code> - the dot-based package name
1636
//	 * of the type of the variable being declared</li>
1637
//	 * </ul>
1638
//	 * For kinds of completion proposals, this method returns
1639
//	 * <code>null</code>. Clients must not modify the array
1640
//	 * returned.
1641
//	 * </p>
1642
//	 *
1643
//	 * @return the package name, or <code>null</code> if none
1644
//	 *
1645
//	 * @see #getDeclarationSignature()
1646
//	 * @see #getSignature()
1647
//	 *
1648
//	 * @since 3.1
1649
//	 */
1650
//	public char[] getTypeName() {
1651
//		return this.typeName;
1652
//	}
1653
//
1654
//	/**
1655
//	 * Returns the parameter package names of the method
1656
//	 * relevant in the context, or <code>null</code> if none.
1657
//	 * <p>
1658
//	 * This field is available for the following kinds of
1659
//	 * completion proposals:
1660
//	 * <ul>
1661
//	 * 	<li><code>ANONYMOUS_CLASS_DECLARATION</code> - parameter package names
1662
//	 * of the constructor that is being invoked</li>
1663
//	 * 	<li><code>METHOD_REF</code> - parameter package names
1664
//	 * of the method that is referenced</li>
1665
//	 * 	<li><code>METHOD_DECLARATION</code> - parameter package names
1666
//	 * of the method that is being implemented or overridden</li>
1667
//	 * </ul>
1668
//	 * For kinds of completion proposals, this method returns
1669
//	 * <code>null</code>. Clients must not modify the array
1670
//	 * returned.
1671
//	 * </p>
1672
//	 *
1673
//	 * @return the package name, or <code>null</code> if none
1674
//	 *
1675
//	 * @see #getDeclarationSignature()
1676
//	 * @see #getSignature()
1677
//	 *
1678
//	 * @since 3.1
1679
//	 */
1680
//	public char[][] getParameterPackageNames() {
1681
//		return this.parameterPackageNames;
1682
//	}
1683
//
1684
//	/**
1685
//	 * Returns the parameter type names without the package fragment of
1686
//	 * the method relevant in the context, or <code>null</code> if none.
1687
//	 * <p>
1688
//	 * This field is available for the following kinds of
1689
//	 * completion proposals:
1690
//	 * <ul>
1691
//	 * 	<li><code>ANONYMOUS_CLASS_DECLARATION</code> - parameter type names
1692
//	 * of the constructor that is being invoked</li>
1693
//	 * 	<li><code>METHOD_REF</code> - parameter type names
1694
//	 * of the method that is referenced</li>
1695
//	 * 	<li><code>METHOD_DECLARATION</code> - parameter type names
1696
//	 * of the method that is being implemented or overridden</li>
1697
//	 * </ul>
1698
//	 * For kinds of completion proposals, this method returns
1699
//	 * <code>null</code>. Clients must not modify the array
1700
//	 * returned.
1701
//	 * </p>
1702
//	 *
1703
//	 * @return the package name, or <code>null</code> if none
1704
//	 *
1705
//	 * @see #getDeclarationSignature()
1706
//	 * @see #getSignature()
1707
//	 *
1708
//	 * @since 3.1
1709
//	 */
1710
//	public char[][] getParameterTypeNames() {
1711
//		return this.parameterTypeNames;
1712
//	}
1713
1714
	/**
1319
	/**
1715
	 * Sets the signature of the method, field type, member type,
1320
	 * Sets the signature of the method, field type, member type,
1716
	 * relevant in the context, or <code>null</code> if none.
1321
	 * relevant in the context, or <code>null</code> if none.
Lines 1725-1731 Link Here
1725
	 * @param signature the signature, or <code>null</code> if none
1330
	 * @param signature the signature, or <code>null</code> if none
1726
	 */
1331
	 */
1727
	public void setSignature(char[] signature) {
1332
	public void setSignature(char[] signature) {
1728
		this.signature = signature;
1333
		// default overridden by concrete implementation
1729
	}
1334
	}
1730
1335
1731
	/**
1336
	/**
Lines 1743-1749 Link Here
1743
     * @since 3.1
1348
     * @since 3.1
1744
	 */
1349
	 */
1745
	public void setKey(char[] key) {
1350
	public void setKey(char[] key) {
1746
		this.key = key;
1351
		// default overridden by concrete implementation
1747
	}
1352
	}
1748
1353
1749
	/**
1354
	/**
Lines 1809-1815 Link Here
1809
	 * @see Flags
1414
	 * @see Flags
1810
	 */
1415
	 */
1811
	public int getFlags() {
1416
	public int getFlags() {
1812
		return this.flags;
1417
		return -1; // default overridden by concrete implementation
1813
	}
1418
	}
1814
1419
1815
	/**
1420
	/**
Lines 1826-1832 Link Here
1826
	 * <code>Flags.AccDefault</code> if none
1431
	 * <code>Flags.AccDefault</code> if none
1827
	 */
1432
	 */
1828
	public void setFlags(int flags) {
1433
	public void setFlags(int flags) {
1829
		this.flags = flags;
1434
		// default overridden by concrete implementation
1830
	}
1435
	}
1831
1436
1832
	/**
1437
	/**
Lines 1880-1886 Link Here
1880
	 * @since 3.3
1485
	 * @since 3.3
1881
	 */
1486
	 */
1882
	public CompletionProposal[] getRequiredProposals() {
1487
	public CompletionProposal[] getRequiredProposals() {
1883
		return this.requiredProposals;
1488
		return null; // default overridden by concrete implementation
1884
	}
1489
	}
1885
1490
1886
1491
Lines 1899-1905 Link Here
1899
     * @since 3.3
1504
     * @since 3.3
1900
	 */
1505
	 */
1901
	public void setRequiredProposals(CompletionProposal[] proposals) {
1506
	public void setRequiredProposals(CompletionProposal[] proposals) {
1902
		this.requiredProposals = proposals;
1507
		// default overridden by concrete implementation
1903
	}
1508
	}
1904
1509
1905
	/**
1510
	/**
Lines 1920-1984 Link Here
1920
	 * or not available or not relevant
1525
	 * or not available or not relevant
1921
	 */
1526
	 */
1922
	public char[][] findParameterNames(IProgressMonitor monitor) {
1527
	public char[][] findParameterNames(IProgressMonitor monitor) {
1923
		if (!this.parameterNamesComputed) {
1528
		return null; // default overridden by concrete implementation
1924
			this.parameterNamesComputed = true;
1925
1926
			switch(this.completionKind) {
1927
				case ANONYMOUS_CLASS_DECLARATION:
1928
					try {
1929
						this.parameterNames = findMethodParameterNames(
1930
								this.declarationPackageName,
1931
								this.declarationTypeName,
1932
								CharOperation.lastSegment(this.declarationTypeName, '.'),
1933
								Signature.getParameterTypes(this.originalSignature == null ? this.signature : this.originalSignature));
1934
					} catch(IllegalArgumentException e) {
1935
						// protection for invalid signature
1936
						if(this.parameterTypeNames != null) {
1937
							this.parameterNames =  createDefaultParameterNames(this.parameterTypeNames.length);
1938
						} else {
1939
							this.parameterNames = null;
1940
						}
1941
					}
1942
					break;
1943
				case METHOD_REF:
1944
				case METHOD_REF_WITH_CASTED_RECEIVER:
1945
					try {
1946
						this.parameterNames = findMethodParameterNames(
1947
								this.declarationPackageName,
1948
								this.declarationTypeName,
1949
								this.name,
1950
								Signature.getParameterTypes(this.originalSignature == null ? this.signature : this.originalSignature));
1951
					} catch(IllegalArgumentException e) {
1952
						// protection for invalid signature
1953
						if(this.parameterTypeNames != null) {
1954
							this.parameterNames =  createDefaultParameterNames(this.parameterTypeNames.length);
1955
						} else {
1956
							this.parameterNames = null;
1957
						}
1958
					}
1959
					break;
1960
				case METHOD_DECLARATION:
1961
					try {
1962
						this.parameterNames = findMethodParameterNames(
1963
								this.declarationPackageName,
1964
								this.declarationTypeName,
1965
								this.name,
1966
								Signature.getParameterTypes(this.originalSignature == null ? this.signature : this.originalSignature));
1967
					} catch(IllegalArgumentException e) {
1968
						// protection for invalid signature
1969
						if(this.parameterTypeNames != null) {
1970
							this.parameterNames =  createDefaultParameterNames(this.parameterTypeNames.length);
1971
						} else {
1972
							this.parameterNames = null;
1973
						}
1974
					}
1975
					if(this.parameterNames != null) {
1976
						this.updateCompletion = true;
1977
					}
1978
					break;
1979
			}
1980
		}
1981
		return this.parameterNames;
1982
	}
1529
	}
1983
1530
1984
	/**
1531
	/**
Lines 1993-2000 Link Here
1993
	 * @param parameterNames the parameter names, or <code>null</code> if none
1540
	 * @param parameterNames the parameter names, or <code>null</code> if none
1994
	 */
1541
	 */
1995
	public void setParameterNames(char[][] parameterNames) {
1542
	public void setParameterNames(char[][] parameterNames) {
1996
		this.parameterNames = parameterNames;
1543
		// default overridden by concrete implementation
1997
		this.parameterNamesComputed = true;
1998
	}
1544
	}
1999
1545
2000
	/**
1546
	/**
Lines 2018-2024 Link Here
2018
	 * @since 3.1
1564
	 * @since 3.1
2019
	 */
1565
	 */
2020
	public int getAccessibility() {
1566
	public int getAccessibility() {
2021
		return this.accessibility;
1567
		return -1; // default overridden by concrete implementation
2022
	}
1568
	}
2023
1569
2024
	/**
1570
	/**
Lines 2040-2052 Link Here
2040
	 * @since 3.1
1586
	 * @since 3.1
2041
	 */
1587
	 */
2042
	public boolean isConstructor() {
1588
	public boolean isConstructor() {
2043
		return this.isConstructor;
1589
		return false; // default overridden by concrete implementation
2044
	}
1590
	}
2045
1591
2046
	private int receiverStart;
2047
	private int receiverEnd;
2048
	private char[] receiverSignature;
2049
2050
	/**
1592
	/**
2051
	 * Returns the type signature or package name of the relevant
1593
	 * Returns the type signature or package name of the relevant
2052
	 * receiver in the context, or <code>null</code> if none.
1594
	 * receiver in the context, or <code>null</code> if none.
Lines 2071-2077 Link Here
2071
	 * @since 3.4
1613
	 * @since 3.4
2072
	 */
1614
	 */
2073
	public char[] getReceiverSignature() {
1615
	public char[] getReceiverSignature() {
2074
		return this.receiverSignature;
1616
		return null; // default overridden by concrete implementation
2075
	}
1617
	}
2076
1618
2077
	/**
1619
	/**
Lines 2095-2101 Link Here
2095
	 * @since 3.4
1637
	 * @since 3.4
2096
	 */
1638
	 */
2097
	public int getReceiverStart() {
1639
	public int getReceiverStart() {
2098
		return this.receiverStart;
1640
		return -1; // default overridden by concrete implementation
2099
	}
1641
	}
2100
1642
2101
	/**
1643
	/**
Lines 2118-2124 Link Here
2118
	 * @since 3.4
1660
	 * @since 3.4
2119
	 */
1661
	 */
2120
	public int getReceiverEnd() {
1662
	public int getReceiverEnd() {
2121
		return this.receiverEnd;
1663
		return -1; // default overridden by concrete implementation
2122
	}
1664
	}
2123
1665
2124
	/**
1666
	/**
Lines 2138-2144 Link Here
2138
	 * @since 3.4
1680
	 * @since 3.4
2139
	 */
1681
	 */
2140
	public void setReceiverSignature(char[] signature) {
1682
	public void setReceiverSignature(char[] signature) {
2141
		this.receiverSignature = signature;
1683
		// default overridden by concrete implementation
2142
	}
1684
	}
2143
1685
2144
	/**
1686
	/**
Lines 2156-2278 Link Here
2156
	 * @since 3.4
1698
	 * @since 3.4
2157
	 */
1699
	 */
2158
	public void setReceiverRange(int startIndex, int endIndex) {
1700
	public void setReceiverRange(int startIndex, int endIndex) {
2159
		this.receiverStart = startIndex;
1701
		// default overridden by concrete implementation
2160
		this.receiverEnd = endIndex;
2161
	}
2162
2163
	public String toString() {
2164
		StringBuffer buffer = new StringBuffer();
2165
		buffer.append('[');
2166
		switch(this.completionKind) {
2167
			case CompletionProposal.ANONYMOUS_CLASS_DECLARATION :
2168
				buffer.append("ANONYMOUS_CLASS_DECLARATION"); //$NON-NLS-1$
2169
				break;
2170
			case CompletionProposal.FIELD_REF :
2171
				buffer.append("FIELD_REF"); //$NON-NLS-1$
2172
				break;
2173
			case CompletionProposal.KEYWORD :
2174
				buffer.append("KEYWORD"); //$NON-NLS-1$
2175
				break;
2176
			case CompletionProposal.LABEL_REF :
2177
				buffer.append("LABEL_REF"); //$NON-NLS-1$
2178
				break;
2179
			case CompletionProposal.LOCAL_VARIABLE_REF :
2180
				buffer.append("LOCAL_VARIABLE_REF"); //$NON-NLS-1$
2181
				break;
2182
			case CompletionProposal.METHOD_DECLARATION :
2183
				buffer.append("METHOD_DECLARATION"); //$NON-NLS-1$
2184
				if(this.isConstructor) {
2185
					buffer.append("<CONSTRUCTOR>"); //$NON-NLS-1$
2186
				}
2187
				break;
2188
			case CompletionProposal.METHOD_REF :
2189
				buffer.append("METHOD_REF"); //$NON-NLS-1$
2190
				if(this.isConstructor) {
2191
					buffer.append("<CONSTRUCTOR>"); //$NON-NLS-1$
2192
				}
2193
				break;
2194
			case CompletionProposal.PACKAGE_REF :
2195
				buffer.append("PACKAGE_REF"); //$NON-NLS-1$
2196
				break;
2197
			case CompletionProposal.TYPE_REF :
2198
				buffer.append("TYPE_REF"); //$NON-NLS-1$
2199
				break;
2200
			case CompletionProposal.VARIABLE_DECLARATION :
2201
				buffer.append("VARIABLE_DECLARATION"); //$NON-NLS-1$
2202
				break;
2203
			case CompletionProposal.POTENTIAL_METHOD_DECLARATION :
2204
				buffer.append("POTENTIAL_METHOD_DECLARATION"); //$NON-NLS-1$
2205
				break;
2206
			case CompletionProposal.METHOD_NAME_REFERENCE :
2207
				buffer.append("METHOD_IMPORT"); //$NON-NLS-1$
2208
				break;
2209
			case CompletionProposal.ANNOTATION_ATTRIBUTE_REF :
2210
				buffer.append("ANNOTATION_ATTRIBUTE_REF"); //$NON-NLS-1$
2211
				break;
2212
			case CompletionProposal.JAVADOC_BLOCK_TAG :
2213
				buffer.append("JAVADOC_BLOCK_TAG"); //$NON-NLS-1$
2214
				break;
2215
			case CompletionProposal.JAVADOC_INLINE_TAG :
2216
				buffer.append("JAVADOC_INLINE_TAG"); //$NON-NLS-1$
2217
				break;
2218
			case CompletionProposal.JAVADOC_FIELD_REF:
2219
				buffer.append("JAVADOC_FIELD_REF"); //$NON-NLS-1$
2220
				break;
2221
			case CompletionProposal.JAVADOC_METHOD_REF :
2222
				buffer.append("JAVADOC_METHOD_REF"); //$NON-NLS-1$
2223
				break;
2224
			case CompletionProposal.JAVADOC_TYPE_REF :
2225
				buffer.append("JAVADOC_TYPE_REF"); //$NON-NLS-1$
2226
				break;
2227
			case CompletionProposal.JAVADOC_PARAM_REF :
2228
				buffer.append("JAVADOC_PARAM_REF"); //$NON-NLS-1$
2229
				break;
2230
			case CompletionProposal.JAVADOC_VALUE_REF :
2231
				buffer.append("JAVADOC_VALUE_REF"); //$NON-NLS-1$
2232
				break;
2233
			case CompletionProposal.FIELD_IMPORT :
2234
				buffer.append("FIELD_IMPORT"); //$NON-NLS-1$
2235
				break;
2236
			case CompletionProposal.METHOD_IMPORT :
2237
				buffer.append("METHOD_IMPORT"); //$NON-NLS-1$
2238
				break;
2239
			case CompletionProposal.TYPE_IMPORT :
2240
				buffer.append("TYPE_IMPORT"); //$NON-NLS-1$
2241
				break;
2242
			case CompletionProposal.METHOD_REF_WITH_CASTED_RECEIVER :
2243
				buffer.append("METHOD_REF_WITH_CASTED_RECEIVER"); //$NON-NLS-1$
2244
				break;
2245
			case CompletionProposal.FIELD_REF_WITH_CASTED_RECEIVER :
2246
				buffer.append("FIELD_REF_WITH_CASTED_RECEIVER"); //$NON-NLS-1$
2247
				break;
2248
			default :
2249
				buffer.append("PROPOSAL"); //$NON-NLS-1$
2250
				break;
2251
2252
		}
2253
		buffer.append("]{completion:"); //$NON-NLS-1$
2254
		if (this.completion != null) buffer.append(this.completion);
2255
		buffer.append(", declSign:"); //$NON-NLS-1$
2256
		if (this.declarationSignature != null) buffer.append(this.declarationSignature);
2257
		buffer.append(", sign:"); //$NON-NLS-1$
2258
		if (this.signature != null) buffer.append(this.signature);
2259
		buffer.append(", declKey:"); //$NON-NLS-1$
2260
		if (this.declarationKey != null) buffer.append(this.declarationKey);
2261
		buffer.append(", key:"); //$NON-NLS-1$
2262
		if (this.key != null) buffer.append(this.key);
2263
		buffer.append(", name:"); //$NON-NLS-1$
2264
		if (this.name != null) buffer.append(this.name);
2265
		buffer.append(", replace:["); //$NON-NLS-1$
2266
		buffer.append(this.replaceStart);
2267
		buffer.append(',');
2268
		buffer.append(this.replaceEnd);
2269
		buffer.append("], token:["); //$NON-NLS-1$
2270
		buffer.append(this.tokenStart);
2271
		buffer.append(',');
2272
		buffer.append(this.tokenEnd);
2273
		buffer.append("], relevance:"); //$NON-NLS-1$
2274
		buffer.append(this.relevance);
2275
		buffer.append('}');
2276
		return buffer.toString();
2277
	}
1702
	}
2278
}
1703
}

Return to bug 245858