use of com.intellij.openapi.externalSystem.view.ExternalSystemNode in project intellij-community by JetBrains.
the class OpenTasksActivationManagerAction method isEnabled.
@Override
protected boolean isEnabled(AnActionEvent e) {
if (!super.isEnabled(e))
return false;
final List<ExternalSystemNode> selectedNodes = ExternalSystemDataKeys.SELECTED_NODES.getData(e.getDataContext());
if (selectedNodes == null || selectedNodes.size() != 1)
return false;
final Object externalData = selectedNodes.get(0).getData();
ProjectSystemId projectSystemId = getSystemId(e);
e.getPresentation().setText(ExternalSystemBundle.message("external.system.task.activation.title"));
e.getPresentation().setDescription(ExternalSystemBundle.message("external.system.task.activation.description", projectSystemId.getReadableName()));
final boolean isProjectNode = externalData instanceof ProjectData || externalData instanceof ModuleData;
return isProjectNode && StringUtil.isNotEmpty(((ExternalConfigPathAware) externalData).getLinkedExternalProjectPath());
}
use of com.intellij.openapi.externalSystem.view.ExternalSystemNode in project intellij-community by JetBrains.
the class RefreshExternalProjectAction method perform.
@Override
public void perform(@NotNull final Project project, @NotNull ProjectSystemId projectSystemId, @NotNull AbstractExternalEntityData externalEntityData, @NotNull AnActionEvent e) {
final List<ExternalSystemNode> selectedNodes = ExternalSystemDataKeys.SELECTED_NODES.getData(e.getDataContext());
final ExternalSystemNode<?> externalSystemNode = ContainerUtil.getFirstItem(selectedNodes);
assert externalSystemNode != null;
final ExternalConfigPathAware externalConfigPathAware = externalSystemNode.getData() instanceof ExternalConfigPathAware ? (ExternalConfigPathAware) externalSystemNode.getData() : null;
assert externalConfigPathAware != null;
// We save all documents because there is a possible case that there is an external system config file changed inside the ide.
FileDocumentManager.getInstance().saveAllDocuments();
final ExternalProjectSettings linkedProjectSettings = ExternalSystemApiUtil.getSettings(project, projectSystemId).getLinkedProjectSettings(externalConfigPathAware.getLinkedExternalProjectPath());
final String externalProjectPath = linkedProjectSettings == null ? externalConfigPathAware.getLinkedExternalProjectPath() : linkedProjectSettings.getExternalProjectPath();
ExternalSystemUtil.refreshProject(project, projectSystemId, externalProjectPath, false, ProgressExecutionMode.IN_BACKGROUND_ASYNC);
}
use of com.intellij.openapi.externalSystem.view.ExternalSystemNode in project intellij-community by JetBrains.
the class RemoveExternalSystemRunConfigurationAction 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;
int res = Messages.showYesNoDialog(project, "Delete \"" + settings.getName() + "\"?", "Confirmation", Messages.getQuestionIcon());
if (res == Messages.YES) {
((RunManagerEx) RunManager.getInstance(project)).removeConfiguration(settings);
}
}
use of com.intellij.openapi.externalSystem.view.ExternalSystemNode in project intellij-community by JetBrains.
the class ToggleTaskActivationAction method getTasks.
@NotNull
private static List<TaskData> getTasks(AnActionEvent e) {
final List<ExternalSystemNode> selectedNodes = ExternalSystemDataKeys.SELECTED_NODES.getData(e.getDataContext());
if (selectedNodes == null)
return Collections.emptyList();
List<TaskData> tasks = new SmartList<>();
for (ExternalSystemNode node : selectedNodes) {
if (node instanceof TaskNode && !node.isIgnored()) {
tasks.add((TaskData) node.getData());
} else if (node instanceof RunConfigurationNode) {
final RunnerAndConfigurationSettings configurationSettings = ((RunConfigurationNode) node).getSettings();
final ExternalSystemRunConfiguration runConfiguration = (ExternalSystemRunConfiguration) configurationSettings.getConfiguration();
final ExternalSystemTaskExecutionSettings taskExecutionSettings = runConfiguration.getSettings();
tasks.add(new TaskData(taskExecutionSettings.getExternalSystemId(), RUN_CONFIGURATION_TASK_PREFIX + configurationSettings.getName(), taskExecutionSettings.getExternalProjectPath(), null));
} else {
return Collections.emptyList();
}
}
return tasks;
}
use of com.intellij.openapi.externalSystem.view.ExternalSystemNode in project intellij-community by JetBrains.
the class GradleRefreshProjectDependenciesAction method perform.
@Override
public void perform(@NotNull final Project project, @NotNull ProjectSystemId projectSystemId, @NotNull AbstractExternalEntityData externalEntityData, @NotNull AnActionEvent e) {
final List<ExternalSystemNode> selectedNodes = ExternalSystemDataKeys.SELECTED_NODES.getData(e.getDataContext());
final ExternalSystemNode<?> externalSystemNode = ContainerUtil.getFirstItem(selectedNodes);
assert externalSystemNode != null;
final ExternalConfigPathAware externalConfigPathAware = externalSystemNode.getData() instanceof ExternalConfigPathAware ? (ExternalConfigPathAware) externalSystemNode.getData() : null;
assert externalConfigPathAware != null;
// We save all documents because there is a possible case that there is an external system config file changed inside the ide.
FileDocumentManager.getInstance().saveAllDocuments();
final ExternalProjectSettings linkedProjectSettings = ExternalSystemApiUtil.getSettings(project, projectSystemId).getLinkedProjectSettings(externalConfigPathAware.getLinkedExternalProjectPath());
final String externalProjectPath = linkedProjectSettings == null ? externalConfigPathAware.getLinkedExternalProjectPath() : linkedProjectSettings.getExternalProjectPath();
ExternalSystemUtil.refreshProject(externalProjectPath, new ImportSpecBuilder(project, projectSystemId).useDefaultCallback().use(ProgressExecutionMode.IN_BACKGROUND_ASYNC).withArguments("--refresh-dependencies").build());
}
Aggregations