Search in sources :

Example 1 with DeploymentSource

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

the class DeployToServerRunConfiguration method readExternal.

@Override
public void readExternal(Element element) throws InvalidDataException {
    super.readExternal(element);
    ConfigurationState state = XmlSerializer.deserialize(element, ConfigurationState.class);
    myServerName = null;
    myDeploymentSource = null;
    myServerName = state.myServerName;
    final Element deploymentTag = state.myDeploymentTag;
    if (deploymentTag != null) {
        String typeId = deploymentTag.getAttributeValue(DEPLOYMENT_SOURCE_TYPE_ATTRIBUTE);
        final DeploymentSourceType<?> type = findDeploymentSourceType(typeId);
        if (type != null) {
            myDeploymentSource = new ReadAction<DeploymentSource>() {

                @Override
                protected void run(@NotNull final Result<DeploymentSource> result) {
                    result.setResult(type.load(deploymentTag, getProject()));
                }
            }.execute().getResultObject();
            myDeploymentConfiguration = myDeploymentConfigurator.createDefaultConfiguration(myDeploymentSource);
            ComponentSerializationUtil.loadComponentState(myDeploymentConfiguration.getSerializer(), deploymentTag.getChild(SETTINGS_ELEMENT));
        } else {
            LOG.warn("Cannot load deployment source for '" + getName() + "' run configuration: unknown deployment type '" + typeId + "'");
        }
    }
}
Also used : Element(org.jdom.Element) DeploymentSource(com.intellij.remoteServer.configuration.deployment.DeploymentSource)

Example 2 with DeploymentSource

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

the class CloudSdkAppEngineHelperTest method testCreateFlexDeployRunner_noPersistedModule.

@Test
public void testCreateFlexDeployRunner_noPersistedModule() {
    when(deploymentConfiguration.getModuleName()).thenReturn(null);
    DeploymentSource flexSource = createMockDeployableDeploymentSource();
    when(((AppEngineDeployable) flexSource).getEnvironment()).thenReturn(AppEngineEnvironment.APP_ENGINE_FLEX);
    File mockSourceFile = mock(File.class);
    when(mockSourceFile.exists()).thenReturn(true);
    when(flexSource.getFile()).thenReturn(mockSourceFile);
    Optional<CancellableRunnable> runner = helper.createDeployRunner(loggingHandler, flexSource, deploymentConfiguration, callback);
    assertFalse(runner.isPresent());
    verify(callback, times(1)).errorOccurred("No app.yaml specified for flexible deployment.");
}
Also used : CancellableRunnable(com.intellij.openapi.vcs.impl.CancellableRunnable) DeploymentSource(com.intellij.remoteServer.configuration.deployment.DeploymentSource) File(java.io.File) Test(org.junit.Test)

Example 3 with DeploymentSource

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

the class CloudRunConfigurationUtil method createRunConfiguration.

public static <SC extends ServerConfiguration, DC extends DeploymentConfiguration> DeployToServerRunConfiguration<SC, DC> createRunConfiguration(RemoteServer<SC> account, Module module, DC deploymentConfiguration) {
    final ModulePointer modulePointer = ModulePointerManager.getInstance(module.getProject()).create(module);
    DeploymentSource deploymentSource = new ModuleDeploymentSourceImpl(modulePointer);
    return createRunConfiguration(account, module, deploymentSource, deploymentConfiguration);
}
Also used : ModulePointer(com.intellij.openapi.module.ModulePointer) ModuleDeploymentSourceImpl(com.intellij.remoteServer.impl.configuration.deployment.ModuleDeploymentSourceImpl) DeploymentSource(com.intellij.remoteServer.configuration.deployment.DeploymentSource)

Example 4 with DeploymentSource

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

the class DeployToServerSettingsEditor method updateDeploymentSettingsEditor.

private void updateDeploymentSettingsEditor() {
    String serverName = myServerListModel.getSelectedItem();
    RemoteServer<S> selectedServer = serverName != null ? RemoteServersManager.getInstance().findByName(serverName, myServerType) : null;
    DeploymentSource selectedSource = mySourceListModel.getSelectedItem();
    if (Comparing.equal(selectedSource, myLastSelectedSource) && Comparing.equal(selectedServer, myLastSelectedServer)) {
        return;
    }
    if (!Comparing.equal(selectedSource, myLastSelectedSource)) {
        updateBeforeRunOptions(myLastSelectedSource, false);
        updateBeforeRunOptions(selectedSource, true);
    }
    if (selectedSource != null && selectedServer != null) {
        myDeploymentSettingsComponent.removeAll();
        myDeploymentSettingsEditor = myDeploymentConfigurator.createEditor(selectedSource, selectedServer);
        if (myDeploymentSettingsEditor != null) {
            Disposer.register(this, myDeploymentSettingsEditor);
            myDeploymentSettingsComponent.add(BorderLayout.CENTER, myDeploymentSettingsEditor.getComponent());
        }
    }
    myLastSelectedSource = selectedSource;
    myLastSelectedServer = selectedServer;
}
Also used : DeploymentSource(com.intellij.remoteServer.configuration.deployment.DeploymentSource)

Example 5 with DeploymentSource

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

the class DeployToServerSettingsEditor method applyEditorTo.

@Override
protected void applyEditorTo(@NotNull DeployToServerRunConfiguration<S, D> configuration) throws ConfigurationException {
    updateDeploymentSettingsEditor();
    configuration.setServerName(myServerListModel.getSelectedItem());
    DeploymentSource deploymentSource = mySourceListModel.getSelectedItem();
    configuration.setDeploymentSource(deploymentSource);
    if (deploymentSource != null) {
        D deployment = configuration.getDeploymentConfiguration();
        if (deployment == null) {
            deployment = myDeploymentConfigurator.createDefaultConfiguration(deploymentSource);
            configuration.setDeploymentConfiguration(deployment);
        }
        if (myDeploymentSettingsEditor != null) {
            myDeploymentSettingsEditor.applyTo(deployment);
        }
    } else {
        configuration.setDeploymentConfiguration(null);
    }
}
Also used : DeploymentSource(com.intellij.remoteServer.configuration.deployment.DeploymentSource)

Aggregations

DeploymentSource (com.intellij.remoteServer.configuration.deployment.DeploymentSource)6 ModuleDeploymentSourceImpl (com.intellij.remoteServer.impl.configuration.deployment.ModuleDeploymentSourceImpl)2 Module (com.intellij.openapi.module.Module)1 ModulePointer (com.intellij.openapi.module.ModulePointer)1 ModulePointerManager (com.intellij.openapi.module.ModulePointerManager)1 CancellableRunnable (com.intellij.openapi.vcs.impl.CancellableRunnable)1 ModuleDeploymentSource (com.intellij.remoteServer.configuration.deployment.ModuleDeploymentSource)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 Element (org.jdom.Element)1 Test (org.junit.Test)1