1 11 package org.eclipse.jdt.internal.ui.text; 12 13 import org.eclipse.core.runtime.IProgressMonitor; 14 15 import org.eclipse.jface.text.IDocument; 16 import org.eclipse.jface.text.IRegion; 17 import org.eclipse.jface.text.reconciler.DirtyRegion; 18 import org.eclipse.jface.text.reconciler.IReconcilingStrategy; 19 import org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension; 20 21 27 public class CompositeReconcilingStrategy implements IReconcilingStrategy, IReconcilingStrategyExtension { 28 29 30 private IReconcilingStrategy[] fStrategies; 31 32 35 public CompositeReconcilingStrategy() { 36 } 37 38 43 public void setReconcilingStrategies(IReconcilingStrategy[] strategies) { 44 fStrategies= strategies; 45 } 46 47 52 public IReconcilingStrategy[] getReconcilingStrategies() { 53 return fStrategies; 54 } 55 56 59 public void setDocument(IDocument document) { 60 if (fStrategies == null) 61 return; 62 63 for (int i= 0; i < fStrategies.length; i++) 64 fStrategies[i].setDocument(document); 65 } 66 67 70 public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) { 71 if (fStrategies == null) 72 return; 73 74 for (int i= 0; i < fStrategies.length; i++) 75 fStrategies[i].reconcile(dirtyRegion, subRegion); 76 } 77 78 81 public void reconcile(IRegion partition) { 82 if (fStrategies == null) 83 return; 84 85 for (int i= 0; i < fStrategies.length; i++) 86 fStrategies[i].reconcile(partition); 87 } 88 89 92 public void setProgressMonitor(IProgressMonitor monitor) { 93 if (fStrategies == null) 94 return; 95 96 for (int i=0; i < fStrategies.length; i++) { 97 if (fStrategies[i] instanceof IReconcilingStrategyExtension) { 98 IReconcilingStrategyExtension extension= (IReconcilingStrategyExtension) fStrategies[i]; 99 extension.setProgressMonitor(monitor); 100 } 101 } 102 } 103 104 107 public void initialReconcile() { 108 if (fStrategies == null) 109 return; 110 111 for (int i=0; i < fStrategies.length; i++) { 112 if (fStrategies[i] instanceof IReconcilingStrategyExtension) { 113 IReconcilingStrategyExtension extension= (IReconcilingStrategyExtension) fStrategies[i]; 114 extension.initialReconcile(); 115 } 116 } 117 } 118 } 119 | Popular Tags |