/** * Returns the context information validator that should be used to determine when the currently * displayed context information should be dismissed. 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 an validator * @see IContentAssistProcessor#getContextInformationValidator() * @since 3.0 */ IContextInformationValidator getContextInformationValidator(IContentAssistSubjectControl contentAssistSubjectControl, int offset) { IContentAssistProcessor p= getProcessor(contentAssistSubjectControl, offset); return p != null ? p.getContextInformationValidator() : 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 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 context information validator that should be used to determine when the currently * displayed context information should be dismissed. The position is used to determine the * appropriate content assist processor to invoke. * * @param viewer the text viewer * @param offset a document offset * @return an validator * @see IContentAssistProcessor#getContextInformationValidator() * @since 3.0 */ IContextInformationValidator getContextInformationValidator(ITextViewer viewer, int offset) { IContentAssistProcessor p= getProcessor(viewer, offset); return p != null ? p.getContextInformationValidator() : 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 the * presentation of context information. 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#getContextInformationAutoActivationCharacters() * @since 3.0 */ char[] getContextInformationAutoActivationCharacters(ITextViewer viewer, int offset) { IContentAssistProcessor p= getProcessor(viewer, offset); return p != null ? p.getContextInformationAutoActivationCharacters() : null; }
/** * Returns the characters which when typed by the user should automatically initiate the * presentation of context information. 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#getContextInformationAutoActivationCharacters() * @since 3.0 */ char[] getContextInformationAutoActivationCharacters(IContentAssistSubjectControl contentAssistSubjectControl, int offset) { IContentAssistProcessor p= getProcessor(contentAssistSubjectControl, offset); return p != null ? p.getContextInformationAutoActivationCharacters() : null; }
/** * Returns an array of completion proposals computed based on the specified document position. * 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 an array of completion proposals * @see IContentAssistProcessor#computeCompletionProposals(ITextViewer, int) * @since 3.0 */ ICompletionProposal[] computeCompletionProposals( final IContentAssistSubjectControl contentAssistSubjectControl, final int offset) { fLastErrorMessage= null; final ICompletionProposal[][] result= { null }; final IContentAssistProcessor p= getProcessor(contentAssistSubjectControl, offset); if (p instanceof ISubjectControlContentAssistProcessor) { // Ensure that the assist session ends cleanly even if the processor throws an exception. SafeRunner.run(new ExceptionLoggingSafeRunnable(COMPLETION_ERROR_MESSAGE_KEY) { @Override public void run() throws Exception { result[0]= ((ISubjectControlContentAssistProcessor) p) .computeCompletionProposals(contentAssistSubjectControl, offset); fLastErrorMessage= p.getErrorMessage(); } }); } return result[0]; }
/** * Returns an array of completion proposals computed based on the specified document position. * The position is used to determine the appropriate content assist processor to invoke. * * @param viewer the viewer for which to compute the proposals * @param offset a document offset * @return an array of completion proposals or <code>null</code> if no proposals are possible * @see IContentAssistProcessor#computeCompletionProposals(ITextViewer, int) */ ICompletionProposal[] computeCompletionProposals(final ITextViewer viewer, final int offset) { fLastErrorMessage= null; final ICompletionProposal[][] result= { null }; final IContentAssistProcessor p= getProcessor(viewer, offset); if (p != null) { // Ensure that the assist session ends cleanly even if the processor throws an exception. SafeRunner.run(new ExceptionLoggingSafeRunnable(COMPLETION_ERROR_MESSAGE_KEY) { @Override public void run() throws Exception { result[0]= p.computeCompletionProposals(viewer, offset); fLastErrorMessage= p.getErrorMessage(); } }); } return result[0]; }
/** * Returns an array of context information objects computed based on the specified document * position. The position is used to determine the appropriate content assist processor to * invoke. * * @param viewer the viewer for which to compute the context information * @param offset a document offset * @return an array of context information objects * @see IContentAssistProcessor#computeContextInformation(ITextViewer, int) */ IContextInformation[] computeContextInformation(final ITextViewer viewer, final int offset) { fLastErrorMessage= null; final IContextInformation[][] result= { null }; final IContentAssistProcessor p= getProcessor(viewer, offset); if (p != null) { // Ensure that the assist session ends cleanly even if the processor throws an exception. SafeRunner.run(new ExceptionLoggingSafeRunnable(CONTEXT_ERROR_MESSAGE_KEY) { @Override public void run() throws Exception { result[0]= p.computeContextInformation(viewer, offset); fLastErrorMessage= p.getErrorMessage(); } }); } return result[0]; }
/** * Returns an array of context information objects computed based on the specified document * position. 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 an array of context information objects * @see IContentAssistProcessor#computeContextInformation(ITextViewer, int) * @since 3.0 */ IContextInformation[] computeContextInformation( final IContentAssistSubjectControl contentAssistSubjectControl, final int offset) { fLastErrorMessage= null; final IContextInformation[][] result= { null }; final IContentAssistProcessor p= getProcessor(contentAssistSubjectControl, offset); if (p instanceof ISubjectControlContentAssistProcessor) { // Ensure that the assist session ends cleanly even if the processor throws an exception. SafeRunner.run(new ExceptionLoggingSafeRunnable(CONTEXT_ERROR_MESSAGE_KEY) { @Override public void run() throws Exception { result[0]= ((ISubjectControlContentAssistProcessor) p) .computeContextInformation(contentAssistSubjectControl, offset); fLastErrorMessage= p.getErrorMessage(); } }); } return result[0]; }
/** * Fires a session end event to all registered {@link ICompletionListener}s. * * @since 3.2 */ void fireSessionEndEvent() { if (fContentAssistSubjectControlAdapter != null) { IContentAssistProcessor processor= getProcessor(fContentAssistSubjectControlAdapter, fContentAssistSubjectControlAdapter.getSelectedRange().x); ContentAssistEvent event= new ContentAssistEvent(this, processor); for (ICompletionListener listener : fCompletionListeners) { listener.assistSessionEnded(event); } } }
/** * Fires a session restart event to all registered {@link ICompletionListener}s. * * @since 3.4 */ void fireSessionRestartEvent() { if (fContentAssistSubjectControlAdapter != null) { IContentAssistProcessor processor= getProcessor(fContentAssistSubjectControlAdapter, fContentAssistSubjectControlAdapter.getSelectedRange().x); ContentAssistEvent event= new ContentAssistEvent(this, processor); for (ICompletionListener listener : fCompletionListeners) { if (listener instanceof ICompletionListenerExtension) ((ICompletionListenerExtension)listener).assistSessionRestarted(event); } } }
/** * Fires a session begin event to all registered {@link ICompletionListener}s. * * @param isAutoActivated <code>true</code> if this session was triggered by auto activation * @since 3.2 */ void fireSessionBeginEvent(boolean isAutoActivated) { if (fContentAssistSubjectControlAdapter != null && !isProposalPopupActive()) { IContentAssistProcessor processor= getProcessor(fContentAssistSubjectControlAdapter, fContentAssistSubjectControlAdapter.getSelectedRange().x); ContentAssistEvent event= new ContentAssistEvent(this, processor, isAutoActivated); for (ICompletionListener listener : fCompletionListeners) { listener.assistSessionStarted(event); } } }