Search in sources :

Example 1 with WEBAPP

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

the class WebAppDeployDialog method createButton.

private void createButton(Composite container) {
    Composite composite = new Composite(container, SWT.NONE);
    composite.setLayout(new RowLayout(SWT.VERTICAL));
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
    Button btnCreate = new Button(composite, SWT.NONE);
    btnCreate.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            sendTelemetry("CREATE");
            EventUtil.logEvent(EventType.info, WEBAPP, OPEN_CREATEWEBAPP_DIALOG, buildProperties());
            createAppService(project);
        }
    });
    btnCreate.setText("Create...");
    btnDelete = new Button(composite, SWT.NONE);
    btnDelete.setEnabled(false);
    btnDelete.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            sendTelemetry("DELETE");
            deleteAppService();
        }
    });
    btnDelete.setText("Delete...");
    Button btnRefresh = new Button(composite, SWT.NONE);
    btnRefresh.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            sendTelemetry("REFRESH");
            EventUtil.executeWithLog(WEBAPP, REFRESH_METADATA, (operation) -> {
                table.removeAll();
                fillAppServiceDetails();
                doFillTable(true);
            });
        }
    });
    btnRefresh.setText("Refresh");
    btnDeployToRoot = new Button(composite, SWT.CHECK);
    btnDeployToRoot.setSelection(true);
    btnDeployToRoot.setText("Deploy to root");
    int size = btnDeployToRoot.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
    btnCreate.setLayoutData(new RowData(size, SWT.DEFAULT));
    btnDelete.setLayoutData(new RowData(size, SWT.DEFAULT));
    btnRefresh.setLayoutData(new RowData(size, SWT.DEFAULT));
    btnDeployToRoot.setLayoutData(new RowData(size, SWT.DEFAULT));
}
Also used : HttpURLConnection(java.net.HttpURLConnection) Azure(com.microsoft.azure.toolkit.lib.Azure) DefaultToolTip(org.eclipse.jface.window.DefaultToolTip) IDialogConstants(org.eclipse.jface.dialogs.IDialogConstants) FocusEvent(org.eclipse.swt.events.FocusEvent) Point(org.eclipse.swt.graphics.Point) CommonUtils(com.microsoft.azuretools.webapp.util.CommonUtils) PluginUtil(com.microsoft.azuretools.core.utils.PluginUtil) Composite(org.eclipse.swt.widgets.Composite) Map(java.util.Map) REFRESH_METADATA(com.microsoft.azuretools.telemetry.TelemetryConstants.REFRESH_METADATA) MessageDialog(org.eclipse.jface.dialogs.MessageDialog) IWebAppDeploymentSlot(com.microsoft.azure.toolkit.lib.appservice.service.IWebAppDeploymentSlot) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Text(org.eclipse.swt.widgets.Text) ILog(org.eclipse.core.runtime.ILog) PlatformUI(org.eclipse.ui.PlatformUI) Runtime(com.microsoft.azure.toolkit.lib.appservice.model.Runtime) UpdateProgressIndicator(com.microsoft.azuretools.core.utils.UpdateProgressIndicator) ErrorType(com.microsoft.azuretools.telemetrywrapper.ErrorType) Status(org.eclipse.core.runtime.Status) JavaVersion(com.microsoft.azure.toolkit.lib.appservice.model.JavaVersion) CountDownLatch(java.util.concurrent.CountDownLatch) Window(org.eclipse.jface.window.Window) AzureAccount(com.microsoft.azure.toolkit.lib.auth.AzureAccount) SWT(org.eclipse.swt.SWT) EventUtil(com.microsoft.azuretools.telemetrywrapper.EventUtil) SimpleDateFormat(java.text.SimpleDateFormat) CREATE_WEBAPP_SLOT(com.microsoft.azuretools.telemetry.TelemetryConstants.CREATE_WEBAPP_SLOT) IProject(org.eclipse.core.resources.IProject) IDataModel(org.eclipse.wst.common.frameworks.datamodel.IDataModel) ErrorWindow(com.microsoft.azuretools.core.ui.ErrorWindow) DefaultLoader(com.microsoft.tooling.msservices.components.DefaultLoader) WebComponentExportDataModelProvider(org.eclipse.jst.j2ee.internal.web.archive.operations.WebComponentExportDataModelProvider) GridData(org.eclipse.swt.layout.GridData) RowData(org.eclipse.swt.layout.RowData) Link(org.eclipse.swt.widgets.Link) IWebAppBase(com.microsoft.azure.toolkit.lib.appservice.service.IWebAppBase) Subscription(com.microsoft.azure.toolkit.lib.common.model.Subscription) TableItem(org.eclipse.swt.widgets.TableItem) Shell(org.eclipse.swt.widgets.Shell) DELETE_WEBAPP(com.microsoft.azuretools.telemetry.TelemetryConstants.DELETE_WEBAPP) IOException(java.io.IOException) Mono(reactor.core.publisher.Mono) DataModelFactory(org.eclipse.wst.common.frameworks.datamodel.DataModelFactory) File(java.io.File) ProgressDialog(com.microsoft.azuretools.core.utils.ProgressDialog) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) GridLayout(org.eclipse.swt.layout.GridLayout) Activator(com.microsoft.azuretools.webapp.Activator) URL(java.net.URL) Date(java.util.Date) DEPLOY_WEBAPP(com.microsoft.azuretools.telemetry.TelemetryConstants.DEPLOY_WEBAPP) TableColumn(org.eclipse.swt.widgets.TableColumn) MavenUtils(com.microsoft.azuretools.core.utils.MavenUtils) IncrementalProjectBuilder(org.eclipse.core.resources.IncrementalProjectBuilder) IStatus(org.eclipse.core.runtime.IStatus) WebContainer(com.microsoft.azure.toolkit.lib.appservice.model.WebContainer) AzureWebAppMvpModel(com.microsoft.azuretools.core.mvp.model.webapp.AzureWebAppMvpModel) Button(org.eclipse.swt.widgets.Button) Operation(com.microsoft.azuretools.telemetrywrapper.Operation) UUID(java.util.UUID) Display(org.eclipse.swt.widgets.Display) Collectors(java.util.stream.Collectors) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) Objects(java.util.Objects) List(java.util.List) AzureDeploymentProgressNotification(com.microsoft.azuretools.core.ui.views.AzureDeploymentProgressNotification) Optional(java.util.Optional) Label(org.eclipse.swt.widgets.Label) WEBAPP(com.microsoft.azuretools.telemetry.TelemetryConstants.WEBAPP) ControlDecoration(org.eclipse.jface.fieldassist.ControlDecoration) OPEN_CREATEWEBAPP_DIALOG(com.microsoft.azuretools.telemetry.TelemetryConstants.OPEN_CREATEWEBAPP_DIALOG) Image(org.eclipse.swt.graphics.Image) HashMap(java.util.HashMap) Table(org.eclipse.swt.widgets.Table) IWebApp(com.microsoft.azure.toolkit.lib.appservice.service.IWebApp) FocusListener(org.eclipse.swt.events.FocusListener) IAppServicePlan(com.microsoft.azure.toolkit.lib.appservice.service.IAppServicePlan) Schedulers(reactor.core.scheduler.Schedulers) FillLayout(org.eclipse.swt.layout.FillLayout) AzureAppService(com.microsoft.azure.toolkit.lib.appservice.AzureAppService) Combo(org.eclipse.swt.widgets.Combo) Job(org.eclipse.core.runtime.jobs.Job) IJ2EEComponentExportDataModelProperties(org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentExportDataModelProperties) Group(org.eclipse.swt.widgets.Group) StringUtils(com.microsoft.azuretools.adauth.StringUtils) RowLayout(org.eclipse.swt.layout.RowLayout) EventType(com.microsoft.azuretools.telemetrywrapper.EventType) AccessibilityUtils(com.microsoft.azuretools.core.utils.AccessibilityUtils) TelemetryConstants(com.microsoft.azuretools.telemetry.TelemetryConstants) AppServiceBaseEntity(com.microsoft.azure.toolkit.lib.appservice.entity.AppServiceBaseEntity) AppInsightsClient(com.microsoft.azuretools.telemetry.AppInsightsClient) TelemetryManager(com.microsoft.azuretools.telemetrywrapper.TelemetryManager) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FocusAdapter(org.eclipse.swt.events.FocusAdapter) WebAppSettingModel(com.microsoft.azuretools.core.mvp.model.webapp.WebAppSettingModel) Control(org.eclipse.swt.widgets.Control) RowData(org.eclipse.swt.layout.RowData) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) Button(org.eclipse.swt.widgets.Button) RowLayout(org.eclipse.swt.layout.RowLayout) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Point(org.eclipse.swt.graphics.Point)

