Index: openide/src/org/openide/explorer/propertysheet/Bundle.properties =================================================================== RCS file: /cvs/openide/src/org/openide/explorer/propertysheet/Bundle.properties,v --- openide/src/org/openide/explorer/propertysheet/Bundle.properties 29 Jan 2002 10:02:06 -0000 1.24 +++ openide/src/org/openide/explorer/propertysheet/Bundle.properties 20 Mar 2002 17:35:10 -0000 @@ -6,7 +6,7 @@ # http://www.sun.com/ # # The Original Code is NetBeans. The Initial Developer of the Original -# Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun +# Code is Sun Microsystems, Inc. Portions Copyright 1997-2002 Sun # Microsystems, Inc. All Rights Reserved. @@ -40,6 +40,8 @@ ACS_CTL_VisibleWritableOnly=Show Editable Properties Only CTL_Customize=Customizer ACS_CTL_Customize=Customizer +CTL_Help=Help +ACS_CTL_Help=Help # PropertyPanel # This message is printed to ide.log if user is customizing an object as bean Index: openide/src/org/openide/explorer/propertysheet/PropertySheet.java =================================================================== RCS file: /cvs/openide/src/org/openide/explorer/propertysheet/PropertySheet.java,v --- openide/src/org/openide/explorer/propertysheet/PropertySheet.java 28 Feb 2002 15:41:23 -0000 1.79 +++ openide/src/org/openide/explorer/propertysheet/PropertySheet.java 20 Mar 2002 17:35:33 -0000 @@ -7,7 +7,7 @@ * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original - * Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun + * Code is Sun Microsystems, Inc. Portions Copyright 1997-2002 Sun * Microsystems, Inc. All Rights Reserved. */ @@ -116,6 +116,7 @@ static protected Icon iCustomize; static final String PROP_HAS_CUSTOMIZER = "hasCustomizer"; // NOI18N + static final String PROP_PAGE_HELP_ID = "pageHelpID"; // NOI18N private static String getString(String key) { return NbBundle.getBundle(PropertySheet.class).getString(key); @@ -310,6 +311,7 @@ if (index != pages.getSelectedIndex ()) { pages.setSelectedIndex (index); } + firePropertyChange(PROP_PAGE_HELP_ID, null, null); } /** @@ -331,6 +333,19 @@ public int getCurrentPage () { return pages.getSelectedIndex (); } + + String getPageHelpID() { + if (isAncestorOf(pages)) { + Component comp = pages.getSelectedComponent(); + if (comp instanceof PropertySheetTab) { + String helpID = ((PropertySheetTab)comp).getHelpID(); + if (helpID != null) { + return helpID; + } + } + } + return null; + } /** * Set whether buttons in sheet should be plastic. @@ -477,6 +492,7 @@ if (selectedTabName != null) { setCurrentPage(selectedTabName); } + firePropertyChange(PROP_PAGE_HELP_ID, null, null); } /** @@ -525,6 +541,22 @@ // JOptionPane.showMessageDialog(null, activeNode.getCustomizer(), "", JOptionPane.CLOSED_OPTION); } + /** Show help on the selected tab. + */ + void invokeHelp() { + try { + Class c = Class.forName("org.openide.explorer.propertysheet.PropertySheet$HelpInvoker"); // NOI18N + Runnable r = (Runnable)c.newInstance(); + current.set(this); + r.run(); + return; + } catch (Exception e) { + // if something went wrong just + // don't bother (IDE probably not present, cannot show help) + } catch (LinkageError e) { + } + } + static ThreadLocal current = new ThreadLocal(); @@ -540,6 +572,19 @@ throw new IllegalStateException(); } org.openide.TopManager.getDefault ().getNodeOperation ().customize (instance.activeNode); + } + } + + /** Shows help for the selected tab without using the top manager. + */ + static class HelpInvoker implements Runnable { + public void run() { + PropertySheet instance = (PropertySheet)current.get(); + current.set(null); + if (instance == null || instance.getPageHelpID() == null){ + throw new IllegalStateException(); + } + org.openide.TopManager.getDefault().showHelp(new HelpCtx(instance.getPageHelpID())); } } Index: openide/src/org/openide/explorer/propertysheet/PropertySheetToolbar.java =================================================================== RCS file: /cvs/openide/src/org/openide/explorer/propertysheet/PropertySheetToolbar.java,v --- openide/src/org/openide/explorer/propertysheet/PropertySheetToolbar.java 29 Oct 2001 10:37:05 -0000 1.8 +++ openide/src/org/openide/explorer/propertysheet/PropertySheetToolbar.java 20 Mar 2002 17:35:38 -0000 @@ -7,7 +7,7 @@ * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original - * Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun + * Code is Sun Microsystems, Inc. Portions Copyright 1997-2002 Sun * Microsystems, Inc. All Rights Reserved. */ @@ -48,6 +48,11 @@ /** Set of buttons. */ private ToolbarToggleButton bNoSort, bAlphaSort, bTypeSort, bDisplayWritableOnly; private ToolbarButton customizer; + /** Show help on the active property sheet tab (Node.PropertySet) if applicable. + * Does not show node- nor property-level help. + * @see #20794 + */ + private ToolbarButton help; /** When firing back to the PropertySheet we should not react to changes - * - this should prevent the loop. @@ -112,6 +117,18 @@ customizer.setToolTipText(getString("CTL_Customize")); customizer.setEnabled(false); customizer.addActionListener(this); + + ts = new Toolbar.Separator(); + add(ts); + ts.updateUI(); + + add(help = new ToolbarButton(new ImageIcon(Utilities.loadImage( + "org/openide/resources/propertysheet/help.gif")))); // NOI18N + + help.getAccessibleContext().setAccessibleName(getString("ACS_CTL_Help")); + help.setToolTipText(getString("CTL_Help")); + help.setEnabled(false); + help.addActionListener(this); } @@ -128,6 +145,8 @@ setSortingMode(PropertySheet.SORTED_BY_TYPES); } else if(source == customizer) { mySheet.invokeCustomization(); + } else if (source == help) { + mySheet.invokeHelp(); } else if(source == bDisplayWritableOnly) { ignorePropertyChange = true; try { @@ -174,6 +193,9 @@ } if (evt.getPropertyName().equals(PropertySheet.PROP_HAS_CUSTOMIZER)) { customizer.setEnabled(((Boolean)evt.getNewValue()).booleanValue()); + } + if (evt.getPropertyName().equals(PropertySheet.PROP_PAGE_HELP_ID)) { + help.setEnabled(mySheet.getPageHelpID() != null); } } Index: openide/test/stdalone/src/org/openide/stdalonetest/TestClassResolution.java =================================================================== RCS file: /cvs/openide/test/stdalone/src/org/openide/stdalonetest/TestClassResolution.java,v --- openide/test/stdalone/src/org/openide/stdalonetest/TestClassResolution.java 11 Feb 2002 12:01:13 -0000 1.2 +++ openide/test/stdalone/src/org/openide/stdalonetest/TestClassResolution.java 20 Mar 2002 17:36:14 -0000 @@ -46,6 +46,7 @@ "org/openide/explorer/propertysheet/PropertyPanel$PropertySheetSettingsInvoker", "org/openide/explorer/propertysheet/PropertySheet$PropertySheetSettingsInvoker", "org/openide/explorer/propertysheet/PropertySheet$CustomizationInvoker", + "org/openide/explorer/propertysheet/PropertySheet$HelpInvoker", "org/openide/explorer/view/DragDropUtilities$WarningInvoker", "org/openide/explorer/ExplorerActions$DestroyInvoker", "org/openide/explorer/ExplorerActions$ConfirmationInvoker",