考虑到 GWT 就是 Java,GWT IDE 插件有什么好处?
编写 GWT 代码基本上就是编写 Java 代码,那么 IDE 的 GWT 到底是做什么的呢?例如,IDEA 和 Eclipse 都有 GWT 插件(也许还有 NetBeans?),但它们是否能实现我在没有 GWT 插件的情况下仅使用 Eclipse 或 IDEA 无法做到的功能?
Seen that writing GWT code is basically writing Java code, what does a GWT for an IDE exactly do? For example there are GWT plugins for IDEA and for Eclipse (and maybe for NetBeans?) but do they do that I cannot do simply by using Eclipse or IDEA without the GWT plugin?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
他们向 IDE 添加向导、对话框、编辑器和其他扩展,专门帮助完成 GWT 任务。例如,该插件添加了一个向导,让您可以输入项目名称,而不是使用命令行从头开始创建一个新的 GWT 项目,或者创建一个 eclipse java 项目,然后自己创建所有必需的文件,它会为您创建所有必需的文件。
其他添加内容可以是大型的东西,例如本地服务器,也可以是最小的东西,例如源代码格式化程序。插件的天空是无限的。
我知道 GWT 在 Eclipse 中添加了一个 GUI 编辑器,这样您就可以拖放控件,而不是手动输入它们。
They add wizards, dialogs, editors, and other extensions to the IDE that help specifically with GWT tasks. For example, rather then creating a new GWT project from scratch using the command line, or creating an eclipse java project and then creating all the necessary files yourself, the plug-in adds a wizard that lets you type in the name of the project, and it creates all the necessary files for you.
Other additions can be large stuff like a local server, or minimal like a source code formatter. The sky is the limit with plug-ins.
I know the GWT adds a GUI editor to eclipse so you can drag and drop controls rather then manually entering them all.
我自己只用过IDEA插件。我绝对不想放弃它。正如其他人所说,您可以创建 GWT 项目并在托管模式下进行调试,就像运行任何其他应用程序一样轻松,但这只是开始。
IDEA 还具有多个特定于 GWT 的类创建选项。您可以创建一个新的 UiBinder 文件,该文件将生成
.ui.xml
文件和 Java 文件,并且已经具备用于创建UiBinder
对象的管道。您可以创建一个新的 GWT Remote Service,它将为您创建服务接口、异步接口和实现类。GWT 插件还会警告您编辑器中可能出现的大量错误。如果您的服务接口在异步接口中没有正确的匹配方法,它会警告您,并有意修复该问题。如果您的服务实现类没有在 web.xml 文件中定义条目(是的,目的是自动注册它),它会发出警告。如果您的 UiBinder 类中有未在
.ui.xml
文件中定义的字段,它会向您发出警告,再次旨在通过几次按键来帮助解决问题。最重要的是,代码补全对于所有内容都非常出色,包括 CSS 属性、Javascript、HTML 和各种 XML 文件。
I've only used the IDEA plugin myself. I definitely would not want to give it up. As others have said, you can create a GWT project and debug in hosted mode as easily as you would run any other application, but that's only the beginning.
IDEA also has several GWT-specific class creation options. You can create a new UiBinder file, which will generate both the
.ui.xml
file and the Java file, and will already have the plumbing in place for creating theUiBinder
object. You can create a new GWT Remote Service, which will create the service interface, async interface, and implementation class for you.The GWT plugin will also warn you about tons of probable errors right in the editor. It will warn you if your service interface doesn't have proper matching methods in the async interface, and has an intention for fixing the problem. It will warn if your service implementation class does not have an entry defined in the
web.xml
file (yep, with an intention available to automatically register it). It will warn you if you have fields in your UiBinder class that aren't defined in the.ui.xml
file, again with an intention to help resolve the issue with just a couple keystrokes.On top of that, the code completion is excellent for everything including CSS attributes, Javascript, HTML, and the various XML files.
是的,您可以,但是使用给定 IDE 的插件可以帮助您无需从 IDE 切换到另一个工具(例如用于测试)
这里是 IDEA 的演示
http://www.jetbrains.com/idea/training/demos/GWT.html
同样的方式你也可以从命令行(我有时会这样做)或者让 IDE 通过按一个按钮来帮助您。
Yes, you can, however using a plugin for a given IDE, helps you by not needing to swap from the IDE to another tool ( for testing for instance )
Here's the demo of IDEA
http://www.jetbrains.com/idea/training/demos/GWT.html
The same way you can also compile from the command line ( I do it sometimes ) or let the IDE help you by pressing a single button.
GWT Eclipse 插件不提供调试功能吗? Eclipse 中的 GWT 调试是有史以来最有用的工具。
Doesn't the GWT Eclipse plugin provide the debugging capabilities? GWT debugging in eclipse is the most useful tool ever.
还有一个 MyEclipse 插件,可为您提供类似 Matisse 的 GWT 拖放工具箱。
对于 Netbeans,我们有 GWT4NB 插件,它提供了良好的调试和代码完成功能,也适用于 .ui.xml 文件。
There also is a plug-in for MyEclipse that gives you a Matisse-like drag and drop Toolbox for GWT.
For Netbeans we have the GWT4NB plug-in, which offers among other things good debugging and code completion which works also for .ui.xml files.
好的...
GWT RPC - 使用 Google 插件,它确实减少了验证接口 RPC 接口异步对声明的乏味。
UiBinder。每个 uibinder 集都是一对文件:ui 模板和模板 bean。该插件帮助我验证模板中 uifields 和模板 bean 的对应关系。然后还有@uifactory、@uifield(provided=true)。
您可以在 ui 模板中使用 ui:with 声明另一个“外部”bean(除模板 bean 之外的 java 代码)。这样,您就可以从 bean 中提取函数来为您的 gwt 小部件属性提供值。该插件为我提供了 ui:with bean 中可见功能的自动完成/验证。
当然,插件也提供了编译器,将java代码编译为javascript。
与客户端一起使用的调试器。想象一下,当我们在编译为 JavaScript 的客户端代码上执行调试器时,插件如何工作。
运行配置,自动填充空白、参数和参数。我讨厌自己编写 gwt 启动配置。
如果没有这个插件,GWT 的开发将会相当乏味。
OK ...
GWT RPC - With Google plugin, it does reduce the tedium verifying the interface RPC interface-async pair declaration.
UiBinder. Each uibinder set is a pair of files: The ui template and the template bean. The plugin helps me verify the correspondence of uifields in the template and the template bean. Then there are @uifactory, @uifield(provided=true).
You can declare another an "external" bean (a java code other than its template bean) using ui:with in the ui template. With that you pull in functions from the bean to provide values for your gwt widget attributes. The plugin provides me with auto-complete/verification of functions that are visible in ui:with bean.
Of course, the plugin provides the compiler too, which compiles the java code into javascript.
The debugger which works with the client-side. Imagine how the plugin works when we step the debugger on the client code which is compiled to javascript.
The run config, which automatically fills in the blanks, the args and params. I would hate writing a gwt launch config by myself.
Without the plugin, GWT development would be rather tedious.