Source Code Cross Referenced for NbDebuggerEngine.java in  » XML-UI » xui32 » com » xoetrope » editor » netbeans » visualizer » Java Source Code / Java DocumentationJava Source Code and Java Documentation

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 » XML UI » xui32 » com.xoetrope.editor.netbeans.visualizer 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.xoetrope.editor.netbeans.visualizer;
002:
003:        import com.xoetrope.carousel.visualizer.ModelVisualiserPanel;
004:        import com.xoetrope.carousel.visualizer.VisualiserDebuggerEngine;
005:        import com.xoetrope.carousel.visualizer.VisualiserDebuggerModel;
006:        import java.awt.event.ActionEvent;
007:        import java.awt.event.ActionListener;
008:        import java.beans.PropertyChangeEvent;
009:        import java.util.List;
010:        import javax.swing.Timer;
011:        import org.netbeans.api.debugger.Breakpoint;
012:        import org.netbeans.api.debugger.DebuggerEngine;
013:        import org.netbeans.api.debugger.DebuggerManager;
014:        import org.netbeans.api.debugger.DebuggerManagerListener;
015:        import org.netbeans.api.debugger.Session;
016:        import org.netbeans.api.debugger.Watch;
017:        import org.netbeans.api.debugger.jpda.JPDABreakpoint;
018:        import org.netbeans.api.debugger.jpda.JPDADebugger;
019:        import org.netbeans.api.debugger.jpda.ObjectVariable;
020:        import org.netbeans.api.debugger.jpda.Variable;
021:        import org.netbeans.api.debugger.jpda.event.JPDABreakpointEvent;
022:        import org.netbeans.api.debugger.jpda.event.JPDABreakpointListener;
023:
024:        public class NbDebuggerEngine implements  VisualiserDebuggerEngine,
025:                DebuggerManagerListener, JPDABreakpointListener {
026:
027:            private Breakpoint[] breakPoints;
028:            private ModelVisualiserPanel visualiserPanel;
029:
030:            /**
031:             * Adds the "debugger" tab visualizing the model in run-time.
032:             * @param vPanel the panel where the tab is to be added
033:             */
034:            public void setupDebuggerInterface(ModelVisualiserPanel vPanel) {
035:                visualiserPanel = vPanel;
036:                visualiserPanel.setDebuggerModel(null);
037:                DebuggerManager debugManager = DebuggerManager
038:                        .getDebuggerManager();
039:                debugManager.addDebuggerListener(this );
040:                if (breakPoints == null) {
041:                    breakPoints = debugManager.getBreakpoints();
042:                    int numBreakpoints = 0;
043:                    if (breakPoints != null)
044:                        numBreakpoints = breakPoints.length;
045:                    for (int i = 0; i < numBreakpoints; i++) {
046:                        if (breakPoints[i] instanceof  JPDABreakpoint)
047:                            ((JPDABreakpoint) breakPoints[i])
048:                                    .addJPDABreakpointListener(this );
049:                    }
050:                }
051:
052:                DebuggerEngine debugEngine = debugManager.getCurrentEngine();
053:                try {
054:                    Session session = debugManager.getCurrentSession();
055:                    if (session == null) {
056:                        visualiserPanel
057:                                .addMessageNode("No debugger session available");
058:                        return;
059:                    }
060:                    debugEngine = session.getCurrentEngine();
061:                } catch (Exception e) {
062:                    e.printStackTrace();
063:                }
064:
065:                try {
066:                    List debuggerInstances = debugEngine.lookup(null,
067:                            JPDADebugger.class);
068:                    JPDADebugger jpdaDebugger = (JPDADebugger) debuggerInstances
069:                            .get(0);
070:                    int suspendState = jpdaDebugger.getSuspend();
071:                    if (/*( suspendState == jpdaDebugger.STATE_STOPPED ) &&*/(jpdaDebugger
072:                            .getCurrentCallStackFrame() != null)) {
073:                        Variable varModel = jpdaDebugger
074:                                .evaluate("net.xoetrope.xui.XProjectManager.getModel()");
075:
076:                        if (varModel instanceof  ObjectVariable) {
077:                            ObjectVariable objVar = (ObjectVariable) varModel;
078:                            VisualiserDebuggerModel debuggerModel = new NbDebuggerModel(
079:                                    jpdaDebugger, objVar);
080:                            visualiserPanel.setDebuggerModel(debuggerModel);
081:                            visualiserPanel.setRootModel(debuggerModel);
082:                        }
083:                        varModel = jpdaDebugger
084:                                .evaluate("net.xoetrope.xui.XProjectManager.getCurrentProject().getStartupParam(\"ProjectPath\")");
085:                        if (varModel instanceof  ObjectVariable) {
086:                            ObjectVariable objVar = (ObjectVariable) varModel;
087:                            String projectPath = objVar.getValue();
088:                            projectPath = projectPath.substring(1, projectPath
089:                                    .length() - 1);
090:                            visualiserPanel.setProjectPath(projectPath);
091:                        }
092:                    } else {
093:                        visualiserPanel.addMessageNode("Debugger running");
094:                    }
095:                } catch (Exception e) {
096:                    visualiserPanel.addMessageNode("Debuggers lookup failure");
097:                    e.printStackTrace();
098:                }
099:            }
100:
101:            public Breakpoint[] initBreakpoints() {
102:                return new Breakpoint[0];
103:            }
104:
105:            /**
106:             * Called when some breakpoint is removed.
107:             */
108:            public void breakpointRemoved(Breakpoint breakpoint) {
109:                if (breakpoint instanceof  JPDABreakpoint) {
110:                    JPDABreakpoint jpdaBreakpoint = (JPDABreakpoint) breakpoint;
111:                    jpdaBreakpoint.removeJPDABreakpointListener(this );
112:                }
113:            }
114:
115:            /**
116:             * Called when some breakpoint is added.
117:             */
118:            public void breakpointAdded(Breakpoint breakpoint) {
119:                if (breakpoint instanceof  JPDABreakpoint) {
120:                    JPDABreakpoint jpdaBreakpoint = (JPDABreakpoint) breakpoint;
121:                    jpdaBreakpoint.addJPDABreakpointListener(this );
122:                }
123:            }
124:
125:            public void initWatches() {
126:            }
127:
128:            public void watchAdded(Watch arg0) {
129:            }
130:
131:            public void watchRemoved(Watch arg0) {
132:            }
133:
134:            public void sessionAdded(Session arg0) {
135:            }
136:
137:            /**
138:             * Called when some session is removed.
139:             */
140:            public void sessionRemoved(Session session) {
141:                visualiserPanel.setDebuggerModel(null);
142:                visualiserPanel.refresh(null);
143:                visualiserPanel.addMessageNode("No debugger session available");
144:
145:                int numBreakpoints = 0;
146:                if (breakPoints != null)
147:                    numBreakpoints = breakPoints.length;
148:                for (int i = 0; i < numBreakpoints; i++) {
149:                    if (breakPoints[i] instanceof  JPDABreakpoint)
150:                        ((JPDABreakpoint) breakPoints[i])
151:                                .removeJPDABreakpointListener(this );
152:                }
153:                breakPoints = null;
154:            }
155:
156:            public void engineAdded(DebuggerEngine arg0) {
157:            }
158:
159:            public void engineRemoved(DebuggerEngine arg0) {
160:            }
161:
162:            public void propertyChange(PropertyChangeEvent evt) {
163:            }
164:
165:            public void breakpointReached(JPDABreakpointEvent event) {
166:                if (visualiserPanel.getDebuggerModel() == null) {
167:                    ActionListener task = (new ActionListener() {
168:                        public void actionPerformed(ActionEvent e) {
169:                            visualiserPanel.refresh(null);
170:                        }
171:                    });
172:                    Timer timer = new Timer(1000, task);
173:                    timer.setRepeats(false);
174:                    timer.setCoalesce(true);
175:                    timer.start();
176:                }
177:            }
178:
179:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.