Search in sources :

Example 1 with ExternalSystemFacadeManager

use of com.intellij.openapi.externalSystem.service.ExternalSystemFacadeManager in project intellij-community by JetBrains.

the class AbstractExternalSystemTask method refreshState.

public void refreshState() {
    if (getState() != ExternalSystemTaskState.IN_PROGRESS) {
        return;
    }
    final ExternalSystemFacadeManager manager = ServiceManager.getService(ExternalSystemFacadeManager.class);
    try {
        final RemoteExternalSystemFacade facade = manager.getFacade(myIdeProject, myExternalProjectPath, myExternalSystemId);
        setState(facade.isTaskInProgress(getId()) ? ExternalSystemTaskState.IN_PROGRESS : ExternalSystemTaskState.FAILED);
    } catch (Throwable e) {
        setState(ExternalSystemTaskState.FAILED);
        myError.set(e);
        if (!myIdeProject.isDisposed()) {
            LOG.warn(e);
        }
    }
}
Also used : ExternalSystemFacadeManager(com.intellij.openapi.externalSystem.service.ExternalSystemFacadeManager) RemoteExternalSystemFacade(com.intellij.openapi.externalSystem.service.RemoteExternalSystemFacade)

Example 2 with ExternalSystemFacadeManager

use of com.intellij.openapi.externalSystem.service.ExternalSystemFacadeManager in project intellij-community by JetBrains.

the class ExternalSystemExecuteTaskTask method doCancel.

@Override
protected boolean doCancel() throws Exception {
    final ExternalSystemFacadeManager manager = ServiceManager.getService(ExternalSystemFacadeManager.class);
    RemoteExternalSystemFacade facade = manager.getFacade(getIdeProject(), getExternalProjectPath(), getExternalSystemId());
    RemoteExternalSystemTaskManager taskManager = facade.getTaskManager();
    return taskManager.cancelTask(getId());
}
Also used : RemoteExternalSystemTaskManager(com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemTaskManager) ExternalSystemFacadeManager(com.intellij.openapi.externalSystem.service.ExternalSystemFacadeManager) RemoteExternalSystemFacade(com.intellij.openapi.externalSystem.service.RemoteExternalSystemFacade)

Example 3 with ExternalSystemFacadeManager

use of com.intellij.openapi.externalSystem.service.ExternalSystemFacadeManager in project intellij-community by JetBrains.

the class ExternalSystemExecuteTaskTask method doExecute.

@SuppressWarnings("unchecked")
@Override
protected void doExecute() throws Exception {
    final ExternalSystemFacadeManager manager = ServiceManager.getService(ExternalSystemFacadeManager.class);
    ExternalSystemExecutionSettings settings = ExternalSystemApiUtil.getExecutionSettings(getIdeProject(), getExternalProjectPath(), getExternalSystemId());
    KeyFMap keyFMap = getUserMap();
    for (Key key : keyFMap.getKeys()) {
        settings.putUserData(key, keyFMap.get(key));
    }
    RemoteExternalSystemFacade facade = manager.getFacade(getIdeProject(), getExternalProjectPath(), getExternalSystemId());
    RemoteExternalSystemTaskManager taskManager = facade.getTaskManager();
    List<String> taskNames = ContainerUtilRt.map2List(myTasksToExecute, ExternalTaskPojo::getName);
    final List<String> vmOptions = parseCmdParameters(myVmOptions);
    final List<String> arguments = parseCmdParameters(myArguments);
    settings.withVmOptions(vmOptions).withArguments(arguments);
    taskManager.executeTasks(getId(), taskNames, getExternalProjectPath(), settings, myJvmAgentSetup);
}
Also used : ExternalTaskPojo(com.intellij.openapi.externalSystem.model.execution.ExternalTaskPojo) KeyFMap(com.intellij.util.keyFMap.KeyFMap) RemoteExternalSystemTaskManager(com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemTaskManager) ExternalSystemFacadeManager(com.intellij.openapi.externalSystem.service.ExternalSystemFacadeManager) RemoteExternalSystemFacade(com.intellij.openapi.externalSystem.service.RemoteExternalSystemFacade) ExternalSystemExecutionSettings(com.intellij.openapi.externalSystem.model.settings.ExternalSystemExecutionSettings) Key(com.intellij.openapi.util.Key)

Example 4 with ExternalSystemFacadeManager

use of com.intellij.openapi.externalSystem.service.ExternalSystemFacadeManager in project intellij-community by JetBrains.

the class ExternalSystemResolveProjectTask method doCancel.

protected boolean doCancel() throws Exception {
    final ExternalSystemFacadeManager manager = ServiceManager.getService(ExternalSystemFacadeManager.class);
    Project ideProject = getIdeProject();
    RemoteExternalSystemProjectResolver resolver = manager.getFacade(ideProject, myProjectPath, getExternalSystemId()).getResolver();
    return resolver.cancelTask(getId());
}
Also used : Project(com.intellij.openapi.project.Project) RemoteExternalSystemProjectResolver(com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolver) ExternalSystemFacadeManager(com.intellij.openapi.externalSystem.service.ExternalSystemFacadeManager)

Example 5 with ExternalSystemFacadeManager

use of com.intellij.openapi.externalSystem.service.ExternalSystemFacadeManager in project intellij-community by JetBrains.

the class ExternalSystemResolveProjectTask method doExecute.

@SuppressWarnings("unchecked")
protected void doExecute() throws Exception {
    final ExternalSystemFacadeManager manager = ServiceManager.getService(ExternalSystemFacadeManager.class);
    Project ideProject = getIdeProject();
    RemoteExternalSystemProjectResolver resolver = manager.getFacade(ideProject, myProjectPath, getExternalSystemId()).getResolver();
    ExternalSystemExecutionSettings settings = ExternalSystemApiUtil.getExecutionSettings(ideProject, myProjectPath, getExternalSystemId());
    if (StringUtil.isNotEmpty(myVmOptions)) {
        settings.withVmOptions(ParametersListUtil.parse(myVmOptions));
    }
    if (StringUtil.isNotEmpty(myArguments)) {
        settings.withArguments(ParametersListUtil.parse(myArguments));
    }
    ExternalSystemProgressNotificationManagerImpl progressNotificationManager = (ExternalSystemProgressNotificationManagerImpl) ServiceManager.getService(ExternalSystemProgressNotificationManager.class);
    ExternalSystemTaskId id = getId();
    progressNotificationManager.onStart(id, myProjectPath);
    try {
        DataNode<ProjectData> project = resolver.resolveProjectInfo(id, myProjectPath, myIsPreviewMode, settings);
        if (project != null) {
            myExternalProject.set(project);
            ExternalSystemManager<?, ?, ?, ?, ?> systemManager = ExternalSystemApiUtil.getManager(getExternalSystemId());
            assert systemManager != null;
            Set<String> externalModulePaths = ContainerUtil.newHashSet();
            Collection<DataNode<ModuleData>> moduleNodes = ExternalSystemApiUtil.findAll(project, ProjectKeys.MODULE);
            for (DataNode<ModuleData> node : moduleNodes) {
                externalModulePaths.add(node.getData().getLinkedExternalProjectPath());
            }
            String projectPath = project.getData().getLinkedExternalProjectPath();
            ExternalProjectSettings linkedProjectSettings = systemManager.getSettingsProvider().fun(ideProject).getLinkedProjectSettings(projectPath);
            if (linkedProjectSettings != null) {
                linkedProjectSettings.setModules(externalModulePaths);
            }
        }
        progressNotificationManager.onSuccess(id);
    } finally {
        progressNotificationManager.onEnd(id);
    }
}
Also used : ExternalSystemTaskId(com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskId) ExternalSystemProgressNotificationManagerImpl(com.intellij.openapi.externalSystem.service.remote.ExternalSystemProgressNotificationManagerImpl) ExternalSystemFacadeManager(com.intellij.openapi.externalSystem.service.ExternalSystemFacadeManager) ExternalSystemProgressNotificationManager(com.intellij.openapi.externalSystem.service.notification.ExternalSystemProgressNotificationManager) ExternalProjectSettings(com.intellij.openapi.externalSystem.settings.ExternalProjectSettings) Project(com.intellij.openapi.project.Project) RemoteExternalSystemProjectResolver(com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolver) DataNode(com.intellij.openapi.externalSystem.model.DataNode) ModuleData(com.intellij.openapi.externalSystem.model.project.ModuleData) ExternalSystemExecutionSettings(com.intellij.openapi.externalSystem.model.settings.ExternalSystemExecutionSettings) ProjectData(com.intellij.openapi.externalSystem.model.project.ProjectData)

Aggregations

ExternalSystemFacadeManager (com.intellij.openapi.externalSystem.service.ExternalSystemFacadeManager)6 RemoteExternalSystemFacade (com.intellij.openapi.externalSystem.service.RemoteExternalSystemFacade)3 ExternalSystemExecutionSettings (com.intellij.openapi.externalSystem.model.settings.ExternalSystemExecutionSettings)2 RemoteExternalSystemProjectResolver (com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolver)2 RemoteExternalSystemTaskManager (com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemTaskManager)2 Project (com.intellij.openapi.project.Project)2 DataNode (com.intellij.openapi.externalSystem.model.DataNode)1 ExternalTaskPojo (com.intellij.openapi.externalSystem.model.execution.ExternalTaskPojo)1 ModuleData (com.intellij.openapi.externalSystem.model.project.ModuleData)1 ProjectData (com.intellij.openapi.externalSystem.model.project.ProjectData)1 ExternalSystemTaskId (com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskId)1 ExternalSystemProgressNotificationManager (com.intellij.openapi.externalSystem.service.notification.ExternalSystemProgressNotificationManager)1 ExternalSystemProgressNotificationManagerImpl (com.intellij.openapi.externalSystem.service.remote.ExternalSystemProgressNotificationManagerImpl)1 AbstractExternalSystemSettings (com.intellij.openapi.externalSystem.settings.AbstractExternalSystemSettings)1 ExternalProjectSettings (com.intellij.openapi.externalSystem.settings.ExternalProjectSettings)1 ExternalSystemSettingsListenerAdapter (com.intellij.openapi.externalSystem.settings.ExternalSystemSettingsListenerAdapter)1 Key (com.intellij.openapi.util.Key)1 KeyFMap (com.intellij.util.keyFMap.KeyFMap)1