private int getKeyCode(final KeySequence inSequence) {
   int out = 0;
   for (final KeyStroke lStroke : inSequence.getKeyStrokes()) {
     out |= lStroke.getModifierKeys() | lStroke.getNaturalKey();
   }
   return out;
 }
  /**
   * @param event the key event to be checked
   * @param commandId the command to be checked
   * @return true if the given key event can trigger the passed command (and false otherwise).
   */
  public static boolean matchesKeybinding(KeyEvent event, String commandId) {
    final IBindingService bindingSvc =
        (IBindingService) PlatformUI.getWorkbench().getAdapter(IBindingService.class);
    TriggerSequence[] activeBindingsFor = bindingSvc.getActiveBindingsFor(commandId);

    for (TriggerSequence seq : activeBindingsFor) {
      if (seq instanceof KeySequence) {
        KeySequence keySequence = (KeySequence) seq;
        KeyStroke[] keyStrokes = keySequence.getKeyStrokes();

        for (KeyStroke keyStroke : keyStrokes) {

          if (keyStroke.getNaturalKey() == event.keyCode
              && (keyStroke.getModifierKeys() & event.stateMask) != 0) {

            return true;
          }
        }
      }
    }

    return false;
  }