@Override public boolean supportsVerifyKeyListener() { if (fContentAssistSubjectControl != null) return fContentAssistSubjectControl.supportsVerifyKeyListener(); return true; } /**
/** * {@inheritDoc} */ protected void possibleCompletionsClosed() { possibleCompletionsVisible = false; super.possibleCompletionsClosed(); }
/** * {@inheritDoc} */ protected Point restoreCompletionProposalPopupSize() { possibleCompletionsVisible = true; return super.restoreCompletionProposalPopupSize(); }
/** * Installs content assist on the given combo. * * @param combo the combo */ public void install( Combo combo ) { control = combo; control.addFocusListener( this ); super.install( new ComboContentAssistSubjectAdapter( combo ) ); }
/** * Installs content assist on the given text. * * @param text the text */ public void install( Text text ) { control = text; control.addFocusListener( this ); super.install( new TextContentAssistSubjectAdapter( text ) ); }
/** * Disable content assist. */ private void disable() { if (! fControl.isDisposed()) { fContentAssistant.uninstall(); fContentAssistSubjectAdapter.setContentAssistCueProvider(null); fControl.removeFocusListener(fFocusListener); fFocusListener= null; if (fHandlerActivation != null) deactivateHandler(); } }
/** * {@inheritDoc} */ public String showPossibleCompletions() { possibleCompletionsVisible = true; return super.showPossibleCompletions(); }
/** * Creates a new {@link ContentAssistHandler} for the given {@link Combo}. * Only a single {@link ContentAssistHandler} may be installed on a {@link Combo} instance. * Content Assist is enabled by default. * * @param combo target combo * @param contentAssistant a configured content assistant * @return a new {@link ContentAssistHandler} */ public static ContentAssistHandler createHandlerForCombo(Combo combo, SubjectControlContentAssistant contentAssistant) { return new ContentAssistHandler(combo, new ComboContentAssistSubjectAdapter(combo), contentAssistant); }
/** * Create and install the {@link LabelProvider} for fContentAssistSubjectAdapter. */ private void installCueLabelProvider() { ILabelProvider labelProvider= new LabelProvider() { @Override public String getText(Object element) { IBindingService bindingService= PlatformUI.getWorkbench().getAdapter(IBindingService.class); TriggerSequence[] activeBindings= bindingService.getActiveBindingsFor(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); if (activeBindings.length == 0) return ContentAssistMessages.ContentAssistHandler_contentAssistAvailable; return NLSUtility.format(ContentAssistMessages.ContentAssistHandler_contentAssistAvailableWithKeyBinding, activeBindings[0].format()); } }; fContentAssistSubjectAdapter.setContentAssistCueProvider(labelProvider); }
@Override protected void focusLost() { if (fContentAssistant != null && fContentAssistant.hasProposalPopupFocus()) { // skip focus lost if it went to the content assist popup } else { super.focusLost(); } }
@Override public void setEventConsumer(IEventConsumer eventConsumer) { if (fContentAssistSubjectControl != null) fContentAssistSubjectControl.setEventConsumer(eventConsumer); else fViewer.setEventConsumer(eventConsumer); }
/** * Installs this adapter's information validator on the given context frame. * * @param frame the context frame */ public void installValidator(ContextFrame frame) { if (fContentAssistSubjectControl != null) { if (frame.fValidator instanceof ISubjectControlContextInformationValidator) ((ISubjectControlContextInformationValidator)frame.fValidator).install(frame.fInformation, fContentAssistSubjectControl, frame.fOffset); } else frame.fValidator.install(frame.fInformation, fViewer, frame.fOffset); }
@Override public Point getSelectedRange() { if (fContentAssistSubjectControl != null) return fContentAssistSubjectControl.getSelectedRange(); return fViewer.getSelectedRange(); }
/** * Installs this adapter's information presenter on the given context frame. * * @param frame the context frame */ public void installContextInformationPresenter(ContextFrame frame) { if (fContentAssistSubjectControl != null) { if (frame.fPresenter instanceof ISubjectControlContextInformationPresenter) ((ISubjectControlContextInformationPresenter)frame.fValidator).install(frame.fInformation, fContentAssistSubjectControl, frame.fBeginOffset); } else frame.fPresenter.install(frame.fInformation, fViewer, frame.fBeginOffset); }
@Override public IDocument getDocument() { IDocument document= (IDocument)fText.getData("document"); //$NON-NLS-1$ if (document == null) { document= new InternalDocument() ; fText.setData("document", document); //$NON-NLS-1$ } return document; }
@Override public IDocument getDocument() { IDocument document= (IDocument)fCombo.getData("document"); //$NON-NLS-1$ if (document == null) { document= new InternalDocument() ; fCombo.setData("document", document); //$NON-NLS-1$ } return document; }
/** * Disable content assist. */ private void disable() { if (! fControl.isDisposed()) { fContentAssistant.uninstall(); fContentAssistSubjectAdapter.setContentAssistCueProvider(null); fControl.removeFocusListener(fFocusListener); fFocusListener= null; if (fHandlerActivation != null) deactivateHandler(); } }
public Object execute(ExecutionEvent event) throws ExecutionException { if (ContentAssistHandler.this.isEnabled()) // don't call AbstractHandler#isEnabled()! fContentAssistant.showPossibleCompletions(); return null; } };
/** * Creates a new {@link ContentAssistHandler} for the given {@link Combo}. * Only a single {@link ContentAssistHandler} may be installed on a {@link Combo} instance. * Content Assist is enabled by default. * * @param combo target combo * @param contentAssistant a configured content assistant * @return a new {@link ContentAssistHandler} */ public static ContentAssistHandler createHandlerForCombo(Combo combo, SubjectControlContentAssistant contentAssistant) { return new ContentAssistHandler(combo, new ComboContentAssistSubjectAdapter(combo), contentAssistant); }
@Override public boolean supportsVerifyKeyListener() { if (fContentAssistSubjectControl != null) return fContentAssistSubjectControl.supportsVerifyKeyListener(); return true; } /**