1) Added missing strings for italic, underline and strike through.
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / ui / text / CompositeReconcilingStrategy.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2003 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials 
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package net.sourceforge.phpdt.internal.ui.text;
12
13 import org.eclipse.core.runtime.IProgressMonitor;
14 import org.eclipse.jface.text.IDocument;
15 import org.eclipse.jface.text.IRegion;
16 import org.eclipse.jface.text.reconciler.DirtyRegion;
17 import org.eclipse.jface.text.reconciler.IReconcilingStrategy;
18 import org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension;
19
20 /**
21  * A reconciling strategy consisting of a sequence of internal reconciling
22  * strategies. By default, all requests are passed on to the contained
23  * strategies.
24  * 
25  * @since 3.0
26  */
27 public class CompositeReconcilingStrategy implements IReconcilingStrategy,
28                 IReconcilingStrategyExtension {
29
30         /** The list of internal reconciling strategies. */
31         private IReconcilingStrategy[] fStrategies;
32
33         /**
34          * Creates a new, empty composite reconciling strategy.
35          */
36         public CompositeReconcilingStrategy() {
37         }
38
39         /**
40          * Sets the reconciling strategies for this composite strategy.
41          * 
42          * @param strategies
43          *            the strategies to be set or <code>null</code>
44          */
45         public void setReconcilingStrategies(IReconcilingStrategy[] strategies) {
46                 fStrategies = strategies;
47         }
48
49         /**
50          * Returns the previously set stratgies or <code>null</code>.
51          * 
52          * @return the contained strategies or <code>null</code>
53          */
54 //      public IReconcilingStrategy[] getReconcilingStrategies() {
55 //              return fStrategies;
56 //      }
57
58         /*
59          * @see org.eclipse.jface.text.reconciler.IReconcilingStrategy#setDocument(org.eclipse.jface.text.IDocument)
60          */
61         public void setDocument(IDocument document) {
62                 if (fStrategies == null)
63                         return;
64
65                 for (int i = 0; i < fStrategies.length; i++)
66                         fStrategies[i].setDocument(document);
67         }
68
69         /*
70          * @see org.eclipse.jface.text.reconciler.IReconcilingStrategy#reconcile(org.eclipse.jface.text.reconciler.DirtyRegion,
71          *      org.eclipse.jface.text.IRegion)
72          */
73         public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) {
74                 if (fStrategies == null)
75                         return;
76
77                 for (int i = 0; i < fStrategies.length; i++)
78                         fStrategies[i].reconcile(dirtyRegion, subRegion);
79         }
80
81         /*
82          * @see org.eclipse.jface.text.reconciler.IReconcilingStrategy#reconcile(org.eclipse.jface.text.IRegion)
83          */
84         public void reconcile(IRegion partition) {
85                 if (fStrategies == null)
86                         return;
87
88                 for (int i = 0; i < fStrategies.length; i++)
89                         fStrategies[i].reconcile(partition);
90         }
91
92         /*
93          * @see org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension#setProgressMonitor(org.eclipse.core.runtime.IProgressMonitor)
94          */
95         public void setProgressMonitor(IProgressMonitor monitor) {
96                 if (fStrategies == null)
97                         return;
98
99                 for (int i = 0; i < fStrategies.length; i++) {
100                         if (fStrategies[i] instanceof IReconcilingStrategyExtension) {
101                                 IReconcilingStrategyExtension extension = (IReconcilingStrategyExtension) fStrategies[i];
102                                 extension.setProgressMonitor(monitor);
103                         }
104                 }
105         }
106
107         /*
108          * @see org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension#initialReconcile()
109          */
110         public void initialReconcile() {
111                 if (fStrategies == null)
112                         return;
113
114                 for (int i = 0; i < fStrategies.length; i++) {
115                         if (fStrategies[i] instanceof IReconcilingStrategyExtension) {
116                                 IReconcilingStrategyExtension extension = (IReconcilingStrategyExtension) fStrategies[i];
117                                 extension.initialReconcile();
118                         }
119                 }
120         }
121 }