blob: 032bc285fa8c25ef6e706b7f993634ec5a3e1874 [file] [log] [blame]
nitind93023a12006-09-19 18:24:13 +00001/*******************************************************************************
nsandonatoff577b42010-03-29 14:55:55 +00002 * Copyright (c) 2006, 2010 IBM Corporation and others.
nitind93023a12006-09-19 18:24:13 +00003 * 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
nsandonatoff577b42010-03-29 14:55:55 +000010 * David Carver (Intalio) - bug 307323 - remove extraneous call to spell check strategy
nitind93023a12006-09-19 18:24:13 +000011 *******************************************************************************/
paverydc8b3062005-10-24 20:43:42 +000012package org.eclipse.wst.sse.ui.internal.reconcile;
13
paverydc8b3062005-10-24 20:43:42 +000014import java.io.IOException;
nitindc77f9632008-03-19 21:26:39 +000015import java.io.StringReader;
nitind93023a12006-09-19 18:24:13 +000016import java.util.ArrayList;
nsandonato8efc7582009-12-02 23:52:57 +000017import java.util.Arrays;
18import java.util.HashSet;
nitind93023a12006-09-19 18:24:13 +000019import java.util.List;
nsandonato8efc7582009-12-02 23:52:57 +000020import java.util.Set;
paverydc8b3062005-10-24 20:43:42 +000021
nsandonato8efc7582009-12-02 23:52:57 +000022import org.eclipse.core.runtime.NullProgressMonitor;
paverydc8b3062005-10-24 20:43:42 +000023import org.eclipse.core.runtime.Platform;
24import org.eclipse.core.runtime.content.IContentDescription;
25import org.eclipse.core.runtime.content.IContentType;
nitindbb9106d2008-10-11 00:52:30 +000026import org.eclipse.core.runtime.content.IContentTypeManager;
paverydc8b3062005-10-24 20:43:42 +000027import org.eclipse.jface.text.IDocument;
nsandonato95924232009-08-26 20:50:40 +000028import org.eclipse.jface.text.ITextViewer;
paverydc8b3062005-10-24 20:43:42 +000029import org.eclipse.jface.text.ITypedRegion;
nitindf3f10872007-09-03 06:36:56 +000030import org.eclipse.jface.text.Region;
paverydc8b3062005-10-24 20:43:42 +000031import org.eclipse.jface.text.reconciler.DirtyRegion;
32import org.eclipse.jface.text.reconciler.IReconcilingStrategy;
nsandonato8efc7582009-12-02 23:52:57 +000033import org.eclipse.jface.text.source.IAnnotationModel;
paverydc8b3062005-10-24 20:43:42 +000034import org.eclipse.jface.text.source.ISourceViewer;
nitindb8d88912010-04-05 13:49:32 +000035import org.eclipse.jface.text.source.projection.ProjectionViewer;
nsandonato95924232009-08-26 20:50:40 +000036import org.eclipse.wst.sse.ui.internal.ExtendedConfigurationBuilder;
paverydc8b3062005-10-24 20:43:42 +000037import org.eclipse.wst.sse.ui.internal.IReleasable;
nitind93023a12006-09-19 18:24:13 +000038import org.eclipse.wst.sse.ui.internal.Logger;
nsandonato95924232009-08-26 20:50:40 +000039import org.eclipse.wst.sse.ui.internal.SSEUIPlugin;
nsandonato95924232009-08-26 20:50:40 +000040import org.eclipse.wst.sse.ui.internal.projection.AbstractStructuredFoldingStrategy;
41import org.eclipse.wst.sse.ui.internal.provisional.preferences.CommonEditorPreferenceNames;
paverydc8b3062005-10-24 20:43:42 +000042import org.eclipse.wst.sse.ui.internal.reconcile.validator.ValidatorBuilder;
43import org.eclipse.wst.sse.ui.internal.reconcile.validator.ValidatorMetaData;
44import org.eclipse.wst.sse.ui.internal.reconcile.validator.ValidatorStrategy;
nitindb0445972006-02-16 22:19:20 +000045import org.eclipse.wst.sse.ui.internal.spelling.SpellcheckStrategy;
nsandonato7a2c57a2010-01-19 20:01:07 +000046import org.eclipse.wst.sse.ui.reconcile.ISourceReconcilingListener;
paverydc8b3062005-10-24 20:43:42 +000047
48/**
nitindb0445972006-02-16 22:19:20 +000049 * Adds to DirtyRegionProcessor Job: - IDocumentListener - ValidatorStrategy -
50 * Text viewer(dispose, input changed) listeners. - default, spelling, and
51 * validator strategies - DirtyRegion processing logic.
paverydc8b3062005-10-24 20:43:42 +000052 */
nitindb0445972006-02-16 22:19:20 +000053public class DocumentRegionProcessor extends DirtyRegionProcessor {
nitindc77f9632008-03-19 21:26:39 +000054 private static final boolean DEBUG_VALIDATORS = Boolean.TRUE.toString().equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.ui/debug/reconcilerValidators")); //$NON-NLS-1$
nitind93023a12006-09-19 18:24:13 +000055
paverydc8b3062005-10-24 20:43:42 +000056 /**
nitindb0445972006-02-16 22:19:20 +000057 * A strategy to use the defined default Spelling service.
paverydc8b3062005-10-24 20:43:42 +000058 */
nitindc77f9632008-03-19 21:26:39 +000059 private IReconcilingStrategy fSpellcheckStrategy;
paverydc8b3062005-10-24 20:43:42 +000060
paverydc8b3062005-10-24 20:43:42 +000061 /**
62 * The strategy that runs validators contributed via
63 * <code>org.eclipse.wst.sse.ui.extensions.sourcevalidation</code>
64 * extension point
65 */
66 private ValidatorStrategy fValidatorStrategy;
nitindb0445972006-02-16 22:19:20 +000067
nsandonato8efc7582009-12-02 23:52:57 +000068 private ISourceReconcilingListener[] fReconcileListeners = new ISourceReconcilingListener[0];
69
nsandonato8c642522009-01-26 22:45:19 +000070 private IReconcilingStrategy fSemanticHighlightingStrategy;
71
nsandonato95924232009-08-26 20:50:40 +000072 /**
73 * The folding strategy for this processor
74 */
75 private AbstractStructuredFoldingStrategy fFoldingStrategy;
76
nitinda5804e82006-03-14 00:54:11 +000077 private final String SSE_UI_ID = "org.eclipse.wst.sse.ui"; //$NON-NLS-1$
paverydc8b3062005-10-24 20:43:42 +000078
nsandonato95924232009-08-26 20:50:40 +000079 /**
80 * true if as you type validation is enabled,
81 * false otherwise
82 */
83 private boolean fValidationEnabled;
nsandonato8efc7582009-12-02 23:52:57 +000084
85 public void addReconcilingListener(ISourceReconcilingListener listener) {
86 Set listeners = new HashSet(Arrays.asList(fReconcileListeners));
87 listeners.add(listener);
88 fReconcileListeners = (ISourceReconcilingListener[]) listeners.toArray(new ISourceReconcilingListener[listeners.size()]);
89 }
90
nitindb0445972006-02-16 22:19:20 +000091 protected void beginProcessing() {
92 super.beginProcessing();
nitinda5804e82006-03-14 00:54:11 +000093 ValidatorStrategy validatorStrategy = getValidatorStrategy();
94 if (validatorStrategy != null) {
95 validatorStrategy.beginProcessing();
96 }
nsandonato8efc7582009-12-02 23:52:57 +000097 if ((getTextViewer() instanceof ISourceViewer)) {
98 for (int i = 0; i < fReconcileListeners.length; i++) {
99 fReconcileListeners[i].aboutToBeReconciled();
100 }
101 }
paverydc8b3062005-10-24 20:43:42 +0000102 }
paverydc8b3062005-10-24 20:43:42 +0000103
nitindb0445972006-02-16 22:19:20 +0000104 protected void endProcessing() {
105 super.endProcessing();
nitinda5804e82006-03-14 00:54:11 +0000106 ValidatorStrategy validatorStrategy = getValidatorStrategy();
107 if (validatorStrategy != null) {
108 validatorStrategy.endProcessing();
109 }
nitind5893a852008-08-09 19:19:10 +0000110 /* single spell-check for everything to ensure that SpellingProblem offsets are correct */
nitindbb9106d2008-10-11 00:52:30 +0000111 IReconcilingStrategy spellingStrategy = getSpellcheckStrategy();
nitindfefa7702008-10-11 01:12:21 +0000112 IDocument document = getDocument();
113 if (spellingStrategy != null && document != null) {
nsandonatoff577b42010-03-29 14:55:55 +0000114 spellingStrategy.reconcile(new Region(0, document.getLength()));
nitind5893a852008-08-09 19:19:10 +0000115 }
nsandonato8c642522009-01-26 22:45:19 +0000116
117 IReconcilingStrategy semanticHighlightingStrategy = getSemanticHighlightingStrategy();
118 if (semanticHighlightingStrategy != null && document != null) {
119 semanticHighlightingStrategy.reconcile(new Region(0, document.getLength()));
120 }
nsandonato8efc7582009-12-02 23:52:57 +0000121
122 if ((getTextViewer() instanceof ISourceViewer)) {
123 ISourceViewer sourceViewer = (ISourceViewer) getTextViewer();
124 IAnnotationModel annotationModel = sourceViewer.getAnnotationModel();
125 for (int i = 0; i < fReconcileListeners.length; i++) {
126 fReconcileListeners[i].reconciled(document, annotationModel, false, new NullProgressMonitor());
127 }
128 }
129 }
130
131 public void forceReconciling() {
132 super.forceReconciling();
nitindb0445972006-02-16 22:19:20 +0000133 }
paverydc8b3062005-10-24 20:43:42 +0000134
nitindb0445972006-02-16 22:19:20 +0000135 protected String getContentType(IDocument doc) {
136 if (doc == null)
137 return null;
paverydc8b3062005-10-24 20:43:42 +0000138
nitindb0445972006-02-16 22:19:20 +0000139 String contentTypeId = null;
paverydc8b3062005-10-24 20:43:42 +0000140
nitindb0445972006-02-16 22:19:20 +0000141 IContentType ct = null;
142 try {
nitindc77f9632008-03-19 21:26:39 +0000143 IContentDescription desc = Platform.getContentTypeManager().getDescriptionFor(new StringReader(doc.get()), null, IContentDescription.ALL);
nitindb0445972006-02-16 22:19:20 +0000144 if (desc != null) {
145 ct = desc.getContentType();
146 if (ct != null)
147 contentTypeId = ct.getId();
paverydc8b3062005-10-24 20:43:42 +0000148 }
149 }
nitindb0445972006-02-16 22:19:20 +0000150 catch (IOException e) {
151 // just bail
paverydc8b3062005-10-24 20:43:42 +0000152 }
nitindb0445972006-02-16 22:19:20 +0000153 return contentTypeId;
paverydc8b3062005-10-24 20:43:42 +0000154 }
paverydc8b3062005-10-24 20:43:42 +0000155
nitindc77f9632008-03-19 21:26:39 +0000156 protected IReconcilingStrategy getSpellcheckStrategy() {
nitindbb9106d2008-10-11 00:52:30 +0000157 if (fSpellcheckStrategy == null && getDocument() != null) {
nitindb0445972006-02-16 22:19:20 +0000158 String contentTypeId = getContentType(getDocument());
nitindbb9106d2008-10-11 00:52:30 +0000159 if (contentTypeId == null) {
160 contentTypeId = IContentTypeManager.CT_TEXT;
161 }
162 if (getTextViewer() instanceof ISourceViewer) {
163 ISourceViewer viewer = (ISourceViewer) getTextViewer();
164 fSpellcheckStrategy = new SpellcheckStrategy(viewer, contentTypeId);
165 fSpellcheckStrategy.setDocument(getDocument());
paverydc8b3062005-10-24 20:43:42 +0000166 }
paverydc8b3062005-10-24 20:43:42 +0000167 }
nitindb0445972006-02-16 22:19:20 +0000168 return fSpellcheckStrategy;
paverydc8b3062005-10-24 20:43:42 +0000169 }
nsandonato95924232009-08-26 20:50:40 +0000170
171 /**
172 * <p>Get the folding strategy for this processor. Retrieved from the
173 * extended configuration builder. The processor chosen is set by the plugin.</p>
174 *
175 * <p>EX:<br />
176 * <code>&lt;extension point="org.eclipse.wst.sse.ui.editorConfiguration"&gt;<br />
177 * &lt;provisionalConfiguration<br />
178 * type="foldingstrategy"<br />
179 * class="org.eclipse.wst.xml.ui.internal.projection.XMLFoldingStrategy"<br />
180 * target="org.eclipse.core.runtime.xml, org.eclipse.wst.xml.core.xmlsource" /&gt;<br />
181 * &lt;/extension&gt;</code></p>
182 *
183 * <p>The type must be equal to <code>AbstractFoldingStrategy.ID</code> (AKA: foldingstrategy)
184 * and the class must extend <code>org.eclipse.wst.sse.ui.internal.projection.AbstractFoldingStrategy</code>
185 * and the target must be a structured editor content type ID</p>
186 *
187 * @return the requested folding strategy or null if none can be found
188 */
189 protected IReconcilingStrategy getFoldingStrategy() {
190 if(fFoldingStrategy == null && getDocument() != null) {
191 String contentTypeId = getContentType(getDocument());
192 if (contentTypeId == null) {
193 contentTypeId = IContentTypeManager.CT_TEXT;
194 }
195
196 ITextViewer viewer = getTextViewer();
nitindb8d88912010-04-05 13:49:32 +0000197 if(viewer instanceof ProjectionViewer) {
nsandonato95924232009-08-26 20:50:40 +0000198 ExtendedConfigurationBuilder builder = ExtendedConfigurationBuilder.getInstance();
199
200 IContentType type = Platform.getContentTypeManager().getContentType(contentTypeId);
201 while(fFoldingStrategy == null && type != null) {
202 fFoldingStrategy =(AbstractStructuredFoldingStrategy) builder.getConfiguration(
203 AbstractStructuredFoldingStrategy.ID, type.getId());
204
205 type = type.getBaseType();
206 }
207
208 if(fFoldingStrategy != null) {
nitindb8d88912010-04-05 13:49:32 +0000209 fFoldingStrategy.setViewer((ProjectionViewer)viewer);
nsandonato95924232009-08-26 20:50:40 +0000210 fFoldingStrategy.setDocument(getDocument());
211 }
212 }
213 }
214
215 return fFoldingStrategy;
216 }
217
218 /**
219 * Enable or disable as you type validation. Typically set by a user preference
220 *
221 * @param enable true to enable as you type validation, false to disable
222 */
223 public void setValidatorStrategyEnabled(boolean enable) {
224 fValidationEnabled = enable;
225 }
nitindb0445972006-02-16 22:19:20 +0000226
paverydc8b3062005-10-24 20:43:42 +0000227 /**
nitindb0445972006-02-16 22:19:20 +0000228 * @return Returns the ValidatorStrategy.
paverydc8b3062005-10-24 20:43:42 +0000229 */
nitindb0445972006-02-16 22:19:20 +0000230 protected ValidatorStrategy getValidatorStrategy() {
nsandonato95924232009-08-26 20:50:40 +0000231 ValidatorStrategy validatorStrategy = null;
232 if (fValidatorStrategy == null && fValidationEnabled) {
paverydc8b3062005-10-24 20:43:42 +0000233 if (getTextViewer() instanceof ISourceViewer) {
nitindb0445972006-02-16 22:19:20 +0000234 ISourceViewer viewer = (ISourceViewer) getTextViewer();
paverydc8b3062005-10-24 20:43:42 +0000235 String contentTypeId = null;
nitindb0445972006-02-16 22:19:20 +0000236
paverydc8b3062005-10-24 20:43:42 +0000237 IDocument doc = viewer.getDocument();
238 contentTypeId = getContentType(doc);
nitindb0445972006-02-16 22:19:20 +0000239
paverydc8b3062005-10-24 20:43:42 +0000240 if (contentTypeId != null) {
paverydc8b3062005-10-24 20:43:42 +0000241 validatorStrategy = new ValidatorStrategy(viewer, contentTypeId);
242 ValidatorBuilder vBuilder = new ValidatorBuilder();
nitinda5804e82006-03-14 00:54:11 +0000243 ValidatorMetaData[] vmds = vBuilder.getValidatorMetaData(SSE_UI_ID);
nitind93023a12006-09-19 18:24:13 +0000244 List enabledValidators = new ArrayList(1);
245 /* if any "must" handle this content type, just add them */
246 boolean foundSpecificContentTypeValidators = false;
paverydc8b3062005-10-24 20:43:42 +0000247 for (int i = 0; i < vmds.length; i++) {
nitind93023a12006-09-19 18:24:13 +0000248 if (vmds[i].mustHandleContentType(contentTypeId)) {
249 if (DEBUG_VALIDATORS)
250 Logger.log(Logger.INFO, contentTypeId + " using specific validator " + vmds[i].getValidatorId()); //$NON-NLS-1$
251 foundSpecificContentTypeValidators = true;
252 enabledValidators.add(vmds[i]);
253 }
254 }
255 if (!foundSpecificContentTypeValidators) {
256 for (int i = 0; i < vmds.length; i++) {
257 if (vmds[i].canHandleContentType(contentTypeId)) {
258 if (DEBUG_VALIDATORS)
259 Logger.log(Logger.INFO, contentTypeId + " using inherited(?) validator " + vmds[i].getValidatorId()); //$NON-NLS-1$
260 enabledValidators.add(vmds[i]);
261 }
262 }
263 }
264 for (int i = 0; i < enabledValidators.size(); i++) {
265 validatorStrategy.addValidatorMetaData((ValidatorMetaData) enabledValidators.get(i));
paverydc8b3062005-10-24 20:43:42 +0000266 }
267 }
268 }
269 fValidatorStrategy = validatorStrategy;
nsandonato95924232009-08-26 20:50:40 +0000270 } else if(fValidatorStrategy != null && fValidationEnabled) {
271 validatorStrategy = fValidatorStrategy;
paverydc8b3062005-10-24 20:43:42 +0000272 }
nsandonato95924232009-08-26 20:50:40 +0000273 return validatorStrategy;
paverydc8b3062005-10-24 20:43:42 +0000274 }
nsandonato8c642522009-01-26 22:45:19 +0000275
276 public void setSemanticHighlightingStrategy(IReconcilingStrategy semanticHighlightingStrategy) {
277 fSemanticHighlightingStrategy = semanticHighlightingStrategy;
278 fSemanticHighlightingStrategy.setDocument(getDocument());
279 }
280
281 protected IReconcilingStrategy getSemanticHighlightingStrategy() {
282 return fSemanticHighlightingStrategy;
283 }
nsandonato95924232009-08-26 20:50:40 +0000284
paverydc8b3062005-10-24 20:43:42 +0000285 /**
nitindb0445972006-02-16 22:19:20 +0000286 * @param dirtyRegion
paverydc8b3062005-10-24 20:43:42 +0000287 */
nitindb0445972006-02-16 22:19:20 +0000288 protected void process(DirtyRegion dirtyRegion) {
nsandonato0e6030b2009-12-15 15:51:37 +0000289 if (!isInstalled() || isInRewriteSession() || dirtyRegion == null || getDocument() == null)
nitindb0445972006-02-16 22:19:20 +0000290 return;
291
292 super.process(dirtyRegion);
nsandonatof165d2f2009-09-28 14:54:44 +0000293
nitindb0445972006-02-16 22:19:20 +0000294 ITypedRegion[] partitions = computePartitioning(dirtyRegion);
nsandonatof165d2f2009-09-28 14:54:44 +0000295
296 // call the validator strategy once for each effected partition
nitindb0445972006-02-16 22:19:20 +0000297 DirtyRegion dirty = null;
298 for (int i = 0; i < partitions.length; i++) {
nsandonato95924232009-08-26 20:50:40 +0000299 dirty = createDirtyRegion(partitions[i], DirtyRegion.INSERT);
300
nitindb0445972006-02-16 22:19:20 +0000301 // [source]validator (extension) for this partition
david_williams5ce6d6c2006-05-28 23:58:12 +0000302 if (getValidatorStrategy() != null) {
nitindb0445972006-02-16 22:19:20 +0000303 getValidatorStrategy().reconcile(partitions[i], dirty);
david_williams5ce6d6c2006-05-28 23:58:12 +0000304 }
nsandonatof165d2f2009-09-28 14:54:44 +0000305 }
306
307 /* if there is a folding strategy then reconcile it for the
308 * entire dirty region.
309 * NOTE: the folding strategy does not care about the sub regions.
310 */
311 if(getFoldingStrategy() != null) {
312 getFoldingStrategy().reconcile(dirtyRegion, null);
pavery1f1588d2006-02-15 20:44:54 +0000313 }
paverydc8b3062005-10-24 20:43:42 +0000314 }
nsandonato8efc7582009-12-02 23:52:57 +0000315
316 public void removeReconcilingListener(ISourceReconcilingListener listener) {
317 Set listeners = new HashSet(Arrays.asList(fReconcileListeners));
318 listeners.remove(listener);
319 fReconcileListeners = (ISourceReconcilingListener[]) listeners.toArray(new ISourceReconcilingListener[listeners.size()]);
320 }
321
paverydc8b3062005-10-24 20:43:42 +0000322
nitindb0445972006-02-16 22:19:20 +0000323 public void setDocument(IDocument doc) {
324 super.setDocument(doc);
nsandonato95924232009-08-26 20:50:40 +0000325
nitindb0445972006-02-16 22:19:20 +0000326 IReconcilingStrategy validatorStrategy = getValidatorStrategy();
327 if (validatorStrategy != null) {
328 validatorStrategy.setDocument(doc);
paverydc8b3062005-10-24 20:43:42 +0000329 }
nsandonato033201e2010-08-10 20:42:56 +0000330 if (fSemanticHighlightingStrategy != null) {
331 fSemanticHighlightingStrategy.setDocument(doc);
332 }
nitindbb9106d2008-10-11 00:52:30 +0000333
334 fSpellcheckStrategy = null;
nsandonato95924232009-08-26 20:50:40 +0000335 if(fFoldingStrategy != null) {
336 fFoldingStrategy.uninstall();
337 }
338 fFoldingStrategy = null;
paverydc8b3062005-10-24 20:43:42 +0000339 }
nitindc77f9632008-03-19 21:26:39 +0000340
nitindf3f10872007-09-03 06:36:56 +0000341 protected void setEntireDocumentDirty(IDocument document) {
342 super.setEntireDocumentDirty(document);
nitindb0445972006-02-16 22:19:20 +0000343
nitindf3f10872007-09-03 06:36:56 +0000344 // make the entire document dirty
345 // this also happens on a "save as"
346 if (document != null && isInstalled() && fLastPartitions != null && document.getLength() == 0) {
347 /**
348 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=199053
349 *
350 * Process the strategies for the last known-good partitions.
351 */
352 for (int i = 0; i < fLastPartitions.length; i++) {
nitind69bc47f2008-04-07 22:45:51 +0000353 ValidatorStrategy validatorStrategy = getValidatorStrategy();
354 if (validatorStrategy != null) {
355 validatorStrategy.reconcile(fLastPartitions[i], createDirtyRegion(fLastPartitions[i], DirtyRegion.REMOVE));
356 }
nitindf3f10872007-09-03 06:36:56 +0000357 }
nitindbb9106d2008-10-11 00:52:30 +0000358 IReconcilingStrategy spellingStrategy = getSpellcheckStrategy();
359 if (spellingStrategy != null) {
360 spellingStrategy.reconcile(new Region(0, document.getLength()));
nitindf3f10872007-09-03 06:36:56 +0000361 }
nsandonato95924232009-08-26 20:50:40 +0000362
363 //if there is a folding strategy then reconcile it
364 if(getFoldingStrategy() != null) {
365 getFoldingStrategy().reconcile(new Region(0, document.getLength()));
366 }
nitindf3f10872007-09-03 06:36:56 +0000367 }
368 }
nitindc77f9632008-03-19 21:26:39 +0000369
nitindb0445972006-02-16 22:19:20 +0000370 /**
nsandonato95924232009-08-26 20:50:40 +0000371 * @see org.eclipse.wst.sse.ui.internal.reconcile.DirtyRegionProcessor#install(org.eclipse.jface.text.ITextViewer)
372 */
373 public void install(ITextViewer textViewer) {
374 super.install(textViewer);
nsandonato8efc7582009-12-02 23:52:57 +0000375
nsandonato95924232009-08-26 20:50:40 +0000376 //determine if validation is enabled
377 this.fValidationEnabled = SSEUIPlugin.getInstance().getPreferenceStore().getBoolean(
378 CommonEditorPreferenceNames.EVALUATE_TEMPORARY_PROBLEMS);
379 }
380
381 /**
nitindb0445972006-02-16 22:19:20 +0000382 * @see org.eclipse.wst.sse.ui.internal.reconcile.DirtyRegionProcessor#uninstall()
383 */
384 public void uninstall() {
385 if (isInstalled()) {
386
387 cancel();
388
nitindb0445972006-02-16 22:19:20 +0000389 IReconcilingStrategy validatorStrategy = getValidatorStrategy();
390
391 if (validatorStrategy != null) {
392 if (validatorStrategy instanceof IReleasable)
393 ((IReleasable) validatorStrategy).release();
394 }
nitindbb9106d2008-10-11 00:52:30 +0000395
nsandonatoa8c69092009-03-12 02:07:17 +0000396 if (fSpellcheckStrategy != null) {
397 fSpellcheckStrategy.setDocument(null);
398 fSpellcheckStrategy = null;
399 }
nsandonato8efc7582009-12-02 23:52:57 +0000400
401 fReconcileListeners = new ISourceReconcilingListener[0];
nitindb0445972006-02-16 22:19:20 +0000402 }
403 super.uninstall();
404 }
paverydc8b3062005-10-24 20:43:42 +0000405}