Search in sources :

Example 1 with MavenShortcutsManager

use of org.jetbrains.idea.maven.tasks.MavenShortcutsManager in project intellij-community by JetBrains.

the class AssignShortcutAction method getGoalActionId.

@Nullable
private static String getGoalActionId(DataContext context) {
    final List<String> goals = MavenDataKeys.MAVEN_GOALS.getData(context);
    if (goals == null || goals.size() != 1) {
        return null;
    }
    MavenProject project = MavenActionUtil.getMavenProject(context);
    if (project == null)
        return null;
    String goal = goals.get(0);
    final MavenShortcutsManager shortcutsManager = getShortcutsManager(context);
    String actionId = shortcutsManager != null ? shortcutsManager.getActionId(project.getPath(), goal) : null;
    if (actionId != null) {
        AnAction action = ActionManager.getInstance().getAction(actionId);
        if (action == null) {
            MavenKeymapExtension.getOrRegisterAction(project, actionId, goal);
        }
    }
    return actionId;
}
Also used : MavenProject(org.jetbrains.idea.maven.project.MavenProject) MavenShortcutsManager(org.jetbrains.idea.maven.tasks.MavenShortcutsManager) AnAction(com.intellij.openapi.actionSystem.AnAction) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

AnAction (com.intellij.openapi.actionSystem.AnAction)1 Nullable (org.jetbrains.annotations.Nullable)1 MavenProject (org.jetbrains.idea.maven.project.MavenProject)1 MavenShortcutsManager (org.jetbrains.idea.maven.tasks.MavenShortcutsManager)1