ed517e9ba8a07709b07905ae4c497b5ab44cf277
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / codeassist / complete / CompletionOnSingleNameReference.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 a single name reference containing the completion identifier.
16  * e.g.
17  *
18  *      class X {
19  *    void foo() {
20  *      ba[cursor]
21  *    }
22  *  }
23  *
24  *      ---> class X {
25  *         void foo() {
26  *           <CompleteOnName:ba>
27  *         }
28  *       }
29  *
30  * The source range of the completion node denotes the source range
31  * which should be replaced by the completion.
32  */
33
34 import net.sourceforge.phpdt.internal.compiler.ast.*;
35 import net.sourceforge.phpdt.internal.compiler.lookup.*;
36  
37 public class CompletionOnSingleNameReference extends SingleNameReference {
38 public CompletionOnSingleNameReference(char[] source, long pos) {
39         super(source, pos);
40 }
41 public TypeBinding resolveType(BlockScope scope) {
42         throw new CompletionNodeFound(this, scope);
43 }
44 public String toStringExpression() {
45         return "<CompleteOnName:" + super.toStringExpression() + ">"; //$NON-NLS-2$ //$NON-NLS-1$
46 }
47 }