Example 2 with WEBAPP

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

the class WebAppDeployDialog method doFillTable.

private void doFillTable(boolean forceRefresh) {
    try {
        webAppDetailsMap.clear();
        table.removeAll();
        TableItem refreshingItem = new TableItem(table, SWT.NULL);
        refreshingItem.setText(REFRESHING);
        Mono.fromCallable(() -> {
            return Azure.az(AzureAppService.class).webapps(forceRefresh).stream().filter(webApp -> !webApp.getRuntime().isDocker() && !Objects.equals(webApp.getRuntime().getJavaVersion(), JavaVersion.OFF)).sorted((o1, o2) -> o1.name().compareTo(o2.name())).collect(Collectors.toList());
        }).subscribeOn(Schedulers.boundedElastic()).subscribe(webAppDetailsList -> {
            DefaultLoader.getIdeHelper().invokeLater(() -> {
                table.removeAll();
                for (IWebApp webApp : webAppDetailsList) {
                    TableItem item = new TableItem(table, SWT.NULL);
                    item.setText(new String[] { webApp.name(), webApp.getRuntime().getWebContainer().getValue(), webApp.getRuntime().getJavaVersion().getValue(), webApp.resourceGroup() });
                    webAppDetailsMap.put(webApp.name(), webApp);
                }
                fillUserSettings();
            });
        });
    } catch (Exception e) {
        LOG.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "updateAndFillTable@AppServiceCreateDialog", e));
    }
}
Also used : HttpURLConnection(java.net.HttpURLConnection) Azure(com.microsoft.azure.toolkit.lib.Azure) DefaultToolTip(org.eclipse.jface.window.DefaultToolTip) IDialogConstants(org.eclipse.jface.dialogs.IDialogConstants) FocusEvent(org.eclipse.swt.events.FocusEvent) Point(org.eclipse.swt.graphics.Point) CommonUtils(com.microsoft.azuretools.webapp.util.CommonUtils) PluginUtil(com.microsoft.azuretools.core.utils.PluginUtil) Composite(org.eclipse.swt.widgets.Composite) Map(java.util.Map) REFRESH_METADATA(com.microsoft.azuretools.telemetry.TelemetryConstants.REFRESH_METADATA) MessageDialog(org.eclipse.jface.dialogs.MessageDialog) IWebAppDeploymentSlot(com.microsoft.azure.toolkit.lib.appservice.service.IWebAppDeploymentSlot) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Text(org.eclipse.swt.widgets.Text) ILog(org.eclipse.core.runtime.ILog) PlatformUI(org.eclipse.ui.PlatformUI) Runtime(com.microsoft.azure.toolkit.lib.appservice.model.Runtime) UpdateProgressIndicator(com.microsoft.azuretools.core.utils.UpdateProgressIndicator) ErrorType(com.microsoft.azuretools.telemetrywrapper.ErrorType) Status(org.eclipse.core.runtime.Status) JavaVersion(com.microsoft.azure.toolkit.lib.appservice.model.JavaVersion) CountDownLatch(java.util.concurrent.CountDownLatch) Window(org.eclipse.jface.window.Window) AzureAccount(com.microsoft.azure.toolkit.lib.auth.AzureAccount) SWT(org.eclipse.swt.SWT) EventUtil(com.microsoft.azuretools.telemetrywrapper.EventUtil) SimpleDateFormat(java.text.SimpleDateFormat) CREATE_WEBAPP_SLOT(com.microsoft.azuretools.telemetry.TelemetryConstants.CREATE_WEBAPP_SLOT) IProject(org.eclipse.core.resources.IProject) IDataModel(org.eclipse.wst.common.frameworks.datamodel.IDataModel) ErrorWindow(com.microsoft.azuretools.core.ui.ErrorWindow) DefaultLoader(com.microsoft.tooling.msservices.components.DefaultLoader) WebComponentExportDataModelProvider(org.eclipse.jst.j2ee.internal.web.archive.operations.WebComponentExportDataModelProvider) GridData(org.eclipse.swt.layout.GridData) RowData(org.eclipse.swt.layout.RowData) Link(org.eclipse.swt.widgets.Link) IWebAppBase(com.microsoft.azure.toolkit.lib.appservice.service.IWebAppBase) Subscription(com.microsoft.azure.toolkit.lib.common.model.Subscription) TableItem(org.eclipse.swt.widgets.TableItem) Shell(org.eclipse.swt.widgets.Shell) DELETE_WEBAPP(com.microsoft.azuretools.telemetry.TelemetryConstants.DELETE_WEBAPP) IOException(java.io.IOException) Mono(reactor.core.publisher.Mono) DataModelFactory(org.eclipse.wst.common.frameworks.datamodel.DataModelFactory) File(java.io.File) ProgressDialog(com.microsoft.azuretools.core.utils.ProgressDialog) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) GridLayout(org.eclipse.swt.layout.GridLayout) Activator(com.microsoft.azuretools.webapp.Activator) URL(java.net.URL) Date(java.util.Date) DEPLOY_WEBAPP(com.microsoft.azuretools.telemetry.TelemetryConstants.DEPLOY_WEBAPP) TableColumn(org.eclipse.swt.widgets.TableColumn) MavenUtils(com.microsoft.azuretools.core.utils.MavenUtils) IncrementalProjectBuilder(org.eclipse.core.resources.IncrementalProjectBuilder) IStatus(org.eclipse.core.runtime.IStatus) WebContainer(com.microsoft.azure.toolkit.lib.appservice.model.WebContainer) AzureWebAppMvpModel(com.microsoft.azuretools.core.mvp.model.webapp.AzureWebAppMvpModel) Button(org.eclipse.swt.widgets.Button) Operation(com.microsoft.azuretools.telemetrywrapper.Operation) UUID(java.util.UUID) Display(org.eclipse.swt.widgets.Display) Collectors(java.util.stream.Collectors) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) Objects(java.util.Objects) List(java.util.List) AzureDeploymentProgressNotification(com.microsoft.azuretools.core.ui.views.AzureDeploymentProgressNotification) Optional(java.util.Optional) Label(org.eclipse.swt.widgets.Label) WEBAPP(com.microsoft.azuretools.telemetry.TelemetryConstants.WEBAPP) ControlDecoration(org.eclipse.jface.fieldassist.ControlDecoration) OPEN_CREATEWEBAPP_DIALOG(com.microsoft.azuretools.telemetry.TelemetryConstants.OPEN_CREATEWEBAPP_DIALOG) Image(org.eclipse.swt.graphics.Image) HashMap(java.util.HashMap) Table(org.eclipse.swt.widgets.Table) IWebApp(com.microsoft.azure.toolkit.lib.appservice.service.IWebApp) FocusListener(org.eclipse.swt.events.FocusListener) IAppServicePlan(com.microsoft.azure.toolkit.lib.appservice.service.IAppServicePlan) Schedulers(reactor.core.scheduler.Schedulers) FillLayout(org.eclipse.swt.layout.FillLayout) AzureAppService(com.microsoft.azure.toolkit.lib.appservice.AzureAppService) Combo(org.eclipse.swt.widgets.Combo) Job(org.eclipse.core.runtime.jobs.Job) IJ2EEComponentExportDataModelProperties(org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentExportDataModelProperties) Group(org.eclipse.swt.widgets.Group) StringUtils(com.microsoft.azuretools.adauth.StringUtils) RowLayout(org.eclipse.swt.layout.RowLayout) EventType(com.microsoft.azuretools.telemetrywrapper.EventType) AccessibilityUtils(com.microsoft.azuretools.core.utils.AccessibilityUtils) TelemetryConstants(com.microsoft.azuretools.telemetry.TelemetryConstants) AppServiceBaseEntity(com.microsoft.azure.toolkit.lib.appservice.entity.AppServiceBaseEntity) AppInsightsClient(com.microsoft.azuretools.telemetry.AppInsightsClient) TelemetryManager(com.microsoft.azuretools.telemetrywrapper.TelemetryManager) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FocusAdapter(org.eclipse.swt.events.FocusAdapter) WebAppSettingModel(com.microsoft.azuretools.core.mvp.model.webapp.WebAppSettingModel) Control(org.eclipse.swt.widgets.Control) Status(org.eclipse.core.runtime.Status) IStatus(org.eclipse.core.runtime.IStatus) AzureAppService(com.microsoft.azure.toolkit.lib.appservice.AzureAppService) TableItem(org.eclipse.swt.widgets.TableItem) IOException(java.io.IOException) IWebApp(com.microsoft.azure.toolkit.lib.appservice.service.IWebApp)

