eclipse rcp - IInputSelectionProvider not considered by listeners of RCP SelectionService -
i have rcp application different views. views should interact each other through eclipse selectionservice. in view 1 have added selectionlistener with
getsite().getworkbenchwindow().getselectionservice().addselectionlistener(this.listener);
in view 2 have added selectionprovider
getsite().setselectionprovider(this);
to working, implemented methods iinputselectionprovider in view 2. when run program, view 1s selection listener not invoked. after debugging, found out view 1 not added in list of listeners of view 2. in view 2 have method
private listenerlist listenerslist = new listenerlist(); @override public void addselectionchangedlistener(iselectionchangedlistener iselectionchangedlistener) { // todo auto-generated method stub listenerslist.add(iselectionchangedlistener); }
which adds listeners iinputselectionprovider. question is: should call method. understanding eclipse selectionservice should
getsite().getworkbenchwindow().getselectionservice().addselectionlistener(this.listener);
but doesn't work. have fill listenerlist myself? if yes, why have use selectionservice @ all? or have iterate through list of listeners calling other method , not using list @ all? because if inspect iselectionservice object
iselectionservice service = getsite().getworkbenchwindow().getselectionservice();
i see listeners. not part of listenerlist above.
the addselectionchangedlistener called every time view gets activated , removed when view not longer active. means: if view active , 'setseletion' called, views listening notified. if these views call 'setselection' nothing happens. no notification started.
Comments
Post a Comment