KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ant > internal > ui > editor > text > NotifyingReconciler


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11
12 package org.eclipse.ant.internal.ui.editor.text;
13
14
15 import java.util.ArrayList JavaDoc;
16 import java.util.Iterator JavaDoc;
17
18 import org.eclipse.jface.text.reconciler.DirtyRegion;
19 import org.eclipse.jface.text.reconciler.IReconcilingStrategy;
20 import org.eclipse.jface.text.reconciler.MonoReconciler;
21
22
23 public class NotifyingReconciler extends MonoReconciler {
24
25     private ArrayList JavaDoc fReconcilingParticipants= new ArrayList JavaDoc();
26     
27     /**
28      * Constructor for NotifyingReconciler.
29      * @param strategy
30      */

31     public NotifyingReconciler(IReconcilingStrategy strategy) {
32         super(strategy, false);
33     }
34
35     /*
36      * @see org.eclipse.jface.text.reconciler.AbstractReconciler#process(org.eclipse.jface.text.reconciler.DirtyRegion)
37      */

38     protected void process(DirtyRegion dirtyRegion) {
39         super.process(dirtyRegion);
40         notifyReconcilingParticipants();
41     }
42
43     public void addReconcilingParticipant(IReconcilingParticipant participant) {
44         fReconcilingParticipants.add(participant);
45     }
46
47     public void removeReconcilingParticipant(IReconcilingParticipant participant) {
48         fReconcilingParticipants.remove(participant);
49     }
50
51     protected void notifyReconcilingParticipants() {
52         Iterator JavaDoc i= new ArrayList JavaDoc(fReconcilingParticipants).iterator();
53         while (i.hasNext()) {
54             ((IReconcilingParticipant) i.next()).reconciled();
55         }
56     }
57     /* (non-Javadoc)
58      * @see org.eclipse.jface.text.reconciler.AbstractReconciler#initialProcess()
59      */

60     protected void initialProcess() {
61         super.initialProcess();
62         notifyReconcilingParticipants();
63     }
64 }
65
Popular Tags