Source Code Cross Referenced for WorkingMemoryViewContentProvider.java in  » Rule-Engine » drolls-Rule-Engine » org » drools » eclipse » debug » 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 » Rule Engine » drolls Rule Engine » org.drools.eclipse.debug 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.drools.eclipse.debug;
002:
003:        import java.util.ArrayList;
004:        import java.util.List;
005:
006:        import org.drools.eclipse.DroolsEclipsePlugin;
007:        import org.eclipse.debug.core.DebugException;
008:        import org.eclipse.debug.core.ILaunch;
009:        import org.eclipse.debug.core.model.IDebugTarget;
010:        import org.eclipse.debug.core.model.IValue;
011:        import org.eclipse.debug.core.model.IVariable;
012:        import org.eclipse.jdt.debug.core.IJavaArray;
013:        import org.eclipse.jdt.debug.core.IJavaModifiers;
014:        import org.eclipse.jdt.debug.core.IJavaObject;
015:        import org.eclipse.jdt.debug.core.IJavaType;
016:        import org.eclipse.jdt.debug.core.IJavaValue;
017:        import org.eclipse.jdt.debug.core.IJavaVariable;
018:
019:        /**
020:         * The Working Memory view content provider.
021:         * 
022:         * @author <a href="mailto:kris_verlaenen@hotmail.com">kris verlaenen </a>
023:         */
024:        public class WorkingMemoryViewContentProvider extends
025:                DroolsDebugViewContentProvider {
026:
027:            private DroolsDebugEventHandlerView view;
028:
029:            public WorkingMemoryViewContentProvider(
030:                    DroolsDebugEventHandlerView view) {
031:                this .view = view;
032:            }
033:
034:            protected String getEmptyString() {
035:                return "The selected working memory is empty.";
036:            }
037:
038:            public Object[] getChildren(Object obj) {
039:                try {
040:                    IVariable[] variables = null;
041:                    if (obj != null
042:                            && obj instanceof  IJavaObject
043:                            && "org.drools.reteoo.ReteooStatefulSession"
044:                                    .equals(((IJavaObject) obj)
045:                                            .getReferenceTypeName())) {
046:                        variables = getWorkingMemoryElements((IJavaObject) obj);
047:                    } else if (obj instanceof  IVariable) {
048:                        if (view.isShowLogicalStructure()) {
049:                            IValue value = getLogicalValue(((IVariable) obj)
050:                                    .getValue(), new ArrayList());
051:                            variables = value.getVariables();
052:                        }
053:                        if (variables == null) {
054:                            variables = ((IVariable) obj).getValue()
055:                                    .getVariables();
056:                        }
057:                    }
058:                    if (variables == null) {
059:                        return new Object[0];
060:                    } else {
061:                        cache(obj, variables);
062:                        return variables;
063:                    }
064:                } catch (DebugException e) {
065:                    DroolsEclipsePlugin.log(e);
066:                    return new Object[0];
067:                }
068:            }
069:
070:            private IVariable[] getWorkingMemoryElements(IJavaObject stackObj)
071:                    throws DebugException {
072:                IValue objects = DebugUtil.getValueByExpression(
073:                        "return iterateObjectsToList().toArray();", stackObj);
074:                if (objects instanceof  IJavaArray) {
075:                    IJavaArray array = (IJavaArray) objects;
076:                    List result = new ArrayList();
077:
078:                    IJavaValue[] vals = array.getValues();
079:
080:                    for (int i = 0; i < vals.length; i++) {
081:                        result.add(new MyJavaVariable("[" + i + "]", vals[i]));
082:                    }
083:
084:                    return (IVariable[]) result.toArray(new IVariable[0]);
085:                }
086:                return null;
087:            }
088:
089:            public class MyJavaVariable implements  IJavaVariable {
090:
091:                private String name;
092:                private IJavaValue value;
093:
094:                public MyJavaVariable(String name, IJavaValue value) {
095:                    this .name = name;
096:                    this .value = value;
097:                }
098:
099:                public String getSignature() throws DebugException {
100:                    return ((IJavaValue) getValue()).getSignature();
101:                }
102:
103:                public String getGenericSignature() throws DebugException {
104:                    return ((IJavaValue) getValue()).getGenericSignature();
105:                }
106:
107:                public IJavaType getJavaType() throws DebugException {
108:                    return ((IJavaValue) getValue()).getJavaType();
109:                }
110:
111:                public boolean isLocal() {
112:                    return false;
113:                }
114:
115:                public IValue getValue() {
116:                    return value;
117:                }
118:
119:                public String getName() {
120:                    return name;
121:                }
122:
123:                public String getReferenceTypeName() throws DebugException {
124:                    return ((IJavaValue) getValue()).getReferenceTypeName();
125:                }
126:
127:                public boolean hasValueChanged() {
128:                    return false;
129:                }
130:
131:                public boolean isPublic() {
132:                    return false;
133:                }
134:
135:                public boolean isPrivate() {
136:                    return false;
137:                }
138:
139:                public boolean isProtected() {
140:                    return false;
141:                }
142:
143:                public boolean isPackagePrivate() {
144:                    return false;
145:                }
146:
147:                public boolean isFinal() {
148:                    return false;
149:                }
150:
151:                public boolean isStatic() {
152:                    return false;
153:                }
154:
155:                public boolean isSynthetic() {
156:                    return false;
157:                }
158:
159:                public String getModelIdentifier() {
160:                    return getValue().getModelIdentifier();
161:                }
162:
163:                public IDebugTarget getDebugTarget() {
164:                    return ((IJavaValue) getValue()).getDebugTarget();
165:                }
166:
167:                public ILaunch getLaunch() {
168:                    return getValue().getLaunch();
169:                }
170:
171:                public void setValue(String expression) {
172:                }
173:
174:                public void setValue(IValue value) {
175:                }
176:
177:                public boolean supportsValueModification() {
178:                    return false;
179:                }
180:
181:                public boolean verifyValue(String expression) {
182:                    return false;
183:                }
184:
185:                public boolean verifyValue(IValue value) {
186:                    return false;
187:                }
188:
189:                public Object getAdapter(Class adapter) {
190:                    if (IJavaVariable.class.equals(adapter)
191:                            || IJavaModifiers.class.equals(adapter)) {
192:                        return this ;
193:                    }
194:                    return null;
195:                }
196:
197:                public boolean equals(Object obj) {
198:                    if (obj instanceof  MyJavaVariable) {
199:                        MyJavaVariable var = (MyJavaVariable) obj;
200:                        return var.getName().equals(getName())
201:                                && var.getValue().equals(getValue());
202:                    }
203:                    return false;
204:                }
205:
206:                public int hashCode() {
207:                    return name.hashCode() + value.hashCode();
208:                }
209:            }
210:
211:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.