use of org.eclipse.che.jdt.ui.CheActionAcces in project che by eclipse.
the class CodeAssist method convertProposals.
private Proposals convertProposals(int offset, ICompilationUnit compilationUnit, TextViewer viewer, List<ICompletionProposal> proposals) {
Proposals result = DtoFactory.getInstance().createDto(Proposals.class);
String sessionId = UUID.randomUUID().toString();
result.setSessionId(sessionId);
ArrayList<ProposalPresentation> presentations = new ArrayList<>();
for (int i = 0; i < proposals.size(); i++) {
ProposalPresentation presentation = DtoFactory.getInstance().createDto(ProposalPresentation.class);
ICompletionProposal proposal = proposals.get(i);
presentation.setIndex(i);
presentation.setDisplayString(proposal.getDisplayString());
String image = proposal.getImage() == null ? null : proposal.getImage().getImg();
presentation.setImage(image);
if (proposal instanceof ICompletionProposalExtension4) {
presentation.setAutoInsertable(((ICompletionProposalExtension4) proposal).isAutoInsertable());
}
if (proposal instanceof CheActionAcces) {
String actionId = ((CheActionAcces) proposal).getActionId();
if (actionId != null) {
presentation.setActionId(actionId);
}
}
presentations.add(presentation);
}
result.setProposals(presentations);
cache.put(sessionId, new CodeAssistContext(viewer, offset, proposals, compilationUnit));
return result;
}
Aggregations