Search in sources :

Example 1 with AzureServiceResource

use of com.microsoft.azure.toolkit.intellij.connector.AzureServiceResource 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();
    }));
}
Also used : AzureActionManager(com.microsoft.azure.toolkit.lib.common.action.AzureActionManager) AzureServiceResource(com.microsoft.azure.toolkit.intellij.connector.AzureServiceResource) CreateStorageAccountAction(com.microsoft.azure.toolkit.intellij.storage.creation.CreateStorageAccountAction) AzureStorageAccount(com.microsoft.azure.toolkit.lib.storage.service.AzureStorageAccount) StorageAccountResourceDefinition(com.microsoft.azure.toolkit.intellij.storage.connection.StorageAccountResourceDefinition) BiPredicate(java.util.function.BiPredicate) IActionsContributor(com.microsoft.azure.toolkit.ide.common.IActionsContributor) ResourceCommonActionsContributor(com.microsoft.azure.toolkit.ide.common.action.ResourceCommonActionsContributor) StorageAccount(com.microsoft.azure.toolkit.lib.storage.service.StorageAccount) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) BiConsumer(java.util.function.BiConsumer) ConnectorDialog(com.microsoft.azure.toolkit.intellij.connector.ConnectorDialog) IAzureResource(com.microsoft.azure.toolkit.lib.common.entity.IAzureResource) AzureTaskManager(com.microsoft.azure.toolkit.lib.common.task.AzureTaskManager) ConnectorDialog(com.microsoft.azure.toolkit.intellij.connector.ConnectorDialog) AzureStorageAccount(com.microsoft.azure.toolkit.lib.storage.service.AzureStorageAccount) AzureServiceResource(com.microsoft.azure.toolkit.intellij.connector.AzureServiceResource) AzureStorageAccount(com.microsoft.azure.toolkit.lib.storage.service.AzureStorageAccount) StorageAccount(com.microsoft.azure.toolkit.lib.storage.service.StorageAccount) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) IAzureResource(com.microsoft.azure.toolkit.lib.common.entity.IAzureResource)

Aggregations

AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)1 IActionsContributor (com.microsoft.azure.toolkit.ide.common.IActionsContributor)1 ResourceCommonActionsContributor (com.microsoft.azure.toolkit.ide.common.action.ResourceCommonActionsContributor)1 AzureServiceResource (com.microsoft.azure.toolkit.intellij.connector.AzureServiceResource)1 ConnectorDialog (com.microsoft.azure.toolkit.intellij.connector.ConnectorDialog)1 StorageAccountResourceDefinition (com.microsoft.azure.toolkit.intellij.storage.connection.StorageAccountResourceDefinition)1 CreateStorageAccountAction (com.microsoft.azure.toolkit.intellij.storage.creation.CreateStorageAccountAction)1 AzureActionManager (com.microsoft.azure.toolkit.lib.common.action.AzureActionManager)1 IAzureResource (com.microsoft.azure.toolkit.lib.common.entity.IAzureResource)1 AzureTaskManager (com.microsoft.azure.toolkit.lib.common.task.AzureTaskManager)1 AzureStorageAccount (com.microsoft.azure.toolkit.lib.storage.service.AzureStorageAccount)1 StorageAccount (com.microsoft.azure.toolkit.lib.storage.service.StorageAccount)1 BiConsumer (java.util.function.BiConsumer)1 BiPredicate (java.util.function.BiPredicate)1