Eclipse rcp 手动触发日食4(e4)类';使用注射的es方法?
我有一个类,它被注入了一个Mapapplication。它是一个处理器。我想手动触发处理程序的方法 问题: 当我从另一个类手动实例化处理程序时,MapApplication为null。我从allready触发处理程序的类中注入了一个MapApplication,因此它不是一个生命周期问题 问题:Eclipse rcp 手动触发日食4(e4)类';使用注射的es方法?,eclipse-rcp,e4,Eclipse Rcp,E4,我有一个类,它被注入了一个Mapapplication。它是一个处理器。我想手动触发处理程序的方法 问题: 当我从另一个类手动实例化处理程序时,MapApplication为null。我从allready触发处理程序的类中注入了一个MapApplication,因此它不是一个生命周期问题 问题: 如何在类中触发带有@Inject注释方法的方法?接下来的一天 ManipulateModelhandler man = new ManipulateModelhandler(); //
如何在类中触发带有@Inject注释方法的方法?接下来的一天
ManipulateModelhandler man = new ManipulateModelhandler();
//inject the context into an object
//IEclipseContext iEclipseContext was injected into this class
ContextInjectionFactory.inject(man,iEclipseContext);
man.execute();
甚至更短:
ContextInjectionFactory.make(ManipulateModelhandler.class, iEclipseContext).execute();
或者通过执行独立于其名称的带注释的方法(框架执行的方式):
ContextInjectionFactory.invoke(new ManipulateModelhandler(), Execute.class, iEclipseContext);