use of com.microsoft.azure.toolkit.lib.common.task.AzureTaskManager in project azure-tools-for-java by Microsoft.
the class AzureResourceLabelView method onEvent.
public void onEvent(AzureEvent<Object> event) {
final String type = event.getType();
final Object source = event.getSource();
if (source instanceof IAzureBaseResource && ((IAzureBaseResource<?, ?>) source).id().equals(this.resource.id())) {
final AzureTaskManager tm = AzureTaskManager.getInstance();
if ("common|resource.refresh".equals(type)) {
if (((AzureOperationEvent) event).getStage() == AzureOperationEvent.Stage.AFTER) {
tm.runLater(this::refreshChildren);
}
} else if ("common|resource.status_changed".equals(type)) {
tm.runLater(this::refreshView);
}
}
}
use of com.microsoft.azure.toolkit.lib.common.task.AzureTaskManager 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));
}
Aggregations