use of com.intellij.openapi.externalSystem.view.ModuleNode in project intellij-community by JetBrains.
the class AssignShortcutAction method perform.
@Override
protected void perform(@NotNull Project project, @NotNull ProjectSystemId projectSystemId, @NotNull TaskData taskData, @NotNull AnActionEvent e) {
final ExternalSystemShortcutsManager shortcutsManager = ExternalProjectsManager.getInstance(project).getShortcutsManager();
final String actionId = shortcutsManager.getActionId(taskData.getLinkedExternalProjectPath(), taskData.getName());
if (actionId != null) {
AnAction action = ActionManager.getInstance().getAction(actionId);
if (action == null) {
ExternalSystemNode<?> taskNode = ContainerUtil.getFirstItem(ExternalSystemDataKeys.SELECTED_NODES.getData(e.getDataContext()));
assert taskNode != null;
final String group;
final ModuleNode moduleDataNode = taskNode.findParent(ModuleNode.class);
if (moduleDataNode != null) {
ModuleData moduleData = moduleDataNode.getData();
group = moduleData != null ? moduleData.getInternalName() : null;
} else {
ProjectNode projectNode = taskNode.findParent(ProjectNode.class);
ProjectData projectData = projectNode != null ? projectNode.getData() : null;
group = projectData != null ? projectData.getInternalName() : null;
}
if (group != null) {
ExternalSystemKeymapExtension.getOrRegisterAction(project, group, taskData);
}
}
new EditKeymapsDialog(project, actionId).show();
}
}
Aggregations