在OSX上运行SWT/JFace应用,不依赖Eclipse

SWT/JFace/GEF是Eclipse最主要的开源产物

已经很久不用Eclipse了,想当年在IBM时,从WebSphere到Rational产品家族,言必称Eclipse,言架构必称呼OSGI。从桌面端到服务端,再到web前端,都有OSGI的身影,如Jazz RTC这款备受喜爱的产品,就是基于osgi打造的,Dojo模块也已osgi bundle的方式被launch起来,真是让人赞叹IBM工程师的神奇。
如果说哪一天Eclipse和JBuilder被遗忘到历史的某个角落中,那它里面孵化出的几个UI框架,还是很有价值的,它们就是Eclipse三剑客: SWT/JFace/GEF。

脱离Eclipse框架运行SWT/JFace应用?

当然是可以的,也是有意义的。导入maven依赖:

  
        <dependency>
            <groupId>org.eclipse.swt</groupId>
            <artifactId>org.eclipse.swt.cocoa.macosx.x86_64</artifactId>
            <version>4.6.1</version>
        </dependency>


        <dependency>
            <groupId>org.eclipse.swt</groupId>
            <artifactId>swt-osx</artifactId>
            <version>3.3.0.3346</version>
        </dependency>

      
        <dependency>
            <groupId>org.eclipse.platform</groupId>
            <artifactId>org.eclipse.ui.workbench</artifactId>
            <version>3.126.0</version>
        </dependency>

         
        <dependency>
            <groupId>org.eclipse.platform</groupId>
            <artifactId>org.eclipse.jface</artifactId>
            <version>3.27.0</version>
        </dependency>

        <dependency>
            <groupId>org.eclipse</groupId>
            <artifactId>org.eclipse.draw2d</artifactId>
            <version>3.2.100.v20070529</version>
        </dependency>


        <dependency>
            <groupId>org.eclipse</groupId>
            <artifactId>org.eclipse.gef</artifactId>
            <version>3.2.102.v20080116</version>
        </dependency>

         
        <dependency>
            <groupId>at.bestsolution.efxclipse.eclipse</groupId>
            <artifactId>org.eclipse.gef.graph</artifactId>
            <version>5.0.0.201901221055</version>
        </dependency>

如果在执行maven命令时报错,各种各样的错,都是因为osgi bundle之间的依赖引起的,而且在OSX平台上尤以为甚。则直接去引入相应的jar包也是可以的,在eclipse的安装目录的plugins下,找到下面这些包:
在这里插入图片描述
加入到classpath即可。
注意在OSX下运行SWT应用,需要加VM参数:
在这里插入图片描述

在MacOS上会遇到下面警告:

Method userSpaceScaleFactor in class NSView is deprecated on 10.7 and later.It should not be used in new applications. Use convertRectToBacking: instead. 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

北极象

如果觉得对您有帮助,鼓励一下

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值