use of org.hibernate.eclipse.hqleditor.HibernateResultCollector in project jbosstools-hibernate by jbosstools.
the class FieldPropertyHandler method attributeCompletionProposals.
public ICompletionProposal[] attributeCompletionProposals(IJavaProject project, Node node, String attributeName, String start, int offset) {
// TODO: should also try to find properties getXXX()
if (project != null) {
Node parentNode = node.getParentNode();
String typename = null;
typename = this.extractor.getNearestType(project, parentNode);
if (typename == null) {
// could not locate type
return new IJavaCompletionProposal[0];
}
HibernateResultCollector rc = null;
try {
IType type = project.findType(typename);
// nothing to look for then
if (type == null)
return new ICompletionProposal[0];
rc = new HibernateResultCollector(project);
rc.acceptContext(new CompletionContext());
// TODO: only handle properties ?
rc.setAccepts(false, false, false, false, true, false);
// rc.reset(offset, javaProject, null);
type.codeComplete(start.toCharArray(), -1, start.length(), new char[0][0], new char[0][0], new int[0], false, rc);
} catch (JavaModelException jme) {
// TODO: report
}
IJavaCompletionProposal[] results = rc.getJavaCompletionProposals();
CompletionHelper.transpose(start, offset, results);
return results;
}
return new ICompletionProposal[0];
}
Aggregations