Skip to content

Commit cc0b131

Browse files
authored
Small cleanups to ECR push action (#2613)
1 parent b76bb7b commit cc0b131

File tree

5 files changed

+22
-20
lines changed

5 files changed

+22
-20
lines changed

jetbrains-core/resources/META-INF/ext-docker.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
<!-- SPDX-License-Identifier: Apache-2.0 -->
33

44
<idea-plugin>
5+
<resource-bundle>software.aws.toolkits.resources.MessagesBundle</resource-bundle>
6+
57
<actions>
6-
<group>
8+
<action id="aws.toolkit.ecr.repository.push" class="software.aws.toolkits.jetbrains.services.ecr.actions.PushToRepositoryAction">
79
<add-to-group group-id="ecr.repository.push.group"/>
8-
9-
<action id="ecr.repository.push" class="software.aws.toolkits.jetbrains.services.ecr.actions.PushToRepositoryAction"/>
10-
</group>
10+
</action>
1111
</actions>
1212
</idea-plugin>

jetbrains-core/resources/META-INF/plugin.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,14 +257,12 @@ with what features/services are supported.
257257
</extensions>
258258

259259
<actions>
260-
<group id="ecr.repository.push.group"/>
261-
262260
<group id="aws.toolkit.explorer.ecr" popup="true" compact="false">
263261
<action id="ecr.repository.create" class="software.aws.toolkits.jetbrains.services.ecr.actions.CreateRepositoryAction"/>
264262
</group>
265263

266264
<group id="aws.toolkit.explorer.ecr.repository" popup="true" compact="false">
267-
<reference id="ecr.repository.push.group"/>
265+
<group id="ecr.repository.push.group"/>
268266
<action id="ecr.repository.copyUri" class="software.aws.toolkits.jetbrains.services.ecr.actions.CopyRepositoryUriAction"/>
269267
<separator/>
270268
<action id="ecr.repository.delete" class="software.aws.toolkits.jetbrains.services.ecr.actions.DeleteRepositoryAction"/>

jetbrains-core/src/software/aws/toolkits/jetbrains/core/explorer/actions/AbstractActions.kt

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ import javax.swing.Icon
1919
* @see ExplorerNodeAction
2020
* @see SingleExplorerNodeAction
2121
*/
22-
abstract class SingleResourceNodeAction<in T : AwsExplorerResourceNode<*>>(text: String, description: String? = null, icon: Icon? = null) :
23-
SingleExplorerNodeAction<T>(text, description, icon)
22+
abstract class SingleResourceNodeAction<in T : AwsExplorerResourceNode<*>> : SingleExplorerNodeAction<T> {
23+
constructor() : super()
24+
constructor(text: String, description: String? = null, icon: Icon? = null) : super(text, description, icon)
25+
}
2426

2527
/**
2628
* An action from a [AwsExplorerNode] that only operates on a single resource.
@@ -29,8 +31,9 @@ abstract class SingleResourceNodeAction<in T : AwsExplorerResourceNode<*>>(text:
2931
*
3032
* @see ExplorerNodeAction
3133
*/
32-
abstract class SingleExplorerNodeAction<in T : AwsExplorerNode<*>>(text: String, description: String? = null, icon: Icon? = null) :
33-
ExplorerNodeAction<T>(text, description, icon) {
34+
abstract class SingleExplorerNodeAction<in T : AwsExplorerNode<*>> : ExplorerNodeAction<T> {
35+
constructor() : super()
36+
constructor(text: String, description: String? = null, icon: Icon? = null) : super(text, description, icon)
3437

3538
/**
3639
* If only a single item is selected [update] will be invoked with that selection periodically.
@@ -61,8 +64,9 @@ abstract class SingleExplorerNodeAction<in T : AwsExplorerNode<*>>(text: String,
6164
/**
6265
* Converts generic [ExplorerNodeAction] list into [T] typed nodes
6366
*/
64-
abstract class ExplorerNodeAction<in T : AwsExplorerNode<*>>(text: String, description: String? = null, icon: Icon? = null) :
65-
AnAction(text, description, icon) {
67+
abstract class ExplorerNodeAction<in T : AwsExplorerNode<*>> : AnAction {
68+
constructor() : super()
69+
constructor(text: String, description: String? = null, icon: Icon? = null) : super(text, description, icon)
6670

6771
/**
6872
* Invoked periodically with the selected items of type [T].

jetbrains-core/src/software/aws/toolkits/jetbrains/services/ecr/actions/PushToRepositoryAction.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import com.intellij.openapi.actionSystem.LangDataKeys
1616
import com.intellij.openapi.application.ModalityState
1717
import com.intellij.openapi.application.runInEdt
1818
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory
19+
import com.intellij.openapi.project.DumbAware
1920
import com.intellij.openapi.project.Project
2021
import com.intellij.openapi.project.guessProjectDir
2122
import com.intellij.openapi.ui.DialogWrapper
@@ -69,7 +70,8 @@ import javax.swing.JTextField
6970
import javax.swing.plaf.basic.BasicComboBoxEditor
7071

7172
class PushToRepositoryAction :
72-
SingleExplorerNodeAction<EcrRepositoryNode>(message("action.ecr.repository.push.text")),
73+
SingleExplorerNodeAction<EcrRepositoryNode>(),
74+
DumbAware,
7375
CoroutineScope by ApplicationThreadPoolScope("PushRepositoryAction") {
7476
private val dockerServerRuntime: Deferred<DockerServerRuntimeInstance> =
7577
async(start = CoroutineStart.LAZY) { EcrUtils.getDockerServerRuntimeInstance().runtimeInstance }
@@ -79,9 +81,7 @@ class PushToRepositoryAction :
7981
val client: EcrClient = project.awsClient()
8082

8183
val dialog = PushToEcrDialog(project, selected.repository, dockerServerRuntime)
82-
val result = dialog.showAndGet()
83-
84-
if (!result) {
84+
if (!dialog.showAndGet()) {
8585
// user cancelled; noop
8686
EcrTelemetry.deployImage(project, Result.Cancelled)
8787
return
@@ -134,7 +134,7 @@ internal data class LocalImage(
134134

135135
internal class PushToEcrDialog(
136136
private val project: Project,
137-
selectedRepository: Repository?,
137+
selectedRepository: Repository,
138138
private val dockerServerRuntime: Deferred<DockerServerRuntimeInstance>
139139
) : DialogWrapper(project, null, false, IdeModalityType.PROJECT),
140140
CoroutineScope by ApplicationThreadPoolScope("PushRepositoryDialog") {
@@ -153,7 +153,7 @@ internal class PushToEcrDialog(
153153
.build()
154154

155155
init {
156-
selectedRepository?.let { repo -> remoteRepos.selectedItem { it == repo } }
156+
remoteRepos.selectedItem { it == selectedRepository }
157157

158158
title = message("ecr.push.title")
159159
setOKButtonText(message("ecr.push.confirm"))

resources/resources/software/aws/toolkits/resources/MessagesBundle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
# SPDX-License-Identifier: Apache-2.0
33
action.aws.toolkit.dynamoViewer.changeMaxResults.text=Max Results
4-
action.ecr.repository.push.text=Push to Repository...
4+
action.aws.toolkit.ecr.repository.push.text=Push to Repository...
55
apprunner.action.configure=Configure Service
66
apprunner.action.copyServiceUrl=Copy Service URL
77
apprunner.action.create.service=Create Service...

0 commit comments

Comments
 (0)