Search in sources :

Example 6 with DeploymentEventArgs

use of com.microsoft.azuretools.azurecommons.deploy.DeploymentEventArgs in project azure-tools-for-java by Microsoft.

the class ActivityLogToolWindowFactory method registerDeploymentListener.

public void registerDeploymentListener() {
    AzurePlugin.addDeploymentEventListener(new DeploymentEventListener() {

        @Override
        public void onDeploymentStep(final DeploymentEventArgs args) {
            // unique identifier for deployment
            String key = args.getId() + args.getStartTime().getTime();
            if (rows.containsKey(key)) {
                final DeploymentTableItem item = rows.get(key);
                ApplicationManager.getApplication().invokeLater(new Runnable() {

                    @Override
                    public void run() {
                        item.progress = args.getDeployCompleteness();
                        if (args.getDeployMessage().equalsIgnoreCase(message("runStatus"))) {
                            String html = String.format("%s%s%s%s", "  ", "<html><a href=\"" + args.getDeploymentURL() + "\">", message("runStatusVisible"), "</a></html>");
                            item.description = message("runStatusVisible");
                            item.link = args.getDeploymentURL();
                            if (!ToolWindowManager.getInstance(project).getToolWindow(ActivityLogToolWindowFactory.ACTIVITY_LOG_WINDOW).isVisible()) {
                                ToolWindowManager.getInstance(project).notifyByBalloon(ACTIVITY_LOG_WINDOW, MessageType.INFO, html, null, new BrowserHyperlinkListener());
                            }
                        } else {
                            item.description = args.getDeployMessage();
                        }
                        table.getListTableModel().fireTableDataChanged();
                    }
                });
            } else {
                final DeploymentTableItem item = new DeploymentTableItem(args.getId(), args.getDeployMessage(), dateFormat.format(args.getStartTime()), args.getDeployCompleteness());
                rows.put(key, item);
                ApplicationManager.getApplication().invokeLater(new Runnable() {

                    @Override
                    public void run() {
                        table.getListTableModel().addRow(item);
                    }
                });
            }
        }
    });
}
Also used : DeploymentEventArgs(com.microsoft.azuretools.azurecommons.deploy.DeploymentEventArgs) BrowserHyperlinkListener(com.intellij.ui.BrowserHyperlinkListener) DeploymentEventListener(com.microsoft.azuretools.azurecommons.deploy.DeploymentEventListener)

Aggregations

DeploymentEventArgs (com.microsoft.azuretools.azurecommons.deploy.DeploymentEventArgs)6 DeploymentEventListener (com.microsoft.azuretools.azurecommons.deploy.DeploymentEventListener)4 URL (java.net.URL)2 Date (java.util.Date)2 BrowserHyperlinkListener (com.intellij.ui.BrowserHyperlinkListener)1 AzureDockerHostsManager (com.microsoft.azure.docker.AzureDockerHostsManager)1 DockerHost (com.microsoft.azure.docker.model.DockerHost)1 EditableDockerHost (com.microsoft.azure.docker.model.EditableDockerHost)1 Azure (com.microsoft.azure.management.Azure)1 VirtualMachine (com.microsoft.azure.management.compute.VirtualMachine)1 AzureManager (com.microsoft.azuretools.sdkmanage.AzureManager)1 AzureUIRefreshEvent (com.microsoft.azuretools.utils.AzureUIRefreshEvent)1 AzureDeploymentProgressNotification (com.microsoft.intellij.deploy.AzureDeploymentProgressNotification)1 File (java.io.File)1 MalformedURLException (java.net.MalformedURLException)1 HashMap (java.util.HashMap)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 Job (org.eclipse.core.runtime.jobs.Job)1 TableEditor (org.eclipse.swt.custom.TableEditor)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1