Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Context menu not visible, at least sometimes
Context menu not visible, at least sometimes [message #1033394] Thu, 04 April 2013 07:37
Bastian Wagenfeld is currently offline Bastian WagenfeldFriend
Messages: 163
Registered: January 2013
Senior Member
Hi,

In some of my Parts I have a JFace Table which has a PopupMenu registred:
eMenuService.registerContextMenu(table,"contextMenu");

Depending on the selection I won't show two of the menu's elements:
private void showContextMenu(Object a) {
		boolean show = false;
		List<?> list = (List<?>) tableViewer.getInput();
		if (a == null || tableViewer.getSelection().isEmpty()
				|| !list.contains(a))
			show = false;
		else
			show = true;
		for (MMenuElement elem : popupMenu.getChildren()) {
			if (elem.getElementId().endsWith("delete"))
				elem.setVisible(show);
			else if (elem.getElementId().endsWith("edit"))
				elem.setVisible(show);
			else
				elem.setVisible(true);
		}

	}


This works, but only sometimes. My scenario is:

- I select an item in a tree.
- The part with the table shows up.
- I right-click in the table.
- The menu shows up with only one item (that is the way it should be).
- I select another item in a tree and another part opens.
- I go back to the first item and the part with the table shows up.
- I right-click on the table and nothing happens.
- BUT: It might be, that everything works fine and the menu shows up, like it should.

One could say the menu only doesn't show up every fourth time. But it always shows up, if an item is selected and all of the three MMenuElements are visible.

Hopefully someone has an idea, how this could be solved.

Best regards
Bastian

Previous Topic:Fixed delay when opening file in editor (and some other actions)
Next Topic:Why is it possible to inject E4Workbench.CLEAR_PERSISTED_STATE
Goto Forum:
  


Current Time: Sat Dec 20 16:03:23 GMT 2014

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

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