Note that there are some explanatory texts on larger screens.

plurals
  1. POEclipse RCP - Content Assist trouble
    text
    copied!<p>I'm trying to add content assist to my editor. I've added</p> <pre><code> public IContentAssistant getContentAssistant(ISourceViewer sv) { ContentAssistant ca = new ContentAssistant(); IContentAssistProcessor pr = new TagCompletionProcessor(); ca.setContentAssistProcessor(pr, XMLPartitionScanner.XML_TAG); ca.setContentAssistProcessor(pr, IDocument.DEFAULT_CONTENT_TYPE); return ca; } </code></pre> <p>to editor configuration, then made completion processor class:</p> <pre><code>public class TagCompletionProcessor implements IContentAssistProcessor { private ITypedRegion wordRegion; private String currentWord; private SmartTreeSet tags; public TagCompletionProcessor() { tags = new SmartTreeSet(); //filling tags skipped } @Override public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) { System.out.println("compute"); wordRegion = viewer.getDocument().getDocumentPartitioner().getPartition(offset); try { int offs = wordRegion.getOffset(); int len = wordRegion.getLength(); currentWord = viewer.getDocument().get(offs, len); return tags.getProposals(currentWord.toLowerCase(), offs, len); } catch (BadLocationException e) { return null; } } @Override public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) { return null; } @Override public char[] getCompletionProposalAutoActivationCharacters() { return new char[] {'&lt;'}; } @Override public char[] getContextInformationAutoActivationCharacters() { return null; } @Override public IContextInformationValidator getContextInformationValidator() { return null; } @Override public String getErrorMessage() { return "No tags found"; } </code></pre> <p>}</p> <p>... but it's not working. Init goes normal, but auto-activation does not working and when I'm pressing ctrl-space (I've added org.eclipse.ui.edit.text.contentAssist.proposals command to Bindings ext point) empty list appearing (also it's not near cursor, but in some constant place). What am I doing wrong?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload