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 + "'");
}
}
}
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.");
}
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);
}
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;
}
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);
}
}
Aggregations