[314972] [content assist] Control + shift + space gives java.lang.NullPointerException almost everywhere
diff --git a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/contentassist/JSPStructuredContentAssistProcessor.java b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/contentassist/JSPStructuredContentAssistProcessor.java
index 5d1c5b2..aa2b995 100644
--- a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/contentassist/JSPStructuredContentAssistProcessor.java
+++ b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/contentassist/JSPStructuredContentAssistProcessor.java
@@ -14,11 +14,13 @@
 import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.jface.text.ITextViewer;
 import org.eclipse.jface.text.contentassist.ContentAssistant;
+import org.eclipse.jface.text.contentassist.IContextInformationValidator;
 import org.eclipse.jface.util.PropertyChangeEvent;
 import org.eclipse.jst.jsp.core.text.IJSPPartitions;
 import org.eclipse.wst.html.ui.internal.HTMLUIPlugin;
 import org.eclipse.wst.html.ui.internal.preferences.HTMLUIPreferenceNames;
 import org.eclipse.wst.sse.ui.contentassist.StructuredContentAssistProcessor;
+import org.eclipse.wst.xml.ui.internal.contentassist.AttributeContextInformationPresenter;
 
 /**
  * <p>Implementation of {@link StructuredContentAssistProcessor} for JSP documents</p>
@@ -37,6 +39,9 @@
 	/** property key for determining what the auto activation characters are */
 	private String fAutoActivationCharactersPropertyKey;
 	
