Search in sources :

Example 16 with DirtyRegion

use of org.eclipse.jface.text.reconciler.DirtyRegion in project webtools.sourceediting by eclipse.

the class ReconcileStepForValidator method validate.

protected IReconcileResult[] validate(DirtyRegion dirtyRegion, IRegion subRegion) {
    IReconcileResult[] results = EMPTY_RECONCILE_RESULT_SET;
    IFile file = getFile();
    try {
        IncrementalHelper helper = getHelper(file != null ? file.getProject() : null);
        /*
			 * Setting the URI isn't necessary for all source validators, we
			 * can still continue without it
			 */
        if (file != null && file.exists()) {
            helper.setURI(file.getFullPath().toString());
        }
        if (fValidator instanceof ISourceValidator) {
            IncrementalReporter reporter = getReporter();
            if (getScope() == IReconcileAnnotationKey.PARTIAL)
                ((ISourceValidator) fValidator).validate(dirtyRegion, helper, reporter);
            else
                ((ISourceValidator) fValidator).validate(new Region(0, getDocument().getLength()), helper, reporter);
            /*
				 * call IValidator.cleanup() during release() because this
				 * validator might be called again on a different region
				 */
            results = createAnnotations(reporter.getAnnotationInfo());
            reporter.removeAllMessages(fValidator);
        }
    } catch (Exception e) {
        Logger.logException(e);
    }
    return results;
}
Also used : IFile(org.eclipse.core.resources.IFile) IReconcileResult(org.eclipse.jface.text.reconciler.IReconcileResult) Region(org.eclipse.jface.text.Region) IRegion(org.eclipse.jface.text.IRegion) DirtyRegion(org.eclipse.jface.text.reconciler.DirtyRegion)

Aggregations

DirtyRegion (org.eclipse.jface.text.reconciler.DirtyRegion)16 IDocument (org.eclipse.jface.text.IDocument)8 IReconcilingStrategy (org.eclipse.jface.text.reconciler.IReconcilingStrategy)5 IRegion (org.eclipse.jface.text.IRegion)4 ArrayList (java.util.ArrayList)3 BadLocationException (org.eclipse.jface.text.BadLocationException)3 Document (org.eclipse.jface.text.Document)2 ITypedRegion (org.eclipse.jface.text.ITypedRegion)2 Region (org.eclipse.jface.text.Region)2 AbstractReconciler (org.eclipse.jface.text.reconciler.AbstractReconciler)2 MonoReconciler (org.eclipse.jface.text.reconciler.MonoReconciler)2 AnnotationModel (org.eclipse.jface.text.source.AnnotationModel)2 ISourceViewer (org.eclipse.jface.text.source.ISourceViewer)2 SourceViewer (org.eclipse.jface.text.source.SourceViewer)2 TestTextViewer (org.eclipse.jface.text.tests.TestTextViewer)2 FillLayout (org.eclipse.swt.layout.FillLayout)2 Display (org.eclipse.swt.widgets.Display)2 Shell (org.eclipse.swt.widgets.Shell)2 Accessor (org.eclipse.text.tests.Accessor)2 IndexedRegion (org.eclipse.wst.sse.core.internal.provisional.IndexedRegion)2