Googlipse-不错的GWT Eclipse插件


最近发现一个很不错的用于在Eclipse IDE下应用GWT开发AJAX的插件,叫Googlipse,名字还很好记,呵呵.
它的最近发布版本是0.5.4版,可以支持GWT1.4.60,不过在sourceforge.net里的邮件列表里发现原来这个插件已经停止开发与BUG修复了,真是可惜.现在把安装与使用方法简单翻译一下,以防自己以后忘记,也方便大家学习.不过,本人E文也一般,大致上给翻译一下, 翻译的很生硬,不过主要的信息还是体现出来了,大家将就一下


准备:


1) 下载:http://sourceforge.net/projects/googlipse


2) 安装前提:
 a) Eclipse 3.2 with WebTools Platform 1.5(一定要装,)
 b) 已经安装了JDK 1.5以上
 c) 还需要下载 Google Web Toolkit , 网址是: http://code.google.com/webtoolkit/


 


安装插件到制作实例的全过程(英文是从官方网站上COPY的)


 (*) Drop the com.googlipse.gwt_<version>.jar file in your eclipse\plugins folder
 将com.googlipse.gwt_<version>.jar文件放到你的Eclipse安装文件夹中的plugins文件夹下 (译者注: 我这里用的的com.googlipse.gwt_0.5.4.jar)


 (*) Open Eclipse. Select Window->Preferences->Googlipse and set GWT home to the directory where you have installed the Google Web Toolkit.
 打开Eclipse, 选择Window->Preferences->Googlipse , 设置GWT安装目录


 (*) You are all set to code.
 (此句不知该怎么翻译..-_-!)


Adding Googlipse to your project:
 Googlipse is implemented as a WTP Facet. When creating a new Dynamic Web Project, select Googlipse in the Project Facets page. If you already have a Dynamic Web Project, you can add Googlipse facet by selecting Project->Properties->Project Facets(Please make sure you don’t have gwt-user.jar in your classpath). In case you didn’t like Googlipse, you can remove the facet.


添加Googlipse到你的工程:
 Googlipse是一个实现了WTP的插件(Facet这个单词不知道具体要怎么翻译,暂且翻译成”插件”). 当新建一个的动态WEB工程时,可在工程模块页面中选择Googlipse.如果已经有一个动态WEB工程时,可以通过 Project->Properties->Project Facets 添加Googlipse插件(请确认gwt-user.jar在不在你的classpath中). 假使你不喜欢Googlipse,你也可以移除它.


Creating a Module:
 Once you have a Dynamic Web Project with Googlipse facet, you can add a new module by File->New->Other->Googlipse->Gwt Module. Modules can be created only in valid java packages (default package is not allowed). Either you can type in the package (with project & source folder) in the location field or you can select it by clicking Browse button. You can also click the Create button to create a new package. Next type in the name of the module. Click Finish, you will have all the artifacts for the module generated.


新建一个模块:
 当有了一个包含Googlipse插件的动态WEB工程后,你可以通过 File->New->Other->Googlipse->Gwt Module 添加一个新的模块. 这些模块只能被创建到一个有效的包中(默认包名不允许使用),
你可以指定包名(包含工程名和源文件夹名)或通过点击Browse按钮选择包. 你也可以自己新建一个包. 然后输入模块名称,点击Finish, 就可以得到这个模块生成的组件.
 
Adding a Remote Service;


 Note :A Remote Service will be created only in a module. So if you don’t have a module, you need to create one using the New Module wizard, before this step.
 You can select File->New->Other->Googlipse->Gwt Remote Service. Click the Browse button and select the module (the gwt.xml file). Type the name and uri for the service and click Finish. Now the artifacts for the remote service will be generated. (You have to add an entry in the gwt.xml file manually. Googlipse doesn’t add it. This feature will be implemented in future versions)


添加远程服务:
 提示: 一个模块中只能创建一个远程服务. 在这一步之前, 如果你没有模块, 你需要使用New Module向导创建一个新模块
 选择: File->New->Other->Googlipse->Gwt Remote Service , 点击Browse按钮,选择当前模块(即gwt.xml文件),输入该服务的名程和uri地址,然后点击Finish. 现在这个远程服务的组件就已经生成了.(你必须手动地在gwt.xml文件中添加配置. Googlipse并不自动添加, 在以后的版本中将支持该功能)
 
Adding a Remote Service method:


 You can open the RemoteService interface and add/change methods in it. You need to provide the implementation of those methods in RemoteServiceImpl class, but thanks to Googlipse, you don’t have to do anything in RemoteServiceAsync. Googlipse will automatically update the corresponding Async file whenever a RemoteService interface is changed.


添加一个远程服务的方法:
 你可以打开RemoteService接口并添加/修改其中的方法. 你需要在RemoteServiceImpl类中提供这些方法的实现, 不过有了Googlipse, 你不需要做任何事情,当RemoteService接口改变时Googlipse会自动更新相应的文件
 
Calling a method using Remote Service:
 The utility class in the Remote service should help you in making the remote call.
 
 MyRemoteServiceAsync async = MyRemoteService.Util.getInstance();
 async.makeRemoteCall(param1, param2, callback);
 
在远程服务中调用一个方法:
 在远程服务的实体类会帮你产生相应的远程调用.
 MyRemoteServiceAsync async = MyRemoteService.Util.getInstance();
 async.makeRemoteCall(param1, param2, callback);


Running/Debugging a Gwt Application:
 Select Run->Run/Debug to activate the Lauch configuration dialog box. Double Click “Gwt Application”. In the main page, you can select the Project & Module you want to run. In the parameters page you can select the parameters such as port and log level. Click Run to execute the GwtShell & bring up your application. The laucher will add the jar files & all the source folders in the project to your application.


运行/调试:
 选择 Run->Run/Debug 显示Lauch configuration对话框, 双击”Gwt Application”. 在main页面中,选择要运行的工程和模块.在parameters页面中选择参数,如端口和日志级别. 点击Run,即可执行GwtShell并加载你的应用程序, GwtShell将添加工程中的jar包和所有的源文件夹到你的应用程序中