AnAction anAction = getAction();
DataContext context = DataManager.getInstance().getDataContext();
AnActionEvent anActionEvent = new AnActionEvent(null, context, "", anAction.getTemplatePresentation(), ActionManager.getInstance(), 0);
anAction.actionPerformed(anActionEvent);
FileDocumentManager.getInstance().saveAllDocuments();
}
protected abstract AnAction getAction();
}