Switched to Eclipse 2.1 development; eliminated JTidy package => now standalone plugin
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / codeassist / select / SelectionOnSuperReference.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.select;
12
13 /*
14  * Selection node build by the parser in any case it was intending to
15  * reduce a super reference containing the assist identifier.
16  * e.g.
17  *
18  *      class X extends Z {
19  *    class Y {
20  *      void foo() {
21  *              [start]super[end].bar();
22  *      }
23  *    }
24  *  }
25  *
26  *      ---> class X {
27  *                 class Y {
28  *           void foo() {
29  *             <SelectOnQualifiedSuper:super>
30  *           }
31  *         }
32  *       }
33  *
34  */
35
36 import net.sourceforge.phpdt.internal.compiler.ast.SuperReference;
37 import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
38 import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
39
40 public class SelectionOnSuperReference extends SuperReference {
41
42 public SelectionOnSuperReference(int pos, int sourceEnd) {
43         super(pos, sourceEnd);
44 }
45 public TypeBinding resolveType(BlockScope scope) {
46         TypeBinding binding = super.resolveType(scope);
47
48         if (binding == null || !binding.isValidBinding())
49                 throw new SelectionNodeFound();
50         else
51                 throw new SelectionNodeFound(binding);
52 }
53 public String toStringExpression(){
54
55         return "<SelectOnSuper:"+super.toStringExpression()+">"; //$NON-NLS-2$ //$NON-NLS-1$
56         
57 }
58 }