|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| Step.java | 0% | 0% | 0% | 0% |
|
||||||||||||||
| 1 | /*BEGIN_COPYRIGHT_BLOCK | |
| 2 | * | |
| 3 | * Copyright (c) 2001-2010, JavaPLT group at Rice University (drjava@rice.edu) | |
| 4 | * All rights reserved. | |
| 5 | * | |
| 6 | * Redistribution and use in source and binary forms, with or without | |
| 7 | * modification, are permitted provided that the following conditions are met: | |
| 8 | * * Redistributions of source code must retain the above copyright | |
| 9 | * notice, this list of conditions and the following disclaimer. | |
| 10 | * * Redistributions in binary form must reproduce the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer in the | |
| 12 | * documentation and/or other materials provided with the distribution. | |
| 13 | * * Neither the names of DrJava, the JavaPLT group, Rice University, nor the | |
| 14 | * names of its contributors may be used to endorse or promote products | |
| 15 | * derived from this software without specific prior written permission. | |
| 16 | * | |
| 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 18 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 19 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 20 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | |
| 21 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
| 22 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 23 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
| 24 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
| 25 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
| 26 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
| 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 28 | * | |
| 29 | * This software is Open Source Initiative approved Open Source Software. | |
| 30 | * Open Source Initative Approved is a trademark of the Open Source Initiative. | |
| 31 | * | |
| 32 | * This file is part of DrJava. Download the current version of this project | |
| 33 | * from http://www.drjava.org/ or http://sourceforge.net/projects/drjava/ | |
| 34 | * | |
| 35 | * END_COPYRIGHT_BLOCK*/ | |
| 36 | ||
| 37 | package edu.rice.cs.drjava.model.debug.jpda; | |
| 38 | ||
| 39 | import edu.rice.cs.drjava.DrJava; | |
| 40 | import edu.rice.cs.drjava.config.OptionConstants; | |
| 41 | import edu.rice.cs.drjava.model.debug.DebugException; | |
| 42 | ||
| 43 | import java.util.StringTokenizer; | |
| 44 | ||
| 45 | import com.sun.jdi.*; | |
| 46 | import com.sun.jdi.request.*; | |
| 47 | ||
| 48 | /** The breakpoint object which has references to its OpenDefinitionsDocument and its StepRequest */ | |
| 49 | public class Step extends DebugAction<StepRequest> implements OptionConstants { | |
| 50 | private final ThreadReference _thread; | |
| 51 | private final int _size; | |
| 52 | private final int _depth; | |
| 53 | ||
| 54 | // Java class patterns for which we may not want events | |
| 55 | private final String[] _javaExcludes = {"java.*", "javax.*", "sun.*", "com.sun.*", "com.apple.eawt.*", "com.apple.eio.*" }; | |
| 56 | ||
| 57 | /** @throws IllegalStateException if the document does not have a file */ | |
| 58 | 0 | public Step(JPDADebugger manager, int size, int depth) |
| 59 | throws DebugException, IllegalStateException { | |
| 60 | 0 | super (manager); |
| 61 | 0 | _suspendPolicy = EventRequest.SUSPEND_EVENT_THREAD; |
| 62 | 0 | _thread = _manager.getCurrentThread(); |
| 63 | 0 | _size = size; |
| 64 | 0 | _depth = depth; |
| 65 | 0 | _countFilter = 1; //only step once. |
| 66 | 0 | _initializeRequests(); |
| 67 | } | |
| 68 | ||
| 69 | //public boolean createRequest(ReferenceType rt) throws DebugException { | |
| 70 | // return false; | |
| 71 | //} | |
| 72 | ||
| 73 | /** Creates an appropriate EventRequest from the EventRequestManager and | |
| 74 | * stores it in the _request field. | |
| 75 | * @throws DebugException if the request could not be created. | |
| 76 | */ | |
| 77 | 0 | protected void _createRequests() throws DebugException { |
| 78 | 0 | boolean stepJava = DrJava.getConfig().getSetting(DEBUG_STEP_JAVA).booleanValue(); |
| 79 | 0 | boolean stepInterpreter = DrJava.getConfig().getSetting(DEBUG_STEP_INTERPRETER).booleanValue(); |
| 80 | 0 | boolean stepDrJava = DrJava.getConfig().getSetting(DEBUG_STEP_DRJAVA).booleanValue(); |
| 81 | ||
| 82 | 0 | StepRequest request = _manager.getEventRequestManager(). |
| 83 | createStepRequest(_thread, _size, _depth); | |
| 84 | 0 | if (!stepJava) { |
| 85 | 0 | for (int i = 0; i < _javaExcludes.length; i++) { |
| 86 | 0 | request.addClassExclusionFilter(_javaExcludes[i]); |
| 87 | } | |
| 88 | } | |
| 89 | 0 | if (!stepInterpreter) { |
| 90 | 0 | request.addClassExclusionFilter("koala.*"); |
| 91 | 0 | request.addClassExclusionFilter("edu.rice.cs.dynamicjava.*"); |
| 92 | } | |
| 93 | 0 | if (!stepDrJava) { |
| 94 | 0 | request.addClassExclusionFilter("edu.rice.cs.drjava.*"); |
| 95 | 0 | request.addClassExclusionFilter("edu.rice.cs.util.*"); |
| 96 | 0 | request.addClassExclusionFilter("edu.rice.cs.plt.*"); |
| 97 | } | |
| 98 | 0 | for(String s: DrJava.getConfig().getSetting(DEBUG_STEP_EXCLUDE)) { |
| 99 | 0 | request.addClassExclusionFilter(s.trim()); |
| 100 | } | |
| 101 | ||
| 102 | // Add this request (the only one) to the list | |
| 103 | 0 | _requests.add(request); |
| 104 | } | |
| 105 | ||
| 106 | 0 | public String toString() { return "Step[thread: " + _thread + "]"; } |
| 107 | } |
|
||||||||||