[187448] toggling spellcheck preference disables content assist and source validation
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextViewerConfiguration.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextViewerConfiguration.java
index 33f1821..537258f 100644
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextViewerConfiguration.java
+++ b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextViewerConfiguration.java
@@ -240,7 +240,9 @@
fContentAssistant.setContextInformationPopupForeground(color);
fContentAssistant.setContextSelectorForeground(color);
}
+ }
+ if (!fContentAssistant.isInitialized()) {
// add content assist processors for each partition type
String[] types = getConfiguredContentTypes(sourceViewer);
for (int i = 0; i < types.length; i++) {
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentassist/StructuredContentAssistant.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentassist/StructuredContentAssistant.java
index c8d7773..5f35cae 100644
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentassist/StructuredContentAssistant.java
+++ b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentassist/StructuredContentAssistant.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -134,10 +134,22 @@
}
fProcessors.clear();
}
+ fProcessors = null;
+
// clear out list of installed content types
if (fInstalledExtendedContentTypes != null) {
fInstalledExtendedContentTypes.clear();
}
super.uninstall();
}
+
+ /**
+ * Returns true if content assist has been initialized with some content
+ * assist processors. False otherwise.
+ *
+ * @return true if content assistant has been initialized
+ */
+ public boolean isInitialized() {
+ return (fProcessors != null);
+ }
}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/DirtyRegionProcessor.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/DirtyRegionProcessor.java
index 13dae90..feb94ae 100644
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/DirtyRegionProcessor.java
+++ b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/DirtyRegionProcessor.java
@@ -55,9 +55,9 @@
public class DirtyRegionProcessor extends Job implements IReconciler, IReconcilerExtension, IConfigurableReconciler {
class DocumentListener implements IDocumentListener {
public void documentAboutToBeChanged(DocumentEvent event) {
- /*
- * if in rewrite session and already going to reprocess
- * entire document after rewrite session, do nothing
+ /*
+ * if in rewrite session and already going to reprocess entire
+ * document after rewrite session, do nothing
*/
if (isInRewriteSession() && fReprocessAfterRewrite)
return;
@@ -66,9 +66,9 @@
}
public void documentChanged(DocumentEvent event) {
- /*
- * if in rewrite session and already going to reprocess
- * entire document after rewrite session, do nothing
+ /*
+ * if in rewrite session and already going to reprocess entire
+ * document after rewrite session, do nothing
*/
if (isInRewriteSession() && fReprocessAfterRewrite)
return;
@@ -107,13 +107,14 @@
if (isInRewriteSession()) {
/*
* while in rewrite session, found a dirty region, so flag
- * that entire document needs to be reprocesed after rewrite
- * session
+ * that entire document needs to be reprocesed after
+ * rewrite session
*/
if (!fReprocessAfterRewrite && (dr != null)) {
fReprocessAfterRewrite = true;
}
- } else {
+ }
+ else {
processDirtyRegion(dr);
}
}
@@ -176,13 +177,13 @@
class DocumentRewriteSessionListener implements IDocumentRewriteSessionListener {
long time0 = 0;
-
+
public void documentRewriteSessionChanged(DocumentRewriteSessionEvent event) {
boolean oldValue = fInRewriteSession;
fInRewriteSession = event != null && event.getChangeType().equals(DocumentRewriteSessionEvent.SESSION_START);
if (event.getChangeType().equals(DocumentRewriteSessionEvent.SESSION_START)) {
- if(DEBUG) {
+ if (DEBUG) {
time0 = System.currentTimeMillis();
}
flushDirtyRegionQueue();
@@ -190,7 +191,7 @@
}
else if (event.getChangeType().equals(DocumentRewriteSessionEvent.SESSION_STOP)) {
if (fInRewriteSession ^ oldValue && fDocument != null) {
- if(DEBUG) {
+ if (DEBUG) {
Logger.log(Logger.INFO, "Rewrite session lasted " + (System.currentTimeMillis() - time0) + "ms");
time0 = System.currentTimeMillis();
}
@@ -254,8 +255,7 @@
private ITextViewer fViewer;
boolean fInRewriteSession = false;
/**
- * true if entire document needs to be reprocessed after
- * rewrite session
+ * true if entire document needs to be reprocessed after rewrite session
*/
boolean fReprocessAfterRewrite = false;
@@ -519,10 +519,7 @@
void handleInputDocumentChanged(IDocument oldInput, IDocument newInput) {
// don't bother if reconciler not installed
if (isInstalled()) {
-
- reconcilerDocumentChanged(newInput);
setDocument(newInput);
- setEntireDocumentDirty(newInput);
}
}
@@ -598,30 +595,11 @@
}
}
- /**
- * Reinitializes listeners and sets new document onall strategies.
- *
- * @see org.eclipse.jface.text.reconciler.AbstractReconciler#reconcilerDocumentChanged(IDocument)
- */
- void reconcilerDocumentChanged(IDocument newDocument) {
- IDocument currentDoc = getDocument();
-
- // unhook old document listener
- if (currentDoc != null)
- currentDoc.removeDocumentListener(fDocumentListener);
- // hook up new document listener
- if (newDocument != null)
- newDocument.addDocumentListener(fDocumentListener);
-
- // sets document on all strategies
- setDocument(newDocument);
- }
-
protected IStatus run(IProgressMonitor monitor) {
IStatus status = Status.OK_STATUS;
- if(!PlatformUI.isWorkbenchRunning())
+ if (!PlatformUI.isWorkbenchRunning())
return status;
-
+
try {
beginProcessing();
@@ -655,15 +633,25 @@
}
public void setDocument(IDocument doc) {
- if (fDocument != null && fDocument instanceof IDocumentExtension4) {
- ((IDocumentExtension4) fDocument).removeDocumentRewriteSessionListener(fDocumentRewriteSessionListener);
+ if (fDocument != null) {
+ // unhook old document listener
+ fDocument.removeDocumentListener(fDocumentListener);
+ if (fDocument instanceof IDocumentExtension4) {
+ ((IDocumentExtension4) fDocument).removeDocumentRewriteSessionListener(fDocumentRewriteSessionListener);
+ }
}
fDocument = doc;
- if (fDocument != null && fDocument instanceof IDocumentExtension4) {
- ((IDocumentExtension4) fDocument).addDocumentRewriteSessionListener(fDocumentRewriteSessionListener);
+ if (fDocument != null) {
+ if (fDocument instanceof IDocumentExtension4) {
+ ((IDocumentExtension4) fDocument).addDocumentRewriteSessionListener(fDocumentRewriteSessionListener);
+ }
+ // hook up new document listener
+ fDocument.addDocumentListener(fDocumentListener);
}
+
+ setEntireDocumentDirty(doc);
}
/**
@@ -723,8 +711,6 @@
// removes widget listener
getTextViewer().removeTextInputListener(fTextInputListener);
setInstalled(false);
- // removes document listeners
- reconcilerDocumentChanged(null);
}
setDocument(null);
}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/StructuredRegionProcessor.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/StructuredRegionProcessor.java
index a3c0963..fe734fa 100644
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/StructuredRegionProcessor.java
+++ b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/StructuredRegionProcessor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2006 IBM Corporation and others.
+ * Copyright (c) 2001, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -57,10 +57,6 @@
System.out.println("======================================================"); //$NON-NLS-1$
}
setDocument(sDoc);
- // propagate document change
- // setDocumentOnAllStrategies(sDoc);
- // ensure that the document is re-reconciled
- setEntireDocumentDirty(sDoc);
}
}
finally {
@@ -268,16 +264,16 @@
* @see org.eclipse.jface.text.reconciler.AbstractReconciler#reconcilerDocumentChanged(IDocument)
*/
protected void reconcilerDocumentChanged(IDocument newDocument) {
+ setDocument(newDocument);
+ }
- IDocument currentDoc = getDocument();
-
+ public void setDocument(IDocument newDocument) {
// unhook old lifecycle listner
- unhookModelLifecycleListener(currentDoc);
+ unhookModelLifecycleListener(getDocument());
+ super.setDocument(newDocument);
// add new lifecycle listener
if (newDocument != null)
hookUpModelLifecycleListener(newDocument);
-
- super.reconcilerDocumentChanged(newDocument);
}
/**