Permalink
Browse files

update doc, clean up code

  • Loading branch information...
1 parent af65ccd commit 1f20311d3b761670174757dbe6ac11677ac631fa mrennie committed Mar 4, 2010
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -16,6 +16,7 @@
import org.eclipse.wst.jsdt.debug.core.jsdi.ThreadReference;
import org.eclipse.wst.jsdt.debug.core.jsdi.VirtualMachine;
import org.eclipse.wst.jsdt.debug.core.jsdi.request.BreakpointRequest;
+import org.eclipse.wst.jsdt.debug.internal.rhino.RhinoDebugPlugin;
import org.eclipse.wst.jsdt.debug.internal.rhino.jsdi.ScriptReferenceImpl;
import org.eclipse.wst.jsdt.debug.internal.rhino.jsdi.VirtualMachineImpl;
import org.eclipse.wst.jsdt.debug.rhino.transport.JSONConstants;
@@ -48,10 +49,8 @@ public BreakpointRequestImpl(VirtualMachineImpl vm, Location location) {
this.location = location;
}
- /*
- * (non-Javadoc)
- *
- * @seeorg.eclipse.e4.languages.javascript.jsdi.request.BreakpointRequest# addThreadFilter(org.eclipse.e4.languages.javascript.jsdi.ThreadReference)
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.jsdt.debug.core.jsdi.request.BreakpointRequest#addThreadFilter(org.eclipse.wst.jsdt.debug.core.jsdi.ThreadReference)
*/
public synchronized void addThreadFilter(ThreadReference thread) {
checkDeleted();
@@ -67,20 +66,16 @@ public synchronized ThreadReference thread() {
return this.thread;
}
- /*
- * (non-Javadoc)
- *
- * @seeorg.eclipse.e4.languages.javascript.jsdi.request.BreakpointRequest# addConditionFilter(java.lang.String)
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.jsdt.debug.core.jsdi.request.BreakpointRequest#addConditionFilter(java.lang.String)
*/
public synchronized void addConditionFilter(String condition) {
checkDeleted();
this.condition = condition;
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.e4.languages.javascript.jsdi.request.BreakpointRequest#addHitCountFilter(int)
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.jsdt.debug.core.jsdi.request.BreakpointRequest#addHitCountFilter(int)
*/
public void addHitCountFilter(int hitcount) {
checkDeleted();
@@ -105,56 +100,50 @@ public synchronized int hitcount() {
return this.hitcount;
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.e4.languages.javascript.jsdi.request.BreakpointRequest#location ()
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.jsdt.debug.core.jsdi.Locatable#location()
*/
public Location location() {
return this.location;
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.e4.languages.javascript.rhino.jsdi.request.EventRequestImpl #setEnabled(boolean)
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.jsdt.debug.internal.rhino.jsdi.request.EventRequestImpl#setEnabled(boolean)
*/
public synchronized void setEnabled(boolean enabled) {
checkDeleted();
- if (this.enabled == enabled)
+ if (this.enabled == enabled) {
return;
-
+ }
if (enabled) {
ScriptReferenceImpl scriptReferenceImpl = (ScriptReferenceImpl) this.location.scriptReference();
Long scriptId = scriptReferenceImpl.getScriptId();
-
Request request = new Request(JSONConstants.SETBREAKPOINT);
request.getArguments().put(JSONConstants.SCRIPT_ID, scriptId);
request.getArguments().put(JSONConstants.CONDITION, this.condition);
- if (this.location.functionName() != null)
+ if (this.location.functionName() != null) {
request.getArguments().put(JSONConstants.FUNCTION, this.location.functionName());
- else
+ }
+ else{
request.getArguments().put(JSONConstants.LINE, new Integer(this.location.lineNumber()));
+ }
try {
Response response = this.vm.sendRequest(request);
Map body = (Map) response.getBody().get(JSONConstants.BREAKPOINT);
Number id = (Number) body.get(JSONConstants.BREAKPOINT_ID);
this.breakpointId = new Long(id.longValue());
} catch (TimeoutException e) {
- // TODO log this
- e.printStackTrace();
+ RhinoDebugPlugin.log(e);
} catch (DisconnectedException e) {
- // TODO log this
- e.printStackTrace();
+ RhinoDebugPlugin.log(e);
}
} else {
Request request = new Request(JSONConstants.CLEARBREAKPOINT);
request.getArguments().put(JSONConstants.BREAKPOINT_ID, breakpointId);
try {
vm.sendRequest(request);
} catch (TimeoutException e) {
- // TODO log this
- e.printStackTrace();
+ RhinoDebugPlugin.log(e);
} catch (DisconnectedException e) {
// ignore
}
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,25 +14,44 @@
import org.eclipse.wst.jsdt.debug.core.jsdi.request.DebuggerStatementRequest;
import org.eclipse.wst.jsdt.debug.internal.rhino.jsdi.VirtualMachineImpl;
+/**
+ * Rhino implementation of {@link DebuggerStatementRequest}
+ *
+ * @since 1.0
+ */
public class DebuggerStatementRequestImpl extends EventRequestImpl implements DebuggerStatementRequest {
private ThreadReference thread;
+ /**
+ * Constructor
+ * @param vm
+ */
public DebuggerStatementRequestImpl(VirtualMachineImpl vm) {
super(vm);
}
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.jsdt.debug.core.jsdi.request.DebuggerStatementRequest#addThreadFilter(org.eclipse.wst.jsdt.debug.core.jsdi.ThreadReference)
+ */
public synchronized void addThreadFilter(ThreadReference thread) {
checkDeleted();
this.thread = thread;
}
+ /**
+ * The underlying {@link ThreadReference}
+ * @return the underlying {@link ThreadReference}
+ */
public synchronized ThreadReference thread() {
return thread;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.jsdt.debug.internal.rhino.jsdi.request.EventRequestImpl#setEnabled(boolean)
+ */
public synchronized void setEnabled(boolean enabled) {
checkDeleted();
this.enabled = enabled;
}
-}
+}
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -25,29 +25,49 @@
protected boolean enabled = false;
protected final VirtualMachineImpl vm;
+ /**
+ * Constructor
+ * @param vm
+ */
public EventRequestImpl(VirtualMachineImpl vm) {
this.vm = vm;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.jsdt.debug.core.jsdi.request.EventRequest#isEnabled()
+ */
public synchronized boolean isEnabled() {
return enabled;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.jsdt.debug.core.jsdi.request.EventRequest#setEnabled(boolean)
+ */
public synchronized void setEnabled(boolean enabled) {
checkDeleted();
this.enabled = enabled;
}
- protected void checkDeleted() {
+ /**
+ * If the delete flag is set throw an {@link IllegalStateException}
+ * @throws IllegalStateException
+ */
+ protected void checkDeleted() throws IllegalStateException {
if (deleted) {
throw new IllegalStateException("deleted"); //$NON-NLS-1$
}
}
-
+
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.jsdt.debug.core.jsdi.Mirror#virtualMachine()
+ */
public VirtualMachine virtualMachine() {
return vm;
}
+ /**
+ * delete the request by setting it disabled and setting the delet flag
+ */
public synchronized void delete() {
setEnabled(false);
deleted = true;
@@ -61,8 +61,7 @@
public EventRequestManagerImpl(VirtualMachineImpl vm) {
this.vm = vm;
eventsMap.put(BreakpointRequestImpl.class, breakpointRequests);
- eventsMap.put(DebuggerStatementRequestImpl.class,
- debuggerStatementRequests);
+ eventsMap.put(DebuggerStatementRequestImpl.class, debuggerStatementRequests);
eventsMap.put(ExceptionRequestImpl.class, exceptionRequests);
eventsMap.put(ScriptLoadRequestImpl.class, scriptLoadRequests);
eventsMap.put(StepRequestImpl.class, stepRequests);
@@ -211,7 +210,6 @@ public synchronized void deleteEventRequest(EventRequest eventRequest) {
throw new IllegalArgumentException(
"bad event request class - " + clazz.getName()); //$NON-NLS-1$
}
-
eventList.remove(eventRequest);
EventRequestImpl eventRequestImpl = (EventRequestImpl) eventRequest;
eventRequestImpl.delete();
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,20 +14,36 @@
import org.eclipse.wst.jsdt.debug.core.jsdi.request.ExceptionRequest;
import org.eclipse.wst.jsdt.debug.internal.rhino.jsdi.VirtualMachineImpl;
+/**
+ * Rhino implementation of {@link ExceptionRequest}
+ *
+ * @since 1.0
+ */
public class ExceptionRequestImpl extends EventRequestImpl implements ExceptionRequest {
private ThreadReference thread;
+ /**
+ * Constructor
+ * @param vm
+ */
public ExceptionRequestImpl(VirtualMachineImpl vm) {
super(vm);
}
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.jsdt.debug.core.jsdi.request.ExceptionRequest#addThreadFilter(org.eclipse.wst.jsdt.debug.core.jsdi.ThreadReference)
+ */
public synchronized void addThreadFilter(ThreadReference thread) {
checkDeleted();
this.thread = thread;
}
+ /**
+ * The underlying {@link ThreadReference}
+ * @return the underlying {@link ThreadReference}
+ */
public synchronized ThreadReference thread() {
return thread;
}
-}
+}
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -13,9 +13,18 @@
import org.eclipse.wst.jsdt.debug.core.jsdi.request.ScriptLoadRequest;
import org.eclipse.wst.jsdt.debug.internal.rhino.jsdi.VirtualMachineImpl;
+/**
+ * Rhino implementation of {@link ScriptLoadRequest}
+ *
+ * @since 1.0
+ */
public class ScriptLoadRequestImpl extends EventRequestImpl implements ScriptLoadRequest {
+ /**
+ * Constructor
+ * @param vm
+ */
public ScriptLoadRequestImpl(VirtualMachineImpl vm) {
super(vm);
}
-}
+}
Oops, something went wrong.

0 comments on commit 1f20311

Please sign in to comment.