Search in sources :

Example 1 with RemoteServer

use of com.intellij.remoteServer.configuration.RemoteServer in project intellij-community by JetBrains.

the class CloudModuleBuilderSourceContribution method configureModule.

@Override
public void configureModule(final Module module) {
    final CloudModuleBuilder moduleBuilder = getModuleBuilder();
    RemoteServer<SC> account = (RemoteServer<SC>) moduleBuilder.getAccount();
    final AC applicationConfiguration = (AC) moduleBuilder.getApplicationConfiguration();
    DC deploymentConfiguration = createDeploymentConfiguration();
    if (applicationConfiguration.isExisting()) {
        deploymentConfiguration.setDefaultDeploymentName(false);
        deploymentConfiguration.setDeploymentName(applicationConfiguration.getExistingAppName());
    }
    final DeployToServerRunConfiguration<SC, DC> runConfiguration = CloudRunConfigurationUtil.createRunConfiguration(account, module, deploymentConfiguration);
    final ServerType<?> cloudType = account.getType();
    final Project project = module.getProject();
    new CloudConnectionTask<Object, SC, DC, SR>(project, CloudBundle.getText("cloud.support", cloudType.getPresentableName()), account) {

        boolean myFirstAttempt = true;

        @Override
        protected Object run(SR serverRuntime) throws ServerRuntimeException {
            doConfigureModule(applicationConfiguration, runConfiguration, myFirstAttempt, serverRuntime);
            return null;
        }

        @Override
        protected void runtimeErrorOccurred(@NotNull String errorMessage) {
            myFirstAttempt = false;
            new SshKeyChecker().checkServerError(errorMessage, getNotifier(), project, this);
        }

        @Override
        protected void postPerform(Object result) {
            detectModuleStructure(module, moduleBuilder.getContentEntryPath());
        }

        @Override
        protected boolean shouldStartInBackground() {
            return false;
        }
    }.performAsync();
}
Also used : SshKeyChecker(com.intellij.remoteServer.util.ssh.SshKeyChecker) Project(com.intellij.openapi.project.Project) RemoteServer(com.intellij.remoteServer.configuration.RemoteServer)

Example 2 with RemoteServer

use of com.intellij.remoteServer.configuration.RemoteServer in project intellij-community by JetBrains.

the class UploadApplicationAction method actionPerformed.

public void actionPerformed(AnActionEvent e) {
    final Project project = e.getRequiredData(CommonDataKeys.PROJECT);
    RunnerAndConfigurationSettings configurationToRun = getConfigurationToRun(project);
    if (configurationToRun != null) {
        ProgramRunnerUtil.executeConfiguration(project, configurationToRun, DefaultRunExecutor.getRunExecutorInstance());
    } else {
        AppEngineCloudType serverType = AppEngineCloudType.getInstance();
        List<RemoteServer<AppEngineServerConfiguration>> servers = RemoteServersManager.getInstance().getServers(serverType);
        DeploymentConfigurationManager.getInstance(project).createAndRunConfiguration(serverType, ContainerUtil.getFirstItem(servers));
    }
}
Also used : Project(com.intellij.openapi.project.Project) AppEngineCloudType(com.intellij.appengine.cloud.AppEngineCloudType) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings) RemoteServer(com.intellij.remoteServer.configuration.RemoteServer)

Example 3 with RemoteServer

use of com.intellij.remoteServer.configuration.RemoteServer in project google-cloud-intellij by GoogleCloudPlatform.

the class AppEngineStandardWebIntegration method setupDeployRunConfiguration.

