Add field for external parser to pref page
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / codeassist / complete / CompletionOnFieldName.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 import net.sourceforge.phpdt.internal.compiler.ast.Expression;
14 import net.sourceforge.phpdt.internal.compiler.ast.FieldDeclaration;
15 import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
16 import net.sourceforge.phpdt.internal.compiler.util.CharOperation;
17
18 public class CompletionOnFieldName extends FieldDeclaration {
19         private static final char[] FAKENAMESUFFIX = " ".toCharArray(); //$NON-NLS-1$
20         public char[] realName;
21         public CompletionOnFieldName(Expression initialization, char[] name, int sourceStart, int sourceEnd) {
22                 super(initialization, CharOperation.concat(name, FAKENAMESUFFIX), sourceStart, sourceEnd); //$NON-NLS-1$
23                 this.realName = name;
24         }
25         
26         public void resolve(MethodScope initializationScope) {
27                 super.resolve(initializationScope);
28                 
29                 throw new CompletionNodeFound(this, initializationScope);
30         }
31         
32         public String toString(int tab) {
33                 String s = tabString(tab);
34                 s += "<CompleteOnFieldName:"; //$NON-NLS-1$
35                 if (type != null) s += type.toString() + " "; //$NON-NLS-1$
36                 s += new String(realName);
37                 if (initialization != null) s += " = " + initialization.toStringExpression(); //$NON-NLS-1$
38                 s += ">"; //$NON-NLS-1$
39                 return s;
40         }       
41 }
42