No popup menu shown with empty TableViewer [message #555746] |
Sat, 28 August 2010 07:22 |
|
I want to provide the user with a popup menu even when the table viewer is empty.
It is working if the table has an entry but it ain't working if the table is empty.
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
Object selection = ((IStructuredSelection) event.getSelection()).getFirstElement();
if (event.getSelection() == null || selection == null) {
addresses.getControl().setMenu(addressTypeMainMenu);
}
else if (selection instanceof Address) {
addresses.getControl().setMenu(addressTypeEntryMenu);
}
}
});
// init viewer context menu
viewer.getControl().setMenu(addressTypeMainMenu);
This code worked fine with a TreeViewer class. Why doesn't it work with a TableViewer?
Thanx in advance
Mihael
|
|
|
Powered by
FUDForum. Page generated in 0.01793 seconds