matthiasblaesing commented on PR #6160:
URL: https://github.com/apache/netbeans/pull/6160#issuecomment-1633073337

   @asbachb sorry, but I have to further things:
   
   I still see jakarta composite libraries offered to me by CC. I looked into 
this an indeed they are generated independently of the `JsfVersion`. I suggest 
this:
   
   <details>
   <summary>Align `LibraryUtils#getCompositeLibraryURL` and 
`LibraryUtils#getAllCompositeLibraryNamespaces`</summary>
   
   ```diff
   # This patch file was generated by NetBeans IDE
   # It uses platform neutral UTF-8 encoding and \n newlines.
   --- 
a/enterprise/web.jsfapi/src/org/netbeans/modules/web/jsfapi/spi/LibraryUtils.java
   +++ 
b/enterprise/web.jsfapi/src/org/netbeans/modules/web/jsfapi/spi/LibraryUtils.java
   @@ -71,10 +71,14 @@
            }
        }
    
   -    public static Set<String> getAllCompositeLibraryNamespaces(String 
libraryName) {
   +    public static Set<String> getAllCompositeLibraryNamespaces(String 
libraryName, JsfVersion jsfVersion) {
            Set<String> namespaces = new LinkedHashSet<>();
   -        namespaces.add(COMPOSITE_LIBRARY_JAKARTA_NS + "/" + libraryName);
   -        namespaces.add(COMPOSITE_LIBRARY_JCP_NS + "/" + libraryName);
   +        if (jsfVersion.isAtLeast(JsfVersion.JSF_4_0)) {
   +            namespaces.add(COMPOSITE_LIBRARY_JAKARTA_NS + "/" + 
libraryName);
   +        }
   +        if(jsfVersion.isAtLeast(JsfVersion.JSF_2_2)) {
   +            namespaces.add(COMPOSITE_LIBRARY_JCP_NS + "/" + libraryName);
   +        }
            namespaces.add(COMPOSITE_LIBRARY_SUN_NS + "/" + libraryName);
            return namespaces;
        }
   
   --- a/enterprise/web.jsfapi/nbproject/org-netbeans-modules-web-jsfapi.sig
   +++ b/enterprise/web.jsfapi/nbproject/org-netbeans-modules-web-jsfapi.sig
   @@ -279,7 +279,7 @@
    meth public static java.lang.String 
getCompositeLibraryURL(java.lang.String,org.netbeans.modules.web.jsfapi.api.JsfVersion)
    meth public static 
java.util.Map<java.lang.String,org.netbeans.modules.web.jsfapi.api.Library> 
getDeclaredLibraries(org.netbeans.modules.html.editor.lib.api.HtmlParsingResult)
    meth public static 
java.util.Map<org.netbeans.modules.web.jsfapi.api.Library,java.lang.String> 
importLibrary(javax.swing.text.Document,java.util.Map<org.netbeans.modules.web.jsfapi.api.Library,java.lang.String>)
   -meth public static java.util.Set<java.lang.String> 
getAllCompositeLibraryNamespaces(java.lang.String)
   +meth public static java.util.Set<java.lang.String> 
getAllCompositeLibraryNamespaces(java.lang.String,org.netbeans.modules.web.jsfapi.api.JsfVersion)
    meth public static org.netbeans.api.project.Project[] getOpenedJSFProjects()
    supr java.lang.Object
   ```
   </details>
   
   I also noticed, that the order of the namespaces did not seem consistent. I 
think the problem is in `JsfNamespaceComparator`. That nicely bundles the 
namespace based on prefix, but inside each group there is no order ensured by 
it. 
   
   <details>
   <summary>Suggested adjustment to `JsfNamespaceComparator.java`</summary>
   
   ```diff
   --- 
a/enterprise/web.jsf.editor/src/org/netbeans/modules/web/jsf/editor/facelets/JsfNamespaceComparator.java
   +++ 
b/enterprise/web.jsf.editor/src/org/netbeans/modules/web/jsf/editor/facelets/JsfNamespaceComparator.java
   @@ -37,7 +37,12 @@
    
        @Override
        public int compare(String namespace1, String namespace2) {
   -        return rate(namespace1).compareTo(rate(namespace2));
   +        int prefixResult = rate(namespace1).compareTo(rate(namespace2));
   +        if(prefixResult != 0) {
   +            return prefixResult;
   +        } else {
   +            return namespace1.compareTo(namespace2);
   +        }
        }
    
        private Integer rate(String namespace) {
   ```
   </details>


-- 
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