use of com.intellij.openapi.externalSystem.view.ExternalSystemNode in project intellij-community by JetBrains.
the class AssignRunConfigurationShortcutAction method actionPerformed.
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
Project project = getProject(e);
assert project != null;
final List<ExternalSystemNode> selectedNodes = ExternalSystemDataKeys.SELECTED_NODES.getData(e.getDataContext());
if (selectedNodes == null || selectedNodes.size() != 1 || !(selectedNodes.get(0) instanceof RunConfigurationNode))
return;
RunnerAndConfigurationSettings settings = ((RunConfigurationNode) selectedNodes.get(0)).getSettings();
assert settings != null;
ExternalSystemRunConfiguration runConfiguration = (ExternalSystemRunConfiguration) settings.getConfiguration();
String actionIdPrefix = getActionPrefix(project, runConfiguration.getSettings().getExternalProjectPath());
String actionId = actionIdPrefix + settings.getName();
AnAction action = ActionManager.getInstance().getAction(actionId);
if (action == null) {
ExternalSystemKeymapExtension.getOrRegisterAction(project, settings);
}
new EditKeymapsDialog(project, actionId).show();
}
use of com.intellij.openapi.externalSystem.view.ExternalSystemNode in project intellij-community by JetBrains.
the class GradleExecuteTaskAction method obtainAppropriateWorkingDirectory.
private static String obtainAppropriateWorkingDirectory(AnActionEvent e) {
final List<ExternalSystemNode> selectedNodes = ExternalSystemDataKeys.SELECTED_NODES.getData(e.getDataContext());
if (selectedNodes == null || selectedNodes.size() != 1) {
final Module module = ExternalSystemActionUtil.getModule(e.getDataContext());
String projectPath = ExternalSystemApiUtil.getExternalProjectPath(module);
return projectPath == null ? "" : projectPath;
}
final ExternalSystemNode<?> node = selectedNodes.get(0);
final Object externalData = node.getData();
if (externalData instanceof ExternalConfigPathAware) {
return ((ExternalConfigPathAware) externalData).getLinkedExternalProjectPath();
} else {
final ExternalConfigPathAware parentExternalConfigPathAware = node.findParentData(ExternalConfigPathAware.class);
return parentExternalConfigPathAware != null ? parentExternalConfigPathAware.getLinkedExternalProjectPath() : "";
}
}
Aggregations