use of com.microsoft.azure.toolkit.intellij.common.AzureArtifact in project azure-tools-for-java by Microsoft.
the class WebAppSlimSettingPanel method resetFromConfig.
@Override
protected void resetFromConfig(@NotNull WebAppConfiguration configuration) {
if (!StringUtils.isAllEmpty(configuration.getWebAppName(), configuration.getWebAppId())) {
final WebAppComboBoxModel configModel = new WebAppComboBoxModel(configuration.getModel());
comboBoxWebApp.setConfigModel(configModel);
}
if (configuration.getAzureArtifactType() != null) {
final AzureArtifact artifact = AzureArtifactManager.getInstance(this.project).getAzureArtifactById(configuration.getAzureArtifactType(), configuration.getArtifactIdentifier());
comboBoxArtifact.setArtifact(artifact);
}
if (configuration.getWebAppId() != null && configuration.isDeployToSlot()) {
toggleSlotPanel(true);
chkDeployToSlot.setSelected(true);
final boolean useNewDeploymentSlot = StringUtils.equals(configuration.getSlotName(), Constants.CREATE_NEW_SLOT);
rbtNewSlot.setSelected(useNewDeploymentSlot);
rbtExistingSlot.setSelected(!useNewDeploymentSlot);
toggleSlotType(!useNewDeploymentSlot);
txtNewSlotName.setText(configuration.getNewSlotName());
cbxSlotName.addItem(useNewDeploymentSlot ? configuration.getNewSlotName() : configuration.getSlotName());
cbxSlotConfigurationSource.addItem(configuration.getNewSlotConfigurationSource());
} else {
toggleSlotPanel(false);
chkDeployToSlot.setSelected(false);
}
final DateFormat df = new SimpleDateFormat("yyMMddHHmmss");
final String defaultSlotName = StringUtils.isEmpty(configuration.getNewSlotName()) ? String.format(DEFAULT_SLOT_NAME, df.format(new Date())) : configuration.getNewSlotName();
txtNewSlotName.setText(defaultSlotName);
chkToRoot.setSelected(configuration.isDeployToRoot());
chkOpenBrowser.setSelected(configuration.isOpenBrowserAfterDeployment());
slotDecorator.setOn(configuration.isSlotPanelVisible());
}
use of com.microsoft.azure.toolkit.intellij.common.AzureArtifact in project azure-tools-for-java by Microsoft.
the class SpringCloudDeploymentConfigurationPanel method onArtifactChanged.
private void onArtifactChanged(final ItemEvent e) {
final DataContext context = DataManager.getInstance().getDataContext(getContentPanel());
final ConfigurationSettingsEditorWrapper editor = ConfigurationSettingsEditorWrapper.CONFIGURATION_EDITOR_KEY.getData(context);
final AzureArtifact artifact = (AzureArtifact) e.getItem();
if (Objects.nonNull(editor) && Objects.nonNull(artifact)) {
if (e.getStateChange() == ItemEvent.DESELECTED) {
BeforeRunTaskUtils.removeBeforeRunTask(editor, artifact);
}
if (e.getStateChange() == ItemEvent.SELECTED) {
BeforeRunTaskUtils.addBeforeRunTask(editor, artifact, this.configuration);
}
}
}
use of com.microsoft.azure.toolkit.intellij.common.AzureArtifact in project azure-tools-for-java by Microsoft.
the class AppServiceInfoBasicPanel method getData.
@SneakyThrows
@Override
public T getData() {
final String name = this.textName.getValue();
final Runtime platform = this.selectorRuntime.getValue();
final AzureArtifact artifact = this.selectorApplication.getValue();
final T result = (T) (this.config == null ? initConfig() : this.config).toBuilder().build();
result.setName(name);
result.setRuntime(platform);
if (Objects.nonNull(artifact)) {
final AzureArtifactManager manager = AzureArtifactManager.getInstance(this.project);
final String path = manager.getFileForDeployment(this.selectorApplication.getValue());
result.setApplication(Paths.get(path));
}
this.config = result;
return result;
}
use of com.microsoft.azure.toolkit.intellij.common.AzureArtifact in project azure-tools-for-java by Microsoft.
the class AppServiceInfoAdvancedPanel method getData.
@Override
public T getData() {
final Subscription subscription = this.selectorSubscription.getValue();
final ResourceGroup resourceGroup = this.selectorGroup.getValue();
final String name = this.textName.getValue();
final Runtime runtime = this.selectorRuntime.getValue();
final Region region = this.selectorRegion.getValue();
final AppServicePlanEntity servicePlan = this.selectorServicePlan.getValue();
final AzureArtifact artifact = this.selectorApplication.getValue();
final T config = supplier.get();
config.setSubscription(subscription);
config.setResourceGroup(resourceGroup);
config.setName(name);
config.setRuntime(runtime);
config.setRegion(region);
config.setServicePlan(servicePlan);
if (Objects.nonNull(artifact)) {
final AzureArtifactManager manager = AzureArtifactManager.getInstance(this.project);
final String path = manager.getFileForDeployment(this.selectorApplication.getValue());
config.setApplication(Paths.get(path));
}
return config;
}
use of com.microsoft.azure.toolkit.intellij.common.AzureArtifact in project azure-tools-for-java by Microsoft.
the class SpringCloudDeploymentConfigurationPanel method getData.
public SpringCloudAppConfig getData(SpringCloudAppConfig appConfig) {
final SpringCloudDeploymentConfig deploymentConfig = appConfig.getDeployment();
appConfig.setSubscriptionId(this.selectorSubscription.getValue().getId());
appConfig.setClusterName(this.selectorCluster.getValue().name());
appConfig.setAppName(this.selectorApp.getValue().name());
final AzureArtifact artifact = this.selectorArtifact.getValue();
deploymentConfig.setArtifact(new WrappedAzureArtifact(this.selectorArtifact.getValue(), this.project));
return appConfig;
}
Aggregations