private void setupDeployRunConfiguration(@NotNull Module module) {
    RunManager runManager = RunManager.getInstance(module.getProject());
    boolean hasExistingDeployConfiguration = runManager.getAllConfigurationsList().stream().filter(config -> config instanceof DeployToServerRunConfiguration).map(config -> ((DeployToServerRunConfiguration) config).getServerType()).anyMatch(serverType -> serverType instanceof AppEngineCloudType);
    if (!hasExistingDeployConfiguration) {
        AppEngineCloudType serverType = ServerType.EP_NAME.findExtension(AppEngineCloudType.class);
        RemoteServer<AppEngineServerConfiguration> server = ContainerUtil.getFirstItem(RemoteServersManager.getInstance().getServers(serverType));
        DeployToServerConfigurationType configurationType = DeployToServerConfigurationTypesRegistrar.getDeployConfigurationType(serverType);
        ConfigurationFactoryEx factory = configurationType.getFactory();
        RunnerAndConfigurationSettings settings = runManager.createRunConfiguration(configurationType.getDisplayName(), factory);
        DeployToServerRunConfiguration<?, ?> runConfiguration = (DeployToServerRunConfiguration<?, ?>) settings.getConfiguration();
        if (server != null) {
            runConfiguration.setServerName(server.getName());
        }
        runManager.addConfiguration(settings, false);
    }
}
Also used : AppEngineServerConfiguration(com.google.cloud.tools.intellij.appengine.cloud.AppEngineServerConfiguration) FrameworkSupportModel(com.intellij.ide.util.frameworkSupport.FrameworkSupportModel) VirtualFile(com.intellij.openapi.vfs.VirtualFile) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings) ServerType(com.intellij.remoteServer.ServerType) Artifact(com.intellij.packaging.artifacts.Artifact) ContainerUtil(com.intellij.util.containers.ContainerUtil) DeployToServerConfigurationTypesRegistrar(com.intellij.remoteServer.impl.configuration.deployment.DeployToServerConfigurationTypesRegistrar) DeployToServerConfigurationType(com.intellij.remoteServer.impl.configuration.deployment.DeployToServerConfigurationType) Library(com.intellij.openapi.roots.libraries.Library) CloudDebugConfigType(com.google.cloud.tools.intellij.debugger.CloudDebugConfigType) AppEngineCloudType(com.google.cloud.tools.intellij.appengine.cloud.AppEngineCloudType) ModuleRunConfiguration(com.intellij.execution.configurations.ModuleRunConfiguration) ModifiableRootModel(com.intellij.openapi.roots.ModifiableRootModel) RunManager(com.intellij.execution.RunManager) Project(com.intellij.openapi.project.Project) Module(com.intellij.openapi.module.Module) FrameworkRole(com.intellij.ide.util.frameworkSupport.FrameworkRole) DeployToServerRunConfiguration(com.intellij.remoteServer.impl.configuration.deployment.DeployToServerRunConfiguration) ArtifactType(com.intellij.packaging.artifacts.ArtifactType) RemoteServer(com.intellij.remoteServer.configuration.RemoteServer) RemoteServersManager(com.intellij.remoteServer.configuration.RemoteServersManager) ConfigurationFactory(com.intellij.execution.configurations.ConfigurationFactory) FrameworkSupportInModuleProvider(com.intellij.framework.addSupport.FrameworkSupportInModuleProvider) Nullable(org.jetbrains.annotations.Nullable) CloudDebugRunConfiguration(com.google.cloud.tools.intellij.debugger.CloudDebugRunConfiguration) List(java.util.List) ServiceManager(com.intellij.openapi.components.ServiceManager) NotNull(org.jetbrains.annotations.NotNull) ConfigurationFactoryEx(com.intellij.execution.configuration.ConfigurationFactoryEx) DeployToServerConfigurationType(com.intellij.remoteServer.impl.configuration.deployment.DeployToServerConfigurationType) AppEngineServerConfiguration(com.google.cloud.tools.intellij.appengine.cloud.AppEngineServerConfiguration) AppEngineCloudType(com.google.cloud.tools.intellij.appengine.cloud.AppEngineCloudType) ConfigurationFactoryEx(com.intellij.execution.configuration.ConfigurationFactoryEx) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings) RunManager(com.intellij.execution.RunManager) DeployToServerRunConfiguration(com.intellij.remoteServer.impl.configuration.deployment.DeployToServerRunConfiguration)

Aggregations

Project (com.intellij.openapi.project.Project)3 RemoteServer (com.intellij.remoteServer.configuration.RemoteServer)3 RunnerAndConfigurationSettings (com.intellij.execution.RunnerAndConfigurationSettings)2 AppEngineCloudType (com.google.cloud.tools.intellij.appengine.cloud.AppEngineCloudType)1 AppEngineServerConfiguration (com.google.cloud.tools.intellij.appengine.cloud.AppEngineServerConfiguration)1 CloudDebugConfigType (com.google.cloud.tools.intellij.debugger.CloudDebugConfigType)1 CloudDebugRunConfiguration (com.google.cloud.tools.intellij.debugger.CloudDebugRunConfiguration)1 AppEngineCloudType (com.intellij.appengine.cloud.AppEngineCloudType)1 RunManager (com.intellij.execution.RunManager)1 ConfigurationFactoryEx (com.intellij.execution.configuration.ConfigurationFactoryEx)1 ConfigurationFactory (com.intellij.execution.configurations.ConfigurationFactory)1 ModuleRunConfiguration (com.intellij.execution.configurations.ModuleRunConfiguration)1 FrameworkSupportInModuleProvider (com.intellij.framework.addSupport.FrameworkSupportInModuleProvider)1 FrameworkRole (com.intellij.ide.util.frameworkSupport.FrameworkRole)1 FrameworkSupportModel (com.intellij.ide.util.frameworkSupport.FrameworkSupportModel)1 ServiceManager (com.intellij.openapi.components.ServiceManager)1 Module (com.intellij.openapi.module.Module)1 ModifiableRootModel (com.intellij.openapi.roots.ModifiableRootModel)1 Library (com.intellij.openapi.roots.libraries.Library)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1