private String fAddress;
private String fIdeKey;
- public synchronized void setParentNode(String xmlInput) {
+ public XDebugResponse(String XMLInput) {
+ fTransactionID = -1;
+ fCommand = "";
+ fStatus = "";
+ fReason = "";
+ fName= "";
+ setParentNode(XMLInput);
+ }
+
+ /*public*/private synchronized void setParentNode(String xmlInput) {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = null;
Document doc = null;
int code = Integer.parseInt(PHPDebugUtils.getAttributeValue(child, "code"));
String text = (child.getFirstChild()).getNodeValue();
XDebugCorePlugin.log(IStatus.ERROR," ERROR "+code+": "+text);
- setError(true);
+ fError = true;
return;
}
}
- setError(false);
+ fError = false;
fStatus = getAttributeValue("status");
fReason = getAttributeValue("reason");
if( firstChild1 != null ) {
fValue = firstChild1.getNodeValue();
+ } else {
+ fValue = "";
}
} catch (Exception e) {
// TODO: handle exception
return parentNode;
}
- public synchronized String getIdeKey(){
- return fIdeKey;
- }
-
- public synchronized String getCommand() {
+ /*public*/private synchronized String getCommand() {
return fCommand;
}
- public synchronized String getName() {
+ /*public*/private synchronized String getName() {
return fName;
}
return fValue;
}
- public synchronized String getType() {
- return fType;
- }
-
- public synchronized String getAddress() {
- return fAddress;
- }
-
- public XDebugResponse(String XMLInput) {
- setParentNode(XMLInput);
- }
-
public synchronized String getReason() {
return fReason;
}
return fTransactionID;
}
- public boolean isError() {
+ public boolean isError() {
return fError;
}
-
- public void setError(boolean error) {
- fError = error;
- }
-
- XDebugResponse() {
- fTransactionID = -1;
- fCommand = "";
- fStatus = "";
- fReason = "";
- fName= "";
- }
}
+
private XDebugConnection fConnection;
- private XDebugResponse lastResponse;
-
+ private ResponseList fResponseList;
+
public ResponseListener(XDebugConnection connection) {
super("XDebug Event Dispatch");
setSystem(true);
fConnection = connection;
- lastResponse = new XDebugResponse();
fResponseList = new ResponseList();
}
private void checkResponse(XDebugResponse response) {
- Node node = response.getParentNode();
- if (node.hasChildNodes()) {
- Node child = node.getFirstChild();
- if (child.getNodeName().equals("error")) {
- int code = Integer.parseInt(PHPDebugUtils.getAttributeValue(child, "code"));
- String text=(child.getFirstChild()).getNodeValue();
- XDebugCorePlugin.log(IStatus.ERROR," ERROR "+code+": "+text);
- lastResponse.setError(true);
- return;
- }
- }
- lastResponse.setError(false);
if (response.getStatus().equals("stopping") || response.getStatus().equals("stopped")) {
this.cancel();
- fireEvent(IPHPDebugEvent.STOPPED);
+ fireEvent(IPHPDebugEvent.STOPPED, null);
} else if (response.getStatus().equals("break") && response.getReason().equals("ok")){
if (response.getCommand().equals("run")) {
fireEvent(IPHPDebugEvent.BREAKPOINT_HIT, null);
} else if (response.getCommand().equals("step_into")) {
- fireEvent(IPHPDebugEvent.STEP_END);
+ fireEvent(IPHPDebugEvent.STEP_END, null);
} else if (response.getCommand().equals("step_over")) {
- fireEvent(IPHPDebugEvent.STEP_END);
+ fireEvent(IPHPDebugEvent.STEP_END, null);
} else if (response.getCommand().equals("step_out")) {
- fireEvent(IPHPDebugEvent.STEP_END);
+ fireEvent(IPHPDebugEvent.STEP_END, null);
}
}
}
- protected void fireEvent(int detail) {
- DebugEvent event = new DebugEvent(this, DebugEvent.MODEL_SPECIFIC, detail);
- DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] {event});
- }
-
- protected void fireEvent(int detail, Object data) {
+ private void fireEvent(int detail, Object data) {
DebugEvent event = new DebugEvent(this, DebugEvent.MODEL_SPECIFIC, detail);
event.setData(data);
DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] {event});
*/
protected IStatus run(IProgressMonitor monitor) {
String InputXML = "";
- while (!fConnection.isClosed() && (InputXML != null)) {
+ while (!fConnection.isClosed()) {
if (!monitor.isCanceled()) {
try {
- if(!fConnection.isClosed()) {
InputXML = fConnection.readData();
- }
} catch (Exception e) {
; //
}
if (InputXML != null) {
XDebugCorePlugin.log(IStatus.INFO, InputXML);
- lastResponse.setParentNode(InputXML);
- if (lastResponse.getName() == "response") {
- addResponse(lastResponse, lastResponse.getTransactionID());
- checkResponse(lastResponse);
+ XDebugResponse response = new XDebugResponse(InputXML);
+ if (response.getName() == "response") {
+ fResponseList.add(response);
+ checkResponse(response);
}
}
}
}
return Status.OK_STATUS;
}
- private ResponseList fResponseList;
-
- protected void addResponse(XDebugResponse response, int id) {
- fResponseList.add(response, id);
- }
-
+
public XDebugResponse getResponse(int id) {
return fResponseList.get(id);
}