Code covered by the BSD License  

Highlights from
UIINSPECT - display methods-properties-callbacks of an object

5.0

5.0 | 7 ratings Rate this file 85 Downloads (last 30 days) File Size: 30.09 KB File ID: #17935
image thumbnail

UIINSPECT - display methods-properties-callbacks of an object

by Yair Altman

 

08 Dec 2007 (Updated 08 Dec 2011)

Inspect an object handle (Java/COM/HG); display its methods/properties/callbacks in a unified window

| Watch this File

File Information
Description

Syntax:
hFig = uiinspect(obj)
 
Description:
UIINSPECT inspects an object handle (e.g., Java, COM, Handle Graphics, Matlab class, Dot-Net etc.) and displays the inspection results in a unified Matlab window. UIINSPECT displays a unified window with all relevant object methods (as can be displayed via Matlab's methodsview function), properties (as can be displayed via Matlab's inspect function), static fields, and callbacks. UIINSPECT also displays properties and fields that are not normally displayed with Matlab's inspect function. Property meta-data such as type, accessibility, visibility and default value are also displayed.

Unlike Matlab's inspect function, multiple UIINSPECT windows can be opened simultaneously.
 
Object properties and callbacks may be modified interactively within the UIINSPECT window.
 
hFig = UIINSPECT returns a handle to the created figure window. UIINSPECT opens a regular Matlab figure window which may be accessed via hFig (unlike Matlab's methodsview function which opens a Java frame that is not easily accessible from Matlab).
 
Examples:
hFig = uiinspect(0);
hFig = uiinspect(handle(0));
hFig = uiinspect(gcf);
hFig = uiinspect(handle(gcf));
uiinspect(get(gcf,'JavaFrame'));
uiinspect(classhandle(handle(gcf)));
uiinspect(findprop(handle(gcf),'MenuBar'));
uiinspect('java.lang.String');
uiinspect(java.lang.String('yes'));
uiinspect(actxserver('Excel.Application'));
uiinspect(Employee) % a Matlab class object
uiinspect(?handle) % a Matlab metaclass object
uiinspect('meta.class') % a Matlab class name
uiinspect(System.Diagnostics.Process.GetCurrentProcess) % a .Net object

Warning:
This code heavily relies on undocumented and unsupported Matlab functionality. It works on Matlab 7.1 and later releases, but use at your own risk!

Bugs and suggestions:
Please send to Yair Altman (altmany at gmail dot com)

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
FindJObj - find java handles of Matlab graphic objects
This submission has inspired the following:
checkClass, convert objects to string, FindJObj - find java handles of Matlab graphic objects

MATLAB release MATLAB 7.4 (R2007a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (14)
12 Jun 2008 Brandon Baker

I love this program! What a nice way to ease myself into COM objects! Thank you for this excellent applications.

12 Jun 2008 Brandon Baker

"Thank you for this excellent application" is what I meant to say.

27 Mar 2009 Matthias Höller

Thanks for this very useful and sophisticated tool! Works great even with Java objects

01 May 2009 Darik

what are the chances this could be extended to work with custom handle objects, i.e. classes that inherit from handle?

18 Jan 2010 Yair Altman

For anyone interested, UIInspect now supports:
- Handle Graphics (GUI) objects
- Matlab class objects (e.g., memmapfile)
- Custom (user-defined) class objects
- Java objects
- COM (ActiveX or server) objects

09 Feb 2010 wma  
29 Mar 2010 Yuri Kotliarov  
19 Oct 2010 Andrew Stamps

To follow up my rating, I wanted to say that I have found this to be a very useful tool. However, I think I found a small bug: On line 773 where it is attempting to get property values to display the code currently reads:

if strcmpi(mp.SetAccess,'public')

For this to make sense, I believe it really should be:

if strcmpi(mp.GetAccess,'public')

19 Oct 2010 Yair Altman

thanks Andrew - this will be fixed in the next update

21 Mar 2011 Paul Andrews

Simply excellent. Thanks Yair

23 Mar 2011 Martin Lechner  
03 Aug 2011 Changshun Deng

error:

hFig = uiinspect(0); % root (desktop)
??? uiinspect: Conversion to double from javahandle_withcallbacks.com.mathworks.hg.peer.UITreePeer is not possible.

Error in ==> uiinspect>getHandleTree at 1227
          setappdata(tree_h, 'userdata',userdata);

Error in ==> uiinspect>getMethodsPane at 1162
          paneContents = getHandleTree(obj);

Error in ==> uiinspect>displayObj at 318
      [methodsPane, hgFlag] = getMethodsPane(objMethods, obj);

Error in ==> uiinspect at 124
      fig = displayObj(obj, objMethods, objProps, objCallbacks, objChildren, inputname(1), fig);

17 Aug 2011 Yair Altman

@Deng - I am not seeing the error that you reported. Please ensure that you are using the latest version of uiinspect. If you are using the latest version, please specify your system configuration as reported by the Matlab ver command.

26 Sep 2011 Henrik Toft

I get following error when I try to use "uiinspect" in MATLAB R2011a. I have JUST downloaded the latest version on this page.

>> hFig = uiinspect(gcf);
Warning: Possible deprecated use of set on a Java object with an HG Property 'MousePressedCallback'.
> In uiinspect>getHandleTree at 1094
  In uiinspect>getMethodsPane at 1023
  In uiinspect>displayObj at 306
  In uiinspect at 112
Warning: Possible deprecated use of set on a Java object with an HG Property 'MouseMovedCallback'.
> In uiinspect>getHandleTree at 1095
  In uiinspect>getMethodsPane at 1023
  In uiinspect>displayObj at 306
  In uiinspect at 112
Warning: Possible deprecated use of set on a Java object with an HG Property 'UserData'.
> In uiinspect>getCbsPane at 895
  In uiinspect>displayObj at 307
  In uiinspect at 112
??? uiinspect: Java exception occurred:
java.lang.ArrayIndexOutOfBoundsException: No such child: 0

at java.awt.Container.getComponent(Unknown Source)

Error in ==> uiinspect>getPropsPane at 446
          inspectorTable = inspectorTable.getComponent(0);

Error in ==> uiinspect>displayObj at 308
      [propsPane, inspectorTable] = getPropsPane(objProps);

Error in ==> uiinspect at 112
      fig = displayObj(obj, objMethods, objProps, objCallbacks, objChildren, inputname(1), fig);
 
>>
>> ver
-------------------------------------------------------------------------------------
MATLAB Version 7.12.0.635 (R2011a)
MATLAB License Number: ******
Operating System: Microsoft Windows 7 Version 6.1 (Build 7601: Service Pack 1)
Java VM Version: Java 1.6.0_17-b04 with Sun Microsystems Inc. Java HotSpot(TM) Client VM mixed mode
-------------------------------------------------------------------------------------
MATLAB Version 7.12 (R2011a)
Neural Network Toolbox Version 7.0.1 (R2011a)
Statistics Toolbox Version 7.5 (R2011a)
>>

Cheers,
Henrik

Please login to add a comment or rating.
Updates
25 Jan 2008

Fixes for many edge-cases

05 Mar 2009

Fixed single property edge-case; fixed prop name case sensitivity problem; fixed properties tooltip; now accepts class names - not just object handles; added display of class interfaces & static fields

30 Mar 2009

Added Extra method details checkbox (default=off); auto-hide inspectable checkbox if irrelevant; auto-sort methods by args list; hyperlinked classes; fixed title for classname inputs

16 Apr 2009

Fixed case of no methods (e.g., uimenus); fixed superclass/interfaces of classname input; auto-hide callbacks pane if no CBs are available; fixed occasional endless loop upon callback update error

03 May 2009

Fixed setting callbacks on non-handle('CallbackProperties')ed Java objects; fixed input param edge-case; hyperlinked the className to Sun's javadocs where relevant; auto-checked newer version; removed figure main menu

19 May 2009

Improved information display for HG handles; added HG-handle screenshot to animated gif (added to COM and Java screenshots); enabled reuse of uiinspect window

26 May 2009

Added support for Matlab classes (helped by Darik Gamble); improved display for classname input; fixed methods info gathering for some handles

16 Jan 2010

Added CaretPositionChanged & InputMethodTextChanged to list of standard callbacks; minor fix to requesting focus of Java handles; minor fix to version-check display; fixed a few bugs in properties meta-info of Matlab classes

16 Mar 2010

Fixes for R2010a

11 Jun 2010

Displayed class modifiers; improved performance; removed empty panels by default; fixed warning msgs when sorting props table; fixes for R2010b

12 Jun 2010

Displayed class modifiers; improved performance; removed empty panels by default; fixed warning msgs when sorting props table; fixes for R2010b; fixed download (m-file => zip-file)

20 Oct 2010

Minor fix suggested by Andrew Stamps; added automatic callbacks grouping

01 Nov 2010

Major fix for pre-R2010 compatibility

02 Nov 2010

Major fix for pre-R2010 compatibility

28 Feb 2011

Removed R2010b warning messages; minor fix for Dot-Net classes; minor fixes for callbacks table; fixed online docpage for Java Swing classes

03 Mar 2011

Fixed several issues in the Value field of the "Other properties" table

08 Dec 2011

Fixed R2011b crash when inspecting COM; fixed problems with Value field in "Other properties" table of static fields; fixed display of non-static Java fields; fixed display of some cases of Java class names; minor fixes for Matlab class properties

Tag Activity for this File
Tag Applied By Date/Time
gui tools Yair Altman 22 Oct 2008 09:38:33
example Yair Altman 22 Oct 2008 09:38:33
java Yair Altman 22 Oct 2008 09:38:33
com Yair Altman 22 Oct 2008 09:38:33
object Yair Altman 22 Oct 2008 09:38:33
handle Yair Altman 22 Oct 2008 09:38:33
gui Yair Altman 22 Oct 2008 09:38:33
inspect Yair Altman 22 Oct 2008 09:38:33
undocumented Yair Altman 06 Mar 2009 09:57:29
example wang 21 Apr 2009 08:42:51
com lu jia 01 Nov 2010 04:47:20
com laivan qui 22 Jan 2011 05:25:11

Contact us at files@mathworks.com