Java Code Examples for com.intellij.openapi.actionSystem.ActionManager#tryToExecute()

The following examples show how to use com.intellij.openapi.actionSystem.ActionManager#tryToExecute() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractRichStringBasedPostfixTemplate.java    From HakunaMatataIntelliJPlugin with Apache License 2.0 5 votes vote down vote up
protected void onTemplateFinished(TemplateManager manager, Editor editor, Template template) {
    // format and add ;
    final ActionManager actionManager = ActionManagerImpl.getInstance();
    final String editorCompleteStatementText = "EditorCompleteStatement";
    final AnAction action = actionManager.getAction(editorCompleteStatementText);
    actionManager.tryToExecute(action, ActionCommand.getInputEvent(editorCompleteStatementText), null, ActionPlaces.UNKNOWN, true);
}
 
Example 2
Source File: FindViewByIdFieldTemplate.java    From android-postfix-plugin with Apache License 2.0 5 votes vote down vote up
@Override
protected void onTemplateFinished(final TemplateManager manager, final Editor editor, Template template) {
    final ActionManager actionManager = ActionManagerImpl.getInstance();
    final String editorCompleteStatementText = "IntroduceField";
    final AnAction action = actionManager.getAction(editorCompleteStatementText);
    actionManager.tryToExecute(action, ActionCommand.getInputEvent(editorCompleteStatementText), null, ActionPlaces.UNKNOWN, true);
}
 
Example 3
Source File: FindViewByIdVariableTemplate.java    From android-postfix-plugin with Apache License 2.0 5 votes vote down vote up
@Override
protected void onTemplateFinished(final TemplateManager manager, final Editor editor, Template template) {
    final ActionManager actionManager = ActionManagerImpl.getInstance();
    final String editorCompleteStatementText = "IntroduceVariable";
    final AnAction action = actionManager.getAction(editorCompleteStatementText);
    actionManager.tryToExecute(action, ActionCommand.getInputEvent(editorCompleteStatementText), null, ActionPlaces.UNKNOWN, true);
}
 
Example 4
Source File: AbstractRichStringBasedPostfixTemplate.java    From android-postfix-plugin with Apache License 2.0 5 votes vote down vote up
protected void onTemplateFinished(TemplateManager manager, Editor editor, Template template) {
    // format and add ;
    final ActionManager actionManager = ActionManagerImpl.getInstance();
    final String editorCompleteStatementText = "EditorCompleteStatement";
    final AnAction action = actionManager.getAction(editorCompleteStatementText);
    actionManager.tryToExecute(action, ActionCommand.getInputEvent(editorCompleteStatementText), null, ActionPlaces.UNKNOWN, true);
}
 
Example 5
Source File: MacGestureAdapter.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void swipedLeft(SwipeEvent event) {
  ActionManager actionManager = ActionManager.getInstance();
  AnAction forward = actionManager.getAction("Forward");
  if (forward == null) return;

  actionManager.tryToExecute(forward, createMouseEventWrapper(myFrame), null, null, false);
}
 
Example 6
Source File: MacGestureAdapter.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void swipedRight(SwipeEvent event) {
  ActionManager actionManager = ActionManager.getInstance();
  AnAction back = actionManager.getAction("Back");
  if (back == null) return;

  actionManager.tryToExecute(back, createMouseEventWrapper(myFrame), null, null, false);
}
 
Example 7
Source File: WindowTool.java    From ADB-Duang with MIT License 4 votes vote down vote up
private void actionPerform(String action) {
    ActionManager am = ActionManager.getInstance();
    am.tryToExecute(am.getAction(action),
            ActionCommand.getInputEvent(action), panel1, "", true);

}