use of com.microsoft.azure.toolkit.lib.common.action.AzureActionManager in project azure-tools-for-java by Microsoft.
the class WhatsNewAction method doShow.
private static void doShow(String content, DefaultArtifactVersion version, boolean manually, @Nonnull Project project) {
final FileEditorManager manager = FileEditorManager.getInstance(project);
final VirtualFile file = Arrays.stream(manager.getOpenFiles()).filter(f -> StringUtils.equals(f.getUserData(CONTENT_KEY), CONTENT_PATH)).findFirst().orElse(createVirtualFile(content));
AzureTaskManager.getInstance().runAndWait(() -> {
if (project.isDisposed()) {
return;
}
file.putUserData(TextEditorWithPreview.DEFAULT_LAYOUT_FOR_FILE, TextEditorWithPreview.Layout.SHOW_PREVIEW);
final FileEditor[] editors = manager.openFile(file, true, true);
if (editors.length < 1) {
if (manually) {
BrowserUtil.browse(WHATSNEW_URL);
} else {
final String message = String.format("Azure Toolkit for Java is updated to <b><u>%s</u></b>", version.toString());
final String title = "Azure Toolkit for Java Updated";
final AzureActionManager am = AzureActionManager.getInstance();
final Action<?> changelog = new Action<>((n) -> am.getAction(OPEN_URL).handle(WHATSNEW_URL), new ActionView.Builder("What's New"));
AzureMessager.getMessager().info(message, title, changelog);
}
}
});
}
Aggregations