java - RCP IWorkbenchPage is returning null -
i trying create rcp application. far have menu 2 menuitems. (file -> data , file -> exit) exit works fine, when click on data, gives me error:
!entry org.eclipse.ui 4 0 2017-01-18 21:49:31.066 !message unhandled event loop exception !stack 0 org.eclipse.e4.core.di.injectionexception: java.lang.nullpointerexception @ org.eclipse.e4.core.internal.di.methodrequestor.execute(methodrequestor.java:68) @ org.eclipse.e4.core.internal.di.injectorimpl.invokeusingclass(injectorimpl.java:252) @ org.eclipse.e4.core.internal.di.injectorimpl.invoke(injectorimpl.java:234) @ org.eclipse.e4.core.contexts.contextinjectionfactory.invoke(contextinjectionfactory.java:132) @ org.eclipse.e4.core.commands.internal.handlerservicehandler.execute(handlerservicehandler.java:152) @ org.eclipse.core.commands.command.executewithchecks(command.java:493) @ org.eclipse.core.commands.parameterizedcommand.executewithchecks(parameterizedcommand.java:486) @ org.eclipse.e4.core.commands.internal.handlerserviceimpl.executehandler(handlerserviceimpl.java:210) @ org.eclipse.e4.ui.workbench.renderers.swt.handledcontributionitem.executeitem(handledcontributionitem.java:799) @ org.eclipse.e4.ui.workbench.renderers.swt.handledcontributionitem.handlewidgetselection(handledcontributionitem.java:675) @ org.eclipse.e4.ui.workbench.renderers.swt.handledcontributionitem.access$7(handledcontributionitem.java:659) @ org.eclipse.e4.ui.workbench.renderers.swt.handledcontributionitem$4.handleevent(handledcontributionitem.java:592) @ org.eclipse.swt.widgets.eventtable.sendevent(eventtable.java:84) @ org.eclipse.swt.widgets.display.sendevent(display.java:4362) @ org.eclipse.swt.widgets.widget.sendevent(widget.java:1113) @ org.eclipse.swt.widgets.display.rundeferredevents(display.java:4180) @ org.eclipse.swt.widgets.display.readanddispatch(display.java:3769) @ org.eclipse.e4.ui.internal.workbench.swt.partrenderingengine$4.run(partrenderingengine.java:1127) @ org.eclipse.core.databinding.observable.realm.runwithdefault(realm.java:337) @ org.eclipse.e4.ui.internal.workbench.swt.partrenderingengine.run(partrenderingengine.java:1018) @ org.eclipse.e4.ui.internal.workbench.e4workbench.createandrunui(e4workbench.java:156) @ org.eclipse.ui.internal.workbench$5.run(workbench.java:694) @ org.eclipse.core.databinding.observable.realm.runwithdefault(realm.java:337) @ org.eclipse.ui.internal.workbench.createandrunworkbench(workbench.java:606) @ org.eclipse.ui.platformui.createandrunworkbench(platformui.java:150) @ lab5_vsim1288.application.start(application.java:25) @ org.eclipse.equinox.internal.app.eclipseapphandle.run(eclipseapphandle.java:196) @ org.eclipse.core.runtime.internal.adaptor.eclipseapplauncher.runapplication(eclipseapplauncher.java:134) @ org.eclipse.core.runtime.internal.adaptor.eclipseapplauncher.start(eclipseapplauncher.java:104) @ org.eclipse.core.runtime.adaptor.eclipsestarter.run(eclipsestarter.java:380) @ org.eclipse.core.runtime.adaptor.eclipsestarter.run(eclipsestarter.java:235) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source) @ java.lang.reflect.method.invoke(unknown source) @ org.eclipse.equinox.launcher.main.invokeframework(main.java:669) @ org.eclipse.equinox.launcher.main.basicrun(main.java:608) @ org.eclipse.equinox.launcher.main.run(main.java:1515) @ org.eclipse.equinox.launcher.main.main(main.java:1488) caused by: java.lang.nullpointerexception @ commands.getdatacommand.execute(getdatacommand.java:33) @ org.eclipse.ui.internal.handlers.handlerproxy.execute(handlerproxy.java:295) @ org.eclipse.ui.internal.handlers.e4handlerproxy.execute(e4handlerproxy.java:90) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source) @ java.lang.reflect.method.invoke(unknown source) @ org.eclipse.e4.core.internal.di.methodrequestor.execute(methodrequestor.java:56) ... 38 more
i error here:
// iworkbenchpage p = platformui.getworkbench().getactiveworkbenchwindow().getactivepage(); view v = (view) p.findview("rcp.view"); v.createviewer();
i tried debugging , shows me this:
/** * returns workbench. fails if workbench has not been created yet. * * @return workbench */ public static iworkbench getworkbench() { if (workbench.getinstance() == null) { // <-- // app forgot call createandrunworkbench beforehand throw new illegalstateexception(workbenchmessages.platformui_noworkbench); // <-- } return workbench.getinstance(); }
am missing something? appreciated.
Comments
Post a Comment