1 11 package org.eclipse.pde.internal.ui.editor.text; 12 13 import java.util.ArrayList ; 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.pde.internal.core.text.IReconcilingParticipant; 20 21 public class ReconcilingStrategy implements IReconcilingStrategy { 22 23 private IDocument fDocument; 24 private ArrayList fParticipants = new ArrayList (); 25 26 public ReconcilingStrategy () { 27 } 28 31 public void setDocument(IDocument document) { 32 fDocument = document; 33 } 34 37 public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) { 38 if (fDocument != null) 39 notifyParticipants(); 40 } 41 44 public void reconcile(IRegion partition) { 45 if (fDocument != null) 46 notifyParticipants(); 47 } 48 49 private synchronized void notifyParticipants() { 50 for (int i = 0; i < fParticipants.size(); i++) { 51 ((IReconcilingParticipant)fParticipants.get(i)).reconciled(fDocument); 52 } 53 } 54 55 public void addParticipant(IReconcilingParticipant participant) { 56 fParticipants.add(participant); 57 } 58 59 public void removeParticipant(IReconcilingParticipant participant) { 60 fParticipants.remove(participant); 61 } 62 } 63 | Popular Tags |