Search in sources :

Example 1 with Name

use of com.microsoft.tooling.msservices.helpers.Name in project azure-tools-for-java by Microsoft.

the class CreateFunctionAppAction method openDialog.

@AzureOperation(name = "function.open_creation_dialog", type = AzureOperation.Type.ACTION)
private void openDialog(final Project project, @Nullable final FunctionAppConfig data) {
    final FunctionAppCreationDialog dialog = new FunctionAppCreationDialog(project);
    if (Objects.nonNull(data)) {
        dialog.setData(data);
    }
    dialog.setOkActionListener((config) -> {
        dialog.close();
        this.createFunctionApp(config).subscribe(functionApp -> {
        }, (error) -> {
            final String title = String.format("Reopen dialog \"%s\"", dialog.getTitle());
            final Consumer<Object> act = t -> AzureTaskManager.getInstance().runLater("open dialog", () -> this.openDialog(project, config));
            final Action<?> action = new Action<>(act, new ActionView.Builder(title));
            AzureMessager.getMessager().error(error, null, action);
        });
    });
    dialog.show();
}
Also used : FunctionAppCreationDialog(com.microsoft.azure.toolkit.intellij.function.FunctionAppCreationDialog) AzureOperation(com.microsoft.azure.toolkit.lib.common.operation.AzureOperation) AzureBundle.message(com.microsoft.intellij.ui.messages.AzureBundle.message) AzureUIRefreshCore(com.microsoft.azuretools.utils.AzureUIRefreshCore) IntellijAzureMessager(com.microsoft.azure.toolkit.intellij.common.messager.IntellijAzureMessager) AzureTask(com.microsoft.azure.toolkit.lib.common.task.AzureTask) Single(rx.Single) AzureOperationBundle.title(com.microsoft.azure.toolkit.lib.common.operation.AzureOperationBundle.title) Project(com.intellij.openapi.project.Project) AzureString(com.microsoft.azure.toolkit.lib.common.bundle.AzureString) FunctionAppService(com.microsoft.azure.toolkit.lib.function.FunctionAppService) ProgressManager(com.intellij.openapi.progress.ProgressManager) AzureActionEnum(com.microsoft.tooling.msservices.serviceexplorer.AzureActionEnum) NodeActionListener(com.microsoft.tooling.msservices.serviceexplorer.NodeActionListener) AzureMessager(com.microsoft.azure.toolkit.lib.common.messager.AzureMessager) Nullable(com.microsoft.azuretools.azurecommons.helpers.Nullable) IAzureMessage(com.microsoft.azure.toolkit.lib.common.messager.IAzureMessage) AzureUIRefreshEvent(com.microsoft.azuretools.utils.AzureUIRefreshEvent) Operation(com.microsoft.azuretools.telemetrywrapper.Operation) AzureSignInAction(com.microsoft.intellij.actions.AzureSignInAction) Name(com.microsoft.tooling.msservices.helpers.Name) FunctionAppConfig(com.microsoft.azure.toolkit.lib.function.FunctionAppConfig) AzureTelemetry(com.microsoft.azure.toolkit.lib.common.telemetry.AzureTelemetry) Objects(java.util.Objects) Consumer(java.util.function.Consumer) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) FunctionModule(com.microsoft.tooling.msservices.serviceexplorer.azure.function.FunctionModule) ActionView(com.microsoft.azure.toolkit.lib.common.action.ActionView) TelemetryConstants(com.microsoft.azuretools.telemetry.TelemetryConstants) IFunctionApp(com.microsoft.azure.toolkit.lib.appservice.service.IFunctionApp) Action(com.microsoft.azure.toolkit.lib.common.action.Action) TelemetryManager(com.microsoft.azuretools.telemetrywrapper.TelemetryManager) NodeActionEvent(com.microsoft.tooling.msservices.serviceexplorer.NodeActionEvent) AzureTaskManager(com.microsoft.azure.toolkit.lib.common.task.AzureTaskManager) AzureSignInAction(com.microsoft.intellij.actions.AzureSignInAction) Action(com.microsoft.azure.toolkit.lib.common.action.Action) ActionView(com.microsoft.azure.toolkit.lib.common.action.ActionView) AzureString(com.microsoft.azure.toolkit.lib.common.bundle.AzureString) FunctionAppCreationDialog(com.microsoft.azure.toolkit.intellij.function.FunctionAppCreationDialog) AzureOperation(com.microsoft.azure.toolkit.lib.common.operation.AzureOperation)

