KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > codeassist > complete > CompletionOnFieldType


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.internal.codeassist.complete;
12
13 /*
14  * Completion node build by the parser in any case it was intending to
15  * reduce an type reference located as a potential return type for a class
16  * member, containing the cursor location.
17  * This node is only a fake-field wrapper of the actual completion node
18  * which is accessible as the fake-field type.
19  * e.g.
20  *
21  * class X {
22  * Obj[cursor]
23  * }
24  *
25  * ---> class X {
26  * <CompleteOnType:Obj>;
27  * }
28  *
29  * The source range is always of length 0.
30  * The arguments of the allocation expression are all the arguments defined
31  * before the cursor.
32  */

33  
34 import org.eclipse.jdt.core.compiler.CharOperation;
35 import org.eclipse.jdt.internal.compiler.ast.*;
36
37 public class CompletionOnFieldType extends FieldDeclaration {
38     public boolean isLocalVariable;
39     
40 public CompletionOnFieldType(TypeReference type, boolean isLocalVariable){
41     super();
42     this.sourceStart = type.sourceStart;
43     this.sourceEnd = type.sourceEnd;
44     this.type = type;
45     this.name = CharOperation.NO_CHAR;
46     this.isLocalVariable = isLocalVariable;
47     if (type instanceof CompletionOnSingleTypeReference) {
48         ((CompletionOnSingleTypeReference) type).fieldTypeCompletionNode = this;
49     }
50 }
51
52 public StringBuffer JavaDoc printStatement(int tab, StringBuffer JavaDoc output) {
53     return type.print(tab, output).append(';');
54 }
55 }
56
Popular Tags