You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "neilcsmith-net (via GitHub)" <gi...@apache.org> on 2023/02/24 10:00:34 UTC

[GitHub] [netbeans] neilcsmith-net commented on a diff in pull request #5543: When adding an Autonomous DB, present profiles instead of tenancies

neilcsmith-net commented on code in PR #5543:
URL: https://github.com/apache/netbeans/pull/5543#discussion_r1116754017


##########
enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/actions/AddADBAction.java:
##########
@@ -83,47 +89,82 @@ public class AddADBAction implements ActionListener {
     private static final String USERNAME = "username"; //NOI18N
     private static final String PASSWORD = "password"; //NOI18N
 
+    @NbBundle.Messages({
+        "MSG_CollectingProfiles=Searching for OCI Profiles",
+        "MSG_CollectingProfiles_Text=Loading OCI Profiles",
+        "MSG_CollectingItems=Loading OCI contents",
+        "MSG_CollectingItems_Text=Listing compartments and databases",
+    })
     @Override
     public void actionPerformed(ActionEvent e) {
         Map<String, Object> result = new HashMap<> ();
         
         NotifyDescriptor.ComposedInput ci = new NotifyDescriptor.ComposedInput(Bundle.AddADB(), 3, new Callback() {
-            Map<Integer, List> values = new HashMap<> ();
-            
+            Map<Integer, Map> values = new HashMap<> ();
+
             @Override
             public NotifyDescriptor createInput(NotifyDescriptor.ComposedInput input, int number) {
                 if (number == 1) {
-                    List<TenancyItem> tenancies = new ArrayList<>();
-                    for (OCIProfile p : OCIManager.getDefault().getConnectedProfiles()) {
-                        p.getTenancy().ifPresent(tenancies::add);
+                    ProgressHandle h = ProgressHandle.createHandle(Bundle.MSG_CollectingProfiles());
+                    h.start();
+                    h.progress(Bundle.MSG_CollectingProfiles_Text());
+        
+                    Map<OCIProfile, Tenancy> profiles = new LinkedHashMap<>();
+                    Map<String, TenancyItem> tenancyItems = new LinkedHashMap<>();
+                    try {
+                        for (OCIProfile p : OCIManager.getDefault().getConnectedProfiles()) {
+                            TenancyItem t = p.getTenancy().orElse(null);

Review Comment:
   `Optional` in APIs should be encouraged in my opinion.  Have no issue with expanding to `null` with `orElse` in local imperative code where required either.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists