本文整理汇总了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();
}
示例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);
}
示例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) {
}
}
}
示例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);
}
示例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));
}
示例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);
}
示例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);
}
});
}
示例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);
}
}
示例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) { }
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例14: removeAnActionListener
import com.intellij.openapi.actionSystem.ex.AnActionListener; //导入依赖的package包/类
@Override
public void removeAnActionListener(AnActionListener listener) {
myActionListeners.remove(listener);
}
示例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();
}
}
});
}