01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jdt.internal.codeassist.select;
11:
12: /*
13: * Selection node build by the parser in any case it was intending to
14: * reduce a super reference containing the assist identifier.
15: * e.g.
16: *
17: * class X extends Z {
18: * class Y {
19: * void foo() {
20: * [start]super[end].bar();
21: * }
22: * }
23: * }
24: *
25: * ---> class X {
26: * class Y {
27: * void foo() {
28: * <SelectOnQualifiedSuper:super>
29: * }
30: * }
31: * }
32: *
33: */
34:
35: import org.eclipse.jdt.internal.compiler.ast.SuperReference;
36: import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
37: import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
38:
39: public class SelectionOnSuperReference extends SuperReference {
40:
41: public SelectionOnSuperReference(int pos, int sourceEnd) {
42: super (pos, sourceEnd);
43: }
44:
45: public StringBuffer printExpression(int indent, StringBuffer output) {
46:
47: output.append("<SelectOnSuper:"); //$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: }
|