Aggregations

Azure (com.microsoft.azure.toolkit.lib.Azure)2 AzureAppService (com.microsoft.azure.toolkit.lib.appservice.AzureAppService)2 AppServiceBaseEntity (com.microsoft.azure.toolkit.lib.appservice.entity.AppServiceBaseEntity)2 JavaVersion (com.microsoft.azure.toolkit.lib.appservice.model.JavaVersion)2 Runtime (com.microsoft.azure.toolkit.lib.appservice.model.Runtime)2 WebContainer (com.microsoft.azure.toolkit.lib.appservice.model.WebContainer)2 IAppServicePlan (com.microsoft.azure.toolkit.lib.appservice.service.IAppServicePlan)2 IWebApp (com.microsoft.azure.toolkit.lib.appservice.service.IWebApp)2 IWebAppBase (com.microsoft.azure.toolkit.lib.appservice.service.IWebAppBase)2 IWebAppDeploymentSlot (com.microsoft.azure.toolkit.lib.appservice.service.IWebAppDeploymentSlot)2 AzureAccount (com.microsoft.azure.toolkit.lib.auth.AzureAccount)2 Subscription (com.microsoft.azure.toolkit.lib.common.model.Subscription)2 StringUtils (com.microsoft.azuretools.adauth.StringUtils)2 AzureWebAppMvpModel (com.microsoft.azuretools.core.mvp.model.webapp.AzureWebAppMvpModel)2 WebAppSettingModel (com.microsoft.azuretools.core.mvp.model.webapp.WebAppSettingModel)2 ErrorWindow (com.microsoft.azuretools.core.ui.ErrorWindow)2 AzureDeploymentProgressNotification (com.microsoft.azuretools.core.ui.views.AzureDeploymentProgressNotification)2 AccessibilityUtils (com.microsoft.azuretools.core.utils.AccessibilityUtils)2 MavenUtils (com.microsoft.azuretools.core.utils.MavenUtils)2 PluginUtil (com.microsoft.azuretools.core.utils.PluginUtil)2