+	/** the context information validator for this processor */
+	private IContextInformationValidator fContextInformationValidator;
+	
 	/**
 	 * <p>Constructor</p>
 	 * 
@@ -64,6 +69,16 @@
 	}
 	
 	/**
+	 * @see org.eclipse.wst.sse.ui.contentassist.StructuredContentAssistProcessor#getContextInformationValidator()
+	 */
+	public IContextInformationValidator getContextInformationValidator() {
+		if (this.fContextInformationValidator == null) {
+			this.fContextInformationValidator = new AttributeContextInformationPresenter();
+		}
+		return this.fContextInformationValidator;
+	}
+	
+	/**
 	 * @see org.eclipse.wst.html.ui.internal.contentassist.HTMLStructuredContentAssistProcessor#getCompletionProposalAutoActivationCharacters()
 	 */
 	public char[] getCompletionProposalAutoActivationCharacters() {
diff --git a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/contentassist/LibraryTagsCompletionProposalComputer.java b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/contentassist/LibraryTagsCompletionProposalComputer.java
index c787941..8712ad0 100644
--- a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/contentassist/LibraryTagsCompletionProposalComputer.java
+++ b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/contentassist/LibraryTagsCompletionProposalComputer.java
@@ -11,9 +11,11 @@
 package org.eclipse.jst.jsp.ui.internal.contentassist;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 
+import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.jst.jsp.core.internal.contentmodel.JSPCMDocumentFactory;
 import org.eclipse.jst.jsp.core.internal.contentmodel.TaglibController;
@@ -69,6 +71,16 @@
 	private int fDepthCount;
 
 	/**
+	 * @see org.eclipse.wst.html.ui.internal.contentassist.HTMLTagsCompletionProposalComputer#computeContextInformation(org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext, org.eclipse.core.runtime.IProgressMonitor)
+	 */
+	public List computeContextInformation(
+			CompletionProposalInvocationContext context,
+			IProgressMonitor monitor) {
+		
+		return Collections.EMPTY_LIST;
+	}
+	
+	/**
 	 * @see org.eclipse.wst.html.ui.internal.contentassist.HTMLTagsCompletionProposalComputer#validModelQueryNode(org.eclipse.wst.xml.core.internal.contentmodel.CMNode)
 	 */
 	protected boolean validModelQueryNode(CMNode node) {
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/contentassist/AbstractContentAssistProcessor.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/contentassist/AbstractContentAssistProcessor.java
index e2c878b..c103fbf 100644
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/contentassist/AbstractContentAssistProcessor.java
+++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/contentassist/AbstractContentAssistProcessor.java
@@ -39,6 +39,7 @@
 import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionContainer;
 import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList;
 import org.eclipse.wst.sse.core.internal.util.Debug;
+import org.eclipse.wst.sse.ui.contentassist.ICompletionProposalComputer;
 import org.eclipse.wst.sse.ui.contentassist.StructuredContentAssistProcessor;
 import org.eclipse.wst.sse.ui.internal.IReleasable;
 import org.eclipse.wst.sse.ui.internal.contentassist.ContentAssistUtils;
@@ -82,7 +83,10 @@
 import org.w3c.dom.NodeList;
 
 /**
- * @deprecated This class is no longer used locally and will be removed in the future
+ * @deprecated This class is no longer used locally and will be removed in the future.
+ * Implementers of this class should now use the <code>org.eclipse.wst.sse.ui.completionProposal</code>
+ * extension point in conjunction with the {@link ICompletionProposalComputer} interface.
+ * 
  * @see StructuredContentAssistProcessor
  */
 abstract public class AbstractContentAssistProcessor implements IContentAssistProcessor, IReleasable {
@@ -114,7 +118,6 @@
 	protected static final String UNKNOWN_CONTEXT = XMLUIMessages.Content_Assist_not_availab_UI_;
 	protected char completionProposalAutoActivationCharacters[] = null;
 	protected char contextInformationAutoActivationCharacters[] = null;
-	private AttributeContextInformationProvider fAttributeInfoProvider = null;
 	private AttributeContextInformationPresenter fContextInformationPresenter = null;
 
 	protected String fErrorMessage = null;
@@ -1459,10 +1462,7 @@
 	 *            <code>null</code> if no context could be found
 	 */
 	public IContextInformation[] computeContextInformation(ITextViewer viewer, int documentOffset) {
-		if (fAttributeInfoProvider == null) {
-			fAttributeInfoProvider = new AttributeContextInformationProvider((IStructuredDocument) viewer.getDocument(), (AttributeContextInformationPresenter) getContextInformationValidator());
-		}
-		return fAttributeInfoProvider.getAttributeInformation(documentOffset);
+		return new IContextInformation[0];
 	}
 
 	protected ContentAssistRequest computeEndTagOpenProposals(int documentPosition, String matchString, ITextRegion completionRegion, IDOMNode nodeAtOffset, IDOMNode node) {
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/contentassist/AbstractXMLCompletionProposalComputer.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/contentassist/AbstractXMLCompletionProposalComputer.java
index 82b23ce..eba5b95 100644
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/contentassist/AbstractXMLCompletionProposalComputer.java
+++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/contentassist/AbstractXMLCompletionProposalComputer.java
@@ -13,6 +13,7 @@
 
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Properties;
@@ -21,7 +22,6 @@
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.jface.text.ITextViewer;
 import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.jface.text.contentassist.IContextInformationValidator;
 import org.eclipse.wst.sse.core.StructuredModelManager;
 import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
 import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
@@ -76,15 +76,10 @@
 		private static final String JSP_SCRIPTLET_OPEN = "JSP_SCRIPTLET_OPEN"; //$NON-NLS-1$
 	}
 
-	private AttributeContextInformationProvider fAttributeInfoProvider;
-	private AttributeContextInformationPresenter fContextInformationPresenter;
-
 	private String fErrorMessage;
 	private ITextViewer fTextViewer;
 
 	public AbstractXMLCompletionProposalComputer() {
-		fAttributeInfoProvider = null;
-		fContextInformationPresenter = null;
 		fErrorMessage = null;
 		fTextViewer = null;
 	}
@@ -200,11 +195,8 @@
 			CompletionProposalInvocationContext context,
 			IProgressMonitor monitor) {
 		
-		if (fAttributeInfoProvider == null) {
-			fAttributeInfoProvider = new AttributeContextInformationProvider((IStructuredDocument)context.getDocument(),
-					(AttributeContextInformationPresenter) getContextInformationValidator());
-		}
-		return Arrays.asList(fAttributeInfoProvider.getAttributeInformation(context.getInvocationOffset()));
+		//no default context info
+		return Collections.EMPTY_LIST;
 	}
 	
 	/**
@@ -1109,21 +1101,6 @@
 				(type == DOMJSPRegionContextsPrivateCopy.JSP_ROOT_TAG_NAME) ||
 				type.equals(DOMJSPRegionContextsPrivateCopy.JSP_DIRECTIVE_NAME));
 	}
-
-	/**
-	 * Returns a validator used to determine when displayed context
-	 * information should be dismissed. May only return <code>null</code> if
-	 * the processor is incapable of computing context information.
-	 * 
-	 * a context information validator, or <code>null</code> if the
-	 * processor is incapable of computing context information
-	 */
-	private IContextInformationValidator getContextInformationValidator() {
-		if (fContextInformationPresenter == null) {
-			fContextInformationPresenter = new AttributeContextInformationPresenter();
-		}
-		return fContextInformationPresenter;
-	}
 	
 	/**
 	 * StructuredTextViewer must be set before using this.
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/contentassist/AttributeContextInformationPresenter.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/contentassist/AttributeContextInformationPresenter.java
index acd660b..9871c79 100644
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/contentassist/AttributeContextInformationPresenter.java
+++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/contentassist/AttributeContextInformationPresenter.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2001, 2006 IBM Corporation and others.
+ * Copyright (c) 2001, 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
@@ -19,13 +19,13 @@
 import org.eclipse.jface.text.TextPresentation;
 import org.eclipse.jface.text.contentassist.IContextInformation;
 import org.eclipse.jface.text.contentassist.IContextInformationPresenter;
-import org.eclipse.jface.text.contentassist.IContextInformationValidator;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.StyleRange;
 import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
 import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
 import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
 import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList;
+import org.eclipse.wst.sse.ui.internal.contentassist.ContextInformationValidator;
 import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
 import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
 
@@ -36,43 +36,22 @@
  * 
  * @author pavery
  */
-public class AttributeContextInformationPresenter implements IContextInformationPresenter, IContextInformationValidator {
-	private int fDocumentPosition = -1;
+public class AttributeContextInformationPresenter extends ContextInformationValidator implements IContextInformationPresenter {
 
 	private IContextInformation fInfo = null;
 	private ContextInfoModelUtil fModelUtil = null;
-	private ITextViewer fViewer = null;
 
 	public AttributeContextInformationPresenter() {
 		super();
 	}
-
+	
 	/**
-	 * @see org.eclipse.jface.text.contentassist.IContextInformationValidator#install(org.eclipse.jface.text.contentassist.IContextInformation,
-	 *      org.eclipse.jface.text.ITextViewer, int)
+	 * @see org.eclipse.wst.sse.ui.internal.contentassist.ContextInformationValidator#install(org.eclipse.jface.text.contentassist.IContextInformation, org.eclipse.jface.text.ITextViewer, int)
 	 */
 	public void install(IContextInformation info, ITextViewer viewer, int documentPosition) {
-		fInfo = info;
-		fViewer = viewer;
-		fDocumentPosition = documentPosition;
-		fModelUtil = new ContextInfoModelUtil((IStructuredDocument) fViewer.getDocument());
-	}
-
-	/**
-	 * @see org.eclipse.jface.text.contentassist.IContextInformationValidator#isContextInformationValid(int)
-	 */
-	public boolean isContextInformationValid(int documentPosition) {
-		// determine whether or not this context info should still be
-		// showing...
-		// if cursor still within the element it's valid...
-		boolean result = false;
-		if (fModelUtil != null) {
-			IStructuredDocumentRegion startRegion = fModelUtil.getXMLNode(fDocumentPosition).getStartStructuredDocumentRegion();
-			int start = startRegion.getStartOffset();
-			int end = startRegion.getEndOffset();
-			result = (documentPosition < end) && (documentPosition > start + 1);
-		}
-		return result;
+		super.install(info, viewer, documentPosition);
+		this.fInfo = info;
+		this.fModelUtil = new ContextInfoModelUtil((IStructuredDocument) viewer.getDocument());
 	}
 
 	/**
@@ -88,6 +67,9 @@
 
 		// iterate existing attributes from current node
 		IDOMNode xmlNode = fModelUtil.getXMLNode(documentPosition);
+		if (xmlNode == null)
+			return false;
+		
 		IStructuredDocumentRegion sdRegion = xmlNode.getFirstStructuredDocumentRegion();
 		ITextRegionList regions = sdRegion.getRegions();
 		ITextRegion r = null;
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/contentassist/ContextInfoModelUtil.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/contentassist/ContextInfoModelUtil.java
index a48e753..a0c1c81 100644
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/contentassist/ContextInfoModelUtil.java
+++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/contentassist/ContextInfoModelUtil.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2001, 2006 IBM Corporation and others.
+ * Copyright (c) 2001, 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
@@ -55,7 +55,9 @@
 		IDOMNode xmlNode = null;
 		try {
 			xmlModel = StructuredModelManager.getModelManager().getExistingModelForRead(getDocument());
-			xmlNode = (IDOMNode) xmlModel.getIndexedRegion(offset);
+			if (xmlModel != null) {
+				xmlNode = (IDOMNode) xmlModel.getIndexedRegion(offset);
+			}
 		}
 		finally {
 			if (xmlModel != null)
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/contentassist/XMLStructuredContentAssistProcessor.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/contentassist/XMLStructuredContentAssistProcessor.java
index 2489364..03b1a38 100644
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/contentassist/XMLStructuredContentAssistProcessor.java
+++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/contentassist/XMLStructuredContentAssistProcessor.java
@@ -14,6 +14,7 @@
 
 import org.eclipse.jface.text.ITextViewer;
 import org.eclipse.jface.text.contentassist.ContentAssistant;
+import org.eclipse.jface.text.contentassist.IContextInformationValidator;
 import org.eclipse.jface.util.PropertyChangeEvent;
 import org.eclipse.wst.sse.ui.contentassist.StructuredContentAssistProcessor;
 import org.eclipse.wst.xml.ui.internal.XMLUIPlugin;
@@ -31,6 +32,9 @@
 	/** the auto activation characters for this processor, set by user preference */
 	private char[] fCompletionPropoaslAutoActivationCharacters;
 	
+	/** the context information validator for this processor */
+	private IContextInformationValidator fContextInformationValidator;
+	
 	/**
 	 * <p>Constructor</p>
 	 * 
@@ -45,6 +49,15 @@
 		getAutoActivationCharacterPreferences();
 	}
 
+	/**
+	 * @see org.eclipse.wst.sse.ui.contentassist.StructuredContentAssistProcessor#getContextInformationValidator()
+	 */
+	public IContextInformationValidator getContextInformationValidator() {
+		if (this.fContextInformationValidator == null) {
+			this.fContextInformationValidator = new AttributeContextInformationPresenter();
+		}
+		return this.fContextInformationValidator;
+	}
 
 	/**
 	 * @see org.eclipse.wst.sse.ui.contentassist.StructuredContentAssistProcessor#getCompletionProposalAutoActivationCharacters()
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/contentassist/XMLTagsCompletionProposalComputer.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/contentassist/XMLTagsCompletionProposalComputer.java
index c34a635..6f82956 100644
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/contentassist/XMLTagsCompletionProposalComputer.java
+++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/contentassist/XMLTagsCompletionProposalComputer.java
@@ -10,6 +10,13 @@
  *******************************************************************************/
 package org.eclipse.wst.xml.ui.internal.contentassist;
 
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.text.contentassist.IContextInformationValidator;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
+import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext;
 import org.eclipse.wst.xml.core.internal.contentmodel.CMNode;
 
 /**
@@ -26,6 +33,16 @@
 	/** the generated used to generate the proposals */
 	protected XMLContentModelGenerator fGenerator;
 	
+	/** the context information validator for this computer */
+	private IContextInformationValidator fContextInformationValidator;
+	
+	/**
+	 * TODO: IAN: Comment me
+	 */
+	public XMLTagsCompletionProposalComputer() {
+		this.fContextInformationValidator = null;
+	}
+	
 	/**
 	 * @see org.eclipse.wst.xml.ui.internal.contentassist.AbstractXMLModelQueryCompletionProposalComputer#getContentGenerator()
 	 */
@@ -37,6 +54,19 @@
 	}
 	
 	/**
+	 * @see org.eclipse.wst.xml.ui.internal.contentassist.AbstractXMLCompletionProposalComputer#computeContextInformation(org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext, org.eclipse.core.runtime.IProgressMonitor)
+	 */
+	public List computeContextInformation(
+			CompletionProposalInvocationContext context,
+			IProgressMonitor monitor) {
+		
+		AttributeContextInformationProvider attributeInfoProvider =
+			new AttributeContextInformationProvider((IStructuredDocument)context.getDocument(),
+					(AttributeContextInformationPresenter) getContextInformationValidator());
+		return Arrays.asList(attributeInfoProvider.getAttributeInformation(context.getInvocationOffset()));
+	}
+	
+	/**
 	 * <p>Filters out any model query actions that are not specific to XML</p>
 	 * <p><b>NOTE:</b> Currently nothing is filtered so this computer returns all
 	 * results from the model query for the current content type</p>
@@ -46,4 +76,19 @@
 	protected boolean validModelQueryNode(CMNode node) {
 		return true;
 	}
+	
+	/**
+	 * Returns a validator used to determine when displayed context
+	 * information should be dismissed. May only return <code>null</code> if
+	 * the processor is incapable of computing context information.
+	 * 
+	 * a context information validator, or <code>null</code> if the
+	 * processor is incapable of computing context information
+	 */
+	private IContextInformationValidator getContextInformationValidator() {
+		if (fContextInformationValidator == null) {
+			fContextInformationValidator = new AttributeContextInformationPresenter();
+		}
+		return fContextInformationValidator;
+	}
 }