Context menu not visible, at least sometimes [message #1033394] |
Thu, 04 April 2013 07:37 |
Bastian Wagenfeld Messages: 183 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
|
|
|
Powered by
FUDForum. Page generated in 0.02897 seconds