Hot questions for Using EventBus in gwtp


I am using GWTP platform & eClipse to build webapp. In Eclipse, when creating a Presenter, it will create 3 files (ex:,, & SearchView.ui.xml):

public class SearchView extends ViewImpl implements SearchPresenter.MyView

public class SearchPresenter extends
    Presenter<SearchPresenter.MyView, SearchPresenter.MyProxy>{
    private EventBus eventBus;
    public SearchPresenter(final EventBus eventBus, final MyView view) {
         super(eventBus, view);

To use eventBus, we just simply use eclipse to create EventBus file, ex, then we call eventBus in SearchPresenter by using this code:

MyEvent mEvent=new MyEvent();

now suppose I got a non-presenter class public class SearchDialogBox extends DialogBox, then my question is how can i use MyEvent in SearchDialogBox? How to getEventBus() in SearchDialogBox?


I' dont use GWTP, but I guess the following is ok.

@Inject private EventBus eventBus

should work (if you don't use it in SearchDialogBox constructor right away).

Otherwise try to find out which class in GWTP extends Assuming it is called "MyInjector" just write :

private EventBus eventBus = MyInjector.INSTANCE.getEventBus();