--- options.api/apichanges.xml +++ options.api/apichanges.xml @@ -75,6 +75,21 @@ + + + API to handle selection of subcategory from a composite OptionspanelController + + + + + + Added API to handle selection of subcategory. It is meant to be called from + a composite {@link org.netbeans.spi.options.OptionspanelController} and delegates to + {@link org.netbeans.spi.options.OptionspanelController#setCurrentSubcategory(java.lang.String)}. + + + + Should Import Require Restart? --- options.api/manifest.mf +++ options.api/manifest.mf @@ -2,6 +2,6 @@ OpenIDE-Module: org.netbeans.modules.options.api/1 OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/options/Bundle.properties OpenIDE-Module-Layer: org/netbeans/modules/options/resources/mf-layer.xml -OpenIDE-Module-Specification-Version: 1.37 +OpenIDE-Module-Specification-Version: 1.38 AutoUpdate-Show-In-Client: false AutoUpdate-Essential-Module: true --- options.api/src/org/netbeans/spi/options/OptionsPanelController.java +++ options.api/src/org/netbeans/spi/options/OptionsPanelController.java @@ -213,6 +213,18 @@ } /** + * Enables to handle selection of subcategory. It is meant to be called from + * a composite {@link org.netbeans.spi.options.OptionspanelController} and delegates to + * {@link org.netbeans.spi.options.OptionspanelController#setCurrentSubcategory(java.lang.String)}. + * @param subpath path of subcategory to be selected. Path is + * composed from registration names divided by slash. + * @since 1.38 + */ + public final void setSubcategory(String subpath) { + setCurrentSubcategory(subpath); + } + + /** * * Get current help context asociated with this panel. * --- options.editor/src/org/netbeans/modules/options/editor/FolderBasedController.java +++ options.editor/src/org/netbeans/modules/options/editor/FolderBasedController.java @@ -231,7 +231,7 @@ subpath = subpath.substring(e.getKey().length()); if (subpath.length() > 0 && subpath.startsWith("/")) { - setCurrentSubcategory(e.getValue(), subpath.substring(1)); + e.getValue().setSubcategory(subpath.substring(1)); } return ; @@ -241,26 +241,6 @@ Logger.getLogger(FolderBasedController.class.getName()).log(Level.WARNING, "setCurrentSubcategory: cannot open: {0}", subpath); } - private static void setCurrentSubcategory(OptionsPanelController c, String subpath) { - //#180821: cannot directly call setCurrentSubcategory on c as that is protected - try { - Method m = OptionsPanelController.class.getDeclaredMethod("setCurrentSubcategory", String.class); - - m.setAccessible(true); - m.invoke(c, subpath); - } catch (IllegalAccessException ex) { - Exceptions.printStackTrace(ex); - } catch (IllegalArgumentException ex) { - Exceptions.printStackTrace(ex); - } catch (InvocationTargetException ex) { - Exceptions.printStackTrace(ex); - } catch (NoSuchMethodException ex) { - Exceptions.printStackTrace(ex); - } catch (SecurityException ex) { - Exceptions.printStackTrace(ex); - } - } - Iterable getMimeTypes() { return getMimeType2delegates ().keySet(); }