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
9 * IBM Corporation - initial API and implementation
10 ******************************************************************************/
11 package net.sourceforge.phpdt.internal.codeassist.complete;
14 * Completion node build by the parser in any case it was intending to
15 * reduce a type reference containing the completion identifier as a single
19 * class X extends Obj[cursor]
21 * ---> class X extends <CompleteOnType:Obj>
23 * The source range of the completion node denotes the source range
24 * which should be replaced by the completion.
27 import net.sourceforge.phpdt.internal.compiler.ast.*;
28 import net.sourceforge.phpdt.internal.compiler.lookup.*;
30 public class CompletionOnSingleTypeReference extends SingleTypeReference {
31 public boolean isCompletionNode;
32 public CompletionOnSingleTypeReference(char[] source, long pos) {
34 isCompletionNode = true;
36 public void aboutToResolve(Scope scope) {
37 getTypeBinding(scope);
40 * No expansion of the completion reference into an array one
42 public TypeReference copyDims(int dim){
45 public TypeBinding getTypeBinding(Scope scope) {
46 if(isCompletionNode) {
47 throw new CompletionNodeFound(this, scope);
49 return super.getTypeBinding(scope);
52 public TypeBinding resolveTypeEnclosing(BlockScope scope, ReferenceBinding enclosingType) {
53 if(isCompletionNode) {
54 throw new CompletionNodeFound(this, enclosingType, scope);
56 return super.resolveTypeEnclosing(scope, enclosingType);
59 public String toStringExpression(int tab){
61 return "<CompleteOnType:" + new String(token) + ">" ; //$NON-NLS-2$ //$NON-NLS-1$