AST在eclipse编辑器当前选定的代码? [英] AST for current selected code in eclipse editor?

查看:97
本文介绍了AST在eclipse编辑器当前选定的代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在java编辑器中找到当前选择的AST。
基本上我想将选定的java代码转换成其他形式(也许是其他语言或XML等)。所以我想,我需要得到AST的选择。
目前我可以将选择作为简单的文本。有什么办法出现这样的问题吗?
感谢已经!!

解决方案

有一些JDT插件开发人员的便利工具,特别是)开始挖掘视图类。



您正在旅行到不太平凡(通常是无证件)的JDT领域,开发您的代码挖掘技能将大大提高您的表现。


I need to get the AST for the current selection in the java editor fo eclipse. Basically I want to convert the selected java code in to some other form(maybe some other language or XML etc..). So I guess, I need to get the AST for the selection. Currently I am able to get the selection as simple text. Is there any way out for such problem? Thanks already!!

解决方案

There are a number of handy tools for JDT plugin developers, especially the AST View which does pretty much what you are looking for. So, all you need to do is grab the code for AST View and check how it is done.

The plugin can be installed from the following update site: http://www.eclipse.org/jdt/ui/update-site

Use the plugin spy (read more about it in this article) to start digging into the view classes.

You are traveling into less trivial (and often undocumented) areas of JDT, developing your code digging skills will greatly improve your performance.

这篇关于AST在eclipse编辑器当前选定的代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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