Interface ActionProvider


public interface ActionProvider
Ability for a project to have various actions (e.g. Build) invoked on it. Should be registered in a project's lookup and will be used by UI infrastructure.

Implementations supporting single file commands (command constants ending with _SINGLE) can also be registered in default lookup. If a provider in project lookup does not enable the action for a given command on the selected file then the first implementation found in default lookup that is enabled will be used.

If the project supports ProjectConfigurations, the ActionProvider implementation must check ProjectConfiguration presence in the action's context Lookup whether the caller requested a specific configuration, and use it to process the requested action, if found.
See Also:
  • Field Details

  • Method Details

    • getSupportedActions

      String[] getSupportedActions()
      Get a list of all commands which this project supports.
      Returns:
      a list of command names suitable for invokeAction(java.lang.String, org.openide.util.Lookup)
      See Also:
    • invokeAction

      void invokeAction(String command, org.openide.util.Lookup context) throws IllegalArgumentException
      Run a project command. Will be invoked in the event thread. The context may be ignored by some commands, but some may need it in order to get e.g. the selected source file to build by itself, etc.
      Parameters:
      command - a predefined command name (must be among getSupportedActions())
      context - any action context, e.g. for a node selection (as in ContextAwareAction)
      Throws:
      IllegalArgumentException - if the requested command is not supported
      See Also:
    • isActionEnabled

      boolean isActionEnabled(String command, org.openide.util.Lookup context) throws IllegalArgumentException
      Tells whether the command can be invoked in given context and thus if actions representing this command should be enabled or disabled. The context may be ignored by some commands, but some may need it in order to get e.g. the selected source file to build by itself, etc.
      Parameters:
      command - a predefined command name (must be among getSupportedActions())
      context - any action context, e.g. for a node selection (as in ContextAwareAction)
      Throws:
      IllegalArgumentException - if the requested command is not supported