@@ -34,31 +34,45 @@ public DeleteProjectAction() {
34
34
}
35
35
36
36
@ Override
37
- public String getTelemetryActionName () { return "delete project" ; }
37
+ public void update (AnActionEvent e ) {
38
+ super .update (e );
39
+ if (e .getPresentation ().isVisible ()) {
40
+ Odo odo = getOdo (e );
41
+ if (odo == null ) {
42
+ return ;
43
+ }
44
+ // overrides label given in plugin.xml
45
+ e .getPresentation ().setText ("Delete " + odo .getNamespaceKind ());
46
+ }
47
+ }
48
+
49
+ @ Override
50
+ public String getTelemetryActionName () {return "delete project" ;}
38
51
39
52
@ Override
40
53
public void actionPerformedOnSelectedObject (AnActionEvent anActionEvent , Object selected , @ NotNull Odo odo ) {
54
+ String kind = odo .getNamespaceKind ();
41
55
NamespaceNode namespaceNode = (NamespaceNode ) selected ;
42
- if (Messages .NO == Messages .showYesNoDialog ("Delete Project '" + namespaceNode .getName () + "'.\n Are you sure?" , "Delete Project" ,
43
- Messages .getQuestionIcon ())) {
44
- sendTelemetryResults (TelemetryResult .ABORTED );
45
- return ;
56
+ if (Messages .NO == Messages .showYesNoDialog ("Delete " + kind + " '" + namespaceNode .getName () + "'.\n \n DELETING " + kind . toUpperCase () + " WILL DELETE ALL ASSOCIATED RESOURCES ON THE CLUSTER. \n \ n Are you sure?" , "Delete " + kind ,
57
+ Messages .getQuestionIcon ())) {
58
+ sendTelemetryResults (TelemetryResult .ABORTED );
59
+ return ;
46
60
}
47
61
runWithProgress ((ProgressIndicator progress ) -> {
48
62
try {
49
- Notification notif = NotificationUtils .notifyInformation ("Delete project" , "Deleting project " + namespaceNode .getName ());
63
+ Notification notif = NotificationUtils .notifyInformation ("Delete " + kind , "Deleting " + kind . toLowerCase () + " " + namespaceNode .getName ());
50
64
Notifications .Bus .notify (notif );
51
65
odo .deleteProject (namespaceNode .getName ());
52
66
notif .expire ();
53
- NotificationUtils .notifyInformation ("Delete project" , "Project " + namespaceNode .getName () + " has been successfully deleted" );
67
+ NotificationUtils .notifyInformation ("Delete " + kind , kind + " " + namespaceNode .getName () + " has been successfully deleted" );
54
68
NodeUtils .fireRemoved (namespaceNode );
55
69
sendTelemetryResults (TelemetryResult .SUCCESS );
56
70
} catch (IOException e ) {
57
71
sendTelemetryError (e );
58
- UIHelper .executeInUI (() -> Messages .showErrorDialog ("Error: " + e .getLocalizedMessage (), "Delete Project" ));
72
+ UIHelper .executeInUI (() -> Messages .showErrorDialog ("Error: " + e .getLocalizedMessage (), "Delete " + kind ));
59
73
}
60
74
},
61
- "Delete Project " + namespaceNode .getName (),
75
+ "Delete " + kind + " " + namespaceNode .getName (),
62
76
getEventProject (anActionEvent )
63
77
);
64
78
}
0 commit comments