Source Code Cross Referenced for ScriptWatchEvaluating.java in  » IDE-Netbeans » php » org » netbeans » modules » php » dbgp » models » nodes » 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 » IDE Netbeans » php » org.netbeans.modules.php.dbgp.models.nodes 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The contents of this file are subject to the terms of the Common Development
003:         * and Distribution License (the License). You may not use this file except in
004:         * compliance with the License. You can obtain a copy of the License at
005:         * http://www.netbeans.org/cddl.html or http://www.netbeans.org/cddl.txt. When
006:         * distributing Covered Code, include this CDDL Header Notice in each file and
007:         * include the License file at http://www.netbeans.org/cddl.txt. If applicable,
008:         * add the following below the CDDL Header, with the fields enclosed by brackets []
009:         * replaced by your own identifying information: "Portions Copyrighted [year]
010:         * [name of copyright owner]" The Original Software is NetBeans. The Initial
011:         * Developer of the Original Software is Sun Microsystems, Inc. Portions
012:         * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
013:         */
014:        package org.netbeans.modules.php.dbgp.models.nodes;
015:
016:        import java.util.ArrayList;
017:        import java.util.List;
018:        import java.util.Set;
019:
020:        import org.netbeans.api.debugger.Watch;
021:        import org.netbeans.modules.php.dbgp.DebugSession;
022:        import org.netbeans.modules.php.dbgp.StartActionProviderImpl;
023:        import org.netbeans.modules.php.dbgp.api.ModelNode;
024:        import org.netbeans.modules.php.dbgp.api.SessionId;
025:        import org.netbeans.modules.php.dbgp.api.UnsufficientValueException;
026:        import org.netbeans.modules.php.dbgp.models.VariablesModelFilter.FilterType;
027:        import org.netbeans.modules.php.dbgp.packets.EvalCommand;
028:        import org.netbeans.modules.php.dbgp.packets.Property;
029:        import org.netbeans.spi.debugger.ContextProvider;
030:
031:        public class ScriptWatchEvaluating extends AbstractModelNode implements 
032:                ModelNode {
033:
034:            private static final String WATCH_ICON = "org/netbeans/modules/debugger/resources/watchesView/Watch"; // NOI18N
035:
036:            protected ScriptWatchEvaluating(ContextProvider provider,
037:                    Watch watch) {
038:                super (null, null);
039:                myWatch = watch;
040:                myProvider = provider;
041:                requestValue();
042:            }
043:
044:            public synchronized String getExpression() {
045:                return myWatch.getExpression();
046:            }
047:
048:            public synchronized void remove() {
049:                myWatch.remove();
050:            }
051:
052:            public synchronized void setExpression(String expression) {
053:                myWatch.setExpression(expression);
054:                requestValue();
055:            }
056:
057:            public String getName() {
058:                return myWatch.getExpression();
059:            }
060:
061:            public String getDisplayName() {
062:                return myWatch.getExpression();
063:            }
064:
065:            public String getShortDescription() {
066:                return myWatch.getExpression();
067:            }
068:
069:            public String getIconBase() {
070:                return WATCH_ICON;
071:            }
072:
073:            public synchronized String getType() {
074:                if (myValue == null) {
075:                    return null;
076:                }
077:                return myValue.getType();
078:            }
079:
080:            public synchronized String getValue()
081:                    throws UnsufficientValueException {
082:                if (myValue == null) {
083:                    return null;
084:                }
085:                return myValue.getStringValue();
086:            }
087:
088:            public VariableNode[] getChildren(int from, int to) {
089:                List<AbstractModelNode> list;
090:                synchronized (this ) {
091:                    if (getVariables() == null) {
092:                        list = new ArrayList<AbstractModelNode>();
093:                    } else {
094:                        list = new ArrayList<AbstractModelNode>(getVariables());
095:                    }
096:                }
097:                if (from >= list.size()) {
098:                    return new VariableNode[0];
099:                }
100:                int end = Math.min(to, list.size());
101:                list = list.subList(from, end);
102:                return list.toArray(new VariableNode[list.size()]);
103:            }
104:
105:            /* (non-Javadoc)
106:             * @see org.netbeans.modules.php.dbgp.api.ModelNode#isLeaf()
107:             */
108:            public boolean isLeaf() {
109:                return getChildrenSize() == 0;
110:            }
111:
112:            public boolean isReadOnly() {
113:                /*
114:                 * Theoretically one could perfrom in Eval command response send
115:                 * PropertyGet command with expression as name.
116:                 * In case of appropraite answer one can allow edit such node
117:                 * ( via PropertySet command ) by its full name.
118:                 * But there are complexity in 
119:                 * 1) each time one need to each watch request property via PropertyGet
120:                 * 2) for each child node one needs to build full name manually.
121:                 * 
122:                 * For this time I disallow to edit values in watches view.
123:                 */
124:                return true;
125:            }
126:
127:            /*
128:             * (non-Javadoc)
129:             * 
130:             * @see org.netbeans.modules.php.dbgp.api.ModelNode#getChildrenSize()
131:             */
132:            public synchronized int getChildrenSize() {
133:                return getVariables() == null ? 0 : getVariables().size();
134:            }
135:
136:            /**
137:             * Method intended for call only by WatchesModel.
138:             * WatchesModel is responsible for update this node value when debugger
139:             * response with value.
140:             * This is done in async way.
141:             */
142:            protected synchronized void setEvaluated(Property value) {
143:                myValue = value;
144:                if (value != null) {
145:                    initVariables(value.getChildren());
146:                }
147:            }
148:
149:            protected void requestValue() {
150:                setEvaluated(null);
151:                DebugSession session = getSession();
152:                if (session == null) {
153:                    return;
154:                }
155:                EvalCommand command = new EvalCommand(session
156:                        .getTransactionId());
157:                command.setData(getExpression());
158:                /* TODO : uncomment later. 
159:                 * I found a bug in XDEbug with eval command:
160:                 * after response to eval request it performs two actions:
161:                 * 1) Stops script execution ( and debugging ) unexpectedly
162:                 * 2) Response with unexpected "response" packet that don't contain
163:                 * "command" attribute with "status" attribute equals to "stopped"
164:                 * and "reason" equals "ok".
165:                 * Need to investigate this more deeply and file a bug on XDebug.
166:                 * 
167:                 * XDebug bug submitted: 
168:                 * http://bugs.xdebug.org/bug_view_page.php?bug_id=0000313
169:                 * 
170:                 * session.sendCommandLater(command); 
171:                 */
172:            }
173:
174:            protected boolean isTypeApplied(Set<FilterType> set) {
175:                return true;
176:            }
177:
178:            private SessionId getSessionId() {
179:                if (myProvider == null) {
180:                    return null;
181:                }
182:                SessionId id = (SessionId) myProvider.lookupFirst(null,
183:                        SessionId.class);
184:                if (id == null) {
185:                    return null;
186:                }
187:                return id;
188:            }
189:
190:            private DebugSession getSession() {
191:                return StartActionProviderImpl.getInstance().getCurrentSession(
192:                        getSessionId());
193:            }
194:
195:            private Watch myWatch;
196:
197:            private ContextProvider myProvider;
198:
199:            private Property myValue;
200:        }
www_._j_a_va_2s___.___c___o___m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.