Lines 14-21
Link Here
|
14 |
import java.io.IOException; |
14 |
import java.io.IOException; |
15 |
import java.io.StringReader; |
15 |
import java.io.StringReader; |
16 |
import java.util.ArrayList; |
16 |
import java.util.ArrayList; |
|
|
17 |
import java.util.Arrays; |
18 |
import java.util.HashSet; |
17 |
import java.util.List; |
19 |
import java.util.List; |
|
|
20 |
import java.util.Set; |
18 |
|
21 |
|
|
|
22 |
import org.eclipse.core.runtime.NullProgressMonitor; |
19 |
import org.eclipse.core.runtime.Platform; |
23 |
import org.eclipse.core.runtime.Platform; |
20 |
import org.eclipse.core.runtime.content.IContentDescription; |
24 |
import org.eclipse.core.runtime.content.IContentDescription; |
21 |
import org.eclipse.core.runtime.content.IContentType; |
25 |
import org.eclipse.core.runtime.content.IContentType; |
Lines 26-31
Link Here
|
26 |
import org.eclipse.jface.text.Region; |
30 |
import org.eclipse.jface.text.Region; |
27 |
import org.eclipse.jface.text.reconciler.DirtyRegion; |
31 |
import org.eclipse.jface.text.reconciler.DirtyRegion; |
28 |
import org.eclipse.jface.text.reconciler.IReconcilingStrategy; |
32 |
import org.eclipse.jface.text.reconciler.IReconcilingStrategy; |
|
|
33 |
import org.eclipse.jface.text.source.IAnnotationModel; |
29 |
import org.eclipse.jface.text.source.ISourceViewer; |
34 |
import org.eclipse.jface.text.source.ISourceViewer; |
30 |
import org.eclipse.wst.sse.ui.internal.ExtendedConfigurationBuilder; |
35 |
import org.eclipse.wst.sse.ui.internal.ExtendedConfigurationBuilder; |
31 |
import org.eclipse.wst.sse.ui.internal.IReleasable; |
36 |
import org.eclipse.wst.sse.ui.internal.IReleasable; |
Lines 45-51
Link Here
|
45 |
* validator strategies - DirtyRegion processing logic. |
50 |
* validator strategies - DirtyRegion processing logic. |
46 |
*/ |
51 |
*/ |
47 |
public class DocumentRegionProcessor extends DirtyRegionProcessor { |
52 |
public class DocumentRegionProcessor extends DirtyRegionProcessor { |
48 |
|
|
|
49 |
private static final boolean DEBUG_VALIDATORS = Boolean.TRUE.toString().equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.ui/debug/reconcilerValidators")); //$NON-NLS-1$ |
53 |
private static final boolean DEBUG_VALIDATORS = Boolean.TRUE.toString().equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.ui/debug/reconcilerValidators")); //$NON-NLS-1$ |
50 |
|
54 |
|
51 |
/** |
55 |
/** |
Lines 60-65
Link Here
|
60 |
*/ |
64 |
*/ |
61 |
private ValidatorStrategy fValidatorStrategy; |
65 |
private ValidatorStrategy fValidatorStrategy; |
62 |
|
66 |
|
|
|
67 |
private ISourceReconcilingListener[] fReconcileListeners = new ISourceReconcilingListener[0]; |
68 |
|
63 |
private IReconcilingStrategy fSemanticHighlightingStrategy; |
69 |
private IReconcilingStrategy fSemanticHighlightingStrategy; |
64 |
|
70 |
|
65 |
/** |
71 |
/** |
Lines 74-86
Link Here
|
74 |
* false otherwise |
80 |
* false otherwise |
75 |
*/ |
81 |
*/ |
76 |
private boolean fValidationEnabled; |
82 |
private boolean fValidationEnabled; |
77 |
|
83 |
|
|
|
84 |
public void addReconcilingListener(ISourceReconcilingListener listener) { |
85 |
Set listeners = new HashSet(Arrays.asList(fReconcileListeners)); |
86 |
listeners.add(listener); |
87 |
fReconcileListeners = (ISourceReconcilingListener[]) listeners.toArray(new ISourceReconcilingListener[listeners.size()]); |
88 |
} |
89 |
|
78 |
protected void beginProcessing() { |
90 |
protected void beginProcessing() { |
79 |
super.beginProcessing(); |
91 |
super.beginProcessing(); |
80 |
ValidatorStrategy validatorStrategy = getValidatorStrategy(); |
92 |
ValidatorStrategy validatorStrategy = getValidatorStrategy(); |
81 |
if (validatorStrategy != null) { |
93 |
if (validatorStrategy != null) { |
82 |
validatorStrategy.beginProcessing(); |
94 |
validatorStrategy.beginProcessing(); |
83 |
} |
95 |
} |
|
|
96 |
if ((getTextViewer() instanceof ISourceViewer)) { |
97 |
for (int i = 0; i < fReconcileListeners.length; i++) { |
98 |
fReconcileListeners[i].aboutToBeReconciled(); |
99 |
} |
100 |
} |
84 |
} |
101 |
} |
85 |
|
102 |
|
86 |
protected void endProcessing() { |
103 |
protected void endProcessing() { |
Lines 100-105
Link Here
|
100 |
if (semanticHighlightingStrategy != null && document != null) { |
117 |
if (semanticHighlightingStrategy != null && document != null) { |
101 |
semanticHighlightingStrategy.reconcile(new Region(0, document.getLength())); |
118 |
semanticHighlightingStrategy.reconcile(new Region(0, document.getLength())); |
102 |
} |
119 |
} |
|
|
120 |
|
121 |
if ((getTextViewer() instanceof ISourceViewer)) { |
122 |
ISourceViewer sourceViewer = (ISourceViewer) getTextViewer(); |
123 |
IAnnotationModel annotationModel = sourceViewer.getAnnotationModel(); |
124 |
for (int i = 0; i < fReconcileListeners.length; i++) { |
125 |
fReconcileListeners[i].reconciled(document, annotationModel, false, new NullProgressMonitor()); |
126 |
} |
127 |
} |
103 |
} |
128 |
} |
104 |
|
129 |
|
105 |
protected String getContentType(IDocument doc) { |
130 |
protected String getContentType(IDocument doc) { |
Lines 282-287
Link Here
|
282 |
getFoldingStrategy().reconcile(dirtyRegion, null); |
307 |
getFoldingStrategy().reconcile(dirtyRegion, null); |
283 |
} |
308 |
} |
284 |
} |
309 |
} |
|
|
310 |
|
311 |
public void removeReconcilingListener(ISourceReconcilingListener listener) { |
312 |
Set listeners = new HashSet(Arrays.asList(fReconcileListeners)); |
313 |
listeners.remove(listener); |
314 |
fReconcileListeners = (ISourceReconcilingListener[]) listeners.toArray(new ISourceReconcilingListener[listeners.size()]); |
315 |
} |
316 |
|
285 |
|
317 |
|
286 |
public void setDocument(IDocument doc) { |
318 |
public void setDocument(IDocument doc) { |
287 |
super.setDocument(doc); |
319 |
super.setDocument(doc); |
Lines 332-338
Link Here
|
332 |
*/ |
364 |
*/ |
333 |
public void install(ITextViewer textViewer) { |
365 |
public void install(ITextViewer textViewer) { |
334 |
super.install(textViewer); |
366 |
super.install(textViewer); |
335 |
|
367 |
|
336 |
//determine if validation is enabled |
368 |
//determine if validation is enabled |
337 |
this.fValidationEnabled = SSEUIPlugin.getInstance().getPreferenceStore().getBoolean( |
369 |
this.fValidationEnabled = SSEUIPlugin.getInstance().getPreferenceStore().getBoolean( |
338 |
CommonEditorPreferenceNames.EVALUATE_TEMPORARY_PROBLEMS); |
370 |
CommonEditorPreferenceNames.EVALUATE_TEMPORARY_PROBLEMS); |
Lines 357-362
Link Here
|
357 |
fSpellcheckStrategy.setDocument(null); |
389 |
fSpellcheckStrategy.setDocument(null); |
358 |
fSpellcheckStrategy = null; |
390 |
fSpellcheckStrategy = null; |
359 |
} |
391 |
} |
|
|
392 |
|
393 |
fReconcileListeners = new ISourceReconcilingListener[0]; |
360 |
} |
394 |
} |
361 |
super.uninstall(); |
395 |
super.uninstall(); |
362 |
} |
396 |
} |