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