Example usage for com.intellij.openapi.actionSystem.ex ActionManagerEx fireBeforeActionPerformed

List of usage examples for com.intellij.openapi.actionSystem.ex ActionManagerEx fireBeforeActionPerformed

Introduction

In this page you can find the example usage for com.intellij.openapi.actionSystem.ex ActionManagerEx fireBeforeActionPerformed.

Prototype

public abstract void fireBeforeActionPerformed(@NotNull AnAction action, @NotNull DataContext dataContext,
            @NotNull AnActionEvent event);

Source Link

Usage

From source file:com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl.java

License:Apache License

private boolean _performEditorAction(String actionId) {
    final DataContext dataContext = getEditorDataContext();

    ActionManagerEx managerEx = ActionManagerEx.getInstanceEx();
    AnAction action = managerEx.getAction(actionId);
    AnActionEvent event = new AnActionEvent(null, dataContext, ActionPlaces.UNKNOWN, new Presentation(),
            managerEx, 0);//from  w ww . j  a  v a 2 s .  co  m

    action.update(event);

    if (!event.getPresentation().isEnabled()) {
        return false;
    }

    managerEx.fireBeforeActionPerformed(action, dataContext, event);

    action.actionPerformed(event);

    managerEx.fireAfterActionPerformed(action, dataContext, event);
    return true;
}

From source file:org.jetbrains.jet.plugin.JetLightCodeInsightFixtureTestCase.java

License:Apache License

protected boolean performNotWriteEditorAction(String actionId) {
    DataContext dataContext = ((EditorEx) myFixture.getEditor()).getDataContext();

    ActionManagerEx managerEx = ActionManagerEx.getInstanceEx();
    AnAction action = managerEx.getAction(actionId);
    AnActionEvent event = new AnActionEvent(null, dataContext, ActionPlaces.UNKNOWN, new Presentation(),
            managerEx, 0);// w w  w .  j a  va  2 s .com

    action.update(event);
    if (!event.getPresentation().isEnabled()) {
        return false;
    }

    managerEx.fireBeforeActionPerformed(action, dataContext, event);
    action.actionPerformed(event);

    managerEx.fireAfterActionPerformed(action, dataContext, event);
    return true;
}