[jbosstools-commits] JBoss Tools SVN: r35907 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Fri Oct 21 14:30:13 EDT 2011


Author: vrubezhny
Date: 2011-10-21 14:30:12 -0400 (Fri, 21 Oct 2011)
New Revision: 35907

Modified:
   trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPPropertySourceAdapter.java
Log:
JBIDE-9949 NPE when close VPE in contextassist

The patch preventing content assist processor updating/acquiring when the editor is closing is applied.

Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPPropertySourceAdapter.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPPropertySourceAdapter.java	2011-10-21 18:09:59 UTC (rev 35906)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPPropertySourceAdapter.java	2011-10-21 18:30:12 UTC (rev 35907)
@@ -1,12 +1,12 @@
 /*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Copyright (c) 2007-2011 Red Hat, Inc.
  * Distributed under license by Red Hat, Inc. All rights reserved.
  * This program is made available under the terms of the
  * Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  *
  * Contributors:
- *     Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ *     Red Hat, Inc. - initial API and implementation
  ******************************************************************************/ 
 package org.jboss.tools.jst.jsp.outline;
 
@@ -96,14 +96,12 @@
 	JspELCompletionProposalComputer processor;
 	int offset = 0;
 	KbQuery kbQuery, kbQueryAttr;
-	@SuppressWarnings("unchecked")
 	private Set attributeNames = new HashSet();
 
 	public JSPPropertySourceAdapter(INodeNotifier target) {
 		setTarget(target);
 	}
 	
-	@SuppressWarnings("unchecked")
 	Map getWeights() {
 		return sorter == null ? new HashMap() : sorter.weights;
 	}
@@ -124,14 +122,21 @@
 		}
 
 		if(fNode instanceof Node) {
-			processor = valueHelper.isFacetets() ? new FaceletsELCompletionProposalComputer() : new JspELCompletionProposalComputer();
-//			processor.createContext(getTextViewer(), offset);
-			processor.setKeepState(true);
-	        processor.computeCompletionProposals(new CompletionProposalInvocationContext(getTextViewer(), offset), new NullProgressMonitor());
-			pageContext = processor.getContext();
-			kbQuery = createKbQuery(processor);
-			kbQuery.setMask(true); 
-			kbQueryAttr = createKbQuery(processor);
+			ITextViewer viewer = getTextViewer();
+			// Jeremy: JBIDE-9949: This prevents invocation of CA Proposals Computation in case 
+			// of Text Viewer is not accessible anymore (f.i. in case of closing editor, 
+			// since ITexViewer is acquired from Active Page of Active Workbench Window)
+			//
+			if (viewer != null) {  
+				processor = valueHelper.isFacetets() ? new FaceletsELCompletionProposalComputer() : new JspELCompletionProposalComputer();
+	//			processor.createContext(getTextViewer(), offset);
+				processor.setKeepState(true);
+		        processor.computeCompletionProposals(new CompletionProposalInvocationContext(viewer, offset), new NullProgressMonitor());
+				pageContext = processor.getContext();
+				kbQuery = createKbQuery(processor);
+				kbQuery.setMask(true); 
+				kbQueryAttr = createKbQuery(processor);
+			}
 		}
 	}
 	
@@ -252,7 +257,7 @@
 				}
 				else {
 					String an = attrName;
-					if(an.startsWith("xmlns:")) an = "xmlns:*";
+					if(an.startsWith("xmlns:")) an = "xmlns:*"; //$NON-NLS-1$ //$NON-NLS-2$
 					IAttribute a = as.get(an);
 					if(a != null) {
 						descriptor = createJSPPropertyDescriptor(a, attr.getName(), false);



More information about the jbosstools-commits mailing list