Example 2 with Name

use of com.microsoft.tooling.msservices.helpers.Name in project azure-tools-for-java by Microsoft.

the class Node method initActions.

// sub-classes are expected to override this method and
// add code for initializing node-specific actions; this
// method is called when the node is being constructed and
// is guaranteed to be called only once per node
// NOTE: The Class<?> objects returned by this method MUST be
// public inner classes of the sub-class. We assume that they are.
protected Map<String, Class<? extends NodeActionListener>> initActions() {
    List<Class<? extends NodeActionListener>> actions = node2Actions.get(this.getClass());
    if (actions != null) {
        try {
            for (Class<? extends NodeActionListener> actionClazz : actions) {
                NodeActionListener actionListener = createNodeActionListener(actionClazz);
                if (Objects.nonNull(actionListener.getAction())) {
                    addAction(new DelegateActionListener.BasicActionListener(actionListener, actionListener.getAction()));
                    continue;
                }
                Name nameAnnotation = actionClazz.getAnnotation(Name.class);
                if (nameAnnotation != null) {
                    addAction(nameAnnotation.value(), actionListener);
                }
            }
        } catch (final InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
            DefaultLoader.getUIHelper().showException(e.getMessage(), e, "MS Services - Error", true, false);
        }
    }
    return null;
}
Also used : InvocationTargetException(java.lang.reflect.InvocationTargetException) Name(com.microsoft.tooling.msservices.helpers.Name)

Aggregations

Name (com.microsoft.tooling.msservices.helpers.Name)2 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)1 ProgressManager (com.intellij.openapi.progress.ProgressManager)1 Project (com.intellij.openapi.project.Project)1 IntellijAzureMessager (com.microsoft.azure.toolkit.intellij.common.messager.IntellijAzureMessager)1 FunctionAppCreationDialog (com.microsoft.azure.toolkit.intellij.function.FunctionAppCreationDialog)1 IFunctionApp (com.microsoft.azure.toolkit.lib.appservice.service.IFunctionApp)1 Action (com.microsoft.azure.toolkit.lib.common.action.Action)1 ActionView (com.microsoft.azure.toolkit.lib.common.action.ActionView)1 AzureString (com.microsoft.azure.toolkit.lib.common.bundle.AzureString)1 AzureMessager (com.microsoft.azure.toolkit.lib.common.messager.AzureMessager)1 IAzureMessage (com.microsoft.azure.toolkit.lib.common.messager.IAzureMessage)1 AzureOperation (com.microsoft.azure.toolkit.lib.common.operation.AzureOperation)1 AzureOperationBundle.title (com.microsoft.azure.toolkit.lib.common.operation.AzureOperationBundle.title)1 AzureTask (com.microsoft.azure.toolkit.lib.common.task.AzureTask)1 AzureTaskManager (com.microsoft.azure.toolkit.lib.common.task.AzureTaskManager)1 AzureTelemetry (com.microsoft.azure.toolkit.lib.common.telemetry.AzureTelemetry)1 FunctionAppConfig (com.microsoft.azure.toolkit.lib.function.FunctionAppConfig)1 FunctionAppService (com.microsoft.azure.toolkit.lib.function.FunctionAppService)1 Nullable (com.microsoft.azuretools.azurecommons.helpers.Nullable)1