1 11 package org.eclipse.jdt.internal.ui.text.java; 12 13 import org.eclipse.jdt.core.CompletionProposal; 14 import org.eclipse.jdt.core.IField; 15 import org.eclipse.jdt.core.IJavaProject; 16 import org.eclipse.jdt.core.IMember; 17 import org.eclipse.jdt.core.IType; 18 import org.eclipse.jdt.core.JavaModelException; 19 20 import org.eclipse.jdt.internal.corext.template.java.SignatureUtil; 21 22 23 28 public final class FieldProposalInfo extends MemberProposalInfo { 29 30 36 public FieldProposalInfo(IJavaProject project, CompletionProposal proposal) { 37 super(project, proposal); 38 } 39 40 47 protected IMember resolveMember() throws JavaModelException { 48 char[] declarationSignature= fProposal.getDeclarationSignature(); 49 if (declarationSignature == null) 52 return null; 53 String typeName= SignatureUtil.stripSignatureToFQN(String.valueOf(declarationSignature)); 54 IType type= fJavaProject.findType(typeName); 55 if (type != null) { 56 String name= String.valueOf(fProposal.getName()); 57 IField field= type.getField(name); 58 if (field.exists()) 59 return field; 60 } 61 62 return null; 63 } 64 } 65 | Popular Tags |