1 /*
2  * HelpTextProvider.java
3  *
4  * Created on 16. November 2006, 09:44
5  *
6  * To change this template, choose Tools | Template Manager
7  * and open the template in the editor.
8  */
9 
10 package integration.extensions;
11 
12 import com.sun.star.inspection.XObjectInspectorUI;
13 import com.sun.star.inspection.XPropertyControl;
14 import com.sun.star.inspection.XPropertyControlObserver;
15 import com.sun.star.lang.NoSupportException;
16 
17 /** displays help text for the currently selected method
18  */
19 public class HelpTextProvider implements XPropertyControlObserver
20 {
21     private XObjectInspectorUI  m_inspectorUI;
22 
23     /**
24      * Creates a new instance of HelpTextProvider
25      */
26     public HelpTextProvider( XObjectInspectorUI _inspectorUI )
27     {
28         m_inspectorUI = _inspectorUI;
29         m_inspectorUI.registerControlObserver( this );
30     }
31 
32     public void focusGained( XPropertyControl _propertyControl )
33     {
34         try
35         {
36             String helpText = "here could be the help for:\n";
37             helpText += _propertyControl.getValue().toString();
38             m_inspectorUI.setHelpSectionText( helpText );
39         }
40         catch (NoSupportException ex)
41         {
42             ex.printStackTrace();
43         }
44     }
45 
46     public void valueChanged( XPropertyControl _propertyControl )
47     {
48         // not interested in
49     }
50 }
51