简体   繁体   English

如何在Eclipse E4应用程序启动时做些什么?

[英]How to make something on startup in Eclipse E4 application?

I want to run something exactly after E4 RCP application starts. 我想在E4 RCP应用程序启动后准确地运行某些程序。

How to do that? 怎么做?

You can do this with a LifeCycle class. 您可以使用LifeCycle类进行此操作。 You specify this in the lifeCyceURI property of your product: 您可以在产品的lifeCyceURI属性中指定此lifeCyceURI

<extension
     id="product"
     point="org.eclipse.core.runtime.products">
  <product
        name="%product.name"
        application="org.eclipse.e4.ui.workbench.swt.E4Application">
     <property
           name="lifeCycleURI"
           value="bundleclass://plugin-id/package.LifeCycle">
     </property>
     ....

The PostContextCreate annotation runs very early in the startup: PostContextCreate批注在启动的早期就运行:

public class LifeCycle
{
  @PostContextCreate
  public void postContextCreate()
  {
  }
}

See Register for the Eclipse 4 Application Life Cycle 请参阅注册以获取Eclipse 4应用程序生命周期

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM