@Test public void testOnKeyShortcutSelectedElements() { mockSelectedElements("element-1", "element-2"); mockActionReactingOnKeyAndSelectedElement(KeyboardEvent.Key.E, mock(Element.class)); canvasShortcutsControl.onKeyShortcut(KeyboardEvent.Key.E); verify(keyboardShortcutAction, never()).executeAction(any(), any()); }
@Override public void onKeyShortcut(final KeyboardEvent.Key... keys) { if (selectedNodeId() != null) { final Iterator<KeyboardShortcut> keyboardShortcutActionsIterator = keyboardShortcutActions.iterator(); while (keyboardShortcutActionsIterator.hasNext()) { final KeyboardShortcut action = keyboardShortcutActionsIterator.next(); if (action.matchesPressedKeys(keys) && action.matchesSelectedElement(selectedNodeElement())) { action.executeAction(canvasHandler, selectedNodeId()); } } } }
AbstractCanvasShortcutsControlImpl extends AbstractCanvasHandlerRegistrationControl<AbstractCanvasHandler> implements CanvasControl.SessionAware<EditorSession>,
                   KeyboardControl.KeyShortcutCallback { @Override public void onKeyShortcut(final KeyboardEvent.Key... keys) { if (selectedNodeId() != null) { final Iterator<KeyboardShortcut> keyboardShortcutActionsIterator = keyboardShortcutActions.iterator(); while (keyboardShortcutActionsIterator.hasNext()) { final KeyboardShortcut action = keyboardShortcutActionsIterator.next(); if (action.matchesPressedKeys(keys) && action.matchesSelectedElement(selectedNodeElement())) { action.executeAction(canvasHandler, selectedNodeId()); } } } } }
AbstractCanvasShortcutsControlImpl extends AbstractCanvasHandlerRegistrationControl<AbstractCanvasHandler> implements CanvasControl.SessionAware<EditorSession>,
                   KeyboardControl.KeyShortcutCallback { @Override public void onKeyShortcut(final KeyboardEvent.Key... keys) { if (selectedNodeId() != null) { final Iterator<KeyboardShortcut> keyboardShortcutActionsIterator = keyboardShortcutActions.iterator(); while (keyboardShortcutActionsIterator.hasNext()) { final KeyboardShortcut action = keyboardShortcutActionsIterator.next(); if (action.matchesPressedKeys(keys) && action.matchesSelectedElement(selectedNodeElement())) { action.executeAction(canvasHandler, selectedNodeId()); } } } } @Inject  AbstractCanvasShortcutsControlImpl(final Instance<KeyboardShortcut> keyboardShortcutActions); }
AbstractCanvasShortcutsControlImpl extends AbstractCanvasHandlerRegistrationControl<AbstractCanvasHandler> implements CanvasControl.SessionAware<EditorSession>,
                   KeyboardControl.KeyShortcutCallback { @Override public void onKeyShortcut(final KeyboardEvent.Key... keys) { if (selectedNodeId() != null) { final Iterator<KeyboardShortcut> keyboardShortcutActionsIterator = keyboardShortcutActions.iterator(); while (keyboardShortcutActionsIterator.hasNext()) { final KeyboardShortcut action = keyboardShortcutActionsIterator.next(); if (action.matchesPressedKeys(keys) && action.matchesSelectedElement(selectedNodeElement())) { action.executeAction(canvasHandler, selectedNodeId()); } } } } @Inject  AbstractCanvasShortcutsControlImpl(final Instance<KeyboardShortcut> keyboardShortcutActions); @Override void register(Element element); @Override void bind(final EditorSession session); @Override void onKeyShortcut(final KeyboardEvent.Key... keys); String selectedNodeId(); Element selectedNodeElement(); }
AbstractCanvasShortcutsControlImpl extends AbstractCanvasHandlerRegistrationControl<AbstractCanvasHandler> implements CanvasControl.SessionAware<EditorSession>,
                   KeyboardControl.KeyShortcutCallback { @Override public void onKeyShortcut(final KeyboardEvent.Key... keys) { if (selectedNodeId() != null) { final Iterator<KeyboardShortcut> keyboardShortcutActionsIterator = keyboardShortcutActions.iterator(); while (keyboardShortcutActionsIterator.hasNext()) { final KeyboardShortcut action = keyboardShortcutActionsIterator.next(); if (action.matchesPressedKeys(keys) && action.matchesSelectedElement(selectedNodeElement())) { action.executeAction(canvasHandler, selectedNodeId()); } } } } @Inject  AbstractCanvasShortcutsControlImpl(final Instance<KeyboardShortcut> keyboardShortcutActions); @Override void register(Element element); @Override void bind(final EditorSession session); @Override void onKeyShortcut(final KeyboardEvent.Key... keys); String selectedNodeId(); Element selectedNodeElement();  }