Search in sources :

Example 1 with IntellijAzureMessager

use of com.microsoft.azure.toolkit.intellij.common.messager.IntellijAzureMessager in project azure-tools-for-java by Microsoft.

the class AzureActionsListener method appFrameCreated.

@Override
public void appFrameCreated(@NotNull List<String> commandLineArgs) {
    DefaultLoader.setPluginComponent(this);
    DefaultLoader.setUiHelper(new UIHelperImpl());
    DefaultLoader.setIdeHelper(new IDEHelperImpl());
    AzureTaskManager.register(new IntellijAzureTaskManager());
    AzureRxTaskManager.register();
    AzureMessager.setDefaultMessager(new IntellijAzureMessager());
    IntellijAzureActionManager.register();
    Node.setNode2Actions(NodeActionsMap.NODE_ACTIONS);
    SchedulerProviderFactory.getInstance().init(new AppSchedulerProvider());
    MvpUIHelperFactory.getInstance().init(new MvpUIHelperImpl());
    HDInsightLoader.setHHDInsightHelper(new HDInsightHelperImpl());
    AzureStoreManager.register(new DefaultMachineStore(PluginHelper.getTemplateFile("azure.json")), IntellijStore.getInstance(), IntelliJSecureStore.getInstance());
    try {
        loadPluginSettings();
    } catch (IOException e) {
        PluginUtil.displayErrorDialogAndLog("Error", "An error occurred while attempting to load settings", e);
    }
    AzureInitializer.initialize();
    if (!AzurePlugin.IS_ANDROID_STUDIO) {
        // enable spark serverless node subscribe actions
        ServiceManager.setServiceProvider(CosmosSparkClusterOpsCtrl.class, new CosmosSparkClusterOpsCtrl(CosmosSparkClusterOps.getInstance()));
        ServiceManager.setServiceProvider(TrustStrategy.class, IdeaTrustStrategy.INSTANCE);
        initAuthManage();
        ActionManager am = ActionManager.getInstance();
        DefaultActionGroup toolbarGroup = (DefaultActionGroup) am.getAction(IdeActions.GROUP_MAIN_TOOLBAR);
        toolbarGroup.addAll((DefaultActionGroup) am.getAction("AzureToolbarGroup"));
        DefaultActionGroup popupGroup = (DefaultActionGroup) am.getAction(IdeActions.GROUP_PROJECT_VIEW_POPUP);
        popupGroup.add(am.getAction("AzurePopupGroup"));
    }
    try {
        PlatformDependent.isAndroid();
    } catch (Throwable ignored) {
        DefaultLoader.getUIHelper().showError("A problem with your Android Support plugin setup is preventing the" + " Azure Toolkit from functioning correctly (Retrofit2 and RxJava failed to initialize)" + ".\nTo fix this issue, try disabling the Android Support plugin or installing the " + "Android SDK", "Azure Toolkit for IntelliJ");
    // DefaultLoader.getUIHelper().showException("Android Support Error: isAndroid() throws " + ignored
    // .getMessage(), ignored, "Error Android", true, false);
    }
}
Also used : CosmosSparkClusterOpsCtrl(com.microsoft.azure.cosmosspark.CosmosSparkClusterOpsCtrl) IntellijAzureMessager(com.microsoft.azure.toolkit.intellij.common.messager.IntellijAzureMessager) AppSchedulerProvider(com.microsoft.azuretools.core.mvp.ui.base.AppSchedulerProvider) MvpUIHelperImpl(com.microsoft.intellij.helpers.MvpUIHelperImpl) IOException(java.io.IOException) IDEHelperImpl(com.microsoft.intellij.helpers.IDEHelperImpl) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) IntellijAzureActionManager(com.microsoft.azure.toolkit.intellij.common.action.IntellijAzureActionManager) ActionManager(com.intellij.openapi.actionSystem.ActionManager) HDInsightHelperImpl(com.microsoft.azure.hdinsight.common.HDInsightHelperImpl) UIHelperImpl(com.microsoft.intellij.helpers.UIHelperImpl) MvpUIHelperImpl(com.microsoft.intellij.helpers.MvpUIHelperImpl) DefaultMachineStore(com.microsoft.azure.toolkit.ide.common.store.DefaultMachineStore) IntellijAzureTaskManager(com.microsoft.azure.toolkit.intellij.common.task.IntellijAzureTaskManager)

Example 2 with IntellijAzureMessager

use of com.microsoft.azure.toolkit.intellij.common.messager.IntellijAzureMessager in project azure-tools-for-java by Microsoft.

the class CreateFunctionAppAction method createFunctionApp.

