KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > codeassist > select > SelectionOnQualifiedSuperReference


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.internal.codeassist.select;
12
13 /*
14  * Selection node build by the parser in any case it was intending to
15  * reduce a qualified super reference containing the assist identifier.
16  * e.g.
17  *
18  * class X extends Z {
19  * class Y {
20  * void foo() {
21  * X.[start]super[end].bar();
22  * }
23  * }
24  * }
25  *
26  * ---> class X {
27  * class Y {
28  * void foo() {
29  * <SelectOnQualifiedSuper:X.super>
30  * }
31  * }
32  * }
33  *
34  */

35
36 import org.eclipse.jdt.internal.compiler.ast.QualifiedSuperReference;
37 import org.eclipse.jdt.internal.compiler.ast.TypeReference;
38 import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
39 import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
40
41 public class SelectionOnQualifiedSuperReference extends QualifiedSuperReference {
42 public SelectionOnQualifiedSuperReference(TypeReference name, int pos, int sourceEnd) {
43     super(name, pos, sourceEnd);
44 }
45 public StringBuffer JavaDoc printExpression(int indent, StringBuffer JavaDoc output) {
46
47     output.append("<SelectOnQualifiedSuper:"); //$NON-NLS-1$
48
return super.printExpression(0, output).append('>');
49 }
50
51 public TypeBinding resolveType(BlockScope scope) {
52     TypeBinding binding = super.resolveType(scope);
53
54     if (binding == null || !binding.isValidBinding())
55         throw new SelectionNodeFound();
56     else
57         throw new SelectionNodeFound(binding);
58 }
59 }
60
Popular Tags