All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl Maven / Gradle / Ivy

package com.intellij.openapi.externalSystem.service.remote;

import com.intellij.openapi.externalSystem.model.DataNode;
import com.intellij.openapi.externalSystem.model.ExternalSystemException;
import com.intellij.openapi.externalSystem.model.project.ProjectData;
import com.intellij.openapi.externalSystem.model.settings.ExternalSystemExecutionSettings;
import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskId;
import com.intellij.openapi.externalSystem.service.project.ExternalSystemProjectResolver;
import com.intellij.util.Producer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
 * Defines common interface for resolving gradle project, i.e. building object-level representation of 'build.gradle'.
 * 
 * @author Denis Zhdanov
 * @since 8/8/11 10:58 AM
 */
public class RemoteExternalSystemProjectResolverImpl
  extends AbstractRemoteExternalSystemService implements RemoteExternalSystemProjectResolver
{

  private final ExternalSystemProjectResolver myDelegate;

  public RemoteExternalSystemProjectResolverImpl(@NotNull ExternalSystemProjectResolver delegate) {
    myDelegate = delegate;
  }

  @Nullable
  @Override
  public DataNode resolveProjectInfo(@NotNull final ExternalSystemTaskId id,
                                                  @NotNull final String projectPath,
                                                  final boolean isPreviewMode,
                                                  final S settings)
    throws ExternalSystemException, IllegalArgumentException, IllegalStateException
  {
    return execute(id, new Producer>() {
      @Nullable
      @Override
      public DataNode produce() {
        return myDelegate.resolveProjectInfo(id, projectPath, isPreviewMode, settings, getNotificationListener());
      }
    });
  }

  @Override
  public boolean cancelTask(@NotNull final ExternalSystemTaskId id)
    throws ExternalSystemException, IllegalArgumentException, IllegalStateException {
    return myDelegate.cancelTask(id, getNotificationListener());
  }
}