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


##########
ide/o.n.swing.dirchooser/nbproject/project.xml:
##########
@@ -25,6 +25,24 @@
         <data xmlns="http://www.netbeans.org/ns/nb-module-project/2";>
             <code-name-base>org.netbeans.swing.dirchooser</code-name-base>
             <module-dependencies>
+                <dependency>

Review Comment:
   I'd prefer to find a way to remove these additional dependencies, and not 
rely on any specific LAF.



##########
ide/o.n.swing.dirchooser/src/org/netbeans/swing/dirchooser/DirectoryChooserUI.java:
##########
@@ -237,15 +252,18 @@ public String getDialogTitle(JFileChooser fc) {
         fc.getAccessibleContext().setAccessibleDescription(title);
         return title;
     }
-    
+
+    private static boolean useNBShortcutsPanel() {
+        return UIManager.getLookAndFeel().getID().startsWith("FlatLaf") && 
true/*some prop*/; // TODO just for testing

Review Comment:
   Let's look at necessary UI keys rather than adding any more LAF checks in 
the codebase!



##########
ide/o.n.swing.dirchooser/src/org/netbeans/swing/dirchooser/Module.java:
##########
@@ -96,17 +94,27 @@ private static void install() {
             uid.put(val, impl);
         }
         // #61147: prevent NB from switching to a different UI later (under 
GTK):
-        uid.addPropertyChangeListener(pcl = new PropertyChangeListener() {
-            public @Override void propertyChange(PropertyChangeEvent evt) {
-                String name = evt.getPropertyName();
-                Object className = uid.get(KEY);
-                if ((name.equals(KEY) || name.equals("UIDefaults")) && 
!val.equals(className)
-                        && !isQuickFileChooser(className)) {
-                    originalImpl = (Class<?>) uid.getUIClass(KEY);
-                    uid.put(KEY, val);
-                }
+        uid.addPropertyChangeListener(pcl = (evt) -> {
+            String name = evt.getPropertyName();
+            Object className = uid.get(KEY);
+            if ((name.equals(KEY) || name.equals("UIDefaults")) && 
!val.equals(className) && !isQuickFileChooser(className)) {
+                originalImpl = (Class<?>) uid.getUIClass(KEY);
+                uid.put(KEY, val);
             }
         });
+
+        Function<File[], File[]> fun = (Function<File[], File[]>) (File[] 
files) -> {
+            Favorites favs = Favorites.getDefault();
+            ArrayList<File> list = new ArrayList<>(Arrays.asList(files));
+            for (FileObject root : favs.getFavoriteRoots()) {
+                File file = FileUtil.toFile(root);
+                if (file.isDirectory()) {
+                    list.add(file);
+                }
+            }
+            return list.toArray(File[]::new);
+        };
+        UIManager.put("FileChooser.shortcuts.filesFunction", fun);

Review Comment:
   Adopt this as a provided NetBeans key and provide from the Favorites module 
directly?
   
   Could also consider if Favorites should prepopulate favorites from the shell 
folders on Windows, and then allow all OS to use Favorites to customise links 
in file chooser panels for consistency?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

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

Reply via email to