use of com.intellij.openapi.externalSystem.model.project.ExternalConfigPathAware in project intellij-community by JetBrains.
the class IgnoreExternalProjectAction method setSelected.
@Override
public void setSelected(AnActionEvent e, boolean state) {
final ProjectSystemId projectSystemId = getSystemId(e);
final ExternalSystemNode<ExternalConfigPathAware> projectNode = getProjectNode(e);
if (projectSystemId == null || projectNode == null || projectNode.getData() == null)
return;
projectNode.setIgnored(state);
final Project project = getProject(e);
final String externalProjectPath = projectNode.getData().getLinkedExternalProjectPath();
final ExternalProjectInfo externalProjectInfo = ExternalSystemUtil.getExternalProjectInfo(project, projectSystemId, externalProjectPath);
if (externalProjectInfo == null || externalProjectInfo.getExternalProjectStructure() == null) {
if (LOG.isDebugEnabled()) {
LOG.debug(String.format("external project data not found, path: %s, data: %s", externalProjectPath, externalProjectInfo));
}
return;
}
final DataNode<ProjectData> projectDataNode = externalProjectInfo.getExternalProjectStructure();
ServiceManager.getService(ProjectDataManager.class).importData(projectDataNode, project, true);
}
use of com.intellij.openapi.externalSystem.model.project.ExternalConfigPathAware in project intellij-community by JetBrains.
the class OpenTasksActivationManagerAction 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;
new ConfigureTasksActivationDialog(project, projectSystemId, externalConfigPathAware.getLinkedExternalProjectPath()).showAndGet();
}
use of com.intellij.openapi.externalSystem.model.project.ExternalConfigPathAware 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