Using ESelectionService.setSelection(null) for DI? [message #896733] |
Thu, 19 July 2012 10:12  |
Eclipse User |
|
|
|
Hi,
Is ESelectionService able to propagate null selection, i.e., inform selection listeners that a selection is gone?
I've the following snippet to illustrate my problem:
public class TodoDetailsPart {
@Inject
ESelectionService s;
@Inject
public void updateSelection(@Optional
@Named(IServiceConstants.ACTIVE_SELECTION) Person p) {
System.out.println(" value " + p);
}
@PostConstruct
public void createPartControls(Composite parent) {
parent.setLayout(new GridLayout(1, false));
btnLoadData = new Button(parent, SWT.NONE);
btnLoadData.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
System.out.println("sending null selection");
// set new selection to NULL -> no event propagated to #updateSelection().
s.setSelection(null);
}
});
...
}}
I expected updateSelection() to be called with null every time I click on my btnLoadData. However, this does not happen. Is this behavior intended?
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.51158 seconds