[jbosstools-commits] JBoss Tools SVN: r42958 - in trunk: jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp and 1 other directory.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Thu Aug 9 13:11:52 EDT 2012


Author: vrubezhny
Date: 2012-08-09 13:11:52 -0400 (Thu, 09 Aug 2012)
New Revision: 42958

Modified:
   trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/XMLTextViewerConfiguration.java
   trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/HTMLTextViewerConfiguration.java
   trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JSPTextViewerConfiguration.java
Log:
JBIDE-12407
NPE initializing JBoss Tools web editors (xml, xhtml, etc) if source "on-demand hyperlinking" is disabled in Eclipse 

Issue is fixed

Modified: trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/XMLTextViewerConfiguration.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/XMLTextViewerConfiguration.java	2012-08-09 15:29:05 UTC (rev 42957)
+++ trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/XMLTextViewerConfiguration.java	2012-08-09 17:11:52 UTC (rev 42958)
@@ -34,6 +34,7 @@
 import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.graphics.RGB;
 import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
 import org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration;
 import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext;
 import org.eclipse.wst.sse.ui.internal.ExtendedConfigurationBuilder;
@@ -116,6 +117,9 @@
 	 * @since 3.1
 	 */
 	public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) {
+		if (!fPreferenceStore.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HYPERLINKS_ENABLED))
+			return null;
+
 		List<IHyperlinkDetector> allDetectors = new ArrayList<IHyperlinkDetector>(0);
 
 		IHyperlinkDetector extHyperlinkDetector = getTextEditorsExtensionsHyperlinkDetector(); 
@@ -123,9 +127,11 @@
 		if (extHyperlinkDetector != null) allDetectors.add(extHyperlinkDetector);
 		
 		IHyperlinkDetector[] superDetectors = super.getHyperlinkDetectors(sourceViewer);
-		for (IHyperlinkDetector detector : superDetectors) {
-			if (!allDetectors.contains(detector)) {
-				allDetectors.add(detector);
+		if (superDetectors != null) {
+			for (IHyperlinkDetector detector : superDetectors) {
+				if (!allDetectors.contains(detector)) {
+					allDetectors.add(detector);
+				}
 			}
 		}
 		

Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/HTMLTextViewerConfiguration.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/HTMLTextViewerConfiguration.java	2012-08-09 15:29:05 UTC (rev 42957)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/HTMLTextViewerConfiguration.java	2012-08-09 17:11:52 UTC (rev 42958)
@@ -37,6 +37,7 @@
 import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.graphics.RGB;
 import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
 import org.eclipse.wst.html.core.text.IHTMLPartitions;
 import org.eclipse.wst.html.ui.StructuredTextViewerConfigurationHTML;
 import org.eclipse.wst.html.ui.internal.contentassist.HTMLStructuredContentAssistProcessor;
@@ -124,6 +125,9 @@
 	 * @since 3.1
 	 */
 	public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) {
+		if (!fPreferenceStore.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HYPERLINKS_ENABLED))
+			return null;
+
 		List<IHyperlinkDetector> allDetectors = new ArrayList<IHyperlinkDetector>();
 		
 		IHyperlinkDetector extHyperlinkDetector = HyperlinkDetector.getInstance(); 
@@ -131,9 +135,11 @@
 		if (extHyperlinkDetector != null) allDetectors.add(extHyperlinkDetector);
 		
 		IHyperlinkDetector[] superDetectors = super.getHyperlinkDetectors(sourceViewer);
-		for (IHyperlinkDetector detector : superDetectors) {
-			if (!allDetectors.contains(detector)) {
-				allDetectors.add(detector);
+		if (superDetectors != null) {
+			for (IHyperlinkDetector detector : superDetectors) {
+				if (!allDetectors.contains(detector)) {
+					allDetectors.add(detector);
+				}
 			}
 		}
 		

Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JSPTextViewerConfiguration.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JSPTextViewerConfiguration.java	2012-08-09 15:29:05 UTC (rev 42957)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JSPTextViewerConfiguration.java	2012-08-09 17:11:52 UTC (rev 42958)
@@ -33,6 +33,7 @@
 import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.graphics.RGB;
 import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
 import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext;
 import org.eclipse.wst.sse.ui.internal.ExtendedConfigurationBuilder;
 import org.eclipse.wst.sse.ui.internal.SSEUIPlugin;
@@ -153,6 +154,9 @@
 	 * @since 3.1
 	 */
 	public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) {
+		if (!fPreferenceStore.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HYPERLINKS_ENABLED))
+			return null;
+
 		List<IHyperlinkDetector> allDetectors = new ArrayList<IHyperlinkDetector>();
 		
 		IHyperlinkDetector extHyperlinkDetector = HyperlinkDetector.getInstance(); 
@@ -160,9 +164,11 @@
 		if (extHyperlinkDetector != null) allDetectors.add(extHyperlinkDetector);
 		
 		IHyperlinkDetector[] superDetectors = super.getHyperlinkDetectors(sourceViewer);
-		for (IHyperlinkDetector detector : superDetectors) {
-			if (!allDetectors.contains(detector)) {
-				allDetectors.add(detector);
+		if (superDetectors != null) {
+			for (IHyperlinkDetector detector : superDetectors) {
+				if (!allDetectors.contains(detector)) {
+					allDetectors.add(detector);
+				}
 			}
 		}
 		



More information about the jbosstools-commits mailing list