Search in sources :

Example 1 with WebAppCreationDialog

use of com.microsoft.azure.toolkit.intellij.webapp.WebAppCreationDialog in project azure-tools-for-java by Microsoft.

the class CreateWebAppAction method openDialog.

@AzureOperation(name = "webapp.open_creation_dialog", type = AzureOperation.Type.ACTION)
private void openDialog(final Project project, @Nullable final WebAppConfig data) {
    final WebAppCreationDialog dialog = new WebAppCreationDialog(project);
    if (Objects.nonNull(data)) {
        dialog.setData(data);
    }
    dialog.setOkActionListener((config) -> {
        dialog.close();
        this.createWebApp(config).subscribe(webapp -> {
            final Path artifact = config.getApplication();
            if (Objects.nonNull(artifact) && artifact.toFile().exists()) {
                AzureTaskManager.getInstance().runLater("deploy", () -> deploy(webapp, artifact, project));
            }
        }, (error) -> {
            final String title = String.format("Reopen dialog \"%s\"", dialog.getTitle());
            final Consumer<Object> act = t -> AzureTaskManager.getInstance().runLater("open dialog", () -> this.openDialog(project, config));
            final Action<?> action = new Action<>(act, new ActionView.Builder(title));
            AzureMessager.getMessager().error(error, null, action);
        });
    });
    dialog.show();
}
Also used : Path(java.nio.file.Path) AzureOperation(com.microsoft.azure.toolkit.lib.common.operation.AzureOperation) AzureBundle.message(com.microsoft.intellij.ui.messages.AzureBundle.message) AzureUIRefreshCore(com.microsoft.azuretools.utils.AzureUIRefreshCore) IWebApp(com.microsoft.azure.toolkit.lib.appservice.service.IWebApp) AzureTask(com.microsoft.azure.toolkit.lib.common.task.AzureTask) Single(rx.Single) AzureOperationBundle.title(com.microsoft.azure.toolkit.lib.common.operation.AzureOperationBundle.title) Project(com.intellij.openapi.project.Project) AzureString(com.microsoft.azure.toolkit.lib.common.bundle.AzureString) TextConsoleBuilderFactory(com.intellij.execution.filters.TextConsoleBuilderFactory) AzureWebAppMvpModel(com.microsoft.azuretools.core.mvp.model.webapp.AzureWebAppMvpModel) Path(java.nio.file.Path) Notifications(com.intellij.notification.Notifications) ProgressManager(com.intellij.openapi.progress.ProgressManager) WebAppConfig(com.microsoft.azure.toolkit.lib.webapp.WebAppConfig) AzureActionEnum(com.microsoft.tooling.msservices.serviceexplorer.AzureActionEnum) NodeActionListener(com.microsoft.tooling.msservices.serviceexplorer.NodeActionListener) WebAppModule(com.microsoft.tooling.msservices.serviceexplorer.azure.webapp.WebAppModule) WebAppCreationDialog(com.microsoft.azure.toolkit.intellij.webapp.WebAppCreationDialog) AzureMessager(com.microsoft.azure.toolkit.lib.common.messager.AzureMessager) Nullable(com.microsoft.azuretools.azurecommons.helpers.Nullable) AzureUIRefreshEvent(com.microsoft.azuretools.utils.AzureUIRefreshEvent) AzureSignInAction(com.microsoft.intellij.actions.AzureSignInAction) RunProcessHandler(com.microsoft.intellij.RunProcessHandler) NotificationType(com.intellij.notification.NotificationType) Objects(java.util.Objects) Consumer(java.util.function.Consumer) Notification(com.intellij.notification.Notification) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) WebAppService(com.microsoft.azure.toolkit.lib.webapp.WebAppService) ConsoleView(com.intellij.execution.ui.ConsoleView) ActionView(com.microsoft.azure.toolkit.lib.common.action.ActionView) Action(com.microsoft.azure.toolkit.lib.common.action.Action) NodeActionEvent(com.microsoft.tooling.msservices.serviceexplorer.NodeActionEvent) AzureTaskManager(com.microsoft.azure.toolkit.lib.common.task.AzureTaskManager) AzureSignInAction(com.microsoft.intellij.actions.AzureSignInAction) Action(com.microsoft.azure.toolkit.lib.common.action.Action) WebAppCreationDialog(com.microsoft.azure.toolkit.intellij.webapp.WebAppCreationDialog) ActionView(com.microsoft.azure.toolkit.lib.common.action.ActionView) AzureString(com.microsoft.azure.toolkit.lib.common.bundle.AzureString) AzureOperation(com.microsoft.azure.toolkit.lib.common.operation.AzureOperation)

Aggregations

TextConsoleBuilderFactory (com.intellij.execution.filters.TextConsoleBuilderFactory)1 ConsoleView (com.intellij.execution.ui.ConsoleView)1 Notification (com.intellij.notification.Notification)1 NotificationType (com.intellij.notification.NotificationType)1 Notifications (com.intellij.notification.Notifications)1 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)1 ProgressManager (com.intellij.openapi.progress.ProgressManager)1 Project (com.intellij.openapi.project.Project)1 WebAppCreationDialog (com.microsoft.azure.toolkit.intellij.webapp.WebAppCreationDialog)1 IWebApp (com.microsoft.azure.toolkit.lib.appservice.service.IWebApp)1 Action (com.microsoft.azure.toolkit.lib.common.action.Action)1 ActionView (com.microsoft.azure.toolkit.lib.common.action.ActionView)1 AzureString (com.microsoft.azure.toolkit.lib.common.bundle.AzureString)1 AzureMessager (com.microsoft.azure.toolkit.lib.common.messager.AzureMessager)1 AzureOperation (com.microsoft.azure.toolkit.lib.common.operation.AzureOperation)1 AzureOperationBundle.title (com.microsoft.azure.toolkit.lib.common.operation.AzureOperationBundle.title)1 AzureTask (com.microsoft.azure.toolkit.lib.common.task.AzureTask)1 AzureTaskManager (com.microsoft.azure.toolkit.lib.common.task.AzureTaskManager)1 WebAppConfig (com.microsoft.azure.toolkit.lib.webapp.WebAppConfig)1 WebAppService (com.microsoft.azure.toolkit.lib.webapp.WebAppService)1