1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 /*
23  * HelpTextProvider.java
24  *
25  * Created on 16. November 2006, 09:44
26  *
27  * To change this template, choose Tools | Template Manager
28  * and open the template in the editor.
29  */
30 
31 package integration.extensions;
32 
33 import com.sun.star.inspection.XObjectInspectorUI;
34 import com.sun.star.inspection.XPropertyControl;
35 import com.sun.star.inspection.XPropertyControlObserver;
36 import com.sun.star.lang.NoSupportException;
37 
38 /** displays help text for the currently selected method
39  */
40 public class HelpTextProvider implements XPropertyControlObserver
41 {
42     private XObjectInspectorUI  m_inspectorUI;
43 
44     /**
45      * Creates a new instance of HelpTextProvider
46      */
HelpTextProvider( XObjectInspectorUI _inspectorUI )47     public HelpTextProvider( XObjectInspectorUI _inspectorUI )
48     {
49         m_inspectorUI = _inspectorUI;
50         m_inspectorUI.registerControlObserver( this );
51     }
52 
focusGained( XPropertyControl _propertyControl )53     public void focusGained( XPropertyControl _propertyControl )
54     {
55         try
56         {
57             String helpText = "here could be the help for:\n";
58             helpText += _propertyControl.getValue().toString();
59             m_inspectorUI.setHelpSectionText( helpText );
60         }
61         catch (NoSupportException ex)
62         {
63             ex.printStackTrace();
64         }
65     }
66 
valueChanged( XPropertyControl _propertyControl )67     public void valueChanged( XPropertyControl _propertyControl )
68     {
69         // not interested in
70     }
71 }
72