129
|
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 * Port to the D programming language:
|
|
11 * Frank Benoit <benoit@tionex.de>
|
|
12 *******************************************************************************/
|
|
13 module dwtx.jface.text.reconciler.IReconcileStep;
|
|
14
|
131
|
15 import dwtx.jface.text.reconciler.IReconciler; // packageimport
|
|
16 import dwtx.jface.text.reconciler.DirtyRegionQueue; // packageimport
|
|
17 import dwtx.jface.text.reconciler.IReconcilingStrategy; // packageimport
|
|
18 import dwtx.jface.text.reconciler.AbstractReconcileStep; // packageimport
|
|
19 import dwtx.jface.text.reconciler.IReconcilingStrategyExtension; // packageimport
|
|
20 import dwtx.jface.text.reconciler.MonoReconciler; // packageimport
|
|
21 import dwtx.jface.text.reconciler.AbstractReconciler; // packageimport
|
|
22 import dwtx.jface.text.reconciler.Reconciler; // packageimport
|
|
23 import dwtx.jface.text.reconciler.IReconcilableModel; // packageimport
|
|
24 import dwtx.jface.text.reconciler.DirtyRegion; // packageimport
|
|
25 import dwtx.jface.text.reconciler.IReconcileResult; // packageimport
|
|
26 import dwtx.jface.text.reconciler.IReconcilerExtension; // packageimport
|
|
27
|
|
28
|
129
|
29 import dwt.dwthelper.utils;
|
|
30
|
|
31
|
|
32 import dwtx.core.runtime.IProgressMonitor;
|
|
33 import dwtx.jface.text.IRegion;
|
|
34
|
|
35
|
|
36 /**
|
|
37 * A reconcile step is one of several steps of a
|
|
38 * {@linkplain dwtx.jface.text.reconciler.IReconcilingStrategy reconcile strategy}
|
|
39 * that consists of several steps. This relationship is not coded into an interface but
|
|
40 * should be used by clients who's reconcile strategy consists of several steps.
|
|
41 * <p>
|
|
42 * If a reconcile step has an {@linkplain dwtx.jface.text.reconciler.IReconcilableModel input model}
|
|
43 * it will compute the correct model for the next step in the chain and set the next steps
|
|
44 * input model before <code>reconcile</code> gets called on that next step. After the last
|
|
45 * step has reconciled the {@linkplain dwtx.jface.text.reconciler.IReconcileResult reconcile result}
|
|
46 * array gets returned to the previous step. Each step in the chain adapts the result to its
|
|
47 * input model and returns it to its previous step.
|
|
48 * </p>
|
|
49 * <p>
|
|
50 * Example: Assume a strategy consists of steps A, B and C. And the main model is M.
|
|
51 * The strategy will set M to be A's input model. What will happen is:
|
|
52 * <ol>
|
|
53 * <li>A.setInputModel(M)</li>
|
|
54 * <li>A.reconcile: A reconciles M</li>
|
|
55 * <li>A computes the model for B => MB</li>
|
|
56 * <li>B.setInputModel(MB)</li>
|
|
57 * <li>B.reconcile: B reconciles MB</li>
|
|
58 * <li>B computes the model for C => MC</li>
|
|
59 * <li>C.setInputModel(MC)</li>
|
|
60 * <li>C.reconcile: C reconciles MC</li>
|
|
61 * <li>C returns result RC to step B</li>
|
|
62 * <li>B adapts the RC to MB and merges with its own results</li>
|
|
63 * <li>B returns result RB to step A</li>
|
|
64 * <li>A adapts the result to M and merges with its own results</li>
|
|
65 * <li>A returns the result to the reconcile strategy</li>
|
|
66 * </ol>
|
|
67 * </p>
|
|
68 * <p>
|
|
69 * This interface must be implemented by clients.
|
|
70 * </p>
|
|
71 * @since 3.0
|
|
72 */
|
|
73 public interface IReconcileStep {
|
|
74
|
|
75 /**
|
|
76 * Returns whether this is the last reconcile step or not.
|
|
77 *
|
|
78 * @return <code>true</code> iff this is the last reconcile step
|
|
79 */
|
|
80 bool isLastStep();
|
|
81
|
|
82 /**
|
|
83 * Returns whether this is the first reconcile step or not.
|
|
84 *
|
|
85 * @return <code>true</code> iff this is the first reconcile step
|
|
86 */
|
|
87 bool isFirstStep();
|
|
88
|
|
89 /**
|
|
90 * Sets the step which is in front of this step in the pipe.
|
|
91 * <p>
|
|
92 * Note: This method must be called at most once per reconcile step.
|
|
93 * </p>
|
|
94 *
|
|
95 * @param step the previous step
|
|
96 * @throws RuntimeException if called more than once
|
|
97 */
|
|
98 void setPreviousStep(IReconcileStep step);
|
|
99
|
|
100 /**
|
|
101 * Activates incremental reconciling of the specified dirty region.
|
|
102 * As a dirty region might span multiple content types, the segment of the
|
|
103 * dirty region which should be investigated is also provided to this
|
|
104 * reconciling strategy. The given regions refer to the document passed into
|
|
105 * the most recent call of {@link IReconcilingStrategy#setDocument(dwtx.jface.text.IDocument)}.
|
|
106 *
|
|
107 * @param dirtyRegion the document region which has been changed
|
|
108 * @param subRegion the sub region in the dirty region which should be reconciled
|
|
109 * @return an array with reconcile results
|
|
110 */
|
|
111 IReconcileResult[] reconcile(DirtyRegion dirtyRegion, IRegion subRegion);
|
|
112
|
|
113 /**
|
|
114 * Activates non-incremental reconciling. The reconciling strategy is just told
|
|
115 * that there are changes and that it should reconcile the given partition of the
|
|
116 * document most recently passed into {@link IReconcilingStrategy#setDocument(dwtx.jface.text.IDocument)}.
|
|
117 *
|
|
118 * @param partition the document partition to be reconciled
|
|
119 * @return an array with reconcile results
|
|
120 */
|
|
121 IReconcileResult[] reconcile(IRegion partition);
|
|
122
|
|
123 /**
|
|
124 * Sets the progress monitor for this reconcile step.
|
|
125 *
|
|
126 * @param monitor the progress monitor to be used
|
|
127 */
|
|
128 void setProgressMonitor(IProgressMonitor monitor);
|
|
129
|
|
130 /**
|
|
131 * Returns the progress monitor used to report progress.
|
|
132 *
|
|
133 * @return a progress monitor or <code>null</code> if no progress monitor is available
|
|
134 */
|
|
135 public IProgressMonitor getProgressMonitor();
|
|
136
|
|
137 /**
|
|
138 * Tells this reconcile step on which model it will
|
|
139 * work. This method will be called before any other method
|
|
140 * and can be called multiple times. The regions passed to the
|
|
141 * other methods always refer to the most recent model
|
|
142 * passed into this method.
|
|
143 *
|
|
144 * @param inputModel the model on which this step will work
|
|
145 */
|
|
146 void setInputModel(IReconcilableModel inputModel);
|
|
147 }
|