Search in sources :

Example 1 with IAzureBaseResource

use of com.microsoft.azure.toolkit.lib.common.entity.IAzureBaseResource 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);
        }
    }
}
Also used : IAzureBaseResource(com.microsoft.azure.toolkit.lib.common.entity.IAzureBaseResource) AzureTaskManager(com.microsoft.azure.toolkit.lib.common.task.AzureTaskManager)

Aggregations

IAzureBaseResource (com.microsoft.azure.toolkit.lib.common.entity.IAzureBaseResource)1 AzureTaskManager (com.microsoft.azure.toolkit.lib.common.task.AzureTaskManager)1