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.corext.refactoring.code;
11:
12: import org.eclipse.jdt.core.dom.ASTNode;
13: import org.eclipse.jdt.core.dom.Expression;
14: import org.eclipse.jdt.core.dom.IMethodBinding;
15: import org.eclipse.jdt.core.dom.ITypeBinding;
16: import org.eclipse.jdt.core.dom.rewrite.ImportRewrite;
17:
18: import org.eclipse.jdt.internal.corext.dom.CodeScopeBuilder;
19:
20: public class CallContext {
21:
22: public ASTNode invocation;
23: public String[] arguments;
24: public String receiver;
25: public boolean receiverIsStatic;
26: public CodeScopeBuilder.Scope scope;
27: public int callMode;
28: public ImportRewrite importer;
29:
30: public CallContext(ASTNode inv, CodeScopeBuilder.Scope s, int cm,
31: ImportRewrite i) {
32: super ();
33: invocation = inv;
34: scope = s;
35: callMode = cm;
36: importer = i;
37: }
38:
39: public ITypeBinding getReceiverType() {
40: Expression expression = Invocations.getExpression(invocation);
41: if (expression != null) {
42: return expression.resolveTypeBinding();
43: }
44: IMethodBinding method = Invocations.resolveBinding(invocation);
45: if (method != null) {
46: return method.getDeclaringClass();
47: }
48: return null;
49: }
50: }
|