在Eclipse中开发一个选项以修改Java文件源的时间 [英] Time to develop an option in Eclipse to modify a Java file source

查看:186
本文介绍了在Eclipse中开发一个选项以修改Java文件源的时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在评估开发Eclipse插件来修改一些Java文件的源代码的可能性。



Eclipse插件应该:


  1. 添加一个菜单选项或上下文菜单选项启动修改过程。

  2. 添加一个键绑定

  3. 只有当编辑器在Java文件中打开时,才能以这种方式更改UI。

  4. 修改过程不会打开对话框,也可能是非常简单的一个。

  5. 修改过程将遍历Java文件的AST并修改它。



<考虑到我们没有Eclipse插件的经验,我们需要花时间阅读文档,您在开发该插件时估计多少时间?



提前感谢。

解决方案

真的不是那么困难...我在设计模式类中有学生做一个作业(添加/ remove javabean gett ers和setters)



请参阅 http://help.eclipse.org/ganymede/topic/org.eclipse.jdt.doc.isv/guide/jdt_api_manip.htm



[编辑添加了以下文章参考资料]



伟大的文章在 http://www.eclipse .org / articles / article.php?file = Article-JavaCodeManipulation_AST / index.html (从2006年起可能会有几个API更改)



是的,编写插件需要一点点习惯,而API也是如此。



您可以修改AST - 请参阅上面我参考的页面。 p>

(我应该注意,以上链接来自eclipse帮助,也可以通过Eclipse中的Help-> Help Contents访问 - 有一个很多很好的信息在那里,但它只是一个起点)


I'm evaluating the possibility of developing an Eclipse plugin to modify the source code of some Java files.

The Eclipse plugin should:

  1. add one menu option or context menu option to launch the modification process.
  2. add a key binding
  3. only alter the UI in that way when an editor has been open on a Java file.
  4. the modification process would not open a dialog, or maybe, a very simple one.
  5. the modification process would traverse the AST of the Java file and would modify it.

Considering that we have no experience with Eclipse plugins and we need spend time in reading docs, how much time do you estimate in developing that plugin?

Thanks in advance.

解决方案

It's really not that difficult at all... I had students in my design patterns class doing it for an assignment (adding/removing javabean getters and setters)

See http://help.eclipse.org/ganymede/topic/org.eclipse.jdt.doc.isv/guide/jdt_api_manip.htm

[EDIT: added the following article reference]

And a great article on it at http://www.eclipse.org/articles/article.php?file=Article-JavaCodeManipulation_AST/index.html (from 2006 -- there may be a few API changes since)

Yes, writing plugins takes a little getting used to, but so does any API.

And you can modify the AST -- see the page I reference above.

(I should note that the above link is from the eclipse help, which can also be accessed via Help->Help Contents inside Eclipse -- there's a lot of good info in there, but it's just a starting point)

这篇关于在Eclipse中开发一个选项以修改Java文件源的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