org.netbeans.spi.debugger.jpda

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » ant » org.netbeans.spi.debugger.jpda 
org.netbeans.spi.debugger.jpda
package JPDA Debugger SPIs defines support for Smart Stepping, Variables Filtering and filtering of all Debugger Views.

Smart Stepping Support

Interfaces involved:

  • {@link org.netbeans.api.debugger.jpda.SmartSteppingFilter} : Defines list of class exclusion filters to be used to filter stepping in debugged session.
  • {@link org.netbeans.spi.debugger.jpda.SmartSteppingCallback} : Listens on stepping engine and defines classes / places the debugger can stop in.
  • {@link org.netbeans.api.debugger.jpda.JPDAThread} : Represents context for SmartSteppingCallback (class name, method name, line number, ...).

Functionality supported:

Set of SmartSteppingCallback installed to JPDA Debugger defines scope for Step Into / Over / Out Actions. When user press some Step action, debugging is resumed. And when debugger stops on some new place (defined by class name and line number) set of SSListeners is asked if debugging should stop on this place or not (see {@link org.netbeans.spi.debugger.jpda.SmartSteppingCallback#stopHere} method). But this step-by-step method is slow. That is why the second, more powerfull method is here. SSListener can define some set of class exclusion patterns (like java.*, com.abba.Loader, ...). This set of exclusion patterns managed by {@link org.netbeans.api.debugger.jpda.SmartSteppingFilter} class defines scope for Step Actions in more powerfull way.

JPDA Debugger installs one default SmartSteppingCallback. It excludes all sourceless classes (packages). So, if user does not have mounted sources for Java default libraries, this SSListener adds patterns like: java.*, javax.* and com.sun.*.

How to implement some new Smart Stepping Listener:

Lets say we have some xxx module which generates some code to standard Java classes. The generated code is always in some methods, which name is prefixed with "xxx" like:
class MyClass {
private void xxxBigBusinessMethod () {
// generated code is here!
}
 
public void userMethod () {
// user code is here...
}
}
And we would like to change standard JPDA debugger to not stop in generated methods.
In this case we should implement {@link org.netbeans.spi.debugger.jpda.SmartSteppingCallback}:
public class SmartSteppingCallbackImpl extends SmartSteppingCallback {

public void initFilter (SmartSteppingFilter f) {}

public boolean stopHere (JPDAThread thread, SmartSteppingFilter f) {
String methodName = thread.getMethodName ();
return !methodName.startsWith ("xxx"); // if method starts with "xxx" DO NOT stop there!
}
}
And register full class name of our implementation (packagename.SmartSteppingCallback) in the file named:
META-INF\debugger\netbeans-JPDADebuggerEngine\org.netbeans.spi.debugger.jpda.SmartSteppingCallback

Variables Filtering Support


Filtering of Debugger Views

Content of all Debugger Views (like Breakpoints View, Threads View, ...) can be changed by viewmodel.*Filters. Folowing example shows how to filter Callstack View. We would hide all frames associated with some "java.*" packages. Some dummy node will be displayed in the place of this frames.

Step 1.

We should implement {@link org.netbeans.spi.viewmodel.TreeModelFilter} first:
public class CallStackFilter implements TreeModelFilter {

public Object[] getChildren (TreeModel original, Object parent, int from, int to) {
Object[] originalCh = original.getChildren (parent, from, to);
int i, k = originalCh.length;
ArrayList newCh = new ArrayList ();
boolean in = false;
for (i = 0; i < k; i++) {
if (! (originalCh [i] instanceof CallStackFrame)) {
newCh.add (originalCh [i]);
continue;
}
CallStackFrame f = (CallStackFrame) originalCh [i];
String className = f.getClassName ();
if (className.startsWith ("java")) {
if (!in) {
newCh.add (new JavaxSwing ());
in = true;
}
} else {
in = false;
newCh.add (f);
}
}
return newCh.toArray ();
}

public Object getRoot (TreeModel original) {
return original.getRoot ();
}

public boolean isLeaf (TreeModel original, Object node)
throws UnknownTypeException {
if (node instanceof JavaxSwing) return true;
return original.isLeaf (node);
}

private static class JavaFrames {}
}
And register it in file:
Meta-inf\debugger\netbeans-JPDADebuggerEngine\CallStackView\org.netbeans.spi.viewmodel.TreeModelFilter
As you can see on the picture this Filter replaces some original frames by some dummy node.
Callstack Filtering 2

Step 2.

We should provide NodeModel (at least) for our new node type (JavaFrames) now.
public class CallStackFilter implements NodeModel {


  public String getDisplayName (Object node) throws UnknownTypeException {
if (node instanceof JavaFrames)
return "Java Callstack Frames";
throw new UnknownTypeException (node);
}

public String getIconBase (Object node) throws UnknownTypeException {
if (node instanceof JavaFrames)
return "org/netbeans/examples/debugger/jpda/callstackviewfilterring/NonCurrentFrame";
throw new UnknownTypeException (node);
}

public String getShortDescription (Object node) throws UnknownTypeException {
if (node instanceof JavaFrames)
return "Unimportant hidden callstack frames";
throw new UnknownTypeException (node);
}
}
And registration:
Meta-inf\debugger\netbeans-JPDADebuggerEngine\CallStackView\org.netbeans.spi.viewmodel.TreeModelFilter
Callstack View Filtering 3


Java Source File NameTypeComment
EditorContext.javaClass Defines bridge to editor and src hierarchy.
SmartSteppingCallback.javaClass Listens on stepping engine and defines classes / places the debugger can stop in.
SourcePathProvider.javaClass Defines source path for debugger.
VariablesFilter.javaClass This filter allows to change nodes in Locals View and Watches View for some concrete variable types.
VariablesFilterAdapter.javaClass Default "empty" implementation of VariablesFilter returns original values (name, icon, fields, ...) for given variable.
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.