`
shinfocom
  • 浏览: 1190279 次
文章分类
社区版块
存档分类
最新评论

初学E4/XWT

 
阅读更多

之前学习了SWT/JFace。现在准备研究一下XWT.

首先给出一些简介

What is XWT?

XWT stands for eclipse XML Window Toolkit. It is a powerful and lightweight declarative UI framework designed for Eclipse, based on XML as markup language.

XWT simplifies UI development by a physical separation of UI definition in XML from the run-time logic in programing language. It is very intuitive for creating interfaces directly or via tools such as Visual editor. especially for people with a background in web design and technologies.

参考网址:

http://wiki.eclipse.org/E4/XWT

如何进行一个XWT开发呢?

首先要准备开发环境。

所需要的eclipse3.6和eclipse-e4-repo-incubation-0.10

采用link方式把eclipse-e4..的bundle加载到eclipse里面

现在就开始开发一个简单的XWT程序

启动Eclipse,点击new Project

如图:

点击Next如图

继续点击Next

点击Finish

然后在选择“Dependencies”选项卡,点击“Add”添加依赖

加入这些依赖

org.eclipse.core.runtime,
org.eclipse.swt;bundle-version="3.6.0",
org.eclipse.jface;bundle-version="3.6.0",
org.eclipse.e4.xwt;bundle-version="0.9.1",
org.eclipse.core.databinding;bundle-version="1.3.100",
org.eclipse.jface.databinding;bundle-version="1.4.0",
org.eclipse.core.databinding.property;bundle-version="1.3.0",
com.ibm.icu;bundle-version="4.2.1",
org.pushingpixels.trident;bundle-version="1.2.0",
org.eclipse.e4.xwt.forms;bundle-version="0.9.1",
org.eclipse.ui.forms;bundle-version="3.5.0"

如图所示

我们在package上面点击右键选择new再选择other

如图

最后点击Finish。

就会自动生成两个文件,分别是HelloWorld.java,HelloWorld.xwt

在HelloWorld.java里面的代码如有修改一下,这样才比较合适

之前的是

修改后的是

在HelloWorld.xwt文件中加入一句话

<Label text="HelloWorld"/>

最后写一个Test.java的测试类代码如下

运行结果如图

更多信息会在以后写出来。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics