Search in sources :

Example 26 with ProjectSystemId

use of com.intellij.openapi.externalSystem.model.ProjectSystemId in project intellij-community by JetBrains.

the class ExternalSystemProjectsWatcher method onQueued.

@Override
public void onQueued(@NotNull ExternalSystemTaskId id, String workingDir) {
    if (id.getType() == ExternalSystemTaskType.RESOLVE_PROJECT) {
        final ProjectSystemId systemId = id.getProjectSystemId();
        for (String filePath : ContainerUtil.newArrayList(myKnownAffectedFiles.get(workingDir))) {
            VirtualFile file = VfsUtil.findFileByIoFile(new File(filePath), false);
            if (file != null && !file.isDirectory()) {
                file.putUserData(CRC_WITHOUT_SPACES_BEFORE_LAST_IMPORT, file.getUserData(CRC_WITHOUT_SPACES_CURRENT));
            }
        }
        myUpdatesQueue.queue(new Update(Pair.create(systemId, workingDir)) {

            public void run() {
                doUpdateNotifications(true, systemId, workingDir);
            }
        });
    }
}
Also used : ProjectSystemId(com.intellij.openapi.externalSystem.model.ProjectSystemId) Update(com.intellij.util.ui.update.Update) File(java.io.File)

Example 27 with ProjectSystemId

use of com.intellij.openapi.externalSystem.model.ProjectSystemId 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 28 with ProjectSystemId

use of com.intellij.openapi.externalSystem.model.ProjectSystemId 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)

Example 29 with ProjectSystemId

use of com.intellij.openapi.externalSystem.model.ProjectSystemId in project intellij-community by JetBrains.

the class IgnoreExternalProjectAction method isSelected.

@Override
public boolean isSelected(AnActionEvent e) {
    boolean selected = super.isSelected(e);
    ProjectSystemId systemId = getSystemId(e);
    final String systemIdName = systemId != null ? systemId.getReadableName() : "external";
    if (selected) {
        setText(e, ExternalSystemBundle.message("action.unignore.external.project.text", systemIdName));
        setDescription(e, ExternalSystemBundle.message("action.unignore.external.project.description", systemIdName));
    } else {
        setText(e, ExternalSystemBundle.message("action.ignore.external.project.text", systemIdName));
        setDescription(e, ExternalSystemBundle.message("action.ignore.external.project.description", systemIdName));
    }
    return selected;
}
Also used : ProjectSystemId(com.intellij.openapi.externalSystem.model.ProjectSystemId)

Example 30 with ProjectSystemId

use of com.intellij.openapi.externalSystem.model.ProjectSystemId in project intellij-community by JetBrains.

the class RefreshExternalProjectAction method update.

@Override
public void update(@NotNull AnActionEvent e) {
    super.update(e);
    if (this.getClass() != RefreshExternalProjectAction.class)
        return;
    ProjectSystemId systemId = getSystemId(e);
    final String systemIdName = systemId != null ? systemId.getReadableName() : "external";
    Presentation presentation = e.getPresentation();
    presentation.setText(ExternalSystemBundle.message("action.refresh.project.text", systemIdName));
    presentation.setDescription(ExternalSystemBundle.message("action.refresh.project.description", systemIdName));
}
Also used : ProjectSystemId(com.intellij.openapi.externalSystem.model.ProjectSystemId) Presentation(com.intellij.openapi.actionSystem.Presentation)

Aggregations

ProjectSystemId (com.intellij.openapi.externalSystem.model.ProjectSystemId)36 Project (com.intellij.openapi.project.Project)10 Map (java.util.Map)5 ExternalConfigPathAware (com.intellij.openapi.externalSystem.model.project.ExternalConfigPathAware)4 ProjectData (com.intellij.openapi.externalSystem.model.project.ProjectData)4 File (java.io.File)4 NotNull (org.jetbrains.annotations.NotNull)4 ExternalSystemManager (com.intellij.openapi.externalSystem.ExternalSystemManager)3 DataNode (com.intellij.openapi.externalSystem.model.DataNode)3 ExternalProjectInfo (com.intellij.openapi.externalSystem.model.ExternalProjectInfo)3 ModuleData (com.intellij.openapi.externalSystem.model.project.ModuleData)3 TaskData (com.intellij.openapi.externalSystem.model.task.TaskData)3 ExternalProjectSettings (com.intellij.openapi.externalSystem.settings.ExternalProjectSettings)3 Collection (java.util.Collection)3 RunnerAndConfigurationSettings (com.intellij.execution.RunnerAndConfigurationSettings)2 Presentation (com.intellij.openapi.actionSystem.Presentation)2 Logger (com.intellij.openapi.diagnostic.Logger)2 ExternalSystemTaskExecutionSettings (com.intellij.openapi.externalSystem.model.execution.ExternalSystemTaskExecutionSettings)2 ExternalSystemProcessingManager (com.intellij.openapi.externalSystem.service.internal.ExternalSystemProcessingManager)2 AbstractExternalSystemSettings (com.intellij.openapi.externalSystem.settings.AbstractExternalSystemSettings)2