Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » No popup menu shown with empty TableViewer
No popup menu shown with empty TableViewer [message #555746] Sat, 28 August 2010 07:22
Mihael Schmidt is currently offline Mihael SchmidtFriend
Messages: 28
Registered: August 2010
Junior Member
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
Previous Topic:RCP Product with several versions of a bundle
Next Topic:How to remove standard icons from Properties View?
Goto Forum:
  


Current Time: Thu Nov 27 16:26:06 GMT 2014

Powered by FUDForum. Page generated in 0.02108 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software