Lines 7-13
Link Here
|
7 |
* http://www.sun.com/ |
7 |
* http://www.sun.com/ |
8 |
* |
8 |
* |
9 |
* The Original Code is NetBeans. The Initial Developer of the Original |
9 |
* The Original Code is NetBeans. The Initial Developer of the Original |
10 |
* Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun |
10 |
* Code is Sun Microsystems, Inc. Portions Copyright 1997-2002 Sun |
11 |
* Microsystems, Inc. All Rights Reserved. |
11 |
* Microsystems, Inc. All Rights Reserved. |
12 |
*/ |
12 |
*/ |
13 |
|
13 |
|
Lines 116-121
Link Here
|
116 |
static protected Icon iCustomize; |
116 |
static protected Icon iCustomize; |
117 |
|
117 |
|
118 |
static final String PROP_HAS_CUSTOMIZER = "hasCustomizer"; // NOI18N |
118 |
static final String PROP_HAS_CUSTOMIZER = "hasCustomizer"; // NOI18N |
|
|
119 |
static final String PROP_PAGE_HELP_ID = "pageHelpID"; // NOI18N |
119 |
|
120 |
|
120 |
private static String getString(String key) { |
121 |
private static String getString(String key) { |
121 |
return NbBundle.getBundle(PropertySheet.class).getString(key); |
122 |
return NbBundle.getBundle(PropertySheet.class).getString(key); |
Lines 310-315
Link Here
|
310 |
if (index != pages.getSelectedIndex ()) { |
311 |
if (index != pages.getSelectedIndex ()) { |
311 |
pages.setSelectedIndex (index); |
312 |
pages.setSelectedIndex (index); |
312 |
} |
313 |
} |
|
|
314 |
firePropertyChange(PROP_PAGE_HELP_ID, null, null); |
313 |
} |
315 |
} |
314 |
|
316 |
|
315 |
/** |
317 |
/** |
Lines 331-336
Link Here
|
331 |
public int getCurrentPage () { |
333 |
public int getCurrentPage () { |
332 |
return pages.getSelectedIndex (); |
334 |
return pages.getSelectedIndex (); |
333 |
} |
335 |
} |
|
|
336 |
|
337 |
String getPageHelpID() { |
338 |
if (isAncestorOf(pages)) { |
339 |
Component comp = pages.getSelectedComponent(); |
340 |
if (comp instanceof PropertySheetTab) { |
341 |
String helpID = ((PropertySheetTab)comp).getHelpID(); |
342 |
if (helpID != null) { |
343 |
return helpID; |
344 |
} |
345 |
} |
346 |
} |
347 |
return null; |
348 |
} |
334 |
|
349 |
|
335 |
/** |
350 |
/** |
336 |
* Set whether buttons in sheet should be plastic. |
351 |
* Set whether buttons in sheet should be plastic. |
Lines 477-482
Link Here
|
477 |
if (selectedTabName != null) { |
492 |
if (selectedTabName != null) { |
478 |
setCurrentPage(selectedTabName); |
493 |
setCurrentPage(selectedTabName); |
479 |
} |
494 |
} |
|
|
495 |
firePropertyChange(PROP_PAGE_HELP_ID, null, null); |
480 |
} |
496 |
} |
481 |
|
497 |
|
482 |
/** |
498 |
/** |
Lines 525-530
Link Here
|
525 |
// JOptionPane.showMessageDialog(null, activeNode.getCustomizer(), "", JOptionPane.CLOSED_OPTION); |
541 |
// JOptionPane.showMessageDialog(null, activeNode.getCustomizer(), "", JOptionPane.CLOSED_OPTION); |
526 |
} |
542 |
} |
527 |
|
543 |
|
|
|
544 |
/** Show help on the selected tab. |
545 |
*/ |
546 |
void invokeHelp() { |
547 |
try { |
548 |
Class c = Class.forName("org.openide.explorer.propertysheet.PropertySheet$HelpInvoker"); // NOI18N |
549 |
Runnable r = (Runnable)c.newInstance(); |
550 |
current.set(this); |
551 |
r.run(); |
552 |
return; |
553 |
} catch (Exception e) { |
554 |
// if something went wrong just |
555 |
// don't bother (IDE probably not present, cannot show help) |
556 |
} catch (LinkageError e) { |
557 |
} |
558 |
} |
559 |
|
528 |
static ThreadLocal current = new ThreadLocal(); |
560 |
static ThreadLocal current = new ThreadLocal(); |
529 |
|
561 |
|
530 |
|
562 |
|
Lines 540-545
Link Here
|
540 |
throw new IllegalStateException(); |
572 |
throw new IllegalStateException(); |
541 |
} |
573 |
} |
542 |
org.openide.TopManager.getDefault ().getNodeOperation ().customize (instance.activeNode); |
574 |
org.openide.TopManager.getDefault ().getNodeOperation ().customize (instance.activeNode); |
|
|
575 |
} |
576 |
} |
577 |
|
578 |
/** Shows help for the selected tab without using the top manager. |
579 |
*/ |
580 |
static class HelpInvoker implements Runnable { |
581 |
public void run() { |
582 |
PropertySheet instance = (PropertySheet)current.get(); |
583 |
current.set(null); |
584 |
if (instance == null || instance.getPageHelpID() == null){ |
585 |
throw new IllegalStateException(); |
586 |
} |
587 |
org.openide.TopManager.getDefault().showHelp(new HelpCtx(instance.getPageHelpID())); |
543 |
} |
588 |
} |
544 |
} |
589 |
} |
545 |
|
590 |
|