author | Eugene Ostroukhov <eugeneo@symbian.org> |
Mon, 07 Jun 2010 16:51:19 -0700 | |
changeset 355 | 8726e95bcbba |
parent 276 | f2f4a1259de8 |
permissions | -rw-r--r-- |
2 | 1 |
// Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 |
// Use of this source code is governed by a BSD-style license that can be |
|
3 |
// found in the LICENSE file. |
|
4 |
||
5 |
package org.chromium.debug.core.model; |
|
6 |
||
7 |
import java.util.ArrayList; |
|
8 |
import java.util.Collection; |
|
9 |
import java.util.Collections; |
|
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
10 |
import java.util.Comparator; |
2 | 11 |
import java.util.List; |
276
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
12 |
import java.util.Set; |
2 | 13 |
|
14 |
import org.chromium.debug.core.ChromiumDebugPlugin; |
|
15 |
import org.chromium.sdk.CallFrame; |
|
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
16 |
import org.chromium.sdk.DebugContext; |
2 | 17 |
import org.chromium.sdk.JsArray; |
18 |
import org.chromium.sdk.JsFunction; |
|
19 |
import org.chromium.sdk.JsObject; |
|
20 |
import org.chromium.sdk.JsScope; |
|
21 |
import org.chromium.sdk.JsValue; |
|
22 |
import org.chromium.sdk.JsVariable; |
|
23 |
import org.chromium.sdk.Script; |
|
24 |
import org.chromium.sdk.internal.tools.v8.MethodIsBlockingException; |
|
25 |
import org.eclipse.core.runtime.IStatus; |
|
26 |
import org.eclipse.core.runtime.Status; |
|
27 |
import org.eclipse.debug.core.DebugException; |
|
28 |
import org.eclipse.debug.core.model.IRegisterGroup; |
|
29 |
import org.eclipse.debug.core.model.IStackFrame; |
|
30 |
import org.eclipse.debug.core.model.IThread; |
|
31 |
import org.eclipse.debug.core.model.IVariable; |
|
32 |
||
33 |
/** |
|
34 |
* An IStackFrame implementation over a JsStackFrame instance. |
|
35 |
*/ |
|
36 |
public class StackFrame extends DebugElementImpl implements IStackFrame { |
|
37 |
||
38 |
private final JavascriptThread thread; |
|
39 |
||
40 |
private final CallFrame stackFrame; |
|
41 |
||
42 |
private IVariable[] variables; |
|
43 |
||
44 |
/** |
|
45 |
* Constructs a stack frame for the given handler using the FrameMirror data |
|
46 |
* from the remote V8 VM. |
|
47 |
* |
|
48 |
* @param debugTarget the global parent |
|
49 |
* @param thread for which the stack frame is created |
|
50 |
* @param stackFrame an underlying SDK stack frame |
|
51 |
*/ |
|
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
52 |
public StackFrame(DebugTargetImpl debugTarget, JavascriptThread thread, CallFrame stackFrame) { |
2 | 53 |
super(debugTarget); |
54 |
this.thread = thread; |
|
55 |
this.stackFrame = stackFrame; |
|
56 |
} |
|
57 |
||
58 |
public CallFrame getCallFrame() { |
|
59 |
return stackFrame; |
|
60 |
} |
|
61 |
||
62 |
public IThread getThread() { |
|
63 |
return thread; |
|
64 |
} |
|
65 |
||
66 |
public IVariable[] getVariables() throws DebugException { |
|
67 |
if (variables == null) { |
|
68 |
try { |
|
69 |
variables = wrapScopes(getDebugTarget(), stackFrame.getVariableScopes(), |
|
70 |
stackFrame.getReceiverVariable()); |
|
71 |
} catch (RuntimeException e) { |
|
72 |
// We shouldn't throw RuntimeException from here, because calling |
|
73 |
// ElementContentProvider#update will forget to call update.done(). |
|
74 |
throw new DebugException(new Status(IStatus.ERROR, ChromiumDebugPlugin.PLUGIN_ID, |
|
75 |
"Failed to read variables", e)); //$NON-NLS-1$ |
|
76 |
} |
|
77 |
} |
|
78 |
return variables; |
|
79 |
} |
|
80 |
||
81 |
static IVariable[] wrapVariables( |
|
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
82 |
DebugTargetImpl debugTarget, Collection<? extends JsVariable> jsVars, |
276
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
83 |
Set<? extends String> propertyNameBlackList, |
2 | 84 |
Collection <? extends JsVariable> jsInternalProperties) { |
85 |
List<Variable> vars = new ArrayList<Variable>(jsVars.size()); |
|
86 |
for (JsVariable jsVar : jsVars) { |
|
276
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
87 |
if (propertyNameBlackList.contains(jsVar.getName())) { |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
88 |
continue; |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
89 |
} |
2 | 90 |
vars.add(new Variable(debugTarget, jsVar, false)); |
91 |
} |
|
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
92 |
// Sort all regular properties by name. |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
93 |
Collections.sort(vars, VARIABLE_COMPARATOR); |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
94 |
// Always put internal properties in the end. |
276
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
95 |
if (jsInternalProperties != null) { |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
96 |
for (JsVariable jsMetaVar : jsInternalProperties) { |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
97 |
vars.add(new Variable(debugTarget, jsMetaVar, true)); |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
98 |
} |
2 | 99 |
} |
100 |
return vars.toArray(new IVariable[vars.size()]); |
|
101 |
} |
|
102 |
||
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
103 |
static IVariable[] wrapScopes(DebugTargetImpl debugTarget, List<? extends JsScope> jsScopes, |
2 | 104 |
JsVariable receiverVariable) { |
105 |
List<Variable> vars = new ArrayList<Variable>(); |
|
106 |
||
107 |
for (JsScope scope : jsScopes) { |
|
108 |
if (scope.getType() == JsScope.Type.GLOBAL) { |
|
109 |
if (receiverVariable != null) { |
|
110 |
vars.add(new Variable(debugTarget, receiverVariable, false)); |
|
111 |
receiverVariable = null; |
|
112 |
} |
|
113 |
vars.add(new Variable(debugTarget, wrapScopeAsVariable(scope), false)); |
|
114 |
} else { |
|
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
115 |
int startPos = vars.size(); |
2 | 116 |
for (JsVariable var : scope.getVariables()) { |
117 |
vars.add(new Variable(debugTarget, var, false)); |
|
118 |
} |
|
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
119 |
int endPos = vars.size(); |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
120 |
List<Variable> sublist = vars.subList(startPos, endPos); |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
121 |
Collections.sort(sublist, VARIABLE_COMPARATOR); |
2 | 122 |
} |
123 |
} |
|
124 |
if (receiverVariable != null) { |
|
125 |
vars.add(new Variable(debugTarget, receiverVariable, false)); |
|
126 |
} |
|
127 |
||
128 |
IVariable[] result = new IVariable[vars.size()]; |
|
129 |
// Return in reverse order. |
|
130 |
for (int i = 0; i < result.length; i++) { |
|
131 |
result[result.length - i - 1] = vars.get(i); |
|
132 |
} |
|
133 |
return result; |
|
134 |
} |
|
135 |
||
136 |
private static JsVariable wrapScopeAsVariable(final JsScope jsScope) { |
|
137 |
class ScopeObjectVariable implements JsVariable, JsObject { |
|
138 |
public String getFullyQualifiedName() { |
|
139 |
return getName(); |
|
140 |
} |
|
141 |
public String getName() { |
|
142 |
// TODO(peter.rybin): should we localize it? |
|
143 |
return "<" + jsScope.getType() + ">"; |
|
144 |
} |
|
145 |
public JsValue getValue() throws UnsupportedOperationException { |
|
146 |
return this; |
|
147 |
} |
|
148 |
public boolean isMutable() { |
|
149 |
return false; |
|
150 |
} |
|
151 |
public boolean isReadable() { |
|
152 |
return true; |
|
153 |
} |
|
154 |
public void setValue(String newValue, SetValueCallback callback) |
|
155 |
throws UnsupportedOperationException { |
|
156 |
throw new UnsupportedOperationException(); |
|
157 |
} |
|
158 |
public JsArray asArray() { |
|
159 |
return null; |
|
160 |
} |
|
161 |
public JsFunction asFunction() { |
|
162 |
return null; |
|
163 |
} |
|
164 |
public String getClassName() { |
|
165 |
// TODO(peter.rybin): should we localize it? |
|
166 |
return "#Scope"; |
|
167 |
} |
|
168 |
public Collection<? extends JsVariable> getProperties() throws MethodIsBlockingException { |
|
169 |
return jsScope.getVariables(); |
|
170 |
} |
|
171 |
public Collection<? extends JsVariable> getInternalProperties() |
|
172 |
throws MethodIsBlockingException { |
|
173 |
return Collections.emptyList(); |
|
174 |
} |
|
175 |
public JsVariable getProperty(String name) { |
|
176 |
for (JsVariable var : getProperties()) { |
|
177 |
if (var.getName().equals(name)) { |
|
178 |
return var; |
|
179 |
} |
|
180 |
} |
|
181 |
return null; |
|
182 |
} |
|
183 |
public JsObject asObject() { |
|
184 |
return this; |
|
185 |
} |
|
186 |
public Type getType() { |
|
187 |
return Type.TYPE_OBJECT; |
|
188 |
} |
|
189 |
public String getValueString() { |
|
190 |
return getClassName(); |
|
191 |
} |
|
192 |
public String getRefId() { |
|
193 |
return null; |
|
194 |
} |
|
195 |
} |
|
196 |
return new ScopeObjectVariable(); |
|
197 |
} |
|
198 |
||
199 |
public boolean hasVariables() throws DebugException { |
|
200 |
return stackFrame.getReceiverVariable() != null || stackFrame.getVariableScopes().size() > 0; |
|
201 |
} |
|
202 |
||
203 |
public int getLineNumber() throws DebugException { |
|
355
8726e95bcbba
Initial commit of updated Chrome Java SDK
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
276
diff
changeset
|
204 |
// convert 0-based to 1-based |
8726e95bcbba
Initial commit of updated Chrome Java SDK
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
276
diff
changeset
|
205 |
int inScriptLine = stackFrame.getLineNumber() + 1; |
8726e95bcbba
Initial commit of updated Chrome Java SDK
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
276
diff
changeset
|
206 |
Script script = stackFrame.getScript(); |
8726e95bcbba
Initial commit of updated Chrome Java SDK
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
276
diff
changeset
|
207 |
if (script != null) { |
8726e95bcbba
Initial commit of updated Chrome Java SDK
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
276
diff
changeset
|
208 |
return inScriptLine + script.getStartLine(); |
8726e95bcbba
Initial commit of updated Chrome Java SDK
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
276
diff
changeset
|
209 |
} else { |
8726e95bcbba
Initial commit of updated Chrome Java SDK
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
276
diff
changeset
|
210 |
return inScriptLine; |
8726e95bcbba
Initial commit of updated Chrome Java SDK
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
276
diff
changeset
|
211 |
} |
2 | 212 |
} |
213 |
||
214 |
public int getCharStart() throws DebugException { |
|
215 |
return stackFrame.getCharStart(); |
|
216 |
} |
|
217 |
||
218 |
public int getCharEnd() throws DebugException { |
|
219 |
return -1; |
|
220 |
} |
|
221 |
||
222 |
public String getName() throws DebugException { |
|
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
223 |
return getDebugTarget().getLabelProvider().getStackFrameLabel(this); |
2 | 224 |
} |
225 |
||
226 |
public IRegisterGroup[] getRegisterGroups() throws DebugException { |
|
227 |
return null; |
|
228 |
} |
|
229 |
||
230 |
public boolean hasRegisterGroups() throws DebugException { |
|
231 |
return false; |
|
232 |
} |
|
233 |
||
234 |
public boolean canStepInto() { |
|
235 |
return getThread().canStepInto(); |
|
236 |
} |
|
237 |
||
238 |
public boolean canStepOver() { |
|
239 |
return getThread().canStepOver(); |
|
240 |
} |
|
241 |
||
242 |
public boolean canStepReturn() { |
|
243 |
return getThread().canStepReturn(); |
|
244 |
} |
|
245 |
||
246 |
public boolean isStepping() { |
|
247 |
return getThread().isStepping(); |
|
248 |
} |
|
249 |
||
250 |
public void stepInto() throws DebugException { |
|
251 |
getThread().stepInto(); |
|
252 |
} |
|
253 |
||
254 |
public void stepOver() throws DebugException { |
|
255 |
getThread().stepOver(); |
|
256 |
} |
|
257 |
||
258 |
public void stepReturn() throws DebugException { |
|
259 |
getThread().stepReturn(); |
|
260 |
} |
|
261 |
||
262 |
public boolean canResume() { |
|
263 |
return getThread().canResume(); |
|
264 |
} |
|
265 |
||
266 |
public boolean canSuspend() { |
|
267 |
return getThread().canSuspend(); |
|
268 |
} |
|
269 |
||
270 |
public boolean isSuspended() { |
|
271 |
return getThread().isSuspended(); |
|
272 |
} |
|
273 |
||
274 |
public void resume() throws DebugException { |
|
275 |
getThread().resume(); |
|
276 |
} |
|
277 |
||
278 |
public void suspend() throws DebugException { |
|
279 |
getThread().suspend(); |
|
280 |
} |
|
281 |
||
282 |
public boolean canTerminate() { |
|
283 |
return getThread().canTerminate(); |
|
284 |
} |
|
285 |
||
286 |
public boolean isTerminated() { |
|
287 |
return getThread().isTerminated(); |
|
288 |
} |
|
289 |
||
290 |
public void terminate() throws DebugException { |
|
291 |
getThread().terminate(); |
|
292 |
} |
|
293 |
||
294 |
/** |
|
295 |
* Returns the name of the source file this stack frame is associated with. |
|
296 |
* |
|
297 |
* @return the name of the source file this stack frame is associated with |
|
298 |
*/ |
|
299 |
String getSourceName() { |
|
300 |
Script script = stackFrame.getScript(); |
|
301 |
if (script == null) { |
|
302 |
return Messages.StackFrame_UnknownScriptName; |
|
303 |
} |
|
304 |
return script.getName(); |
|
305 |
} |
|
306 |
||
307 |
@Override |
|
308 |
public boolean equals(Object obj) { |
|
309 |
if (obj instanceof StackFrame) { |
|
310 |
StackFrame other = (StackFrame) obj; |
|
311 |
return other.stackFrame.equals(this.stackFrame); |
|
312 |
} |
|
313 |
return false; |
|
314 |
} |
|
315 |
||
316 |
@Override |
|
317 |
public int hashCode() { |
|
318 |
return stackFrame.hashCode(); |
|
319 |
} |
|
320 |
||
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
321 |
private final static Comparator<Variable> VARIABLE_COMPARATOR = new Comparator<Variable>() { |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
322 |
public int compare(Variable var1, Variable var2) { |
276
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
323 |
return compareNameObjects(getNameObject(var1), getNameObject(var2)); |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
324 |
} |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
325 |
// Get property name as String or Integer. |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
326 |
private Object getNameObject(Variable var) { |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
327 |
String name = var.getName(); |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
328 |
int len = name.length(); |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
329 |
if (len >= 3 && name.charAt(0) == '[' && name.charAt(len-1) == ']') { |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
330 |
Integer i = Integer.valueOf(name.substring(1, len - 1)); |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
331 |
return i; |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
332 |
} |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
333 |
return name; |
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
334 |
} |
276
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
335 |
// Compare property name (either string or integer). |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
336 |
private int compareNameObjects(Object nameObj1, Object nameObj2) { |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
337 |
if (nameObj1 instanceof Integer) { |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
338 |
Integer i1 = (Integer) nameObj1; |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
339 |
if (nameObj2 instanceof Integer) { |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
340 |
Integer i2 = (Integer) nameObj2; |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
341 |
return i1.compareTo(i2); |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
342 |
} else { |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
343 |
return COMPARE_INT_WITH_STRING; |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
344 |
} |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
345 |
} else { |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
346 |
String s1 = (String) nameObj1; |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
347 |
if (nameObj2 instanceof String) { |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
348 |
String s2 = (String) nameObj2; |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
349 |
return s1.compareTo(s2); |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
350 |
} else { |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
351 |
return -COMPARE_INT_WITH_STRING; |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
352 |
} |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
353 |
} |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
354 |
} |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
355 |
// Strings go before numbers. |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
356 |
private static final int COMPARE_INT_WITH_STRING = 1; |
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
357 |
}; |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
358 |
|
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
359 |
@Override |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
360 |
@SuppressWarnings("unchecked") |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
361 |
public Object getAdapter(Class adapter) { |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
362 |
if (adapter == EvaluateContext.class) { |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
363 |
DebugContext debugContext = getDebugTarget().getDebugContext(); |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
364 |
if (debugContext == null) { |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
365 |
return null; |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
366 |
} |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
367 |
return new EvaluateContext(getCallFrame().getEvaluateContext(), getDebugTarget()); |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
368 |
} |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
369 |
return super.getAdapter(adapter); |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
370 |
} |
2 | 371 |
} |