Skip to content

Commit f3e23a2

Browse files
Connect Azure Resource... action can be attached to module or connection manager.
1 parent 323c86d commit f3e23a2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-resource-connector-lib/src/main/java/com/microsoft/azure/toolkit/intellij/connector/ResourceConnectionActionsContributor.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public class ResourceConnectionActionsContributor implements IActionsContributor
4646
public static final Action.Id<Connection<?, ?>> REMOVE_CONNECTION = Action.Id.of("user/connector.remove_connection");
4747
public static final Action.Id<Connection<?, ?>> FIX_CONNECTION = Action.Id.of("user/connector.fix_connection");
4848

49-
public static final Action.Id<AzureModule> CONNECT_TO_MODULE = Action.Id.of("user/connector.connect_to_module");
49+
public static final Action.Id<Object> CONNECT_TO_MODULE = Action.Id.of("user/connector.connect_to_module");
5050
public static final Action.Id<AzureModule> REFRESH_MODULE = Action.Id.of("user/connector.refresh_module");
5151
public static final Action.Id<ConnectionManager> REFRESH_MODULE_CONNECTIONS = Action.Id.of("user/connector.refresh_module_connections");
5252
public static final Action.Id<DeploymentTargetManager> REFRESH_MODULE_TARGETS = Action.Id.of("user/connector.refresh_module_targets");
@@ -124,7 +124,13 @@ public void registerActions(AzureActionManager am) {
124124
new Action<>(CONNECT_TO_MODULE)
125125
.withLabel("Connect Azure Resource...")
126126
.withIcon(AzureIcons.Connector.CONNECT.getIconPath())
127-
.withHandler((module, e) -> AzureTaskManager.getInstance().runLater(() -> ModuleConnectorAction.connectModuleToAzureResource(module.getModule())))
127+
.withHandler((target, e) -> {
128+
if (target instanceof AzureModule module) {
129+
AzureTaskManager.getInstance().runLater(() -> ModuleConnectorAction.connectModuleToAzureResource(module.getModule()));
130+
} else if (target instanceof ConnectionManager cm) {
131+
AzureTaskManager.getInstance().runLater(() -> ModuleConnectorAction.connectModuleToAzureResource(cm.getProfile().getModule().getModule()));
132+
}
133+
})
128134
.withShortcut(am.getIDEDefaultShortcuts().refresh())
129135
.withAuthRequired(false)
130136
.register(am);

0 commit comments

Comments
 (0)