01bfd9b9656c1b17a7f23370ab82b7ee707d8d7e
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / codeassist / complete / CompletionOnFieldType.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2001, 2002 International Business Machines Corp. and others.
3  * All rights reserved. This program and the accompanying materials 
4  * are made available under the terms of the Common Public License v0.5 
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v05.html
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  ******************************************************************************/
11 package net.sourceforge.phpdt.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 net.sourceforge.phpdt.internal.compiler.ast.*;
35 import net.sourceforge.phpdt.internal.compiler.lookup.*;
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 = NoChar;
46         this.isLocalVariable = isLocalVariable;
47 }
48 public TypeBinding getTypeBinding(Scope scope) {
49         if(type instanceof CompletionOnSingleTypeReference)
50                 throw new CompletionNodeFound(this, scope);
51         else // handle the qualified type ref directly
52                 return type.getTypeBinding(scope);
53 }
54 public String toString(int tab) {
55
56         return type.toString(tab);
57 }
58 }