1. New Plug-in Project
Do not change other options, click "Next", then click "Finish" 2, New Showtime.java
PackageCom.developer.showtime;ImportOrg.eclipse.jface.dialogs.MessageDialog;ImportOrg.eclipse.swt.widgets.Display;ImportOrg.eclipse.swt.widgets.Shell;ImportOrg.eclipse.ui.IStartup; Public classShowTimeImplementsistartup{@Override Public voidEarlystartup () {Display.getdefault (). Syncexec (NewRunnable () {@Override Public voidrun () {LongEclipsestarttime = Long.parselong (System.getproperty ("Eclipse.starttime")); LongCosttime = System.currenttimemillis ()-Eclipsestarttime; Shell Shell=Display.getdefault (). Getactiveshell (); String message= "Eclipse Startup time:" + costtime + "MS"; Messagedialog.openinformation (Shell,"Information", message); } }); } }
3, New Plugin.xml Right-click Project, tap New File, enter Plugin.xml
Add Content:
<?XML version= "1.0" encoding= "UTF-8"?><?Eclipse version= "3.4"?><plugin> <extension Point= "Org.eclipse.ui.startup"> <Startupclass= "Com.developer.showtime.ShowTime"/> </extension></plugin>
4. Revise manifest.mf to change the Bundle-symbolicname to: "Bundle-symbolicname:com.developer.showtime;singleton:=true" 5, Test run right-click Project, run as---Eclipse application 6, export to jar package right-click Project, Export->deployable plug-ins and fragments Select Directory , it should be noted that to select the Eclipse directory, do not select the plugins directory, because it will default to $directory/plugins 7, restart eclipseerrors that may occur:1, export times Chinese garbled:
Workaround: Add a Line "javacdefaultencoding" in Build.properties. = UTF-8 "2, out of the jar package is missing plugin.xml do not know why, my package does not include plugin.xml, this problem puzzled me for a long time, accidentally opened the jar package to see just know. Workaround: Just copy the plugin.xml into the jar pack.
Available for download: http://pan.baidu.com/s/1kVOdkTh
Eclipse Simple plug-in development-startup time prompt