Right-Click-Selection-Update with open Context Menu [message #1830312] |
Thu, 23 July 2020 08:33 |
Stefan T Messages: 4 Registered: November 2019 |
Junior Member |
|
|
Hello everyone! I am trying to convince my NatTable to update the currently selected cell on a right click before opening the context menu, since the menu's content and actions are dependant on the selected cell.
In the general case, this can be accomplished by adding the following UiBindingConfiguration:
getNatTable().addConfiguration(new AbstractUiBindingConfiguration() {
@Override
public void configureUiBindings(UiBindingRegistry pUiBindingRegistry) {
pUiBindingRegistry.registerMouseDownBinding(new MouseEventMatcher(SWT.NONE, null, MouseEventMatcher.RIGHT_BUTTON),
new SelectCellAction());
}
});
However, this approach does not always work when the context menu is already open (i.e. by repeating right mouse clicks on an open table). My current best guess is that the statemask, specified as SWT.NONE, doesn't match in this specific case.
This theory is supported by the fact that holding down any control key(ctrl/alt/shift) while right clicking, which does mutate the statemask, also causes the selection to not update. If there was a way to register a MouseEventMatcher with no regard to the statemask, that may solve the issue. Alternatively, if the value of the statemask during my edge-case was known, i could register this edge-case and work around the issue that way.
The matter is made more complicated by the fact that the actual context menu is handled through the eclipse e4 framework, otherwise i could've just hardwired the Action for opening a context menu to do a SelectCellCommand first.
Any ideas?
[Updated on: Thu, 23 July 2020 09:09] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03840 seconds