view selection event [message #1602209] |
Thu, 05 February 2015 06:44  |
Eclipse User |
|
|
|
Hello,
I just try to migrate a small private e4 with SWT / JFace app to efxclipse and just have a problem with the communication between parts.
The code was fine with e4 with JFace / SWT.
Part A (sender) is now slightly different:
@Inject
private ESelectionService selectionService;
private TreeView<Person> treeView;
...
@PostConstruct
void init(BorderPane pane) {
..
treeView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<TreeItem<Person>>() {
@Override
public void changed(ObservableValue<? extends TreeItem<Person>> observable,
TreeItem<Person> oldValue, TreeItem<Person> newValue) {
selectionService.setSelection(newValue);
System.out.println("set: " + newValue); // OK
}
});
Part B (receiver):
@Inject
void setSelection(@Optional @Named(IServiceConstants.ACTIVE_SELECTION) Person selectedPerson) {
System.out.println("readSelection: " + selectedPerson);
if (selectedPerson != null) {
// TODO
}
}
The result is:
readSelection: null
set: TreeItem [ value: PersonXYZ ]
Part B does not receive the selection and strangely the method in Part B is called before this one from Part A.
Does someone has an idea?
Thank You
Sebastian
|
|
|
|
Powered by
FUDForum. Page generated in 0.24026 seconds