Search in sources :

Example 1 with AppEngineServerConfigurationType

use of com.google.cloud.tools.intellij.appengine.server.run.AppEngineServerConfigurationType in project google-cloud-intellij by GoogleCloudPlatform.

the class AppEngineStandardUltimateWebIntegration method setupLocalDevRunConfiguration.

private void setupLocalDevRunConfiguration(Artifact artifact, @NotNull Project project, ModuleRunConfiguration existingConfiguration) {
    final ApplicationServer appServer = getOrCreateAppServer();
    if (appServer != null) {
        AppEngineServerConfigurationType configurationType = AppEngineServerConfigurationType.getInstance();
        CommonModel configuration;
        if (existingConfiguration instanceof CommonModel && ((CommonModel) existingConfiguration).getServerModel() instanceof AppEngineServerModel) {
            configuration = (CommonModel) existingConfiguration;
        } else if (RunManager.getInstance(project).getConfigurationSettingsList(configurationType).isEmpty()) {
            final RunnerAndConfigurationSettings settings = J2EEConfigurationFactory.getInstance().addAppServerConfiguration(project, configurationType.getLocalFactory(), appServer);
            configuration = (CommonModel) settings.getConfiguration();
        } else {
            configuration = null;
        }
        if (artifact != null && configuration != null && configuration.getServerModel() instanceof AppEngineServerModel) {
            ((AppEngineServerModel) configuration.getServerModel()).setArtifact(artifact);
            BuildArtifactsBeforeRunTaskProvider.setBuildArtifactBeforeRun(project, configuration, artifact);
        }
    }
}
Also used : AppEngineServerConfigurationType(com.google.cloud.tools.intellij.appengine.server.run.AppEngineServerConfigurationType) AppEngineServerModel(com.google.cloud.tools.intellij.appengine.server.instance.AppEngineServerModel) ApplicationServer(com.intellij.javaee.appServerIntegrations.ApplicationServer) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings) CommonModel(com.intellij.javaee.run.configuration.CommonModel)

Aggregations

AppEngineServerModel (com.google.cloud.tools.intellij.appengine.server.instance.AppEngineServerModel)1 AppEngineServerConfigurationType (com.google.cloud.tools.intellij.appengine.server.run.AppEngineServerConfigurationType)1 RunnerAndConfigurationSettings (com.intellij.execution.RunnerAndConfigurationSettings)1 ApplicationServer (com.intellij.javaee.appServerIntegrations.ApplicationServer)1 CommonModel (com.intellij.javaee.run.configuration.CommonModel)1