Cypal Studio for GWT 其实就是Googlipse(http://www.googlipse.com),但Googlipse已经不再更新。该项目作者创建了一个新产品来替代Googlipse,这就是Cypal Studio for GWT。从下面的配置过程大家也可以看到二者基本一致。<o:p></o:p>
<o:p></o:p>
二)环境配置及示例<o:p></o:p>
1.Eclipse 3.2 + WTP1.5
2.GWT,从http://code.google.com/webtoolkit/download.html下载并解压缩至D:/gwt-windows-1.4.10目录
3.Cypal Studio for GWT,从http://www.cypal.in/studio 下载并解压缩至Eclipse目录
4.运行Eclipse,打开Window-> Preferences->Cypal Studio,设置GWT Home(步骤2)
5.创建Dynamic Web Project,在configurations选项选中Default Cypal Studio Project
打开com.yourcompany.gwt.test.public下的test.html,添加一个表格。
- <table align=center>
- <tr>
- <td id="slot1"></td><td id="slot2"></td>
- </tr>
- </table>
<o:p></o:p>
Test类实现EntryPoint接口,需要手工实现onModuleLoad方法。
- public void onModuleLoad() {
- // TODO Auto-generated method stub
- final Button button = new Button("Click me");
- final Label label = new Label();
- button.addClickListener(new ClickListener() {
- public void onClick(Widget sender) {
- if (label.getText().equals(""))
- label.setText("Hello World!");
- else
- label.setText("");
- }
- });
- // Assume that the host HTML has elements defined whose
- // IDs are "slot1", "slot2". In a real app, you probably would not want
- // to hard-code IDs. Instead, you could, for example, search for all
- // elements with a particular CSS class and replace them with widgets.
- //
- RootPanel.get("slot1").add(button);
- RootPanel.get("slot2").add(label);
- }
- 运行<o:p></o:p>
点击Run->Run/Debug,打开运行配置对话框,双击GWT Hosted Mode Application,在右侧选择项目和模块,然后可以运行或调试。