Java 类org.eclipse.jface.text.source.ContentAssistantFacade 实例源码

项目:bts    文件:XtextReconciler.java   
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;
    }
}
项目:bts    文件:XtextReconciler.java   
protected void handleInputDocumentChanged(IDocument oldInput, IDocument newInput) {
    if (shouldInstallCompletionListener) {
        ContentAssistantFacade facade = ((ISourceViewerExtension4) textViewer).getContentAssistantFacade();
        if (facade != null) {
            facade.addCompletionListener(documentListener);
        }
        shouldInstallCompletionListener = false;
    }
    if (oldInput instanceof IXtextDocument) {
        ((IXtextDocument) oldInput).removeXtextDocumentContentObserver(documentListener);
    }
    if (newInput instanceof IXtextDocument) {
        ((IXtextDocument) newInput).addXtextDocumentContentObserver(documentListener);
        final IXtextDocument document = XtextDocumentUtil.get(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));
    }
}
项目:ContentAssist    文件:EditorUtilities.java   
/**
 * 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;
}
项目:bts    文件:XtextReconciler.java   
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);
            }
        }
    }
}
项目:Pydev    文件:ScriptConsoleViewerWrapper.java   
public final ContentAssistantFacade getContentAssistantFacade() {
    return viewer.getContentAssistantFacade();
}