|
Lines 1-5
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2000, 2009 IBM Corporation and others. |
2 |
* Copyright (c) 2000, 2010 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
|
Lines 57-83
Link Here
|
| 57 |
*/ |
57 |
*/ |
| 58 |
protected IMember resolveMember() throws JavaScriptModelException { |
58 |
protected IMember resolveMember() throws JavaScriptModelException { |
| 59 |
char[] declarationSignature= fProposal.getDeclarationSignature(); |
59 |
char[] declarationSignature= fProposal.getDeclarationSignature(); |
| 60 |
|
60 |
IFunction func = null; |
| 61 |
if (declarationSignature!=null) { |
61 |
if (declarationSignature!=null) { |
| 62 |
String typeName = SignatureUtil.stripSignatureToFQN(String |
62 |
String typeName = SignatureUtil.stripSignatureToFQN(String |
| 63 |
.valueOf(declarationSignature)); |
63 |
.valueOf(declarationSignature)); |
| 64 |
String name = String.valueOf(fProposal.getName()); |
64 |
String name = String.valueOf(fProposal.getName()); |
| 65 |
String[] parameters = Signature.getParameterTypes(String |
65 |
String[] parameters = Signature.getParameterTypes(String |
| 66 |
.valueOf(fProposal.getSignature())); |
66 |
.valueOf(fProposal.getSignature())); |
| 67 |
IType type = fJavaProject.findType(typeName); |
67 |
//search all the possible types until a match is found |
| 68 |
if (type != null) { |
68 |
IType[] types = fJavaProject.findTypes(typeName); |
| 69 |
boolean isConstructor = fProposal.isConstructor(); |
69 |
for(int i = 0; i < types.length && func != null; ++i) { |
| 70 |
|
70 |
IType type = types[i]; |
| 71 |
return findMethod(name, parameters, isConstructor, type); |
71 |
if (type != null) { |
|
|
72 |
boolean isConstructor = fProposal.isConstructor(); |
| 73 |
try { |
| 74 |
func = findMethod(name, parameters, isConstructor, type); |
| 75 |
} catch(JavaScriptModelException e) { |
| 76 |
//ignore, could not find method |
| 77 |
} |
| 78 |
} |
| 72 |
} |
79 |
} |
| 73 |
else |
80 |
|
| 74 |
{ |
81 |
if(func == null) { |
| 75 |
ITypeRoot typeRoot=fJavaProject.findTypeRoot(typeName); |
82 |
ITypeRoot typeRoot=fJavaProject.findTypeRoot(typeName); |
| 76 |
if(typeRoot != null) |
83 |
if(typeRoot != null) { |
| 77 |
return typeRoot.getFunction(name, parameters); |
84 |
func = typeRoot.getFunction(name, parameters); |
|
|
85 |
} |
| 78 |
} |
86 |
} |
| 79 |
} |
87 |
} |
| 80 |
return null; |
88 |
return func; |
| 81 |
} |
89 |
} |
| 82 |
|
90 |
|
| 83 |
/* adapted from JavaModelUtil */ |
91 |
/* adapted from JavaModelUtil */ |