Eclipse启动时间插件(解决不能弹出问题)


New->Plugin in Project

输入项目名称: 如:com.ds.showtime 其他默认, 不勾选 Create a plugin-in using one of the templates


新建 plugin.xml

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<plugin>
   <extension point="org.eclipse.ui.startup">
           <startup class="com.ds.showtime.ShowTime"/>
   </extension>
</plugin>

双击plugin.xml在 dependencies下,Required Plug-in

增加 org.eclipse.ui

在build下,Binary Build中

选中 plugin.xml

MANIFEST.MF中 添加 singleton:=true

Bundle-SymbolicName: com.ds.showtime;singleton:=true

保存


新建ShowTime类  (com.ds.showtime.ShowTime)

package com.ds.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 msg="Eclipse 启动耗时: "+costTime+"ms";
                MessageDialog.openInformation(shell, "消息", msg);
            }
        });
    }

}


项目上右键 Export->Deployable plug-ins and fragments

选择导出的位置,在所导出的位置会生成plugins文件夹, 把其中的jar 文件拷贝到 eclipse的 plugins中


然后 进入eclipse的 configuration文件夹下 删除 org.eclipse.update文件夹(重新加载所有插件)

重启Eclipse即可

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值