use of org.eclipse.jdt.core.eval.IEvaluationContext in project jbosstools-hibernate by jbosstools.
the class CriteriaEditor method codeComplete.
public void codeComplete(String prefix, CompletionProposalCollector collector, int position, IJavaProject project) throws JavaModelException {
String code = getSourceViewer().getDocument().get();
code = prefix + code;
IEvaluationContext e = getEvaluationContext(project);
if (e != null) {
e.codeComplete(code, prefix.length() + position, collector);
}
}
use of org.eclipse.jdt.core.eval.IEvaluationContext in project jbosstools-hibernate by jbosstools.
the class CompletionHelper method completeOnJavaTypes.
public static ICompletionProposal[] completeOnJavaTypes(IJavaProject javaProject, Settings settings, String packageName, String start, int offset) {
if (javaProject != null) {
IEvaluationContext context = javaProject.newEvaluationContext();
if (packageName != null) {
context.setPackageName(packageName);
}
HibernateResultCollector rc = new HibernateResultCollector(javaProject);
rc.acceptContext(new CompletionContext());
// rc.reset(offset, javaProject, null);
rc.setAccepts(settings);
try {
// cannot send in my own document as it won't compile as
// java - so we just send in
// the smallest snippet possible
context.codeComplete(start, start.length(), rc);
} catch (JavaModelException jme) {
HibernateConsolePlugin.getDefault().logErrorMessage(HibernateConsoleMessages.CompletionHelper_could_not_complete_java_types, jme);
}
IJavaCompletionProposal[] results = rc.getJavaCompletionProposals();
transpose(start, offset, results);
return results;
}
return new ICompletionProposal[0];
}
Aggregations