protected void setAutoActivation(ContentAssistant assistant) { if (contentAssistProcessor != null) { boolean activated = contentAssistProcessor.getCompletionProposalAutoActivationCharacters() != null; assistant.enableAutoActivation(activated); } }
/** * Returns the characters which when typed by the user should automatically initiate proposing * completions. The position is used to determine the appropriate content assist processor to * invoke. * * @param viewer the text viewer * @param offset a document offset * @return the auto activation characters * @see IContentAssistProcessor#getCompletionProposalAutoActivationCharacters() */ char[] getCompletionProposalAutoActivationCharacters(ITextViewer viewer, int offset) { IContentAssistProcessor p= getProcessor(viewer, offset); return p != null ? p.getCompletionProposalAutoActivationCharacters() : null; }
/** * Returns the characters which when typed by the user should automatically initiate proposing * completions. The position is used to determine the appropriate content assist processor to * invoke. * * @param contentAssistSubjectControl the content assist subject control * @param offset a document offset * @return the auto activation characters * @see IContentAssistProcessor#getCompletionProposalAutoActivationCharacters() * @since 3.0 */ char[] getCompletionProposalAutoActivationCharacters(IContentAssistSubjectControl contentAssistSubjectControl, int offset) { IContentAssistProcessor p= getProcessor(contentAssistSubjectControl, offset); return p != null ? p.getCompletionProposalAutoActivationCharacters() : null; }
/** * Returns the characters which when typed by the user should automatically * initiate proposing completions. The position is used to determine the * appropriate content assist processor to invoke. * * @param textViewer the text viewer * @param offset a document offset * @return the auto activation characters * * @see IContentAssistProcessor#getCompletionProposalAutoActivationCharacters */ private char[] getCompletionProposalAutoActivationCharacters(ITextViewer textViewer, int offset) { IContentAssistProcessor p= getProcessor(textViewer, offset); return p != null ? p.getCompletionProposalAutoActivationCharacters() : null; }
/** * Returns the characters which when typed by the user should automatically * initiate proposing completions. The position is used to determine the * appropriate content assist processor to invoke. * * @param textViewer the text viewer * @param offset a document offset * @return the auto activation characters * * @see IContentAssistProcessor#getCompletionProposalAutoActivationCharacters */ private char[] getCompletionProposalAutoActivationCharacters(ITextViewer textViewer, int offset) { IContentAssistProcessor p= getProcessor(textViewer, offset); return p != null ? p.getCompletionProposalAutoActivationCharacters() : null; }
/** * @return whether the given char is an auto-activation trigger char * @since 3.15 */ boolean isAutoActivationTriggerChar(char c) { if (fProcessors == null) return false; for (Set<IContentAssistProcessor> processorsForContentType : fProcessors.values()) { for (IContentAssistProcessor processor : processorsForContentType) { char[] triggers= processor.getCompletionProposalAutoActivationCharacters(); if (triggers != null && new String(triggers).indexOf(c) >= 0) { return true; } triggers= processor.getContextInformationAutoActivationCharacters(); if (triggers != null && new String(triggers).indexOf(c) >= 0) { return true; } } } return false; }
/** * Computes the sorted set of all auto activation trigger characters. * * @return the sorted set of all auto activation trigger characters * @since 3.1 */ private String computeAllAutoActivationTriggers() { if (fProcessors == null) return ""; //$NON-NLS-1$ StringBuffer buf= new StringBuffer(5); Iterator<Entry<String, IContentAssistProcessor>> iter= fProcessors.entrySet().iterator(); while (iter.hasNext()) { Entry<String, IContentAssistProcessor> entry= iter.next(); IContentAssistProcessor processor= entry.getValue(); char[] triggers= processor.getCompletionProposalAutoActivationCharacters(); if (triggers != null) buf.append(triggers); triggers= processor.getContextInformationAutoActivationCharacters(); if (triggers != null) buf.append(triggers); } return buf.toString(); }