GP-1578 code review

This commit is contained in:
dev747368 2021-12-13 22:16:17 +00:00
parent 9c87346ae6
commit 7ca41cb3c2
4 changed files with 12 additions and 12 deletions

View file

@ -74,7 +74,7 @@ public abstract class AbstractNextPreviousAction extends NavigatableContextActio
try {
boolean direction = isForward;
if ((context.getEventModifiers() & ActionEvent.SHIFT_MASK) != 0) {
if ((context.getEventClickModifiers() & ActionEvent.SHIFT_MASK) != 0) {
direction = !direction;
}
@ -123,7 +123,7 @@ public abstract class AbstractNextPreviousAction extends NavigatableContextActio
private String getDescriptionString() {
String prefix = isForward ? "Go To Next " : "Go To Previous ";
return prefix + getNavigationTypeName() + " (shift inverts direction)";
return prefix + getNavigationTypeName() + " (shift-click inverts direction)";
}
abstract protected String getNavigationTypeName();

View file

@ -78,7 +78,7 @@ public class ActionContext {
private MouseEvent mouseEvent;
private Object contextObject;
private Object sourceObject;
private int eventModifiers;
private int eventClickModifiers;
private ActionContext globalContext;
// Note: the setting of this object is delayed. This allows clients to build-up the state
@ -185,25 +185,25 @@ public class ActionContext {
}
/**
* Sets the modifiers for this event.
* Sets the modifiers for this event that were present when the item was clicked on.
*
* @param modifiers bit-masked int, see {@link ActionEvent#getModifiers()} or
* {@link MouseEvent#getModifiersEx()}
*/
public void setEventModifiers(int modifiers) {
this.eventModifiers = modifiers;
public void setEventClickModifiers(int modifiers) {
this.eventClickModifiers = modifiers;
}
/**
* Returns the modifiers for this event.
* Returns the click modifiers for this event.
* <p>
* Only present for some mouse assisted events, e.g. clicking on a toolbar button or choosing
* a menu item in a popup menu.
*
* @return bit-masked int, see {@link InputEvent#SHIFT_MASK}, etc
*/
public int getEventModifiers() {
return eventModifiers;
public int getEventClickModifiers() {
return eventClickModifiers;
}
/**
@ -229,7 +229,7 @@ public class ActionContext {
*/
public ActionContext setMouseEvent(MouseEvent e) {
this.mouseEvent = e;
this.eventModifiers = e.getModifiersEx();
this.eventClickModifiers = e.getModifiersEx();
return this;
}

View file

@ -48,7 +48,7 @@ public class PopupMenuHandler extends MenuHandler {
DockingWindowManager.clearMouseOverHelp();
actionContext.setSourceObject(event.getSource());
actionContext.setEventModifiers(event.getModifiers());
actionContext.setEventClickModifiers(event.getModifiers());
// this gives the UI some time to repaint before executing the action
SwingUtilities.invokeLater( new Runnable() {

View file

@ -116,7 +116,7 @@ public class ToolBarItemManager implements PropertyChangeListener, ActionListene
ActionContext context = getActionContext();
context.setSourceObject(event.getSource());
context.setEventModifiers(event.getModifiers());
context.setEventClickModifiers(event.getModifiers());
// this gives the UI some time to repaint before executing the action
SwingUtilities.invokeLater(() -> {