[jbosstools-commits] JBoss Tools SVN: r35859 - in branches/jbosstools-3.3.0.M4/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central: editors and 1 other directory.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Thu Oct 20 14:37:24 EDT 2011


Author: snjeza
Date: 2011-10-20 14:37:24 -0400 (Thu, 20 Oct 2011)
New Revision: 35859

Modified:
   branches/jbosstools-3.3.0.M4/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/JBossCentralActivator.java
   branches/jbosstools-3.3.0.M4/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java
Log:
JBIDE-9976 Tooltips in JBoss Central crash in Windows 7 64bits

Modified: branches/jbosstools-3.3.0.M4/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/JBossCentralActivator.java
===================================================================
--- branches/jbosstools-3.3.0.M4/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/JBossCentralActivator.java	2011-10-20 18:29:40 UTC (rev 35858)
+++ branches/jbosstools-3.3.0.M4/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/JBossCentralActivator.java	2011-10-20 18:37:24 UTC (rev 35859)
@@ -31,6 +31,8 @@
 import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.IEditorInput;
@@ -91,6 +93,8 @@
 	// The plug-in ID
 	public static final String PLUGIN_ID = "org.jboss.tools.central"; //$NON-NLS-1$
 
+	private static Boolean isInternalWebBrowserAvailable;
+	
 	public static final String SHOW_JBOSS_CENTRAL_ON_STARTUP = "showJBossCentralOnStartup";
 
 	public static final boolean SHOW_JBOSS_CENTRAL_ON_STARTUP_DEFAULT_VALUE = true;
@@ -435,4 +439,30 @@
 		}
 		return directory;
 	}
+		
+	public static boolean isInternalWebBrowserAvailable() {
+		if (isInternalWebBrowserAvailable != null) {
+			return isInternalWebBrowserAvailable.booleanValue();
+		}
+		Shell shell = null;
+		try {
+			shell = new Shell(PlatformUI.getWorkbench().getDisplay());
+			new Browser(shell, SWT.NONE);
+			isInternalWebBrowserAvailable = new Boolean(true);
+			return true;
+		} catch (Throwable t) {
+			try {
+				new Browser(shell, SWT.WEBKIT);
+				isInternalWebBrowserAvailable = new Boolean(true);
+				return true;
+			} catch (Throwable e) {
+				isInternalWebBrowserAvailable = new Boolean(false);
+				return false;
+			}
+		} finally {
+			if (shell != null)
+				shell.dispose();
+		}
+	}
+
 }

Modified: branches/jbosstools-3.3.0.M4/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java
===================================================================
--- branches/jbosstools-3.3.0.M4/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java	2011-10-20 18:29:40 UTC (rev 35858)
+++ branches/jbosstools-3.3.0.M4/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java	2011-10-20 18:37:24 UTC (rev 35859)
@@ -941,7 +941,7 @@
 			//formText.setFont("author", boldFont);
 			formText.setColor("author", JFaceColors.getHyperlinkText(getDisplay()));
 			formText.setImage("image", getFeedsImage());
-			if (entry.getDescription() != null && !entry.getDescription().isEmpty()) {
+			if (JBossCentralActivator.isInternalWebBrowserAvailable() && entry.getDescription() != null && !entry.getDescription().isEmpty()) {
 				ToolTip toolTip = new FeedsToolTip(formText, entry.getDate() + " " + entry.getDescription());
 				toolTip.activate();
 			}



More information about the jbosstools-commits mailing list