Search in sources :

Example 1 with IReconcilingStrategyExtension

use of org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension in project xtext-eclipse by eclipse.

the class SpellingQuickfixTest method computeQuickAssistProposals.

protected ICompletionProposal[] computeQuickAssistProposals(int offset) {
    XtextSourceViewer sourceViewer = getSourceViewer();
    XtextReconciler reconciler = (XtextReconciler) sourceViewer.getAdapter(IReconciler.class);
    IReconcilingStrategyExtension reconcilingStrategyExtension = (IReconcilingStrategyExtension) reconciler.getReconcilingStrategy("");
    reconcilingStrategyExtension.initialReconcile();
    QuickAssistAssistant quickAssistAssistant = (QuickAssistAssistant) sourceViewer.getQuickAssistAssistant();
    IQuickAssistProcessor quickAssistProcessor = quickAssistAssistant.getQuickAssistProcessor();
    ICompletionProposal[] quickAssistProposals = quickAssistProcessor.computeQuickAssistProposals(new TextInvocationContext(sourceViewer, offset, -1));
    return quickAssistProposals;
}
Also used : IQuickAssistProcessor(org.eclipse.jface.text.quickassist.IQuickAssistProcessor) XtextReconciler(org.eclipse.xtext.ui.editor.reconciler.XtextReconciler) XtextSourceViewer(org.eclipse.xtext.ui.editor.XtextSourceViewer) IReconciler(org.eclipse.jface.text.reconciler.IReconciler) TextInvocationContext(org.eclipse.jface.text.source.TextInvocationContext) ICompletionProposal(org.eclipse.jface.text.contentassist.ICompletionProposal) QuickAssistAssistant(org.eclipse.jface.text.quickassist.QuickAssistAssistant) IReconcilingStrategyExtension(org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension)

Example 2 with IReconcilingStrategyExtension

use of org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension in project xtext-eclipse by eclipse.

the class XtextReconciler method handleInputDocumentChanged.

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.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));
    }
}
Also used : IReconcilingStrategyExtension(org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension) ContentAssistantFacade(org.eclipse.jface.text.source.ContentAssistantFacade) ISourceViewerExtension4(org.eclipse.jface.text.source.ISourceViewerExtension4) BadPositionCategoryException(org.eclipse.jface.text.BadPositionCategoryException) IXtextDocument(org.eclipse.xtext.ui.editor.model.IXtextDocument)

Example 3 with IReconcilingStrategyExtension

use of org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension in project erlide_eclipse by erlang.

the class ErlReconciler method initialProcess.

/**
 * This method is called on startup of the background activity. It is called
 * only once during the life time of the reconciler.
 */
protected void initialProcess() {
    synchronized (fMutex) {
        if (fStrategy instanceof IReconcilingStrategyExtension) {
            final IReconcilingStrategyExtension extension = (IReconcilingStrategyExtension) fStrategy;
            extension.initialReconcile();
        }
    }
}
Also used : IReconcilingStrategyExtension(org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension)

Example 4 with IReconcilingStrategyExtension

use of org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension in project erlide_eclipse by erlang.

the class ErlReconciler method setProgressMonitor.

public void setProgressMonitor(final IProgressMonitor monitor) {
    fProgressMonitor = monitor;
    if (fStrategy instanceof IReconcilingStrategyExtension) {
        final IReconcilingStrategyExtension extension = (IReconcilingStrategyExtension) fStrategy;
        extension.setProgressMonitor(monitor);
    }
}
Also used : IReconcilingStrategyExtension(org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension)

Aggregations

IReconcilingStrategyExtension (org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension)4 BadPositionCategoryException (org.eclipse.jface.text.BadPositionCategoryException)1 ICompletionProposal (org.eclipse.jface.text.contentassist.ICompletionProposal)1 IQuickAssistProcessor (org.eclipse.jface.text.quickassist.IQuickAssistProcessor)1 QuickAssistAssistant (org.eclipse.jface.text.quickassist.QuickAssistAssistant)1 IReconciler (org.eclipse.jface.text.reconciler.IReconciler)1 ContentAssistantFacade (org.eclipse.jface.text.source.ContentAssistantFacade)1 ISourceViewerExtension4 (org.eclipse.jface.text.source.ISourceViewerExtension4)1 TextInvocationContext (org.eclipse.jface.text.source.TextInvocationContext)1 XtextSourceViewer (org.eclipse.xtext.ui.editor.XtextSourceViewer)1 IXtextDocument (org.eclipse.xtext.ui.editor.model.IXtextDocument)1 XtextReconciler (org.eclipse.xtext.ui.editor.reconciler.XtextReconciler)1