org.openide.util.Utilities.disabledActionBeep()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(86)

本文整理了Java中org.openide.util.Utilities.disabledActionBeep()方法的一些代码示例,展示了Utilities.disabledActionBeep()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utilities.disabledActionBeep()方法的具体详情如下:
包路径:org.openide.util.Utilities
类名称:Utilities
方法名:disabledActionBeep

Utilities.disabledActionBeep介绍

[英]On some platform this method makes a short audible beep, use it when user tries to invoke an action that's disabled. Some platforms, e.g. MS Windows do not emit any sound in such cases.
[中]在某些平台上,这种方法会发出一声短促的哔哔声,当用户试图调用一个被禁用的操作时使用它。在这种情况下,某些平台(如MS Windows)不会发出任何声音。

代码示例

代码示例来源:origin: org.netbeans.api/org-openide-util-ui

public void actionPerformed(ActionEvent ev) {
  if (isEnabled()) {
    org.openide.util.actions.ActionInvoker.invokeAction(
      this, ev, asynchronous(), new Runnable() {
        public void run() {
          performAction();
        }
      }
    );
  } else {
    // Should not normally happen.
    Utilities.disabledActionBeep();
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-util-ui

/** Perform the action. Tries the performer and then scans the ActionMap
 * of selected topcomponent.
 */
public void actionPerformed(final ActionEvent ev) {
  // First try global context action.
  final Action action = GlobalManager.getDefault().findGlobalAction(getActionMapKey(), getSurviveFocusChange());
  if (action != null) {
    if (action.isEnabled()) {
      action.actionPerformed(ev);
    } else {
      Utilities.disabledActionBeep();
    }
    return;
  }
  final Object ap = getActionPerformer();
  if (ap != null) {
    org.openide.util.actions.ActionInvoker.invokeAction(
      this, ev, asynchronous(), new Runnable() {
        public void run() {
          if (ap == getActionPerformer()) {
            getActionPerformer().performAction(CallbackSystemAction.this);
          }
        }
      }
    );
    return;
  }
  Utilities.disabledActionBeep();
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-debugger-jpda-projectsui

private void invokeAction() {
  Project p = MainProjectManager.getDefault ().getMainProject ();
  ActionProvider actionProvider = p.getLookup ().lookup (
      ActionProvider.class
    );
  if (Arrays.asList(actionProvider.getSupportedActions ()).contains(ActionProvider.COMMAND_DEBUG_STEP_INTO) &&
    actionProvider.isActionEnabled(ActionProvider.COMMAND_DEBUG_STEP_INTO, p.getLookup())) {
    actionProvider.invokeAction (
        ActionProvider.COMMAND_DEBUG_STEP_INTO,
        p.getLookup ()
      );
  } else {
    Utilities.disabledActionBeep();
    setEnabled (
      ActionsManager.ACTION_STEP_INTO,
      false
    );
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-debugger-jpda-projects

private void invokeAction() {
  Project p = MainProjectManager.getDefault ().getMainProject ();
  ActionProvider actionProvider = p.getLookup ().lookup (
      ActionProvider.class
    );
  if (Arrays.asList(actionProvider.getSupportedActions ()).contains(ActionProvider.COMMAND_DEBUG_STEP_INTO) &&
    actionProvider.isActionEnabled(ActionProvider.COMMAND_DEBUG_STEP_INTO, p.getLookup())) {
    actionProvider.invokeAction (
        ActionProvider.COMMAND_DEBUG_STEP_INTO,
        p.getLookup ()
      );
  } else {
    Utilities.disabledActionBeep();
    setEnabled (
      ActionsManager.ACTION_STEP_INTO,
      false
    );
  }
}

相关文章