Initial Commit
[packages] / xemacs-packages / jde / java / src / jde / debugger / command / GetObject.java
1 package jde.debugger.command;
2
3 import java.util.Iterator;
4 import java.util.Map;
5
6 import com.sun.jdi.ObjectReference;
7 import com.sun.jdi.Value;
8 import jde.debugger.Etc;
9 import jde.debugger.JDEException;
10 import jde.debugger.Rep;
11
12
13 /**
14  * 'get_object' command. Information about a particular object.
15  * <p>
16  *
17  * <b>Syntax:</b>
18  * <pre>
19  * get_object objectID
20  * </pre>
21  *
22  * <b>Returns:</b>
23  * <pre>
24  * (jde-dbo-command-result cmd_id {@link Rep#getObjectRep(ObjectReference) detailed-object-info})
25  * </pre>
26  *
27  * Copyright (c) 2000, 2001, 2003    Paul Kinnucan
28  *
29  * @author Paul Kinnucan
30  * @version $Revision: 1.3 $
31  *
32  */
33 public class GetObject extends DebugProcessCommand {
34
35   /**
36    *
37    * @exception jde.debugger.JDEException <description>
38    */
39   public void doCommand() throws JDEException {
40
41     if (m_args.size() < 1)
42       throw new JDEException("Insufficient arguments");
43
44     Long            uniqueID = Etc.safeGetLong(m_args.remove(0), "object ID");
45     ObjectReference oRef     = m_debugger.getStore().get(uniqueID);
46
47     if (oRef == null)
48       throw new JDEException("No such object exists");
49
50     // store the fields in this object that themselves are objects in the
51     // ObjectStore, since the user may query for more information about those.
52     Map  fieldValues = oRef.getValues(oRef.referenceType().visibleFields());
53
54     Iterator iter = fieldValues.values().iterator();
55     while (iter.hasNext()) {
56       Value value = (Value) iter.next();
57
58       if (value instanceof ObjectReference) {
59         m_debugger.getStore().put((ObjectReference) value);
60       }
61     }
62
63     m_debugger.signalCommandResult(m_cmdID,
64                                    Rep.getObjectRep(oRef, true),
65                                    CMD_OK);
66   }
67
68   public Object clone() {return new GetObject();}
69
70 } // GetObject
71
72 /*
73  * $Log: GetObject.java,v $
74  * Revision 1.3  2003/04/29 16:52:10  troy
75  * Initial version of GUI.  Includes display of local variables.
76  *
77  * Revision 1.2  2003/01/15 05:56:26  paulk
78  * Add Petter Mahlen's changes.
79  *
80  * Revision 1.1  2001/03/24 05:52:13  paulk
81  * Initial version.
82  *
83  *
84  */
85
86 // End of Finish.java