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