Search in sources :

Example 1 with ARM

use of com.microsoft.azuretools.telemetry.TelemetryConstants.ARM in project azure-tools-for-java by Microsoft.

the class ResourceTemplateView method updateDeployment.

private void updateDeployment() {
    String oldTemplate = this.originTemplate;
    String oldParameters = this.originParameters;
    final AzureString title = AzureOperationBundle.title("arm|deployment.update", node.getDeployment().name());
    AzureTaskManager.getInstance().runInBackground(new AzureTask(project, title, false, () -> {
        EventUtil.executeWithLog(ARM, UPDATE_DEPLOYMENT_SHORTCUT, (operation -> {
            ResourceTemplateView.this.originTemplate = getTemplate();
            ResourceTemplateView.this.originParameters = getParameters();
            node.getDeployment().update().withTemplate(ResourceTemplateView.this.originTemplate).withParameters(ResourceTemplateView.this.originParameters).withMode(DeploymentMode.INCREMENTAL).apply();
            UIUtils.showNotification(project, NOTIFY_UPDATE_DEPLOYMENT_SUCCESS, MessageType.INFO);
        }), (e) -> {
            // Fall back the origin value when update fail.
            ResourceTemplateView.this.originTemplate = oldTemplate;
            ResourceTemplateView.this.originParameters = oldParameters;
            UIUtils.showNotification(project, NOTIFY_UPDATE_DEPLOYMENT_FAIL + ", " + e.getMessage(), MessageType.ERROR);
        });
    }));
}
Also used : MessageType(com.intellij.openapi.ui.MessageType) VirtualFile(com.intellij.openapi.vfs.VirtualFile) PsiAwareTextEditorProvider(com.intellij.openapi.fileEditor.impl.text.PsiAwareTextEditorProvider) AzureOperationBundle(com.microsoft.azure.toolkit.lib.common.operation.AzureOperationBundle) AzureTask(com.microsoft.azure.toolkit.lib.common.task.AzureTask) FileEditorManager(com.intellij.openapi.fileEditor.FileEditorManager) DeploymentMode(com.microsoft.azure.management.resources.DeploymentMode) MessageBusConnection(com.intellij.util.messages.MessageBusConnection) NOTIFY_UPDATE_DEPLOYMENT_FAIL(com.microsoft.azure.toolkit.intellij.arm.action.UpdateDeploymentAction.NOTIFY_UPDATE_DEPLOYMENT_FAIL) NOTIFY_UPDATE_DEPLOYMENT_SUCCESS(com.microsoft.azure.toolkit.intellij.arm.action.UpdateDeploymentAction.NOTIFY_UPDATE_DEPLOYMENT_SUCCESS) Project(com.intellij.openapi.project.Project) AzureString(com.microsoft.azure.toolkit.lib.common.bundle.AzureString) DeploymentNode(com.microsoft.tooling.msservices.serviceexplorer.azure.arm.deployments.DeploymentNode) LightVirtualFile(com.intellij.testFramework.LightVirtualFile) FileEditorManagerListener(com.intellij.openapi.fileEditor.FileEditorManagerListener) UIUtils(com.microsoft.intellij.ui.util.UIUtils) BaseEditor(com.microsoft.azure.toolkit.intellij.common.BaseEditor) UPDATE_DEPLOYMENT_SHORTCUT(com.microsoft.azuretools.telemetry.TelemetryConstants.UPDATE_DEPLOYMENT_SHORTCUT) PsiAwareTextEditorImpl(com.intellij.openapi.fileEditor.impl.text.PsiAwareTextEditorImpl) FileEditor(com.intellij.openapi.fileEditor.FileEditor) ARM(com.microsoft.azuretools.telemetry.TelemetryConstants.ARM) GridConstraints(com.intellij.uiDesigner.core.GridConstraints) EventUtil(com.microsoft.azuretools.telemetrywrapper.EventUtil) NotNull(org.jetbrains.annotations.NotNull) ARMLanguage(com.microsoft.intellij.language.arm.ARMLanguage) Utils(com.microsoft.azuretools.azurecommons.util.Utils) AzureTaskManager(com.microsoft.azure.toolkit.lib.common.task.AzureTaskManager) javax.swing(javax.swing) AzureString(com.microsoft.azure.toolkit.lib.common.bundle.AzureString) AzureTask(com.microsoft.azure.toolkit.lib.common.task.AzureTask) AzureString(com.microsoft.azure.toolkit.lib.common.bundle.AzureString)

Aggregations

FileEditor (com.intellij.openapi.fileEditor.FileEditor)1 FileEditorManager (com.intellij.openapi.fileEditor.FileEditorManager)1 FileEditorManagerListener (com.intellij.openapi.fileEditor.FileEditorManagerListener)1 PsiAwareTextEditorImpl (com.intellij.openapi.fileEditor.impl.text.PsiAwareTextEditorImpl)1 PsiAwareTextEditorProvider (com.intellij.openapi.fileEditor.impl.text.PsiAwareTextEditorProvider)1 Project (com.intellij.openapi.project.Project)1 MessageType (com.intellij.openapi.ui.MessageType)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 LightVirtualFile (com.intellij.testFramework.LightVirtualFile)1 GridConstraints (com.intellij.uiDesigner.core.GridConstraints)1 MessageBusConnection (com.intellij.util.messages.MessageBusConnection)1 DeploymentMode (com.microsoft.azure.management.resources.DeploymentMode)1 NOTIFY_UPDATE_DEPLOYMENT_FAIL (com.microsoft.azure.toolkit.intellij.arm.action.UpdateDeploymentAction.NOTIFY_UPDATE_DEPLOYMENT_FAIL)1 NOTIFY_UPDATE_DEPLOYMENT_SUCCESS (com.microsoft.azure.toolkit.intellij.arm.action.UpdateDeploymentAction.NOTIFY_UPDATE_DEPLOYMENT_SUCCESS)1 BaseEditor (com.microsoft.azure.toolkit.intellij.common.BaseEditor)1 AzureString (com.microsoft.azure.toolkit.lib.common.bundle.AzureString)1 AzureOperationBundle (com.microsoft.azure.toolkit.lib.common.operation.AzureOperationBundle)1 AzureTask (com.microsoft.azure.toolkit.lib.common.task.AzureTask)1 AzureTaskManager (com.microsoft.azure.toolkit.lib.common.task.AzureTaskManager)1 Utils (com.microsoft.azuretools.azurecommons.util.Utils)1