[320771] XML content areas not spell checked
diff --git a/bundles/org.eclipse.jst.jsp.core/plugin.xml b/bundles/org.eclipse.jst.jsp.core/plugin.xml
index ad4f647..066f96c 100644
--- a/bundles/org.eclipse.jst.jsp.core/plugin.xml
+++ b/bundles/org.eclipse.jst.jsp.core/plugin.xml
@@ -114,7 +114,7 @@
 			file-extensions="jsp,jsv,jtpl,jspx"
 			priority="high"
 			name="%JSP_Content_Type_Extension_Element.name"
-			id="jspsource"
+			id="org.eclipse.jst.jsp.core.jspsource"
 			base-type="org.eclipse.core.runtime.text"
 			default-charset="ISO-8859-1">
 			<describer
@@ -125,7 +125,7 @@
 			file-extensions="jspf,jsf"
 			priority="high"
 			name="%JSP_Fragment_Content_Type_Extension_Element.name"
-			id="jspfragmentsource"
+			id="org.eclipse.jst.jsp.core.jspfragmentsource"
 			base-type="org.eclipse.jst.jsp.core.jspsource"
 			default-charset="ISO-8859-1">
 			<describer
@@ -136,7 +136,7 @@
 			file-extensions="tag,tagx,tagf"
 			priority="high"
 			name="%JSP_Tag_Content_Type_Extension_Element.name"
-			id="tagsource"
+			id="org.eclipse.jst.jsp.core.tagsource"
 			base-type="org.eclipse.jst.jsp.core.jspsource"
 			default-charset="ISO-8859-1"/>
 		<!-- create content type for .tld files -->
@@ -144,7 +144,7 @@
 			file-extensions="tld"
 			priority="high"
 			name="%JSP_TLD_Content_Type_Extension_Element.name"
-			id="tldsource"
+			id="org.eclipse.jst.jsp.core.tldsource"
 			base-type="org.eclipse.core.runtime.xml"
 			default-charset="UTF-8">
 			<!-- add the describer so it's properly detected when opened from within .jar files -->
@@ -161,7 +161,7 @@
 			file-extensions="jsp"
 			priority="high"
 			name="%contentTypeCSSJSPName"
-			id="cssjspsource"
+			id="org.eclipse.jst.jsp.core.cssjspsource"
 			base-type="org.eclipse.jst.jsp.core.jspsource">
 			<describer
 				class="org.eclipse.jst.jsp.css.core.internal.contenttype.ContentDescriberForJSPedCSS" />
@@ -170,7 +170,7 @@
 	        file-extensions="jspf"
 			priority="high"
 			name="%contentTypeCSSJSPFName"
-			id="cssjspfragmentsource"
+			id="org.eclipse.jst.jsp.core.cssjspfragmentsource"
 			base-type="org.eclipse.jst.jsp.core.cssjspsource">
 			<describer
 				class="org.eclipse.jst.jsp.css.core.internal.contenttype.ContentDescriberForJSPedCSS" />
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/spelling/SpellcheckStrategy.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/spelling/SpellcheckStrategy.java
index d75e8e6..d95c9c3 100644
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/spelling/SpellcheckStrategy.java
+++ b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/spelling/SpellcheckStrategy.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2006, 2009 IBM Corporation and others.
+ * Copyright (c) 2006, 2010 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
@@ -117,6 +117,8 @@
 	private String fContentTypeId = null;
 
 	private SpellingProblemCollector fProblemCollector = new SpellingProblemCollector();
+	
+	IStructuredModel structuredModel = null;
 
 	/*
 	 * Keying our Temporary Annotations based on the partition doesn't help
@@ -321,7 +323,16 @@
 			Logger.log(Logger.INFO, "Spell checking [" + regionToBeChecked.getOffset() + "-" + (regionToBeChecked.getOffset() + regionToBeChecked.getLength()) + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 		}
 		if (getDocument() != null) {
-			EditorsUI.getSpellingService().check(getDocument(), new IRegion[]{regionToBeChecked}, fSpellingContext, fProblemCollector, null);
+			try {
+				EditorsUI.getSpellingService().check(getDocument(), new IRegion[]{regionToBeChecked}, fSpellingContext, fProblemCollector, null);
+			}
+			finally {
+				// corresponding "get" is in #shouldSpellCheck(int) 
+				if (structuredModel != null) {
+					structuredModel.releaseFromRead();
+					structuredModel = null;
+				}
+			}
 		}
 		annotationsToAdd = fProblemCollector.getAnnotations();
 		fProblemCollector.clear();
@@ -383,22 +394,19 @@
 	private boolean shouldSpellcheck(int offset) {
 		boolean decision = true;
 		
-		IStructuredModel model = null;
-		try {
-			model = StructuredModelManager.getModelManager().getExistingModelForRead(getDocument());
-			
-			/* use an an adapter factory to get a spell-check decision maker,
-			 * and ask it if the  offset should be spell-checked.  It is done
-			 * this way so content type specific decisions can be made without this
-			 * plugin being aware of any content type specifics.
+		if (structuredModel == null)
+			structuredModel = StructuredModelManager.getModelManager().getExistingModelForRead(getDocument());
+
+		if (structuredModel != null) {
+			/*
+			 * use an an adapter factory to get a spell-check decision maker,
+			 * and ask it if the offset should be spell-checked. It is done
+			 * this way so content type specific decisions can be made without
+			 * this plugin being aware of any content type specifics.
 			 */
-			ISpellcheckDelegate delegate = (ISpellcheckDelegate)Platform.getAdapterManager().getAdapter(model, ISpellcheckDelegate.class);
-			if(delegate != null) {
-				decision = delegate.shouldSpellcheck(offset, model);
-			}
-		}  finally {
-			if(model != null) {
-				model.releaseFromRead();
+			ISpellcheckDelegate delegate = (ISpellcheckDelegate) Platform.getAdapterManager().getAdapter(structuredModel, ISpellcheckDelegate.class);
+			if (delegate != null) {
+				decision = delegate.shouldSpellcheck(offset, structuredModel);
 			}
 		}
 		
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/spelling/SpellcheckDelegateAdapterFactory.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/spelling/SpellcheckDelegateAdapterFactory.java
index a6fae54..da41eb4 100644
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/spelling/SpellcheckDelegateAdapterFactory.java
+++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/spelling/SpellcheckDelegateAdapterFactory.java
@@ -16,6 +16,7 @@
 import org.eclipse.wst.sse.ui.internal.spelling.ISpellcheckDelegate;
 import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
 import org.w3c.dom.Comment;
+import org.w3c.dom.Text;
 
 /**
  * An <code>IAdapterFactory</code> to adapt an <code>IDOMModel</code> to a
@@ -48,7 +49,7 @@
 			
 			IndexedRegion region = model.getIndexedRegion(offset);
 			if(region != null) {
-				shouldSpellcheck = (region instanceof Comment);
+				shouldSpellcheck = (region instanceof Comment || region instanceof Text);
 			}
 			
 			return shouldSpellcheck;