Skip to content

Commit 7954659

Browse files
author
Flanker-MSFT
committed
Fix resource connection could not be created within getting start
1 parent e074499 commit 7954659

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-plugin-applicationinsights/src/main/java/com/microsoft/azure/toolkit/intellij/applicationinsights/task/CreateApplicationInsightsResourceConnectionTask.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import com.microsoft.azure.toolkit.intellij.connector.dotazure.AzureModule;
1313
import com.microsoft.azure.toolkit.intellij.connector.dotazure.ConnectionManager;
1414
import com.microsoft.azure.toolkit.intellij.connector.dotazure.Profile;
15-
import com.microsoft.azure.toolkit.intellij.connector.dotazure.ResourceManager;
1615
import com.microsoft.azure.toolkit.lib.Azure;
1716
import com.microsoft.azure.toolkit.lib.applicationinsights.ApplicationInsight;
1817
import com.microsoft.azure.toolkit.lib.applicationinsights.AzureApplicationInsights;
@@ -45,14 +44,11 @@ public void execute() {
4544
if (Objects.isNull(profile)) {
4645
return;
4746
}
48-
final ConnectionManager connectionManager = profile.getConnectionManager();
49-
final ResourceManager resourceManager = profile.getResourceManager();
50-
final Connection connection = ConnectionManager.getDefinitionOrDefault(resource.getDefinition(),
47+
final Connection<?,?> connection = ConnectionManager.getDefinitionOrDefault(resource.getDefinition(),
5148
consumer.getDefinition()).define(resource, consumer);
5249
if (connection.validate(this.project)) {
53-
Objects.requireNonNull(resourceManager).addResource(resource);
54-
resourceManager.addResource(consumer);
55-
Objects.requireNonNull(connectionManager).addConnection(connection);
50+
profile.createOrUpdateConnection(connection);
51+
profile.save();
5652
final String message = String.format("The connection between %s and %s has been successfully created.",
5753
resource.getName(), consumer.getName());
5854
AzureMessager.getMessager().success(message);

0 commit comments

Comments
 (0)