Source Code Cross Referenced for EclipseDebuggerEngine.java in  » XML-UI » xui32 » com » xoetrope » editor » eclipse » 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.eclipse.visualizer 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.xoetrope.editor.eclipse.visualizer;
002:
003:        import java.awt.event.ActionEvent;
004:        import java.awt.event.ActionListener;
005:
006:        import javax.swing.Timer;
007:
008:        import org.eclipse.core.runtime.IAdaptable;
009:        import org.eclipse.debug.core.DebugEvent;
010:        import org.eclipse.debug.core.DebugPlugin;
011:        import org.eclipse.debug.core.IDebugEventSetListener;
012:        import org.eclipse.debug.core.IExpressionManager;
013:        import org.eclipse.debug.core.model.IDebugTarget;
014:        import org.eclipse.debug.core.model.IValue;
015:        import org.eclipse.debug.core.model.IWatchExpression;
016:        import org.eclipse.debug.ui.DebugUITools;
017:        import org.eclipse.jdt.debug.core.IJavaClassType;
018:        import org.eclipse.jdt.debug.core.IJavaDebugTarget;
019:        import org.eclipse.jdt.debug.core.IJavaObject;
020:        import org.eclipse.jdt.debug.core.IJavaStackFrame;
021:        import org.eclipse.jdt.debug.core.IJavaThread;
022:        import org.eclipse.jdt.debug.core.IJavaType;
023:
024:        import com.xoetrope.carousel.visualizer.ModelVisualiserPanel;
025:        import com.xoetrope.carousel.visualizer.VisualiserDebuggerEngine;
026:        import com.xoetrope.carousel.visualizer.VisualiserDebuggerModel;
027:
028:        public class EclipseDebuggerEngine implements  VisualiserDebuggerEngine,
029:                IDebugEventSetListener {
030:            private ModelVisualiserPanel visualiserPanel;
031:
032:            /**
033:             * Adds the "debugger" tab visualising the model in run-time
034:             * @param vPanel the panel where the tab is to be added
035:             */
036:            public void setupDebuggerInterface(ModelVisualiserPanel vPanel) {
037:                visualiserPanel = vPanel;
038:                visualiserPanel.setDebuggerModel(null);
039:
040:                DebugPlugin debugPlugin = DebugPlugin.getDefault();
041:                debugPlugin.addDebugEventListener(this );
042:                IAdaptable debugContext = DebugUITools.getDebugContext();
043:                if (!(debugContext instanceof  IJavaStackFrame)) {
044:                    visualiserPanel
045:                            .addMessageNode("no debugger session available");
046:                    return;
047:                }
048:
049:                IJavaStackFrame stackFrame = (IJavaStackFrame) debugContext;
050:
051:                IJavaObject rootModel = getRootModel(stackFrame);
052:                if (rootModel == null) {
053:                    visualiserPanel
054:                            .addMessageNode("no debugger session available");
055:                    return;
056:                }
057:
058:                VisualiserDebuggerModel debugRootModel = new EclipseDebuggerModel(
059:                        stackFrame, rootModel);
060:                visualiserPanel.setDebuggerModel(debugRootModel);
061:                visualiserPanel.setRootModel(debugRootModel);
062:            }
063:
064:            /**
065:             * Gets the object referencing a root model on target VM
066:             * @param stackFrame a thread on VM
067:             * @return the root model representation
068:             */
069:            private IJavaObject getRootModel(IJavaStackFrame stackFrame) {
070:                IJavaObject rootModel = null;
071:                try {
072:
073:                    IJavaThread thread = (IJavaThread) stackFrame.getThread();
074:                    IJavaDebugTarget debugTarget = (IJavaDebugTarget) stackFrame
075:                            .getDebugTarget();
076:
077:                    IJavaType[] types = debugTarget
078:                            .getJavaTypes("net.xoetrope.xui.XProjectManager");
079:                    IJavaClassType projectManager = (IJavaClassType) types[0];
080:
081:                    rootModel = (IJavaObject) projectManager.sendMessage(
082:                            "getModel", "()Lnet/xoetrope/xui/data/XModel;",
083:                            null, thread);
084:                } catch (Exception ex) {
085:                    rootModel = null;
086:                }
087:
088:                return rootModel;
089:            }
090:
091:            /**
092:             * Invoked whenever a breakpoint is hit
093:             */
094:            private void breakpointReached() {
095:                if (visualiserPanel.getDebuggerModel() == null) {
096:                    ActionListener task = (new ActionListener() {
097:                        public void actionPerformed(ActionEvent e) {
098:                            visualiserPanel.refresh(null);
099:                        }
100:                    });
101:                    Timer timer = new Timer(1000, task);
102:                    timer.setRepeats(false);
103:                    timer.setCoalesce(true);
104:                    timer.start();
105:                }
106:            }
107:
108:            /**
109:             * Invoked when the debugger session has been removed
110:             */
111:            private void sessionRemoved() {
112:                visualiserPanel.setDebuggerModel(null);
113:                visualiserPanel.refresh(null);
114:                visualiserPanel.addMessageNode("No debugger session available");
115:            }
116:
117:            /**
118:             * Handles breakpoint hits and "debugger session removed" event. 
119:             */
120:            public void handleDebugEvents(DebugEvent[] events) {
121:                for (int i = 0; i < events.length; i++) {
122:                    DebugEvent event = events[i];
123:
124:                    // TODO: not sure whether these conditions are sufficient
125:                    if (event.getKind() == DebugEvent.TERMINATE) {
126:                        if (event.getSource() instanceof  IDebugTarget)
127:                            sessionRemoved();
128:                    } else if (event.getKind() == DebugEvent.SUSPEND) {
129:                        breakpointReached();
130:                    }
131:
132:                }
133:            }
134:
135:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.