Initial Commit
[packages] / xemacs-packages / jde / java / src / jde / debugger / command / GetString.java
1 package jde.debugger.command;
2
3 import com.sun.jdi.ObjectReference;
4 import com.sun.jdi.StringReference;
5 import jde.debugger.Etc;
6 import jde.debugger.JDEException;
7 import jde.debugger.Rep;
8
9
10
11 /**
12  * 'get_string' command. Returns the value of a string
13  * <p>
14  *
15  * <b>Syntax:</b>
16  * <pre>
17  * get_string objectID 
18  * </pre>
19  *
20  * <b>Returns:</b>
21  * <pre>
22  * (jde-dbo-command-result cmd_id {@link Rep#getStringRep(StringReference) string-representation})
23  * </pre>
24  *
25  * Copyright (c) 2000, 2001, 2003    Paul Kinnucan
26  * 
27  * @author Paul Kinnucan
28  * @version $Revision: 1.3 $
29  */
30 public class GetString extends DebugProcessCommand {
31   
32   /**
33    *
34    * @exception jde.debugger.JDEException <description>
35    */
36   public void doCommand() throws JDEException {
37  
38     if (m_args.size() < 1)
39       throw new JDEException("Insufficient arguments");
40
41     Long            uniqueID = Etc.safeGetLong(m_args.remove(0), "object ID");
42     ObjectReference oRef     = m_debugger.getStore().get(uniqueID);
43             
44     if (oRef == null) {
45       throw new JDEException("No such object exists");
46     } else if (!(oRef instanceof StringReference)) {
47       throw new JDEException("Object is not a string");
48     }
49         
50     m_debugger.signalCommandResult(m_cmdID, Rep.getStringRep((StringReference)oRef), CMD_OK, NOQUOTE);
51   }
52     
53   public Object clone() {return new GetString();}
54   
55 } // Run
56
57 /*
58  * $Log: GetString.java,v $
59  * Revision 1.3  2003/01/15 05:56:26  paulk
60  * Add Petter Mahlen's changes.
61  *
62  * Revision 1.2  2001/03/24 05:42:36  paulk
63  * Updated to reflect reorganization of debugger code.
64  *
65  * Revision 1.1  2000/03/03 07:10:29  paulk
66  * Initial revision.
67  *
68  */
69
70 // End of GetString.java