예제 #1
0
  /**
   * Updates the action visibility on the basis of active notation.
   *
   * @param notationIdentifier is the identifier of active notation.
   */
  public void updateActionVisibility(final String notationIdentifier) {
    for (final ProModAction proModAction : notationActionsMap.values()) {
      proModAction.updateActionVisibility(notationIdentifier);
    }

    for (final ModuleSpecificActions moduleSpecificActions : moduleActionsMap.values()) {
      moduleSpecificActions.updateActionVisibility(notationIdentifier);
    }
  }
예제 #2
0
  /**
   * Check whether such a action has been already registered by a notation or any of it's modules.
   *
   * @param action is the action to be checked
   * @return true if such a actions has been already registered, false otherwise
   */
  public boolean existAction(final ProModAction action) {
    if (notationActionsMap.values().contains(action)) {
      return true;
    }

    for (final ModuleSpecificActions moduleSpecificActions : moduleActionsMap.values()) {
      if (moduleSpecificActions.exist(action)) {
        return true;
      }
    }

    return false;
  }
예제 #3
0
  /**
   * Tests whether there is no other already registered action with the same accelerator key
   * definition by this notation. Additionally, check all registered actions of this notation's
   * modules.
   *
   * @param keyStroke is the accelerator key to be tested
   * @return true if there is such a action, false otherwise
   */
  public boolean existAcceleratorKey(final KeyStroke keyStroke) {
    for (final ProModAction action : notationActionsMap.values()) {
      final KeyStroke key = (KeyStroke) action.getValue(AbstractAction.ACCELERATOR_KEY);

      if (key != null && key.equals(keyStroke)) {
        return true;
      }
    }

    for (final ModuleSpecificActions moduleSpecificActions : moduleActionsMap.values()) {
      if (moduleSpecificActions.existAcceleratorKey(keyStroke)) {
        return true;
      }
    }

    return false;
  }
예제 #4
0
  /**
   * Sets the action.
   *
   * @param moduleIdentifier module identifier
   * @param actionIdentifier action identifier
   * @param newProModAction the action itself
   */
  public void setAction(
      final String moduleIdentifier,
      final String actionIdentifier,
      final ProModAction newProModAction) {
    if (moduleIdentifier == null) {
      if (notationActionsMap.containsKey(actionIdentifier)) {
        LOG.error(
            "An attempt to insert the same notation action to the notation actions map, action identifier: "
                + actionIdentifier
                + ".");
      } else {
        notationActionsMap.put(actionIdentifier, newProModAction);
      }

    } else {
      if (moduleActionsMap.containsKey(moduleIdentifier)) {
        moduleActionsMap.get(moduleIdentifier).setAction(actionIdentifier, newProModAction);
      } else {
        final ModuleSpecificActions moduleSpecificActions = new ModuleSpecificActions();
        moduleSpecificActions.setAction(actionIdentifier, newProModAction);
        moduleActionsMap.put(moduleIdentifier, moduleSpecificActions);
      }
    }
  }