use of com.intellij.remoteServer.ServerType 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);
}
}
Aggregations