@AzureOperation(name = "function.create_detail", params = { "config.getName()" }, type = AzureOperation.Type.ACTION)
private Single<IFunctionApp> createFunctionApp(final FunctionAppConfig config) {
    final AzureString title = title("function.create_detail", config.getName());
    final IntellijAzureMessager actionMessenger = new IntellijAzureMessager() {

        @Override
        public boolean show(IAzureMessage raw) {
            if (raw.getType() != IAzureMessage.Type.INFO) {
                return super.show(raw);
            }
            return false;
        }
    };
    final AzureTask<IFunctionApp> task = new AzureTask<>(null, title, false, () -> {
        final Operation operation = TelemetryManager.createOperation(TelemetryConstants.FUNCTION, TelemetryConstants.CREATE_FUNCTION_APP);
        operation.trackProperties(config.getTelemetryProperties());
        try {
            AzureMessager.getContext().setMessager(actionMessenger);
            final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
            indicator.setIndeterminate(true);
            return functionAppService.createFunctionApp(config);
        } finally {
            operation.trackProperties(AzureTelemetry.getActionContext().getProperties());
            operation.complete();
        }
    });
    return AzureTaskManager.getInstance().runInModalAsObservable(task).toSingle().doOnSuccess(app -> {
        AzureMessager.getMessager().success(message("function.create.success.message", app.name()), message("function.create.success.title"));
        this.refreshAzureExplorer(app);
    });
}
Also used : ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) IAzureMessage(com.microsoft.azure.toolkit.lib.common.messager.IAzureMessage) IntellijAzureMessager(com.microsoft.azure.toolkit.intellij.common.messager.IntellijAzureMessager) AzureOperation(com.microsoft.azure.toolkit.lib.common.operation.AzureOperation) Operation(com.microsoft.azuretools.telemetrywrapper.Operation) IFunctionApp(com.microsoft.azure.toolkit.lib.appservice.service.IFunctionApp) AzureTask(com.microsoft.azure.toolkit.lib.common.task.AzureTask) AzureString(com.microsoft.azure.toolkit.lib.common.bundle.AzureString) AzureOperation(com.microsoft.azure.toolkit.lib.common.operation.AzureOperation)

Example 3 with IntellijAzureMessager

use of com.microsoft.azure.toolkit.intellij.common.messager.IntellijAzureMessager in project azure-tools-for-java by Microsoft.

the class PluginLifeCycleListener method appFrameCreated.

@Override
public void appFrameCreated(@NotNull List<String> commandLineArgs) {
    AzureTaskManager.register(new IntellijAzureTaskManager());
    AzureRxTaskManager.register();
    AzureMessager.setDefaultMessager(new IntellijAzureMessager());
    IntellijAzureActionManager.register();
    AzureTaskManager.getInstance().runOnPooledThread(() -> {
        Azure.az(AzureAccount.class).login(AuthType.AZURE_CLI);
    });
}
Also used : IntellijAzureTaskManager(com.microsoft.azure.toolkit.intellij.common.task.IntellijAzureTaskManager) IntellijAzureMessager(com.microsoft.azure.toolkit.intellij.common.messager.IntellijAzureMessager) AzureAccount(com.microsoft.azure.toolkit.lib.auth.AzureAccount)

Aggregations

IntellijAzureMessager (com.microsoft.azure.toolkit.intellij.common.messager.IntellijAzureMessager)3 IntellijAzureTaskManager (com.microsoft.azure.toolkit.intellij.common.task.IntellijAzureTaskManager)2 ActionManager (com.intellij.openapi.actionSystem.ActionManager)1 DefaultActionGroup (com.intellij.openapi.actionSystem.DefaultActionGroup)1 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)1 CosmosSparkClusterOpsCtrl (com.microsoft.azure.cosmosspark.CosmosSparkClusterOpsCtrl)1 HDInsightHelperImpl (com.microsoft.azure.hdinsight.common.HDInsightHelperImpl)1 DefaultMachineStore (com.microsoft.azure.toolkit.ide.common.store.DefaultMachineStore)1 IntellijAzureActionManager (com.microsoft.azure.toolkit.intellij.common.action.IntellijAzureActionManager)1 IFunctionApp (com.microsoft.azure.toolkit.lib.appservice.service.IFunctionApp)1 AzureAccount (com.microsoft.azure.toolkit.lib.auth.AzureAccount)1 AzureString (com.microsoft.azure.toolkit.lib.common.bundle.AzureString)1 IAzureMessage (com.microsoft.azure.toolkit.lib.common.messager.IAzureMessage)1 AzureOperation (com.microsoft.azure.toolkit.lib.common.operation.AzureOperation)1 AzureTask (com.microsoft.azure.toolkit.lib.common.task.AzureTask)1 AppSchedulerProvider (com.microsoft.azuretools.core.mvp.ui.base.AppSchedulerProvider)1 Operation (com.microsoft.azuretools.telemetrywrapper.Operation)1 IDEHelperImpl (com.microsoft.intellij.helpers.IDEHelperImpl)1 MvpUIHelperImpl (com.microsoft.intellij.helpers.MvpUIHelperImpl)1 UIHelperImpl (com.microsoft.intellij.helpers.UIHelperImpl)1