本文介绍如何利用eclipse插件implementors在eclipse中的使用。
eclipse是目前非常流行的开发平台,开放扩展的架构让很多程序员找到了自己个性化的工作环境。
问题提出:
如果你想看看某个类或者方法的实现,一般是ctrl + 鼠标左键,单击即可以打开这个类或者方法的具体实现代码。但是如果碰到接口时,只是到达接口而已,不能到达具体的实现类里。
解决方法:利用eclipse的implementors插件。
当追踪方法代码时,eclipse默认是转到方法的接口类,而接口中是只有方法名称没有具体的实现代码,此插件提供了追踪到具体实现类的实现代码的功能。
另外还有call hierarchy插件: 显示一个方法的调用层次,可以从中看到它被哪些方法调用了,以及它调用了哪些方法,是代码追踪比较实用的工具。eclipse 3.1中已经自带有这个功能了。这个插件就不用另加介绍了。
安装
jdk:1.5.0 从http://java.sun.com上去下载安装
eclipse:3.1.1 从http://www.eclipse.org 上去下载解压
implementors 从http://eclipse-tools.sourceforge.net/implementors/
技巧
eclipse使用技巧之插件管理
提示:新下载的插件plugin一定不要都放在原始的eclipse目录下去,一大堆,累死你。
接口类:ihelloworld.java public interface ihelloworld { string sayhelloworld(); }在接口类ihelloworld.java的方法sayhelloworld()上面右键,在弹出的菜单中选择open implementation,如下图所示:
实现类一:helloworld1.java public class helloworld1 implements ihelloworld { public helloworld1() { super(); } public string sayhelloworld() { return "hello world helloworld1"; } } 实现类二:helloworld2.java public class helloworld2 implements ihelloworld { public helloworld2() { super(); } public string sayhelloworld() { return "hello world helloworld2"; } }
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器