コード例 #1
0
  @Override
  public void initComponent() {
    myMode = Registry.get("ide.tooltip.mode");

    myIsEnabled = Registry.get("ide.tooltip.callout");
    myIsEnabled.addListener(
        new RegistryValueListener.Adapter() {
          @Override
          public void afterValueChanged(RegistryValue value) {
            processEnabled();
          }
        },
        ApplicationManager.getApplication());

    Toolkit.getDefaultToolkit()
        .addAWTEventListener(this, AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK);

    ActionManager.getInstance()
        .addAnActionListener(
            new AnActionListener.Adapter() {
              @Override
              public void beforeActionPerformed(
                  AnAction action, DataContext dataContext, AnActionEvent event) {
                hideCurrent(null, action, event);
              }
            },
            ApplicationManager.getApplication());

    processEnabled();
  }
コード例 #2
0
  public static boolean isTooltipRequest(KeyEvent keyEvent) {
    if (ourTooltipKeysProperty == null) {
      ourTooltipKeysProperty = Registry.get("ide.forcedShowTooltip");
      ourTooltipKeysProperty.addListener(
          new RegistryValueListener.Adapter() {
            @Override
            public void afterValueChanged(RegistryValue value) {
              updateTooltipRequestKey(value);
            }
          },
          Disposer.get("ui"));

      updateTooltipRequestKey(ourTooltipKeysProperty);
    }

    if (keyEvent.getID() != KeyEvent.KEY_PRESSED) return false;

    for (Integer each : ourTooltipKeys) {
      if ((keyEvent.getModifiers() & each.intValue()) == 0) return false;
    }

    for (Integer each : ourOtherTooltipKeys) {
      if ((keyEvent.getModifiers() & each.intValue()) > 0) return false;
    }

    final int code = keyEvent.getKeyCode();

    return code == KeyEvent.VK_META
        || code == KeyEvent.VK_CONTROL
        || code == KeyEvent.VK_SHIFT
        || code == KeyEvent.VK_ALT;
  }
コード例 #3
0
  public void initComponent() {
    myModifiersValue = Registry.get("actionSystem.quickAccessModifiers");
    myModifiersValue.addListener(
        new RegistryValueListener.Adapter() {
          public void afterValueChanged(RegistryValue value) {
            applyModifiersFromRegistry();
          }
        },
        this);

    KeymapManager kmMgr = KeymapManager.getInstance();
    kmMgr.addKeymapManagerListener(this);

    activeKeymapChanged(kmMgr.getActiveKeymap());

    applyModifiersFromRegistry();
  }