Java 类com.intellij.openapi.actionSystem.ex.AnActionListener 实例源码

项目:intellij-ce-playground    文件:IdeTooltipManager.java   
@Override
public void initComponent() {
  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();
}
项目:intellij-ce-playground    文件:CompletionPhase.java   
public CommittingDocuments(@Nullable CompletionProgressIndicator prevIndicator, Editor editor) {
  super(prevIndicator);
  myEditor = editor;
  myProject = editor.getProject();
  focusStamp = IdeFocusManager.getInstance(myProject).getTimestamp(true);
  ActionManager.getInstance().addAnActionListener(new AnActionListener.Adapter() {
    @Override
    public void beforeActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) {
      actionsHappened = true;
    }
  }, this);
  myEditor.getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    public void documentChanged(DocumentEvent e) {
      if (!ignoreDocumentChanges) {
        actionsHappened = true;
      }
    }
  }, this);
}
项目:tools-idea    文件:IdeTooltipManager.java   
@Override
public void initComponent() {
  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();
}
项目:tools-idea    文件:CompletionPhase.java   
public CommittingDocuments(@Nullable CompletionProgressIndicator prevIndicator, Editor editor) {
  super(prevIndicator);
  myEditor = editor;
  myProject = editor.getProject();
  focusStamp = IdeFocusManager.getInstance(myProject).getTimestamp(true);
  ActionManager.getInstance().addAnActionListener(new AnActionListener.Adapter() {
    @Override
    public void beforeActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) {
      actionsHappened = true;
    }
  }, this);
  myEditor.getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    public void documentChanged(DocumentEvent e) {
      if (!ignoreDocumentChanges) {
        actionsHappened = true;
      }
    }
  }, this);
}
项目:consulo    文件:ActionManagerImpl.java   
@Override
public void fireAfterActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) {
  if (action != null) {
    myPrevPerformedActionId = myLastPreformedActionId;
    myLastPreformedActionId = getId(action);
    //noinspection AssignmentToStaticFieldFromInstanceMethod
    IdeaLogger.ourLastActionId = myLastPreformedActionId;
  }
  for (AnActionListener listener : myActionListeners) {
    try {
      listener.afterActionPerformed(action, dataContext, event);
    }
    catch (AbstractMethodError ignored) {
    }
  }
}
项目:consulo    文件:IdeTooltipManager.java   
@Override
public void initComponent() {
  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();
}
项目:consulo    文件:MultipleChangeListBrowser.java   
private void setupRebuildListForActions() {
  ActionManager actionManager = ActionManager.getInstance();
  final AnAction moveAction = actionManager.getAction(IdeActions.MOVE_TO_ANOTHER_CHANGE_LIST);
  final AnAction deleteAction = actionManager.getAction("ChangesView.DeleteUnversioned.From.Dialog");

  actionManager.addAnActionListener(new AnActionListener.Adapter() {
    @Override
    public void afterActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) {
      if (moveAction.equals(action) || myMoveActionWithCustomShortcut != null && myMoveActionWithCustomShortcut.equals(action)) {
        rebuildList();
      }
      else if (deleteAction.equals(action)) {
        UnversionedViewDialog.refreshChanges(myProject, MultipleChangeListBrowser.this);
      }
    }
  }, this);
}
项目:consulo    文件:IgnoredViewDialog.java   
@Override
protected void addCustomActions(@Nonnull DefaultActionGroup group, @Nonnull ActionToolbar actionToolbar) {
  ActionManager actionManager = ActionManager.getInstance();
  AnAction deleteAction = EmptyAction.registerWithShortcutSet("ChangesView.DeleteUnversioned.From.Dialog", CommonShortcuts.getDelete(), myView);
  actionManager.addAnActionListener(new AnActionListener.Adapter() {
    @Override
    public void afterActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) {
      if (action.equals(deleteAction)) {
        refreshView();
        refreshChanges(myProject, getBrowserBase(myView));
      }
    }
  }, myDisposable);
  group.add(deleteAction);
  myView.setMenuActions(new DefaultActionGroup(deleteAction));
}
项目:consulo    文件:ActionTracker.java   
ActionTracker(Editor editor, Disposable parentDisposable) {
  myEditor = editor;
  myProject = editor.getProject();
  ActionManager.getInstance().addAnActionListener(new AnActionListener.Adapter() {
    @Override
    public void beforeActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) {
      myActionsHappened = true;
    }
  }, parentDisposable);
  myEditor.getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    public void documentChanged(DocumentEvent e) {
      if (!myIgnoreDocumentChanges) {
        myActionsHappened = true;
      }
    }
  }, parentDisposable);
}
项目:intellij-ce-playground    文件:ActionManagerImpl.java   
@Override
public void addAnActionListener(final AnActionListener listener, final Disposable parentDisposable) {
  addAnActionListener(listener);
  Disposer.register(parentDisposable, new Disposable() {
    @Override
    public void dispose() {
      removeAnActionListener(listener);
    }
  });
}
项目:intellij-ce-playground    文件:ActionManagerImpl.java   
@Override
public void fireBeforeActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) {
  if (action != null) {
    myPrevPerformedActionId = myLastPreformedActionId;
    myLastPreformedActionId = getId(action);
    //noinspection AssignmentToStaticFieldFromInstanceMethod
    IdeaLogger.ourLastActionId = myLastPreformedActionId;
  }
  for (AnActionListener listener : myActionListeners) {
    listener.beforeActionPerformed(action, dataContext, event);
  }
}
项目:intellij-ce-playground    文件:ActionManagerImpl.java   
@Override
public void fireAfterActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) {
  if (action != null) {
    myPrevPerformedActionId = myLastPreformedActionId;
    myLastPreformedActionId = getId(action);
    //noinspection AssignmentToStaticFieldFromInstanceMethod
    IdeaLogger.ourLastActionId = myLastPreformedActionId;
  }
  for (AnActionListener listener : myActionListeners) {
    try {
      listener.afterActionPerformed(action, dataContext, event);
    }
    catch(AbstractMethodError ignored) { }
  }
}
项目:intellij-ce-playground    文件:ActionManagerImpl.java   
@Override
public void fireBeforeEditorTyping(char c, DataContext dataContext) {
  myLastTimeEditorWasTypedIn = System.currentTimeMillis();
  for (AnActionListener listener : myActionListeners) {
    listener.beforeEditorTyping(c, dataContext);
  }
}
项目:intellij-ce-playground    文件:UnversionedViewDialog.java   
private void refreshViewAfterActionPerformed(@NotNull final ActionGroup opActionGroup) {
  ActionManager.getInstance().addAnActionListener(new AnActionListener.Adapter() {
    @Override
    public void afterActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) {
      for (AnAction anAction : opActionGroup.getChildren(event)) {
        if (anAction.equals(action)) {
          refreshView();
          return;
        }
      }
    }
  }, myDisposable);
}
项目:intellij-ce-playground    文件:MultipleChangeListBrowser.java   
public MultipleChangeListBrowser(final Project project, final List<? extends ChangeList> changeLists, final List<Change> changes,
                                 Disposable parentDisposable,
                                 final ChangeList initialListSelection,
                                 final boolean capableOfExcludingChanges,
                                 final boolean highlightProblems, final Runnable rebuildListListener, @Nullable final Runnable inclusionListener,
                                 final AnAction... additionalActions) {
  super(project, changeLists, changes, initialListSelection, capableOfExcludingChanges, highlightProblems, inclusionListener, MyUseCase.LOCAL_CHANGES, null);
  myParentDisposable = parentDisposable;
  myRebuildListListener = rebuildListListener;

  myChangeListChooser = new ChangeListChooser(changeLists);
  myHeaderPanel.add(myChangeListChooser, BorderLayout.EAST);
  myShowingAllChangeLists = Comparing.haveEqualElements((List<LocalChangeList>) changeLists, ChangeListManager.getInstance(project).getChangeLists());
  ChangeListManager.getInstance(myProject).addChangeListListener(myChangeListListener);

  myExtender = new Extender(project, this, additionalActions);

  ActionManager actionManager = ActionManager.getInstance();
  final AnAction moveAction = actionManager.getAction(IdeActions.MOVE_TO_ANOTHER_CHANGE_LIST);
  actionManager.addAnActionListener(new AnActionListener.Adapter() {
    @Override
    public void afterActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) {
      if (moveAction.equals(action)) {
        rebuildList();
      }
    }
  }, myParentDisposable);

}
项目:tools-idea    文件:ActionManagerImpl.java   
@Override
public void addAnActionListener(final AnActionListener listener, final Disposable parentDisposable) {
  addAnActionListener(listener);
  Disposer.register(parentDisposable, new Disposable() {
    @Override
    public void dispose() {
      removeAnActionListener(listener);
    }
  });
}
项目:tools-idea    文件:ActionManagerImpl.java   
@Override
public void fireBeforeActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) {
  if (action != null) {
    myPrevPerformedActionId = myLastPreformedActionId;
    myLastPreformedActionId = getId(action);
    //noinspection AssignmentToStaticFieldFromInstanceMethod
    IdeaLogger.ourLastActionId = myLastPreformedActionId;
  }
  for (AnActionListener listener : myActionListeners) {
    listener.beforeActionPerformed(action, dataContext, event);
  }
}
项目:tools-idea    文件:ActionManagerImpl.java   
@Override
public void fireAfterActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) {
  if (action != null) {
    myPrevPerformedActionId = myLastPreformedActionId;
    myLastPreformedActionId = getId(action);
    //noinspection AssignmentToStaticFieldFromInstanceMethod
    IdeaLogger.ourLastActionId = myLastPreformedActionId;
  }
  for (AnActionListener listener : myActionListeners) {
    try {
      listener.afterActionPerformed(action, dataContext, event);
    }
    catch(AbstractMethodError ignored) { }
  }
}
项目:tools-idea    文件:ActionManagerImpl.java   
@Override
public void fireBeforeEditorTyping(char c, DataContext dataContext) {
  myLastTimeEditorWasTypedIn = System.currentTimeMillis();
  for (AnActionListener listener : myActionListeners) {
    listener.beforeEditorTyping(c, dataContext);
  }
}
项目:tools-idea    文件:UnversionedViewDialog.java   
private void refreshViewAfterActionPerformed(@NotNull final ActionGroup opActionGroup) {
  ActionManager.getInstance().addAnActionListener(new AnActionListener.Adapter() {
    @Override
    public void afterActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) {
      for (AnAction anAction : opActionGroup.getChildren(event)) {
        if (anAction.equals(action)) {
          refreshView();
          return;
        }
      }
    }
  }, myDisposable);
}
项目:tools-idea    文件:MultipleChangeListBrowser.java   
public MultipleChangeListBrowser(final Project project, final List<? extends ChangeList> changeLists, final List<Change> changes,
                                 Disposable parentDisposable,
                                 final ChangeList initialListSelection,
                                 final boolean capableOfExcludingChanges,
                                 final boolean highlightProblems, final Runnable rebuildListListener, @Nullable final Runnable inclusionListener,
                                 final AnAction... additionalActions) {
  super(project, changeLists, changes, initialListSelection, capableOfExcludingChanges, highlightProblems, inclusionListener, MyUseCase.LOCAL_CHANGES, null);
  myParentDisposable = parentDisposable;
  myRebuildListListener = rebuildListListener;

  myChangeListChooser = new ChangeListChooser(changeLists);
  myHeaderPanel.add(myChangeListChooser, BorderLayout.EAST);
  myShowingAllChangeLists = Comparing.haveEqualElements((List<LocalChangeList>) changeLists, ChangeListManager.getInstance(project).getChangeLists());
  ChangeListManager.getInstance(myProject).addChangeListListener(myChangeListListener);

  myExtender = new Extender(project, this, additionalActions);

  ActionManager actionManager = ActionManager.getInstance();
  final AnAction moveAction = actionManager.getAction(IdeActions.MOVE_TO_ANOTHER_CHANGE_LIST);
  actionManager.addAnActionListener(new AnActionListener.Adapter() {
    @Override
    public void afterActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) {
      if (moveAction.equals(action)) {
        rebuildList();
      }
    }
  }, myParentDisposable);

}
项目:consulo    文件:ActionManagerImpl.java   
@Override
public void addAnActionListener(final AnActionListener listener, final Disposable parentDisposable) {
  addAnActionListener(listener);
  Disposer.register(parentDisposable, new Disposable() {
    @Override
    public void dispose() {
      removeAnActionListener(listener);
    }
  });
}
项目:consulo    文件:ActionManagerImpl.java   
@Override
public void fireBeforeActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) {
  if (action != null) {
    myPrevPerformedActionId = myLastPreformedActionId;
    myLastPreformedActionId = getId(action);
    //noinspection AssignmentToStaticFieldFromInstanceMethod
    IdeaLogger.ourLastActionId = myLastPreformedActionId;
  }
  for (AnActionListener listener : myActionListeners) {
    listener.beforeActionPerformed(action, dataContext, event);
  }
}
项目:consulo    文件:ActionManagerImpl.java   
@Override
public void fireBeforeEditorTyping(char c, DataContext dataContext) {
  myLastTimeEditorWasTypedIn = System.currentTimeMillis();
  for (AnActionListener listener : myActionListeners) {
    listener.beforeEditorTyping(c, dataContext);
  }
}
项目:consulo    文件:UnversionedViewDialog.java   
private void refreshViewAfterActionPerformed(@Nonnull final List<AnAction> actions) {
  ActionManager.getInstance().addAnActionListener(new AnActionListener.Adapter() {
    @Override
    public void afterActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) {
      if (actions.contains(action)) {
        refreshView();
        if (myDeleteActionWithCustomShortcut.equals(action)) {
          // We can not utilize passed "dataContext" here as it results in
          // "cannot share data context between Swing events" assertion.
          refreshChanges(myProject, getBrowserBase(myView));
        }
      }
    }
  }, myDisposable);
}
项目:intellij-ce-playground    文件:ActionManagerImpl.java   
@Override
public void addAnActionListener(AnActionListener listener) {
  myActionListeners.add(listener);
}
项目:intellij-ce-playground    文件:ActionManagerImpl.java   
@Override
public void removeAnActionListener(AnActionListener listener) {
  myActionListeners.remove(listener);
}
项目:tools-idea    文件:ActionManagerImpl.java   
@Override
public void addAnActionListener(AnActionListener listener) {
  myActionListeners.add(listener);
}
项目:tools-idea    文件:ActionManagerImpl.java   
@Override
public void removeAnActionListener(AnActionListener listener) {
  myActionListeners.remove(listener);
}
项目:consulo    文件:ActionManagerImpl.java   
@Override
public void addAnActionListener(AnActionListener listener) {
  myActionListeners.add(listener);
}
项目:consulo    文件:ActionManagerImpl.java   
@Override
public void removeAnActionListener(AnActionListener listener) {
  myActionListeners.remove(listener);
}
项目:consulo    文件:SearchEverywhereAction.java   
@SuppressWarnings("SSBasedInspection")
private void updatePopup() {
  check();
  SwingUtilities.invokeLater(new Runnable() {
    @Override
    public void run() {
      myListModel.update();
      myList.revalidate();
      myList.repaint();

      myRenderer.recalculateWidth();
      if (myBalloon == null || myBalloon.isDisposed()) {
        return;
      }
      if (myPopup == null || !myPopup.isVisible()) {
        final ActionCallback callback = ListDelegationUtil.installKeyboardDelegation(getField().getTextEditor(), myList);
        JBScrollPane content = new JBScrollPane(myList);
        content.setMinimumSize(new Dimension(myBalloon.getSize().width, 30));
        final ComponentPopupBuilder builder = JBPopupFactory.getInstance().createComponentPopupBuilder(content, null);
        myPopup = builder.setRequestFocus(false).setCancelKeyEnabled(false).setCancelCallback(new Computable<Boolean>() {
          @Override
          public Boolean compute() {
            return myBalloon == null || myBalloon.isDisposed() || (!getField().getTextEditor().hasFocus() && !mySkipFocusGain);
          }
        }).createPopup();
        myPopup.setMinimumSize(new Dimension(myBalloon.getSize().width, 30));
        myPopup.getContent().setBorder(new EmptyBorder(0, 0, 0, 0));
        Disposer.register(myPopup, new Disposable() {
          @Override
          public void dispose() {
            callback.setDone();
            resetFields();
            myNonProjectCheckBox.setSelected(false);
            ActionToolbarImpl.updateAllToolbarsImmediately();
            if (myActionEvent != null && myActionEvent.getInputEvent() instanceof MouseEvent) {
              final Component component = myActionEvent.getInputEvent().getComponent();
              if (component != null) {
                final JLabel label = UIUtil.getParentOfType(JLabel.class, component);
                if (label != null) {
                  label.setIcon(AllIcons.Actions.FindPlain);
                }
              }
            }
            myActionEvent = null;
          }
        });
        myPopup.show(new RelativePoint(getField().getParent(), new Point(0, getField().getParent().getHeight())));
        //updatePopupBounds();

        ActionManager.getInstance().addAnActionListener(new AnActionListener.Adapter() {
          @Override
          public void beforeActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) {
            if (action instanceof TextComponentEditorAction) {
              return;
            }
            myPopup.cancel();
          }
        }, myPopup);
      }
      else {
        myList.revalidate();
        myList.repaint();
      }
      ScrollingUtil.ensureSelectionExists(myList);
      if (myList.getModel().getSize() > 0) {
        updatePopupBounds();
      }
    }
  });
}
项目:intellij-ce-playground    文件:ActionManager.java   
public abstract void addAnActionListener(AnActionListener listener);
项目:intellij-ce-playground    文件:ActionManager.java   
public abstract void addAnActionListener(AnActionListener listener, Disposable parentDisposable);
项目:intellij-ce-playground    文件:ActionManager.java   
public abstract void removeAnActionListener(AnActionListener listener);
项目:tools-idea    文件:ActionManager.java   
public abstract void addAnActionListener(AnActionListener listener);
项目:tools-idea    文件:ActionManager.java   
public abstract void addAnActionListener(AnActionListener listener, Disposable parentDisposable);
项目:tools-idea    文件:ActionManager.java   
public abstract void removeAnActionListener(AnActionListener listener);
项目:consulo    文件:ActionManager.java   
public abstract void addAnActionListener(AnActionListener listener);
项目:consulo    文件:ActionManager.java   
public abstract void addAnActionListener(AnActionListener listener, Disposable parentDisposable);