use of com.intellij.openapi.externalSystem.model.ExternalProjectInfo in project android by JetBrains.
the class DataNodeCaches method getCachedProjectData.
@Nullable
public DataNode<ProjectData> getCachedProjectData() {
ProjectDataManager dataManager = ProjectDataManager.getInstance();
String projectPath = getBaseDirPath(myProject).getPath();
ExternalProjectInfo projectInfo = dataManager.getExternalProjectData(myProject, GradleConstants.SYSTEM_ID, projectPath);
return projectInfo != null ? projectInfo.getExternalProjectStructure() : null;
}
use of com.intellij.openapi.externalSystem.model.ExternalProjectInfo in project intellij-community by JetBrains.
the class ExternalSystemImportingTestCase method ignoreData.
protected void ignoreData(BooleanFunction<DataNode<?>> booleanFunction, final boolean ignored) {
final ExternalProjectInfo externalProjectInfo = ProjectDataManager.getInstance().getExternalProjectData(myProject, getExternalSystemId(), getCurrentExternalProjectSettings().getExternalProjectPath());
assertNotNull(externalProjectInfo);
final DataNode<ProjectData> projectDataNode = externalProjectInfo.getExternalProjectStructure();
assertNotNull(projectDataNode);
final Collection<DataNode<?>> nodes = ExternalSystemApiUtil.findAllRecursively(projectDataNode, booleanFunction);
for (DataNode<?> node : nodes) {
ExternalSystemApiUtil.visit(node, dataNode -> dataNode.setIgnored(ignored));
}
ServiceManager.getService(ProjectDataManager.class).importData(projectDataNode, myProject, true);
}
use of com.intellij.openapi.externalSystem.model.ExternalProjectInfo in project intellij-community by JetBrains.
the class TaskCompletionProvider method addArgumentVariants.
@Override
protected void addArgumentVariants(@NotNull CompletionResultSet result) {
List<LookupElement> cachedElements = myCachedElements;
final String projectPath = myProjectPathAccessor.getText();
if (cachedElements == null || !StringUtil.equals(myCachedWorkingDir, projectPath)) {
final ExternalProjectSettings linkedProjectSettings = ExternalSystemApiUtil.getSettings(myProject, mySystemId).getLinkedProjectSettings(projectPath);
if (linkedProjectSettings == null)
return;
final ExternalProjectInfo projectData = ProjectDataManager.getInstance().getExternalProjectData(myProject, mySystemId, linkedProjectSettings.getExternalProjectPath());
if (projectData == null || projectData.getExternalProjectStructure() == null)
return;
cachedElements = ContainerUtil.newArrayList(getVariants(projectData.getExternalProjectStructure(), projectPath));
myCachedElements = cachedElements;
myCachedWorkingDir = projectPath;
}
result.addAllElements(cachedElements);
}
use of com.intellij.openapi.externalSystem.model.ExternalProjectInfo in project intellij-community by JetBrains.
the class ExternalSystemSelectProjectDataToImportAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
final Project project = getProject(e);
final ProjectSystemId projectSystemId = getSystemId(e);
final List<ExternalSystemNode> selectedNodes = ExternalSystemDataKeys.SELECTED_NODES.getData(e.getDataContext());
final ExternalProjectInfo projectInfo;
final ExternalSystemNode<?> externalSystemNode = ContainerUtil.getFirstItem(selectedNodes);
if (externalSystemNode == null) {
projectInfo = ContainerUtil.getFirstItem(ProjectDataManager.getInstance().getExternalProjectsData(project, projectSystemId));
} else {
final ProjectNode projectNode = externalSystemNode instanceof ProjectNode ? (ProjectNode) externalSystemNode : externalSystemNode.findParent(ProjectNode.class);
assert projectNode != null;
final ProjectData projectData = projectNode.getData();
assert projectData != null;
projectInfo = ProjectDataManager.getInstance().getExternalProjectData(project, projectSystemId, projectData.getLinkedExternalProjectPath());
}
final ExternalProjectDataSelectorDialog dialog;
if (projectInfo != null) {
dialog = new ExternalProjectDataSelectorDialog(project, projectInfo, externalSystemNode != null ? externalSystemNode.getData() : null);
dialog.showAndGet();
}
}
use of com.intellij.openapi.externalSystem.model.ExternalProjectInfo 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);
}
Aggregations