Exemplo n.º 1
0
 @Override
 public void initialize() {
   try {
     base.initialize();
   } catch (Exception ignore) {
   }
   myDisposable = Disposer.newDisposable();
   Application application = ApplicationManager.getApplication();
   if (application != null) {
     Disposer.register(application, myDisposable);
   }
   myMnemonicAlarm = new Alarm(Alarm.ThreadToUse.SHARED_THREAD, myDisposable);
   IdeEventQueue.getInstance()
       .addDispatcher(
           e -> {
             if (e instanceof KeyEvent && ((KeyEvent) e).getKeyCode() == KeyEvent.VK_ALT) {
               myAltPressed = e.getID() == KeyEvent.KEY_PRESSED;
               myMnemonicAlarm.cancelAllRequests();
               final Component focusOwner = IdeFocusManager.findInstance().getFocusOwner();
               if (focusOwner != null) {
                 myMnemonicAlarm.addRequest(() -> repaintMnemonics(focusOwner, myAltPressed), 10);
               }
             }
             return false;
           },
           myDisposable);
 }
Exemplo n.º 2
0
 @Override
 public void uninitialize() {
   try {
     base.initialize();
   } catch (Exception ignore) {
   }
   Disposer.dispose(myDisposable);
   myDisposable = null;
 }