Search in sources :

Example 6 with ExternalProjectInfo

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;
}
Also used : ExternalProjectInfo(com.intellij.openapi.externalSystem.model.ExternalProjectInfo) ProjectDataManager(com.intellij.openapi.externalSystem.service.project.ProjectDataManager) Nullable(org.jetbrains.annotations.Nullable)

Example 7 with ExternalProjectInfo

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);
}
Also used : ExternalProjectInfo(com.intellij.openapi.externalSystem.model.ExternalProjectInfo) ProjectDataManager(com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManager) DataNode(com.intellij.openapi.externalSystem.model.DataNode) ProjectData(com.intellij.openapi.externalSystem.model.project.ProjectData)

Example 8 with ExternalProjectInfo

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);
}
Also used : ExternalProjectInfo(com.intellij.openapi.externalSystem.model.ExternalProjectInfo) LookupElement(com.intellij.codeInsight.lookup.LookupElement) ExternalProjectSettings(com.intellij.openapi.externalSystem.settings.ExternalProjectSettings)

Example 9 with ExternalProjectInfo

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();
    }
}
Also used : ExternalProjectInfo(com.intellij.openapi.externalSystem.model.ExternalProjectInfo) Project(com.intellij.openapi.project.Project) ExternalProjectDataSelectorDialog(com.intellij.openapi.externalSystem.service.ui.ExternalProjectDataSelectorDialog) ProjectSystemId(com.intellij.openapi.externalSystem.model.ProjectSystemId) ProjectNode(com.intellij.openapi.externalSystem.view.ProjectNode) ExternalSystemNode(com.intellij.openapi.externalSystem.view.ExternalSystemNode) ProjectData(com.intellij.openapi.externalSystem.model.project.ProjectData)

Example 10 with ExternalProjectInfo

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);
}
Also used : ExternalConfigPathAware(com.intellij.openapi.externalSystem.model.project.ExternalConfigPathAware) ExternalProjectInfo(com.intellij.openapi.externalSystem.model.ExternalProjectInfo) Project(com.intellij.openapi.project.Project) ProjectDataManager(com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManager) ProjectSystemId(com.intellij.openapi.externalSystem.model.ProjectSystemId) ProjectData(com.intellij.openapi.externalSystem.model.project.ProjectData)

Aggregations

ExternalProjectInfo (com.intellij.openapi.externalSystem.model.ExternalProjectInfo)13 DataNode (com.intellij.openapi.externalSystem.model.DataNode)4 ProjectData (com.intellij.openapi.externalSystem.model.project.ProjectData)4 Nullable (org.jetbrains.annotations.Nullable)4 ModuleData (com.intellij.openapi.externalSystem.model.project.ModuleData)3 ProjectSystemId (com.intellij.openapi.externalSystem.model.ProjectSystemId)2 ProjectDataManager (com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManager)2 ExternalProjectSettings (com.intellij.openapi.externalSystem.settings.ExternalProjectSettings)2 Project (com.intellij.openapi.project.Project)2 NotNull (org.jetbrains.annotations.NotNull)2 LookupElement (com.intellij.codeInsight.lookup.LookupElement)1 RunManagerEx (com.intellij.execution.RunManagerEx)1 RunnerAndConfigurationSettings (com.intellij.execution.RunnerAndConfigurationSettings)1 ConfigurationContext (com.intellij.execution.actions.ConfigurationContext)1 ConfigurationFromContext (com.intellij.execution.actions.ConfigurationFromContext)1 RunConfigurationProducer (com.intellij.execution.actions.RunConfigurationProducer)1 ConfigurationType (com.intellij.execution.configurations.ConfigurationType)1 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)1 Editor (com.intellij.openapi.editor.Editor)1 ExternalSystemUiAware (com.intellij.openapi.externalSystem.ExternalSystemUiAware)1