public static SubjectControlContentAssistant createJavaContentAssistant(IContentAssistProcessor processor) { final SubjectControlContentAssistant contentAssistant= new SubjectControlContentAssistant(); contentAssistant.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE); ContentAssistPreference.configure(contentAssistant, JavaPlugin.getDefault().getPreferenceStore()); contentAssistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE); contentAssistant.setInformationControlCreator(new IInformationControlCreator() { public IInformationControl createInformationControl(Shell parent) { return new DefaultInformationControl(parent, SWT.NONE, new HTMLTextPresenter(true)); } }); return contentAssistant; }
/** * {@inheritDoc} */ public String showPossibleCompletions() { possibleCompletionsVisible = true; return super.showPossibleCompletions(); }
@Override protected void focusLost() { if (fContentAssistant != null && fContentAssistant.hasProposalPopupFocus()) { // skip focus lost if it went to the content assist popup } else { super.focusLost(); } }
/** * 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(); } }
/** * 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 ) ); }
/** * Disable content assist. */ private void disable() { if (! fControl.isDisposed()) { fContentAssistant.uninstall(); fContentAssistSubjectAdapter.setContentAssistCueProvider(null); fControl.removeFocusListener(fFocusListener); fFocusListener= null; if (fHandlerActivation != null) deactivateHandler(); } }
public static SubjectControlContentAssistant createContentAssistant(boolean isFind) { final SubjectControlContentAssistant contentAssistant= new SubjectControlContentAssistant(); contentAssistant.setRestoreCompletionProposalSize(SearchPlugin.getDefault().getDialogSettings()); IContentAssistProcessor processor= new RegExContentAssistProcessor(isFind); contentAssistant.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE); contentAssistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE); contentAssistant.setInformationControlCreator(new IInformationControlCreator() { /* * @see org.eclipse.jface.text.IInformationControlCreator#createInformationControl(org.eclipse.swt.widgets.Shell) */ public IInformationControl createInformationControl(Shell parent) { return new DefaultInformationControl(parent); }}); return contentAssistant; }
/** * Installs content assist on the given text viewer. * * @param viewer the text viewer */ public void install( ITextViewer viewer ) { control = viewer.getTextWidget(); control.addFocusListener( this ); // stop traversal (ESC) if popup is shown control.addTraverseListener( new TraverseListener() { public void keyTraversed( TraverseEvent e ) { if ( possibleCompletionsVisible ) { e.doit = false; } } } ); super.install( viewer ); }
@Override public Object execute(ExecutionEvent event) throws ExecutionException { if (ContentAssistHandler.this.isEnabled()) // don't call AbstractHandler#isEnabled()! fContentAssistant.showPossibleCompletions(); return null; } };
/** * Disable content assist. */ private void disable() { if (! fControl.isDisposed()) { fContentAssistant.uninstall(); fContentAssistSubjectAdapter.setContentAssistCueProvider(null); fControl.removeFocusListener(fFocusListener); fFocusListener= null; if (fHandlerActivation != null) deactivateHandler(); } }
@Override protected void focusLost() { if (fContentAssistant != null && fContentAssistant.hasProposalPopupFocus()) { // skip focus lost if it went to the content assist popup } else { super.focusLost(); } }
public static SubjectControlContentAssistant createJavaContentAssistant(IContentAssistProcessor processor) { final SubjectControlContentAssistant contentAssistant= new SubjectControlContentAssistant(); contentAssistant.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE); ContentAssistPreference.configure(contentAssistant, JavaPlugin.getDefault().getPreferenceStore()); contentAssistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE); contentAssistant.setInformationControlCreator(new IInformationControlCreator() { @Override public IInformationControl createInformationControl(Shell parent) { return new DefaultInformationControl(parent, JavaPlugin.getAdditionalInfoAffordanceString()); } }); return contentAssistant; }
/** * Enable content assist. */ private void enable() { if (! fControl.isDisposed()) { fContentAssistant.install(fContentAssistSubjectAdapter); installCueLabelProvider(); installFocusListener(); if (fControl.isFocusControl()) activateHandler(); } }
public Object execute(ExecutionEvent event) throws ExecutionException { if (ContentAssistHandler.this.isEnabled()) // don't call AbstractHandler#isEnabled()! fContentAssistant.showPossibleCompletions(); return null; } };
/** * Uninstalls content assist on the control. */ public void uninstall() { if ( handlerActivation != null ) { IHandlerService handlerService = ( IHandlerService ) PlatformUI.getWorkbench().getAdapter( IHandlerService.class ); handlerService.deactivateHandler( handlerActivation ); handlerActivation = null; } if ( control != null ) { control.removeFocusListener( this ); } super.uninstall(); }
protected void focusLost() { if (fContentAssistant != null && fContentAssistant.hasProposalPopupFocus()) { // skip focus lost if it went to the content assist popup } else { super.focusLost(); } }
public static SubjectControlContentAssistant createJavaContentAssistant(IContentAssistProcessor processor) { final SubjectControlContentAssistant contentAssistant= new SubjectControlContentAssistant(); contentAssistant.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE); ContentAssistPreference.configure(contentAssistant, JavaPlugin.getDefault().getPreferenceStore()); contentAssistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE); contentAssistant.setInformationControlCreator(new IInformationControlCreator() { @Override public IInformationControl createInformationControl(Shell parent) { return new DefaultInformationControl(parent, JavaPlugin.getAdditionalInfoAffordanceString()); } }); return contentAssistant; }
/** * Enable content assist. */ private void enable() { if (! fControl.isDisposed()) { fContentAssistant.install(fContentAssistSubjectAdapter); installCueLabelProvider(); installFocusListener(); if (fControl.isFocusControl()) activateHandler(); } }
@Override public Object execute(ExecutionEvent event) throws ExecutionException { if (ContentAssistHandler.this.isEnabled()) // don't call AbstractHandler#isEnabled()! fContentAssistant.showPossibleCompletions(); return null; } };