use of com.microsoft.azuretools.ijidea.utility.UpdateProgressIndicator in project azure-tools-for-java by Microsoft.
the class WebAppDeployDialog method updateAndFillTable.
private void updateAndFillTable() {
ProgressManager.getInstance().run(new Task.Modal(project, "Update Azure Local Cache Progress", true) {
@Override
public void run(ProgressIndicator progressIndicator) {
progressIndicator.setIndeterminate(true);
try {
if (progressIndicator.isCanceled()) {
throw new CanceledByUserException();
}
AzureModelController.updateResourceGroupMaps(new UpdateProgressIndicator(progressIndicator));
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
doFillTable();
}
}, ModalityState.any());
} catch (CanceledByUserException ex) {
//AzureModel.getInstance().setResourceGroupToWebAppMap(null);
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
System.out.println("updateAndFillTable(): Canceled by user");
doCancelAction();
}
}, ModalityState.any());
} catch (Exception ex) {
ex.printStackTrace();
LOGGER.debug("updateAndFillTable", ex);
}
}
});
}
use of com.microsoft.azuretools.ijidea.utility.UpdateProgressIndicator in project azure-tools-for-java by Microsoft.
the class WebAppDeployDialog method deploy.
private void deploy() {
DefaultTableModel tableModel = (DefaultTableModel) table.getModel();
int selectedRow = table.getSelectedRow();
WebAppDetails wad = webAppWebAppDetailsMap.get(tableModel.getValueAt(selectedRow, 0));
WebApp webApp = wad.webApp;
boolean isDeployToRoot = deployToRootCheckBox.isSelected();
ProgressManager.getInstance().run(new Task.Backgroundable(project, "Deploy Web App Progress", true) {
@Override
public void run(@NotNull ProgressIndicator progressIndicator) {
AzureDeploymentProgressNotification azureDeploymentProgressNotification = new AzureDeploymentProgressNotification(project);
try {
progressIndicator.setIndeterminate(true);
PublishingProfile pp = webApp.getPublishingProfile();
Date startDate = new Date();
azureDeploymentProgressNotification.notifyProgress(webApp.name(), startDate, null, 5, "Deploying Web App...");
WebAppUtils.deployArtifact(artifact.getName(), artifact.getOutputFilePath(), pp, isDeployToRoot, new UpdateProgressIndicator(progressIndicator));
String sitePath = buildSiteLink(wad.webApp, isDeployToRoot ? null : artifact.getName());
progressIndicator.setText("Checking Web App availability...");
progressIndicator.setText2("Link: " + sitePath);
azureDeploymentProgressNotification.notifyProgress(webApp.name(), startDate, sitePath, 75, "Checking Web App availability...");
int stepLimit = 5;
int sleepMs = 2000;
// to make warn up cancelable
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
try {
for (int step = 0; step < stepLimit; ++step) {
if (WebAppUtils.isUrlAccessible(sitePath)) {
// warm up
break;
}
Thread.sleep(sleepMs);
}
} catch (Exception e) {
e.printStackTrace();
LOGGER.error("deploy::warmup", e);
}
}
});
thread.start();
while (thread.isAlive()) {
if (progressIndicator.isCanceled())
return;
else
Thread.sleep(sleepMs);
}
azureDeploymentProgressNotification.notifyProgress(webApp.name(), startDate, sitePath, 100, message("runStatus"));
showLink(sitePath);
} catch (IOException | InterruptedException ex) {
ex.printStackTrace();
//LOGGER.error("deploy", ex);
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
ErrorWindow.show(project, ex.getMessage(), "Deploy Web App Error");
}
});
}
}
});
}
use of com.microsoft.azuretools.ijidea.utility.UpdateProgressIndicator in project azure-tools-for-java by Microsoft.
the class AppServiceChangeSettingsDialog method doOKAction.
@Override
protected void doOKAction() {
ProgressManager.getInstance().run(new Task.Modal(null, "Changing App Service Settings...", true) {
@Override
public void run(ProgressIndicator progressIndicator) {
try {
progressIndicator.setIndeterminate(true);
webApp = editAppService(webApp, new UpdateProgressIndicator(progressIndicator));
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
superDoOKAction();
}
});
} catch (Exception ex) {
ex.printStackTrace();
// TODO: show error message
LOGGER.error("doOKAction :: Task.Modal", ex);
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
ErrorWindow.show(project, ex.getMessage(), "Create App Service Error");
}
});
}
}
});
}
use of com.microsoft.azuretools.ijidea.utility.UpdateProgressIndicator in project azure-tools-for-java by Microsoft.
the class AppServiceCreateDialog method doOKAction.
@Override
protected void doOKAction() {
ProgressManager.getInstance().run(new Task.Modal(project, "Create App Service Progress", true) {
@Override
public void run(ProgressIndicator progressIndicator) {
try {
progressIndicator.setIndeterminate(true);
progressIndicator.setText("Creating Web App Service...");
webApp = WebAppUtils.createAppService(new UpdateProgressIndicator(progressIndicator), model);
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
superDoOKAction();
}
});
} catch (CloudException ex) {
ex.printStackTrace();
//LOGGER.error("run@Progress@doOKAction@@AppServiceCreateDialog", ex);
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
ErrorWindow.show(project, ex.getMessage(), "Create App Service Error");
}
});
} catch (IOException | InterruptedException | AzureCmdException | WebAppUtils.WebAppException ex) {
ex.printStackTrace();
LOGGER.error("run@Progress@doOKAction@AppServiceCreateDialog", ex);
}
}
});
}
Aggregations