Eclipse启动计时插件
来源:互联网 发布:java 中英文字符长度 编辑:程序博客网 时间:2024/04/18 18:10
Eclipse版本如下:
Eclipse Java EE IDE for Web Developers.
Version: Kepler Service Release 2
Build id: 20140224-0627
不需要下载额外的Eclipse for RCP and RAP Developers
File->New->Plug-in Project
Project name填com.developer.showtime,Eclipse version是3.5以后
Options不要生成activator,其他都是默认
不要Create a plug-in using one of the template,直接创建空的即可
然后新建一个ShowTime类,实现IStartup接口,这里需要import三个eclipse包,org.eclipse.jface、swt、ui,在eclipse/plugins/目录下可以找到org.eclipse相关的jar包,添加到build path中。ShowTime代码具体如下:
package com.developer.showtime;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IStartup;
public class ShowTime implements IStartup{
@Override
public void earlyStartup() {
// TODO Auto-generated method stub
Display. getDefault().syncExec(new Runnable(){
@Override
public void run() {
// TODO Auto-generated method stub
long eclipseStartTime = Long.parseLong(System.getProperty( "eclipse.startTime"));
long costTime = System.currentTimeMillis() - eclipseStartTime;
Shell shell = Display.getDefault().getActiveShell();
String message = "Eclipse start in " + costTime + "ms";
MessageDialog. openInformation(shell, "Information" , message);
}
});
}
}
创建plugin.xml:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.5"?>
<plugin>
<extension point= "org.eclipse.ui.startup">
<startup class= "com.developer.showtime.ShowTime" />
</extension>
</plugin>
修改MANIFEST.MF文件:
Manifest-Version: 1.0
Bundle-ManifestVersion : 2
Bundle-Name: Showtime
Bundle-SymbolicName : com.developer.showtime;singleton:=true
Bundle-Version : 1.0.0.qualifier
Bundle-Vendor : DEVELOPER
Require-Bundle : org.eclipse.ui,org.eclipse.jface,org.eclipse.swt
Bundle-RequiredExecutionEnvironment : JavaSE-1.7
注意这里要添加Require-Bundle,否则插件运行时找不到org.eclipse包。
现在就可以Run as -> Eclipse Application运行了,这时会启动一个新的eclipse并运行该插件,成功后就可以导出插件了。
Export->Deployable plug-ins and fragments,将com.developer.showtime_1.0.0.xxxxxxx.jar复制到eclipse/plugins/目录下,重新启动eclipse即可(本人的测试,这一步暂时没成功。。。)。
0 0
- Eclipse启动计时插件
- Eclipse启动找不到插件
- eclipse启动时间插件
- Eclipse无插件启动Tomcat
- Eclipse无插件启动Tomcat
- eclipse插件开发初体验-eclipse启动耗时统计插件
- 通过Eclipse插件启动Tomcat的问题
- 通过Eclipse插件启动Tomcat的问题
- eclipse 安装插件后无法启动
- 启动Eclipse未加载插件,解决方法
- eclipse 启动重启加载插件
- eclipse插件启动Genymotion模拟器失败解决方案
- eclipse插件启动Genymotion模拟器失败解决方案
- eclipse插件启动Genymotion模拟器失败
- 启动Eclipse,Maven插件提示如下错误
- eclipse maven插件方式启动项目
- eclipse提速01 - 禁用不常用的eclipse启动插件
- 自制vim计时小插件: vtimer
- Chrome快捷键
- About IDE
- 是时候了
- linux设备驱动归纳总结(一):内核的相关基础概念
- hdu 1465 不容易系列之一
- Eclipse启动计时插件
- hive中的null值
- Kth Smallest Element in a BST
- I2C总线之(二)---时序
- 论坛自动回复
- 1458 Common Subsequence【lcs】
- 博弈题集
- Task schedule
- poj 1458 Common Subsequence (LCS(最长公共子序列))