当前位置: 首页>>代码示例>>Java>>正文


Java AnActionListener类代码示例

本文整理汇总了Java中com.intellij.openapi.actionSystem.ex.AnActionListener的典型用法代码示例。如果您正苦于以下问题:Java AnActionListener类的具体用法?Java AnActionListener怎么用?Java AnActionListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AnActionListener类属于com.intellij.openapi.actionSystem.ex包,在下文中一共展示了AnActionListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initComponent

import com.intellij.openapi.actionSystem.ex.AnActionListener; //导入依赖的package包/类
@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();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:IdeTooltipManager.java

示例2: CommittingDocuments

import com.intellij.openapi.actionSystem.ex.AnActionListener; //导入依赖的package包/类
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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:CompletionPhase.java

示例3: fireAfterActionPerformed

import com.intellij.openapi.actionSystem.ex.AnActionListener; //导入依赖的package包/类
@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) {
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:ActionManagerImpl.java

示例4: setupRebuildListForActions

import com.intellij.openapi.actionSystem.ex.AnActionListener; //导入依赖的package包/类
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);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:MultipleChangeListBrowser.java

示例5: addCustomActions

import com.intellij.openapi.actionSystem.ex.AnActionListener; //导入依赖的package包/类
@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));
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:IgnoredViewDialog.java

示例6: ActionTracker

import com.intellij.openapi.actionSystem.ex.AnActionListener; //导入依赖的package包/类
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);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:19,代码来源:ActionTracker.java

示例7: addAnActionListener

import com.intellij.openapi.actionSystem.ex.AnActionListener; //导入依赖的package包/类
@Override
public void addAnActionListener(final AnActionListener listener, final Disposable parentDisposable) {
  addAnActionListener(listener);
  Disposer.register(parentDisposable, new Disposable() {
    @Override
    public void dispose() {
      removeAnActionListener(listener);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ActionManagerImpl.java

示例8: fireBeforeActionPerformed

import com.intellij.openapi.actionSystem.ex.AnActionListener; //导入依赖的package包/类
@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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:ActionManagerImpl.java

示例9: fireAfterActionPerformed

import com.intellij.openapi.actionSystem.ex.AnActionListener; //导入依赖的package包/类
@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) { }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:ActionManagerImpl.java

示例10: fireBeforeEditorTyping

import com.intellij.openapi.actionSystem.ex.AnActionListener; //导入依赖的package包/类
@Override
public void fireBeforeEditorTyping(char c, DataContext dataContext) {
  myLastTimeEditorWasTypedIn = System.currentTimeMillis();
  for (AnActionListener listener : myActionListeners) {
    listener.beforeEditorTyping(c, dataContext);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:ActionManagerImpl.java

示例11: refreshViewAfterActionPerformed

import com.intellij.openapi.actionSystem.ex.AnActionListener; //导入依赖的package包/类
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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:UnversionedViewDialog.java

示例12: MultipleChangeListBrowser

import com.intellij.openapi.actionSystem.ex.AnActionListener; //导入依赖的package包/类
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);

}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:MultipleChangeListBrowser.java

示例13: refreshViewAfterActionPerformed

import com.intellij.openapi.actionSystem.ex.AnActionListener; //导入依赖的package包/类
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);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:16,代码来源:UnversionedViewDialog.java

示例14: removeAnActionListener

import com.intellij.openapi.actionSystem.ex.AnActionListener; //导入依赖的package包/类
@Override
public void removeAnActionListener(AnActionListener listener) {
  myActionListeners.remove(listener);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:ActionManagerImpl.java

示例15: updatePopup

import com.intellij.openapi.actionSystem.ex.AnActionListener; //导入依赖的package包/类
@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();
      }
    }
  });
}
 
开发者ID:consulo,项目名称:consulo,代码行数:71,代码来源:SearchEverywhereAction.java


注:本文中的com.intellij.openapi.actionSystem.ex.AnActionListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。