1 /*************************************************************************
3 * The Contents of this file are made available subject to the terms of
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
28 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
29 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
30 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
31 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *************************************************************************/
36 import org
.openoffice
.XInstanceInspector
;
38 import com
.sun
.star
.beans
.Property
;
39 import com
.sun
.star
.beans
.PropertyValue
;
40 import com
.sun
.star
.beans
.XIntrospectionAccess
;
41 import com
.sun
.star
.beans
.XPropertySet
;
42 import com
.sun
.star
.lang
.XServiceInfo
;
43 import com
.sun
.star
.lib
.uno
.helper
.WeakBase
;
44 import com
.sun
.star
.reflection
.XIdlMethod
;
45 import com
.sun
.star
.uno
.Any
;
46 import com
.sun
.star
.uno
.AnyConverter
;
47 import com
.sun
.star
.uno
.Type
;
48 import com
.sun
.star
.uno
.TypeClass
;
49 import com
.sun
.star
.uno
.UnoRuntime
;
50 import com
.sun
.star
.uno
.XComponentContext
;
52 public class InspectorPane
extends WeakBase
implements XInstanceInspector
{ //, XServiceInfo
53 private XComponentContext m_xComponentContext
;
54 private XDialogProvider m_xDialogProvider
;
55 private Introspector m_oIntrospector
= null;
56 private SourceCodeGenerator m_oSourceCodeGenerator
;
57 private XTreeControlProvider m_xTreeControlProvider
;
58 private String sTitle
= "";
61 /** The constructor of the inner class has a XMultiServiceFactory parameter.
63 public InspectorPane(XComponentContext _xComponentContext
, XDialogProvider _xDialogProvider
, XTreeControlProvider _xTreeControlProvider
, int _nLanguage
) {
64 m_xComponentContext
= _xComponentContext
;
65 m_xTreeControlProvider
= _xTreeControlProvider
;
66 m_xDialogProvider
= _xDialogProvider
;
67 m_oIntrospector
= Introspector
.getIntrospector(m_xComponentContext
);
68 m_oSourceCodeGenerator
= new SourceCodeGenerator(_nLanguage
);
69 _xTreeControlProvider
.addInspectorPane(this);
72 /** Inspect the given object for methods, properties, interfaces, and
74 * @param _oUserDefinedObject The object to inspect
75 * @throws RuntimeException If
77 public void inspect(java
.lang
.Object _oUserDefinedObject
, String _sTitle
) throws com
.sun
.star
.uno
.RuntimeException
{
79 Object oContainer
= m_xTreeControlProvider
.inspect(_oUserDefinedObject
, _sTitle
);
80 m_xDialogProvider
.addInspectorPage(getTitle(), oContainer
);
82 catch( Exception exception
) {
83 exception
.printStackTrace(System
.err
);
87 public void setTitle(String _sTitle
){
89 if (_sTitle
.length() > 0){
96 public String
getTitle(){
102 private Type
[] getTypes(Object _oUnoObject
){
103 Type
[] aTypes
= null;
104 if (AnyConverter
.isArray(_oUnoObject
)){
105 aTypes
= (Type
[])_oUnoObject
;
108 aTypes
= m_oIntrospector
.getInterfaces(_oUnoObject
);
114 private Object
invoke(XUnoMethodNode _oUnoMethodNode
){
116 String sParamValueDescription
= "";
117 Object oUnoReturnObject
= _oUnoMethodNode
.invoke();
118 boolean bHasParameters
= _oUnoMethodNode
.hasParameters();
119 boolean bIsPrimitive
= _oUnoMethodNode
.isPrimitive();
121 sParamValueDescription
= " (" + m_oSourceCodeGenerator
.getMethodParameterValueDescription(_oUnoMethodNode
, _oUnoMethodNode
.getLastParameterObjects(), true) + ")";
123 if (oUnoReturnObject
!= null ){
124 String sNodeDescription
= "";
125 XUnoNode oUnoNode
= null;
126 if (_oUnoMethodNode
.getXIdlMethod().getReturnType().getTypeClass().getValue() == TypeClass
.VOID_value
){
127 sNodeDescription
+= _oUnoMethodNode
.getXIdlMethod().getReturnType().getName() + " " + _oUnoMethodNode
.getXIdlMethod().getName() + sParamValueDescription
;
128 _oUnoMethodNode
.setLabel(sNodeDescription
);
129 m_xTreeControlProvider
.nodeChanged(_oUnoMethodNode
);
131 else if (bHasParameters
|| !bIsPrimitive
){
133 sNodeDescription
+= m_oSourceCodeGenerator
.getStringValueOfObject(oUnoReturnObject
, _oUnoMethodNode
.getTypeClass());
136 Any aReturnObject
= Any
.complete(oUnoReturnObject
);
137 String sShortClassName
= Introspector
.getShortClassName(aReturnObject
.getType().getTypeName());
138 sNodeDescription
+= m_oSourceCodeGenerator
.getVariableNameforUnoObject(sShortClassName
);
140 if (Introspector
.isArray(oUnoReturnObject
)){
141 if (Introspector
.isUnoTypeObject(oUnoReturnObject
)){
142 oUnoNode
= addUnoFacetteNode(_oUnoMethodNode
, XUnoFacetteNode
.SINTERFACEDESCRIPTION
, _oUnoMethodNode
.getUnoObject());
144 else if(Introspector
.isUnoPropertyTypeObject(oUnoReturnObject
)){
145 oUnoNode
= addUnoFacetteNode(_oUnoMethodNode
, XUnoFacetteNode
.SPROPERTYINFODESCRIPTION
, oUnoReturnObject
);
147 else if(Introspector
.isUnoPropertyValueTypeObject(oUnoReturnObject
)){
148 oUnoNode
= addUnoFacetteNode(_oUnoMethodNode
, XUnoFacetteNode
.SPROPERTYVALUEDESCRIPTION
, oUnoReturnObject
);
151 if (oUnoNode
== null){
153 sNodeDescription
+= sParamValueDescription
;
155 oUnoNode
= addUnoNode(null, oUnoReturnObject
, sNodeDescription
);
157 oUnoNode
.setParameterObjects(_oUnoMethodNode
.getLastParameterObjects());
160 if (oUnoNode
!= null){
161 oUnoNode
.setFoldable(!bIsPrimitive
);
162 _oUnoMethodNode
.setFoldable(false);
163 _oUnoMethodNode
.addChildNode(oUnoNode
);
164 m_xTreeControlProvider
.nodeInserted(_oUnoMethodNode
, oUnoNode
, _oUnoMethodNode
.getChildCount()-1);
169 sNodeDescription
= _oUnoMethodNode
.getStandardMethodDescription() + "=" + UnoMethodNode
.getDisplayValueOfPrimitiveType(oUnoReturnObject
);
170 _oUnoMethodNode
.setLabel(sNodeDescription
);
171 m_xTreeControlProvider
.nodeChanged(_oUnoMethodNode
);
175 // ReturnObject of method node == null..
177 if (!bHasParameters
){
178 _oUnoMethodNode
.setLabel(_oUnoMethodNode
.getLabel() + " = null");
181 _oUnoMethodNode
.setLabel(_oUnoMethodNode
.getXIdlMethod().getName() + sParamValueDescription
+ " = null");
183 m_xTreeControlProvider
.nodeChanged(_oUnoMethodNode
);
185 return oUnoReturnObject
;
186 }catch(Exception exception
) {
191 public void invokeSelectedMethodNode(){
192 XTreePathProvider xTreePathProvider
= m_xTreeControlProvider
.getSelectedPath();
193 XUnoNode oUnoNode
= xTreePathProvider
.getLastPathComponent();
194 if (oUnoNode
instanceof XUnoMethodNode
){
195 invoke((XUnoMethodNode
) oUnoNode
);
196 m_xTreeControlProvider
.expandPath(xTreePathProvider
);
201 public void addSourceCodeOfSelectedNode(){
202 XTreePathProvider oTreePathProvider
= m_xTreeControlProvider
.getSelectedPath();
203 XUnoNode oUnoNode
= oTreePathProvider
.getLastPathComponent();
204 if (oUnoNode
instanceof XUnoMethodNode
){
205 XUnoMethodNode oUnoMethodNode
= (XUnoMethodNode
) oUnoNode
;
206 if (!oUnoMethodNode
.isInvoked() && oUnoMethodNode
.isInvokable()){
207 invoke(oUnoMethodNode
);
210 String sSourceCode
= m_oSourceCodeGenerator
.addSourceCodeOfUnoObject(oTreePathProvider
, true, true);
211 m_xTreeControlProvider
.setSourceCode(sSourceCode
);
215 public void convertCompleteSourceCode(int _nLanguage
){
216 String sSourceCode
= m_oSourceCodeGenerator
.convertAllUnoObjects(_nLanguage
);
217 m_xTreeControlProvider
.setSourceCode(sSourceCode
);
220 protected XUnoNode
getSelectedNode(){
221 return m_xTreeControlProvider
.getSelectedNode();
225 // add the object to the hashtable for a possible access in the tree
226 private XUnoFacetteNode
addUnoFacetteNode(XUnoNode _oParentNode
, String _sNodeDescription
, Object _oUnoObject
){
227 return m_xTreeControlProvider
.addUnoFacetteNode( _oParentNode
, _sNodeDescription
, _oUnoObject
);
231 private XUnoMethodNode
addMethodNode(Object _objectElement
, XIdlMethod _xIdlMethod
){
232 return m_xTreeControlProvider
.addMethodNode(_objectElement
, _xIdlMethod
);
237 private void addMethodsToTreeNode(XUnoNode _oGrandParentNode
, Object _oUnoParentObject
, XIdlMethod
[] _xIdlMethods
){
238 if (Introspector
.isValid(_xIdlMethods
)){
239 for ( int n
= 0; n
< _xIdlMethods
.length
; n
++ ) {
240 XIdlMethod xIdlMethod
= _xIdlMethods
[n
];
241 if (!xIdlMethod
.getDeclaringClass().getName().equals("com.sun.star.uno.XInterface")){
242 XUnoMethodNode oChildNode
= addMethodNode(_oUnoParentObject
, xIdlMethod
);
243 if (oChildNode
!= null){
244 _oGrandParentNode
.addChildNode(oChildNode
);
252 private void addFacetteNodesToTreeNode(XUnoNode _oParentNode
, Object _oUnoObject
){
253 if (m_oIntrospector
.hasMethods(_oUnoObject
)){
254 addUnoFacetteNode(_oParentNode
, XUnoFacetteNode
.SMETHODDESCRIPTION
, _oUnoObject
);
256 if (m_oIntrospector
.hasProperties(_oUnoObject
)){
257 addUnoFacetteNode(_oParentNode
, XUnoFacetteNode
.SPROPERTYDESCRIPTION
, _oUnoObject
);
259 if (m_oIntrospector
.hasInterfaces(_oUnoObject
)){
260 addUnoFacetteNode(_oParentNode
, XUnoFacetteNode
.SINTERFACEDESCRIPTION
, _oUnoObject
);
262 if (m_oIntrospector
.isContainer(_oUnoObject
)){
263 addUnoFacetteNode(_oParentNode
, XUnoFacetteNode
.SCONTAINERDESCRIPTION
, _oUnoObject
);
265 if (m_oIntrospector
.hasSupportedServices(_oUnoObject
)){
266 addUnoFacetteNode(_oParentNode
, XUnoFacetteNode
.SSERVICEDESCRIPTION
, _oUnoObject
);
271 private void addInterfacesToTreeNode(XUnoNode _oGrandParentNode
, Object _oUnoParentObject
, Type
[] _aTypes
) {
273 if (_oUnoParentObject
!= null){
274 for ( int m
= 0; m
< _aTypes
.length
; m
++ ) {
275 addUnoNode(_oGrandParentNode
, _oUnoParentObject
, _aTypes
[m
]);
279 catch( Exception exception
) {
280 exception
.printStackTrace(System
.err
);
284 // add all services for the given object to the tree under the node parent
285 private void addServicesToTreeNode(XUnoNode _oGrandParentNode
, Object _oUnoObject
) {
287 XServiceInfo xServiceInfo
= UnoRuntime
.queryInterface( XServiceInfo
.class, _oUnoObject
);
288 if ( xServiceInfo
!= null ){
289 String
[] sSupportedServiceNames
= xServiceInfo
.getSupportedServiceNames();
290 for ( int m
= 0; m
< sSupportedServiceNames
.length
; m
++ ) {
291 String sServiceName
= sSupportedServiceNames
[m
];
292 if (sServiceName
.length() > 0){
293 XUnoNode oUnoNode
= addUnoNode(_oGrandParentNode
, _oUnoObject
, sSupportedServiceNames
[m
]);
294 oUnoNode
.setNodeType(XUnoNode
.nSERVICE
);
299 catch(Exception exception
) {
300 exception
.printStackTrace(System
.err
);
304 private void addPropertiesAndInterfacesOfService(XUnoNode _oUnoServiceNode
){
305 String sServiceName
= _oUnoServiceNode
.getClassName();
306 Object oUnoObject
= _oUnoServiceNode
.getUnoObject();
307 addInterfacesToTreeNode(_oUnoServiceNode
, oUnoObject
, m_oIntrospector
.getInterfaces(oUnoObject
, sServiceName
));
308 addPropertiesToTreeNode(_oUnoServiceNode
, oUnoObject
, m_oIntrospector
.getProperties(oUnoObject
, sServiceName
));
312 private void addPropertiesToTreeNode(XUnoNode _oParentNode
, Object _oUnoParentObject
, Property
[] _aProperties
) {
314 if (_aProperties
.length
> 0){
315 for ( int n
= 0; n
< _aProperties
.length
; n
++ ){
316 Property aProperty
= _aProperties
[n
];
317 XIntrospectionAccess xIntrospectionAccess
= m_oIntrospector
.getXIntrospectionAccess(_oUnoParentObject
);
318 XPropertySet xPropertySet
= UnoRuntime
.queryInterface( XPropertySet
.class, xIntrospectionAccess
.queryAdapter(new Type( XPropertySet
.class)));
319 if (xPropertySet
!= null) {
320 if (xPropertySet
.getPropertySetInfo().hasPropertyByName(aProperty
.Name
)){
321 Object objectElement
= xPropertySet
.getPropertyValue(aProperty
.Name
);
322 if (objectElement
!= null) {
323 XUnoNode oChildNode
= m_xTreeControlProvider
.addUnoPropertyNode(_oUnoParentObject
, aProperty
, objectElement
);
324 if (oChildNode
!= null){
325 _oParentNode
.addChildNode(oChildNode
);
333 catch(Exception exception
) {
334 exception
.printStackTrace(System
.err
);
338 private void addContainerElementsToTreeNode(XUnoNode _oParentNode
, Object _oUnoParentObject
){
339 Object
[] oUnoContainerElements
= m_oIntrospector
.getUnoObjectsOfContainer(_oUnoParentObject
);
340 if (Introspector
.isValid(oUnoContainerElements
)){
341 if (oUnoContainerElements
.length
> 0){
342 for (int i
=0; i
< oUnoContainerElements
.length
; i
++){
343 XUnoNode oChildNode
= addUnoNode(_oParentNode
, oUnoContainerElements
[i
], UnoNode
.getNodeDescription(oUnoContainerElements
[i
]));
344 m_xTreeControlProvider
.nodeInserted(_oParentNode
, oChildNode
, _oParentNode
.getChildCount()-1);
351 private XUnoNode
addUnoNode(XUnoNode _oParentNode
, Object _oUnoObject
, String _sLabel
){
352 XUnoNode oUnoNode
= this.m_xTreeControlProvider
.addUnoNode(_oUnoObject
);
353 oUnoNode
.setLabel(_sLabel
);
354 if (_oParentNode
!= null){
355 _oParentNode
.addChildNode(oUnoNode
);
357 setNodeFoldable(oUnoNode
, _oUnoObject
);
362 private void setNodeFoldable(XUnoNode _oUnoNode
, Object _oUnoObject
){
363 if (_oUnoObject
!= null){
364 if (!Introspector
.isObjectPrimitive(_oUnoObject
)){
365 _oUnoNode
.setFoldable(true);
371 private XUnoNode
addUnoNode(XUnoNode _oParentNode
, Object _oUnoObject
, Type _aType
){
372 XUnoNode oUnoNode
= this.m_xTreeControlProvider
.addUnoNode(_oUnoObject
, _aType
);
373 if (_oParentNode
!= null){
374 _oParentNode
.addChildNode(oUnoNode
);
376 setNodeFoldable(oUnoNode
, _oUnoObject
);
381 private void addPropertySetInfoNodesToTreeNode(XUnoFacetteNode _oUnoFacetteNode
, Object _oUnoObject
){
382 if (_oUnoObject
.getClass().isArray()){
383 Object
[] object
= ( Object
[] ) _oUnoObject
;
384 for ( int i
= 0; i
< object
.length
; i
++ ) {
385 Property aProperty
= (Property
) object
[i
];
386 XUnoPropertyNode oUnoPropertyNode
= m_xTreeControlProvider
.addUnoPropertyNode(_oUnoObject
, aProperty
);
387 oUnoPropertyNode
.setLabel(XUnoFacetteNode
.SPROPERTYINFODESCRIPTION
+ " (" + aProperty
.Name
+ ")");
388 oUnoPropertyNode
.setFoldable(true);
389 _oUnoFacetteNode
.addChildNode(oUnoPropertyNode
);
394 private void addPrimitiveValuesToTreeNode(XUnoNode _oUnoNode
, Object _oUnoObject
){
395 if (_oUnoObject
.getClass().isArray()){
396 if (!_oUnoObject
.getClass().getComponentType().isPrimitive()){
397 Object
[] object
= ( Object
[] ) _oUnoObject
;
398 for ( int i
= 0; i
< object
.length
; i
++ ) {
399 if (Introspector
.isObjectPrimitive(object
[i
])){
400 addUnoNode(_oUnoNode
, null, UnoNode
.getNodeDescription(object
[i
]));
405 String
[] sDisplayValues
= UnoNode
.getDisplayValuesofPrimitiveArray(_oUnoObject
);
406 for ( int i
= 0; i
< sDisplayValues
.length
; i
++ ) {
407 addUnoNode(_oUnoNode
, null, sDisplayValues
[i
]);
414 private void addPropertySetInfoSubNodes(XUnoPropertyNode _oUnoPropertyNode
){
415 Property aProperty
= _oUnoPropertyNode
.getProperty();
416 _oUnoPropertyNode
.addChildNode(m_xTreeControlProvider
.addUnoPropertyNodeWithName(aProperty
));
417 _oUnoPropertyNode
.addChildNode(m_xTreeControlProvider
.addUnoPropertyNodeWithType(aProperty
));
418 _oUnoPropertyNode
.addChildNode(m_xTreeControlProvider
.addUnoPropertyNodeWithHandle(aProperty
));
419 _oUnoPropertyNode
.addChildNode(m_xTreeControlProvider
.addUnoPropertyNodeWithAttributesDescription(aProperty
));
423 private void addPropertyValueSubNodes(XUnoFacetteNode _oUnoFacetteNode
, Object _oUnoObject
){
424 if (Introspector
.isUnoPropertyValueTypeObject(_oUnoObject
)){
425 Object
[] object
= ( Object
[] ) _oUnoObject
;
426 for ( int i
= 0; i
< object
.length
; i
++ ) {
427 String sObjectClassName
= object
[i
].getClass().getName();
428 if (sObjectClassName
.equals("com.sun.star.beans.PropertyValue")){
429 XUnoNode oChildNode
= null;
430 PropertyValue aPropertyValue
= (PropertyValue
) object
[i
];
431 if (! Introspector
.isObjectPrimitive(aPropertyValue
.Value
)){
432 oChildNode
= m_xTreeControlProvider
.addUnoPropertyNode(_oUnoObject
, aPropertyValue
, _oUnoObject
);
435 oChildNode
= addUnoNode(null, aPropertyValue
.Value
, UnoPropertyNode
.getStandardPropertyValueDescription(aPropertyValue
));
437 if (oChildNode
!= null){
438 _oUnoFacetteNode
.addChildNode(oChildNode
);
446 public boolean expandNode(XUnoNode _oUnoNode
){
447 if ( _oUnoNode
!= null ) {
448 _oUnoNode
.setFoldable(false);
449 if (m_xTreeControlProvider
.isMethodNode(_oUnoNode
)){
450 XUnoMethodNode oUnoMethodNode
= (XUnoMethodNode
) _oUnoNode
;
451 if (!oUnoMethodNode
.isInvoked()){
452 Object oUnoReturnObject
= invoke((XUnoMethodNode
) _oUnoNode
);
453 if (oUnoReturnObject
== null){
454 _oUnoNode
.setFoldable(true);
459 else if (m_xTreeControlProvider
.isPropertyNode(_oUnoNode
)){
460 XUnoPropertyNode oUnoPropertyNode
= (XUnoPropertyNode
) _oUnoNode
;
461 Object oUnoObject
= oUnoPropertyNode
.getUnoReturnObject();
462 if (oUnoPropertyNode
.getPropertyNodeType() == XUnoPropertyNode
.nPROPERTYSETINFOTYPE
){
463 addPropertySetInfoSubNodes(oUnoPropertyNode
);
466 //TODO this code is redundant!!!
467 if ( oUnoObject
.getClass().isArray()){
468 // TODO probably we should provid a possibility to insert also non-primitive nodes
469 addPrimitiveValuesToTreeNode(oUnoPropertyNode
, oUnoObject
);
472 addFacetteNodesToTreeNode(oUnoPropertyNode
, oUnoObject
);
476 else if (m_xTreeControlProvider
.isFacetteNode(_oUnoNode
)){
477 XUnoFacetteNode oUnoFacetteNode
= (XUnoFacetteNode
) _oUnoNode
;
478 Object oUnoObject
= _oUnoNode
.getUnoObject();
479 if (oUnoFacetteNode
.isMethodNode()){
480 addMethodsToTreeNode(oUnoFacetteNode
, oUnoObject
, m_oIntrospector
.getMethods(oUnoObject
));
482 if (oUnoFacetteNode
.isPropertyNode()){
483 String sNodeDescription
= oUnoFacetteNode
.getLabel();
484 // TODO: it's very dangerous to distinguish the different UnoFacetteNodes only by the node description
485 if (sNodeDescription
.startsWith(XUnoFacetteNode
.SPROPERTYINFODESCRIPTION
)){
486 addPropertySetInfoNodesToTreeNode(oUnoFacetteNode
, oUnoObject
);
488 else if (sNodeDescription
.startsWith(XUnoFacetteNode
.SPROPERTYVALUEDESCRIPTION
)){
489 addPropertyValueSubNodes(oUnoFacetteNode
, oUnoObject
);
492 addPropertiesToTreeNode(oUnoFacetteNode
, oUnoObject
, m_oIntrospector
.getProperties(oUnoObject
));
495 if (oUnoFacetteNode
.isServiceNode()){
496 addServicesToTreeNode(oUnoFacetteNode
, oUnoObject
);
498 if (oUnoFacetteNode
.isInterfaceNode()){
499 addInterfacesToTreeNode(oUnoFacetteNode
, oUnoObject
, getTypes(oUnoObject
));
501 if (oUnoFacetteNode
.isContainerNode()){
502 addContainerElementsToTreeNode(oUnoFacetteNode
, oUnoObject
);
505 else if (_oUnoNode
.getNodeType() == XUnoNode
.nSERVICE
){
506 addPropertiesAndInterfacesOfService(_oUnoNode
);
508 else if (_oUnoNode
.getNodeType() == XUnoNode
.nINTERFACE
){
509 Type aType
= _oUnoNode
.getUnoType();
511 addMethodsToTreeNode(_oUnoNode
, _oUnoNode
.getUnoObject(), m_oIntrospector
.getMethodsOfInterface(aType
));
514 else if (_oUnoNode
.getNodeType() == XUnoNode
.nOTHERS
){
515 Object oUnoObject
= _oUnoNode
.getUnoObject();
516 if ( oUnoObject
.getClass().isArray()){
517 // TODO probably we should provid a possibility to insert also non-primitive nodes
518 addPrimitiveValuesToTreeNode(_oUnoNode
, oUnoObject
);
521 addFacetteNodesToTreeNode(_oUnoNode
, oUnoObject
);
530 public void applyFilter(XUnoFacetteNode _oUnoFacetteNode
, String _sFilter
){
531 for (int i
= 0; i
< _oUnoFacetteNode
.getChildCount(); i
++){
532 XUnoNode oUnoNode
= _oUnoFacetteNode
.getChild(i
);
533 boolean bIsVisible
= oUnoNode
.isFilterApplicable(_sFilter
);
534 m_xTreeControlProvider
.setNodeVisible(oUnoNode
, bIsVisible
);
536 _oUnoFacetteNode
.setFilter(_sFilter
);
540 public String
getFilter(XUnoNode _oUnoNode
){
542 if (_oUnoNode
!= null){
543 XUnoNode oUnoNode
= _oUnoNode
;
544 boolean bleaveLoop
= false;
546 if (m_xTreeControlProvider
.isFacetteNode(oUnoNode
)){
547 sFilter
= ((XUnoFacetteNode
) oUnoNode
).getFilter();
551 if (oUnoNode
.getParentNode() != null){
552 oUnoNode
= oUnoNode
.getParentNode();
558 } while(!bleaveLoop
);
564 public void showPopUpMenu(Object _invoker
, int x
, int y
) throws ClassCastException
{
565 XUnoNode oUnoNode
= getSelectedNode();
566 boolean bdoEnableInvoke
= oUnoNode
instanceof XUnoMethodNode
;
567 if (bdoEnableInvoke
){
568 XUnoMethodNode oUnoMethodNode
= (XUnoMethodNode
) oUnoNode
;
569 bdoEnableInvoke
= oUnoMethodNode
.isInvokable();
571 m_xDialogProvider
.enablePopupMenuItem(XDialogProvider
.SINVOKE
, bdoEnableInvoke
);
572 m_xDialogProvider
.showPopUpMenu(_invoker
, x
, y
);