use of com.microsoft.azure.toolkit.lib.common.action.AzureActionManager in project azure-tools-for-java by Microsoft.
the class SpringCloudExplorerContributor method getModuleNode.
@Override
public Node<?> getModuleNode() {
final AzureActionManager am = AzureActionManager.getInstance();
final IAzureMessager messager = AzureMessager.getDefaultMessager();
final AzureSpringCloud service = az(AzureSpringCloud.class);
return new Node<>(service).view(new AzureServiceLabelView<>(service, "Spring Cloud", ICON)).actions(SpringCloudActionsContributor.SERVICE_ACTIONS).addChildren(AzureSpringCloud::clusters, (cluster, ascNode) -> new Node<>(cluster).view(new AzureResourceLabelView<>(cluster)).actions(SpringCloudActionsContributor.CLUSTER_ACTIONS).addChildren(SpringCloudCluster::apps, (app, clusterNode) -> new Node<>(app).view(new AzureResourceLabelView<>(app)).actions(SpringCloudActionsContributor.APP_ACTIONS)));
}
use of com.microsoft.azure.toolkit.lib.common.action.AzureActionManager in project azure-tools-for-java by Microsoft.
the class StorageExplorerContributor method getModuleNode.
@Override
public Node<?> getModuleNode() {
final AzureActionManager am = AzureActionManager.getInstance();
final IAzureMessager messager = AzureMessager.getDefaultMessager();
final AzureStorageAccount service = az(AzureStorageAccount.class);
return new Node<>(service).view(new AzureServiceLabelView<>(service, NAME, ICON)).actions(StorageActionsContributor.SERVICE_ACTIONS).addChildren(AzureStorageAccount::list, (account, storageNode) -> new Node<>(account).view(new AzureResourceLabelView<>(account)).actions(StorageActionsContributor.ACCOUNT_ACTIONS));
}
use of com.microsoft.azure.toolkit.lib.common.action.AzureActionManager in project azure-tools-for-java by Microsoft.
the class SpringCloudActionsContributor method registerActions.
@Override
public void registerActions(AzureActionManager am) {
final AzureTaskManager tm = AzureTaskManager.getInstance();
final Consumer<SpringCloudApp> openPublicUrl = s -> am.getAction(ResourceCommonActionsContributor.OPEN_URL).handle(s.publicUrl());
final ActionView.Builder openPublicUrlView = new ActionView.Builder("Access Public Endpoint", "/icons/action/browser.svg").title(s -> Optional.ofNullable(s).map(r -> title("springcloud|app.open_public_url", ((SpringCloudApp) r).name())).orElse(null)).enabled(s -> s instanceof SpringCloudApp && ((SpringCloudApp) s).entity().isPublic());
am.registerAction(OPEN_PUBLIC_URL, new Action<>(openPublicUrl, openPublicUrlView));
final Consumer<SpringCloudApp> openTestUrl = s -> am.getAction(ResourceCommonActionsContributor.OPEN_URL).handle(s.testUrl());
final ActionView.Builder openTestUrlView = new ActionView.Builder("Access Test Endpoint", "/icons/action/browser.svg").title(s -> Optional.ofNullable(s).map(r -> title("springcloud|app.open_test_url", ((SpringCloudApp) r).name())).orElse(null)).enabled(s -> s instanceof SpringCloudApp);
am.registerAction(OPEN_TEST_URL, new Action<>(openTestUrl, openTestUrlView));
final ActionView.Builder streamLogView = new ActionView.Builder("Streaming Log", "/icons/action/log.svg").title(s -> Optional.ofNullable(s).map(r -> title("springcloud|app.stream_log", ((SpringCloudApp) r).name())).orElse(null)).enabled(s -> s instanceof SpringCloudApp);
am.registerAction(STREAM_LOG, new Action<>(streamLogView));
}
use of com.microsoft.azure.toolkit.lib.common.action.AzureActionManager in project azure-tools-for-java by Microsoft.
the class IntellijStorageActionsContributor method registerHandlers.
@Override
public void registerHandlers(AzureActionManager am) {
final BiPredicate<Object, AnActionEvent> condition = (r, e) -> r instanceof AzureStorageAccount;
final BiConsumer<Object, AnActionEvent> handler = (c, e) -> CreateStorageAccountAction.createStorageAccount((e.getProject()));
am.registerHandler(ResourceCommonActionsContributor.CREATE, condition, handler);
am.<IAzureResource<?>, AnActionEvent>registerHandler(ResourceCommonActionsContributor.CONNECT, (r, e) -> r instanceof StorageAccount, (r, e) -> AzureTaskManager.getInstance().runLater(() -> {
final ConnectorDialog dialog = new ConnectorDialog(e.getProject());
dialog.setResource(new AzureServiceResource<>(((StorageAccount) r), StorageAccountResourceDefinition.INSTANCE));
dialog.show();
}));
}
use of com.microsoft.azure.toolkit.lib.common.action.AzureActionManager in project azure-tools-for-java by Microsoft.
the class AzureSdkEnforcer method warnDeprecatedLibs.
@AzureOperation(name = "sdk|deprecated_libs.warn", type = AzureOperation.Type.ACTION)
private static void warnDeprecatedLibs(@AzureTelemetry.Property List<? extends AzureJavaSdkEntity> deprecatedLibs) {
final String message = buildMessage(deprecatedLibs);
final AzureActionManager am = AzureActionManager.getInstance();
final Action<?> referenceBook = am.getAction(Action.Id.of(OpenReferenceBookAction.ID));
final Action<?> neverShowAgain = am.getAction(Action.Id.of(IntellijNeverShowAgainAction.ID));
AzureMessager.getMessager().warning(message, "Deprecated Azure SDK libraries Detected", referenceBook, neverShowAgain);
}
Aggregations