2012-12-27 4 views

답변

1

동일한 문제가있어 답변을 찾을 수 없지만 그 과정에서 내 용도로 더 나은 LifeCycleHandler를 발견했습니다. 그것은 당신을위한 좋은 대안이 될 수도 있습니다.

당신은 당신의 plugin.xml에서 핸들러를 참조 할 수 있습니다 그냥 시작 - 확장자로 : 당신이 의존성 주입뿐만 아니라 호출 할 수있는 방법을 표시하는 주석을 사용할 수있는 핸들러에서

<property name="lifeCycleURI" value="platform:/plugin/<plug-in-id>/<path-to-handler-class>" /> 

: 호환성 레이어를 필요로) https://marcteufel.wordpress.com/2011/05/05/231/

1

IStartup # earlyStartup (그래서 미상 :

public class StartupHandler { 
    @Inject 
    Foo bar; 

    @PostContextCreate 
    public void startup(IEclipseContext context) { 
     // do something 
    } 
} 

당신은 여기에 대한 자세한 예를 찾을 수 있습니다 순수한 E4 응용 프로그램에서는 작동하지 않습니다. (#1 참조)

순수 E4 응용 프로그램에서 프로세스를 시작하려면 라이프 사이클 후크를 사용해야합니다. 그래서 :

참조의 plugin.xml에서 ApplicationLifecycle 핸들러 클래스는

<property name="lifeCycleURI" value="platform:/plugin/<plug-in-id>/<path-to-handler-class>" /> 

public class ApplicationLifecycleHandler { 

    @PostContextCreate 
    public void startup(IEclipseContext context) { 
     // do initialization 
    } 
} 

@PostContextCreate 
public void postContextCreate(final IEventBroker eventBroker, etc ..) { 

    // 
    eventBroker.subscribe(UIEvents.UILifeCycle.APP_STARTUP_COMPLETE, 
      new EventHandler() { 
       @Override 
       public void handleEvent(Event event) { 
        // Your code executed at startup, 
        // after application startup is completed 
       } 
      }); 

} 
전체 응용 프로그램 시작시 이벤트를 처리 할 수있는 후크를 추가하여 라이프 사이클 핸들러 클래스 쓰기

(# 1) org.eclipse.ui.startup extension doc

관련 문제