diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/library/user/LibraryFolderWatcher.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/library/user/LibraryFolderWatcher.java index 374560285..c56733768 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/library/user/LibraryFolderWatcher.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/library/user/LibraryFolderWatcher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Gluon and/or its affiliates. + * Copyright (c) 2017, 2021, Gluon and/or its affiliates. * Copyright (c) 2012, 2014, Oracle and/or its affiliates. * All rights reserved. Use is subject to license terms. * @@ -438,15 +438,22 @@ private Collection makeLibraryItems(JarReport jarOrFolderReport) th if (!excludedItems.contains(canonicalName) && !artifactsFilter.contains(canonicalName)) { final String name = e.getKlass().getSimpleName(); + final String sectionName = createSectionName(jarOrFolderReport); final String fxmlText = BuiltinLibrary.makeFxmlText(e.getKlass()); - result.add(new LibraryItem(name, UserLibrary.TAG_USER_DEFINED, fxmlText, iconURL, library)); + result.add(new LibraryItem(name, sectionName, fxmlText, iconURL, library)); } } } return result; } - + private String createSectionName(JarReport jarReport) { + try { + return jarReport.getJar().toFile().getName().replace(".jar", ""); + } catch (Exception e) { + return UserLibrary.TAG_USER_DEFINED; + } + } private URL[] makeURLArrayFromPaths(Collection paths) { final URL[] result = new URL[paths.size()];