1 11 package org.eclipse.jface.text.reconciler; 12 13 import org.eclipse.core.runtime.Assert; 14 import org.eclipse.core.runtime.IProgressMonitor; 15 16 import org.eclipse.jface.text.IDocument; 17 import org.eclipse.jface.text.Region; 18 19 20 34 public class MonoReconciler extends AbstractReconciler { 35 36 37 38 private IReconcilingStrategy fStrategy; 39 40 41 48 public MonoReconciler(IReconcilingStrategy strategy, boolean isIncremental) { 49 super(); 50 51 Assert.isNotNull(strategy); 52 53 fStrategy= strategy; 54 setIsIncrementalReconciler(isIncremental); 55 } 56 57 60 public IReconcilingStrategy getReconcilingStrategy(String contentType) { 61 Assert.isNotNull(contentType); 62 return fStrategy; 63 } 64 65 68 protected void process(DirtyRegion dirtyRegion) { 69 70 if(dirtyRegion != null) 71 fStrategy.reconcile(dirtyRegion, dirtyRegion); 72 else { 73 IDocument document= getDocument(); 74 if (document != null) 75 fStrategy.reconcile(new Region(0, document.getLength())); 76 } 77 } 78 79 82 protected void reconcilerDocumentChanged(IDocument document) { 83 fStrategy.setDocument(document); 84 } 85 86 89 public void setProgressMonitor(IProgressMonitor monitor) { 90 super.setProgressMonitor(monitor); 91 if (fStrategy instanceof IReconcilingStrategyExtension) { 92 IReconcilingStrategyExtension extension= (IReconcilingStrategyExtension) fStrategy; 93 extension.setProgressMonitor(monitor); 94 } 95 } 96 97 100 protected void initialProcess() { 101 if (fStrategy instanceof IReconcilingStrategyExtension) { 102 IReconcilingStrategyExtension extension= (IReconcilingStrategyExtension) fStrategy; 103 extension.initialReconcile(); 104 } 105 } 106 } 107 | Popular Tags |