PHPLanguagePreferencePage.spanish and PHPEditorSyntaxPreferencePage.background added...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / codeassist / complete / CompletionOnMemberAccess.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 access to a member (field reference or message send) 
16  * containing the completion identifier.
17  * e.g.
18  *
19  *      class X {
20  *    void foo() {
21  *      bar().fred[cursor]
22  *    }
23  *  }
24  *
25  *      ---> class X {
26  *         void foo() {
27  *           <CompleteOnMemberAccess:bar().fred>
28  *         }
29  *       }
30  *
31  * The source range of the completion node denotes the source range
32  * which should be replaced by the completion.
33  */
34
35 import net.sourceforge.phpdt.internal.compiler.ast.*;
36 import net.sourceforge.phpdt.internal.compiler.lookup.*;
37
38 public class CompletionOnMemberAccess extends FieldReference {
39         
40         public CompletionOnMemberAccess(char[] source, long pos) {
41                 super(source, pos);
42         }
43         
44         public TypeBinding resolveType(BlockScope scope) {
45                 TypeBinding receiverType = receiver.resolveType(scope);
46                 if (receiverType == null || receiverType.isBaseType())
47                         throw new CompletionNodeFound();
48                 else
49                         throw new CompletionNodeFound(this, receiverType, scope);
50                 // array types are passed along to find the length field
51         }
52         
53         public String toStringExpression() {
54
55                 return "<CompleteOnMemberAccess:" //$NON-NLS-1$
56                                                 + super.toStringExpression() + ">"; //$NON-NLS-1$
57         }
58 }