org.eclipse.jface.text.source.ContentAssistantFacade Java Examples
The following examples show how to use
org.eclipse.jface.text.source.ContentAssistantFacade.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XtextReconciler.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@Override public void install(ITextViewer textViewer) { if (!isInstalled) { this.textViewer = textViewer; textInputListener = new TextInputListener(); textViewer.addTextInputListener(textInputListener); handleInputDocumentChanged(null, textViewer.getDocument()); if (textViewer instanceof ISourceViewerExtension4) { ContentAssistantFacade facade = ((ISourceViewerExtension4) textViewer).getContentAssistantFacade(); if (facade == null) { shouldInstallCompletionListener = true; } else { facade.addCompletionListener(documentListener); } if (strategy instanceof ISourceViewerAware) { ((ISourceViewerAware) strategy).setSourceViewer((ISourceViewer) textViewer); } } isInstalled = true; } }
Example #2
Source File: XtextReconciler.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@Override public void uninstall() { if (isInstalled) { textViewer.removeTextInputListener(textInputListener); isInstalled = false; if (documentListener != null) { if (textViewer instanceof ISourceViewerExtension4) { ContentAssistantFacade facade = ((ISourceViewerExtension4) textViewer).getContentAssistantFacade(); facade.removeCompletionListener(documentListener); } if (textViewer.getDocument() instanceof IXtextDocument) { ((IXtextDocument) textViewer.getDocument()).removeXtextDocumentContentObserver(documentListener); } } cancel(); } }
Example #3
Source File: EditorUtilities.java From ContentAssist with MIT License | 5 votes |
/** * Obtains the content assistant facade of an editor. * @param editor the editor * @return the content assistant facade of the editor */ public static ContentAssistantFacade getContentAssistantFacade(IEditorPart editor) { ISourceViewer viewer = getSourceViewer(editor); if (viewer != null && viewer instanceof SourceViewer) { return ((SourceViewer)viewer).getContentAssistantFacade(); } return null; }
Example #4
Source File: XtextReconciler.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
protected void handleInputDocumentChanged(IDocument oldInput, IDocument newInput) { if (Display.getCurrent() == null) { log.error("Changes to the document must only be applied from the Display thread to keep them ordered", new Exception()); } if (shouldInstallCompletionListener) { ContentAssistantFacade facade = ((ISourceViewerExtension4) textViewer).getContentAssistantFacade(); if (facade != null) { facade.addCompletionListener(documentListener); } shouldInstallCompletionListener = false; } if(oldInput != newInput) { if (oldInput instanceof IXtextDocument) { ((IXtextDocument) oldInput).removeXtextDocumentContentObserver(documentListener); } if (newInput instanceof IXtextDocument) { ((IXtextDocument) newInput).addXtextDocumentContentObserver(documentListener); final IXtextDocument document = xtextDocumentUtil.getXtextDocument(textViewer); strategy.setDocument(document); if (!initalProcessDone && strategy instanceof IReconcilingStrategyExtension) { initalProcessDone = true; IReconcilingStrategyExtension reconcilingStrategyExtension = (IReconcilingStrategyExtension) strategy; reconcilingStrategyExtension.initialReconcile(); } } } if (oldInput != null && newInput != null) { handleDocumentChanged(new InputChangedDocumentEvent(oldInput, newInput)); } }
Example #5
Source File: ScriptConsoleViewerWrapper.java From Pydev with Eclipse Public License 1.0 | 4 votes |
public final ContentAssistantFacade getContentAssistantFacade() { return viewer.getContentAssistantFacade(); }