Search in sources :

Example 1 with ApplicationServer

use of com.intellij.javaee.appServerIntegrations.ApplicationServer in project google-cloud-intellij by GoogleCloudPlatform.

the class JavaeeFrameworkSupportProviderTestCase method deleteApplicationServers.

public static void deleteApplicationServers() {
    final ApplicationServersManager manager = ApplicationServersManager.getInstance();
    final List<ApplicationServer> servers = manager.getApplicationServers();
    final ApplicationServersManager.ApplicationServersManagerModifiableModel model = manager.createModifiableModel();
    for (ApplicationServer server : servers) {
        model.deleteApplicationServer(server);
    }
    ApplicationManager.getApplication().runWriteAction(model::commit);
}
Also used : ApplicationServersManager(com.intellij.javaee.serverInstances.ApplicationServersManager) ApplicationServer(com.intellij.javaee.appServerIntegrations.ApplicationServer)

Example 2 with ApplicationServer

use of com.intellij.javaee.appServerIntegrations.ApplicationServer in project google-cloud-intellij by GoogleCloudPlatform.

the class AppEngineStandardUltimateWebIntegration method getOrCreateAppServer.

private static ApplicationServer getOrCreateAppServer() {
    final CloudSdkService sdkService = CloudSdkService.getInstance();
    if (sdkService == null) {
        return null;
    }
    final AppEngineServerIntegration integration = AppEngineServerIntegration.getInstance();
    // There are no distinguishing features about the App Engine servers so just return
    // the first one found
    final List<ApplicationServer> servers = ApplicationServersManager.getInstance().getApplicationServers(integration);
    if (!servers.isEmpty()) {
        return servers.iterator().next();
    }
    return ApplicationServersManager.getInstance().createServer(integration, new JavaeePersistentData());
}
Also used : JavaeePersistentData(com.intellij.javaee.oss.server.JavaeePersistentData) CloudSdkService(com.google.cloud.tools.intellij.appengine.sdk.CloudSdkService) ApplicationServer(com.intellij.javaee.appServerIntegrations.ApplicationServer) AppEngineServerIntegration(com.google.cloud.tools.intellij.appengine.server.integration.AppEngineServerIntegration)

Example 3 with ApplicationServer

use of com.intellij.javaee.appServerIntegrations.ApplicationServer 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)

Example 4 with ApplicationServer

use of com.intellij.javaee.appServerIntegrations.ApplicationServer in project google-cloud-intellij by GoogleCloudPlatform.

the class AppEngineGwtServerProvider method getServers.

@Override
public List<? extends GwtDevModeServer> getServers() {
    final List<ApplicationServer> servers = ApplicationServersManager.getInstance().getApplicationServers(AppEngineServerIntegration.getInstance());
    final List<GwtDevModeServer> result = new ArrayList<GwtDevModeServer>();
    for (ApplicationServer server : servers) {
        result.add(new AppEngineGwtServer(server));
    }
    return result;
}
Also used : GwtDevModeServer(com.intellij.gwt.run.GwtDevModeServer) ArrayList(java.util.ArrayList) ApplicationServer(com.intellij.javaee.appServerIntegrations.ApplicationServer)

Aggregations

ApplicationServer (com.intellij.javaee.appServerIntegrations.ApplicationServer)4 CloudSdkService (com.google.cloud.tools.intellij.appengine.sdk.CloudSdkService)1 AppEngineServerModel (com.google.cloud.tools.intellij.appengine.server.instance.AppEngineServerModel)1 AppEngineServerIntegration (com.google.cloud.tools.intellij.appengine.server.integration.AppEngineServerIntegration)1 AppEngineServerConfigurationType (com.google.cloud.tools.intellij.appengine.server.run.AppEngineServerConfigurationType)1 RunnerAndConfigurationSettings (com.intellij.execution.RunnerAndConfigurationSettings)1 GwtDevModeServer (com.intellij.gwt.run.GwtDevModeServer)1 JavaeePersistentData (com.intellij.javaee.oss.server.JavaeePersistentData)1 CommonModel (com.intellij.javaee.run.configuration.CommonModel)1 ApplicationServersManager (com.intellij.javaee.serverInstances.ApplicationServersManager)1 ArrayList (java.util.ArrayList)1