Author: yradtsevich
Date: 2011-12-07 07:15:26 -0500 (Wed, 07 Dec 2011)
New Revision: 37049
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/org.jboss.tools.vpe.browsersim/
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.browser/src/org/jboss/tools/vpe/browsersim/browser/PlatformUtil.java
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.browser/src/org/jboss/tools/vpe/browsersim/browser/WebKitBrowserFactory.java
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.eclipse/src/org/jboss/tools/vpe/browsersim/eclipse/Activator.java
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.eclipse/src/org/jboss/tools/vpe/browsersim/eclipse/util/BrowserSimLauncher.java
Log:
https://issues.jboss.org/browse/JBIDE-10360 :
BrowserSim: Unhandled loop exception when running it on MacOSX with 64-bit Eclipse
- changed the way to resolve patches to bundles
- changed the name of the SWT bundle for MacOSX
- added exception handling when a bundle is not found
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.browser/src/org/jboss/tools/vpe/browsersim/browser/PlatformUtil.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.browser/src/org/jboss/tools/vpe/browsersim/browser/PlatformUtil.java 2011-12-07
12:10:59 UTC (rev 37048)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.browser/src/org/jboss/tools/vpe/browsersim/browser/PlatformUtil.java 2011-12-07
12:15:26 UTC (rev 37049)
@@ -23,10 +23,13 @@
String ws = getWs();
String arch = getArch();
- CURRENT_PLATFORM = ws + '.' + os + ("macosx".equals(os) ?
"" : '.' + arch);
+ if ("macosx".equals(os) && "x86".equals(arch)) {
+ CURRENT_PLATFORM = ws + '.' + os; // special case for MacOSX x86 (its SWT
bundle has name org.eclipse.swt.cocoa.macosx)
+ } else {
+ CURRENT_PLATFORM = ws + '.' + os + '.' + arch;
+ }
}
-
-
+
/*
* Copy of org.eclipse.swt.internal.Library.arch()
*/
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.browser/src/org/jboss/tools/vpe/browsersim/browser/WebKitBrowserFactory.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.browser/src/org/jboss/tools/vpe/browsersim/browser/WebKitBrowserFactory.java 2011-12-07
12:10:59 UTC (rev 37048)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.browser/src/org/jboss/tools/vpe/browsersim/browser/WebKitBrowserFactory.java 2011-12-07
12:15:26 UTC (rev 37049)
@@ -26,7 +26,7 @@
return new WebKitBrowser_gtk_linux_x86(parent, style);
} else if (PlatformUtil.CURRENT_PLATFORM.equals("gtk.linux.x86_64")) {
return new WebKitBrowser_gtk_linux_x86_64(parent, style);
- } else if (PlatformUtil.CURRENT_PLATFORM.equals("cocoa.macosx")) {
+ } else if (PlatformUtil.CURRENT_PLATFORM.startsWith("cocoa.macosx")) {
return new WebKitBrowser_webkit_cocoa_macos(parent, style);
} else if (PlatformUtil.CURRENT_PLATFORM.equals("win32.win32.x86")) {
return new WebKitBrowser_win32_win32_x86(parent, style);
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.eclipse/src/org/jboss/tools/vpe/browsersim/eclipse/Activator.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.eclipse/src/org/jboss/tools/vpe/browsersim/eclipse/Activator.java 2011-12-07
12:10:59 UTC (rev 37048)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.eclipse/src/org/jboss/tools/vpe/browsersim/eclipse/Activator.java 2011-12-07
12:15:26 UTC (rev 37049)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.jboss.tools.vpe.browsersim.eclipse;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
@@ -59,6 +61,10 @@
public static Activator getDefault() {
return plugin;
}
+
+ public static void logError(String message, Throwable throwable) {
+ getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, throwable));
+ }
/**
* Returns an image descriptor for the image file at the given
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.eclipse/src/org/jboss/tools/vpe/browsersim/eclipse/util/BrowserSimLauncher.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.eclipse/src/org/jboss/tools/vpe/browsersim/eclipse/util/BrowserSimLauncher.java 2011-12-07
12:10:59 UTC (rev 37048)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.eclipse/src/org/jboss/tools/vpe/browsersim/eclipse/util/BrowserSimLauncher.java 2011-12-07
12:15:26 UTC (rev 37049)
@@ -13,13 +13,15 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
-import java.net.URL;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.preferences.ConfigurationScope;
import org.jboss.tools.vpe.browsersim.browser.PlatformUtil;
+import org.jboss.tools.vpe.browsersim.eclipse.Activator;
+import org.osgi.framework.Bundle;
/**
* @author "Yahor Radtsevich (yradtsevich)"
@@ -82,32 +84,29 @@
};
}.start();
} catch (IOException e) {
- e.printStackTrace();
+ Activator.logError(e.getMessage(), e);
}
}
private static String getBundleLocation(String symbolicName) throws IOException {
- String eclipseHome = new
URL(System.getProperty("eclipse.home.location")).getFile();
- String locationId = Platform.getBundle(symbolicName).getLocation();
-
- File bundleLocation;
- if (locationId.startsWith("reference:file:")) {
- bundleLocation = new
File(locationId.substring("reference:file:".length()));
- } else {
- bundleLocation = new File(locationId);
+ Bundle bundle = Platform.getBundle(symbolicName);
+ if (bundle == null) {
+ throw new IOException("Cannot find bundle: " + symbolicName);
}
- if (!bundleLocation.isAbsolute()) {
- bundleLocation = new File(eclipseHome, bundleLocation.getPath());
- }
-
- if (bundleLocation.isDirectory()) {
- File binDirectory = new File(bundleLocation, "bin");
- if (binDirectory.isDirectory()) {
- bundleLocation = binDirectory;
+ try {
+ File bundleLocation = FileLocator.getBundleFile(bundle);
+
+ if (bundleLocation.isDirectory()) {
+ File binDirectory = new File(bundleLocation, "bin");
+ if (binDirectory.isDirectory()) {
+ bundleLocation = binDirectory;
+ }
}
+
+ return bundleLocation.getCanonicalPath();
+ } catch (IOException e) {
+ throw new IOException("Cannot resolve the path to bundle: " + symbolicName,
e);
}
-
- return bundleLocation.getCanonicalPath();
}
}