如何使SWT浏览器控件使用Mozilla,而不是IE浏览器在Windows? [英] How to make SWT Browser control use Mozilla instead of IE on Windows?

查看:359
本文介绍了如何使SWT浏览器控件使用Mozilla,而不是IE浏览器在Windows?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想就我跑我的应用程序的所有平台SWT使用Mozilla。但是,当然,使用SWT IE浏览器在Windows默认情况下。任何想法如何使SWT使用Mozilla的窗口。我知道我需要在机器上已经安装XULRunner的。

I want to make SWT use mozilla on all platforms I run my app on. But SWT of course used IE on Windows by default. Any idea how to make SWT use Mozilla on windows. I know that I need to have XULRunner installed on the machine.

推荐答案

滑稽你问 - 我只需要同样为我们的项目

Funny you've asked - I just needed the same for our project.


  1. 转到ATF网站(http://wiki.eclipse.org/ATF/Installing) - 有如何从Zend的站点D / L XUL亚军

  2. 这code将让你运行的浏览器不注册的XULRunner:

code:

Bundle bundle = Platform.getBundle("org.mozilla.xulrunner"); //$NON-NLS-1$
if (bundle != null) 
{
    URL resourceUrl = bundle.getResource("xulrunner"); //$NON-NLS-1$
    if (resourceUrl != null) {
        try {
            URL fileUrl = FileLocator.toFileURL(resourceUrl);
            File file = new File(fileUrl.toURI());
            System.setProperty("org.eclipse.swt.browser.XULRunnerPath",file.getAbsolutePath()); //$NON-NLS-1$
        } catch (IOException e) {
            // log the exception
        } catch (URISyntaxException e) {
            // log the exception
        }
    }
}

更多细节在这里:<一href=\"http://www.eclipse.org/swt/faq.php#howusemozilla\">http://www.eclipse.org/swt/faq.php#howusemozilla

注意:我的code是常见问题(不同的插件ID)略有不同 - 我为我的作品这样

Note: my code is slightly different from FAQ (different plugin ID) - i works for me this way.

这篇关于如何使SWT浏览器控件使用Mozilla,而不是IE浏览器在Windows?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