author | Eugene Ostroukhov <eugeneo@symbian.org> |
Mon, 23 Aug 2010 09:55:57 -0700 | |
changeset 471 | 06589bf52fa7 |
child 472 | bd9f2d7c64a6 |
permissions | -rw-r--r-- |
471
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
1 |
package org.symbian.tools.tmw.debug.internal.launch; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
2 |
|
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
3 |
import java.util.ArrayList; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
4 |
import java.util.Collection; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
5 |
|
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
6 |
import org.chromium.debug.core.model.BreakpointSynchronizer.Callback; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
7 |
import org.chromium.debug.core.model.BreakpointSynchronizer.Direction; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
8 |
import org.chromium.debug.core.model.ChromiumLineBreakpoint; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
9 |
import org.chromium.debug.core.model.DebugTargetImpl; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
10 |
import org.chromium.debug.core.model.VmResource; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
11 |
import org.chromium.debug.core.model.VmResourceId; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
12 |
import org.chromium.debug.core.model.WorkspaceBridge; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
13 |
import org.chromium.sdk.CallFrame; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
14 |
import org.chromium.sdk.JavascriptVm; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
15 |
import org.chromium.sdk.JavascriptVm.ScriptsCallback; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
16 |
import org.chromium.sdk.Script; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
17 |
import org.eclipse.core.resources.IFile; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
18 |
import org.eclipse.core.resources.IMarker; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
19 |
import org.eclipse.core.resources.IProject; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
20 |
import org.eclipse.core.resources.IResource; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
21 |
import org.eclipse.core.runtime.CoreException; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
22 |
import org.eclipse.debug.core.DebugPlugin; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
23 |
import org.eclipse.debug.core.ILaunch; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
24 |
import org.eclipse.debug.core.sourcelookup.ISourceContainer; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
25 |
import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
26 |
import org.eclipse.debug.core.sourcelookup.containers.DirectorySourceContainer; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
27 |
import org.eclipse.debug.core.sourcelookup.containers.ProjectSourceContainer; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
28 |
import org.symbian.tools.tmw.debug.internal.Activator; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
29 |
import org.symbian.tools.tmw.debug.internal.model.ResourceManager; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
30 |
import org.symbian.tools.tmw.debug.internal.model.WorkspaceBreakpointHandler; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
31 |
|
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
32 |
public class WRTProjectWorkspaceBridge implements WorkspaceBridge { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
33 |
public static final class Factory implements WorkspaceBridge.Factory { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
34 |
private final IProject project; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
35 |
|
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
36 |
public Factory(IProject project) { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
37 |
this.project = project; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
38 |
} |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
39 |
|
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
40 |
public WorkspaceBridge attachedToVm(DebugTargetImpl debugTargetImpl, JavascriptVm javascriptVm) { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
41 |
return new WRTProjectWorkspaceBridge(debugTargetImpl, javascriptVm, project); |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
42 |
} |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
43 |
|
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
44 |
public String getDebugModelIdentifier() { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
45 |
return DEBUG_MODEL_ID; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
46 |
} |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
47 |
|
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
48 |
public JsLabelProvider getLabelProvider() { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
49 |
return new WrtLabelProvider(); |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
50 |
} |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
51 |
} |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
52 |
|
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
53 |
public final static String DEBUG_MODEL_ID = "org.symbian.debug"; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
54 |
|
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
55 |
private final BreakpointHandler breakpointHandler; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
56 |
private final JavascriptVm javascriptVm; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
57 |
private final IProject project; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
58 |
private final ResourceManager resourceManager; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
59 |
|
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
60 |
public WRTProjectWorkspaceBridge(DebugTargetImpl debugTargetImpl, JavascriptVm javascriptVm, IProject project) { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
61 |
this.javascriptVm = javascriptVm; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
62 |
this.project = project; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
63 |
this.resourceManager = new ResourceManager(); |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
64 |
this.sourceLocator = new WebApplicationSourceLocator(resourceManager); |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
65 |
breakpointHandler = new WorkspaceBreakpointHandler(debugTargetImpl, resourceManager); |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
66 |
ILaunch launch = debugTargetImpl.getLaunch(); |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
67 |
try { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
68 |
sourceLocator.initializeDefaults(launch.getLaunchConfiguration()); |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
69 |
sourceLocator.setSourceContainers(new ISourceContainer[] { new ProjectSourceContainer(project, false), |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
70 |
new DirectorySourceContainer(Activator.getDefault().getStateLocation(), true) }); |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
71 |
} catch (CoreException e) { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
72 |
throw new RuntimeException(e); |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
73 |
} |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
74 |
launch.setSourceLocator(sourceLocator); |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
75 |
} |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
76 |
|
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
77 |
public void beforeDetach() { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
78 |
// Do nothing |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
79 |
} |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
80 |
|
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
81 |
public BreakpointHandler getBreakpointHandler() { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
82 |
return breakpointHandler; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
83 |
} |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
84 |
|
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
85 |
public void handleVmResetEvent() { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
86 |
resourceManager.clear(); |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
87 |
} |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
88 |
|
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
89 |
public void launchRemoved() { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
90 |
// Do nothing |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
91 |
} |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
92 |
|
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
93 |
public void reloadScriptsAtStart() { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
94 |
javascriptVm.getScripts(new ScriptsCallback() { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
95 |
public void failure(String errorMessage) { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
96 |
Activator.log(errorMessage); |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
97 |
} |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
98 |
|
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
99 |
public void success(Collection<Script> scripts) { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
100 |
if (!javascriptVm.isAttached()) { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
101 |
return; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
102 |
} |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
103 |
for (Script script : scripts) { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
104 |
resourceManager.addScript(script); |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
105 |
} |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
106 |
|
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
107 |
IMarker[] markers; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
108 |
try { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
109 |
markers = project.findMarkers(ChromiumLineBreakpoint.BREAKPOINT_MARKER, true, |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
110 |
IResource.DEPTH_INFINITE); |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
111 |
Collection<ChromiumLineBreakpoint> breakpoints = new ArrayList<ChromiumLineBreakpoint>( |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
112 |
markers.length); |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
113 |
for (IMarker marker : markers) { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
114 |
// If it is not ChromiumLineBreakpoint - |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
115 |
// something's gone horribly wrong. Better get |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
116 |
// ClassCastException |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
117 |
ChromiumLineBreakpoint breakpoint = (ChromiumLineBreakpoint) DebugPlugin.getDefault() |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
118 |
.getBreakpointManager().getBreakpoint(marker); |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
119 |
breakpointHandler.breakpointAdded(breakpoint); |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
120 |
breakpoints.add(breakpoint); |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
121 |
} |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
122 |
} catch (CoreException e) { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
123 |
Activator.log(e); |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
124 |
} |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
125 |
|
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
126 |
} |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
127 |
}); |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
128 |
} |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
129 |
|
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
130 |
public void scriptLoaded(Script newScript) { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
131 |
resourceManager.addScript(newScript); |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
132 |
} |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
133 |
|
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
134 |
public int getLineNumber(CallFrame stackFrame) { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
135 |
int offset = 0; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
136 |
Script script = stackFrame.getScript(); |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
137 |
if (script != null) { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
138 |
offset = script.getStartLine(); |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
139 |
} |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
140 |
return offset + stackFrame.getLineNumber() + 1; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
141 |
} |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
142 |
|
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
143 |
private final ISourceLookupDirector sourceLocator; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
144 |
|
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
145 |
public VmResource findVmResourceFromWorkspaceFile(IFile file) throws CoreException { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
146 |
return new VmResourceImpl(resourceManager.findVmResource(file), resourceManager.getScript(file), file.getName()); |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
147 |
} |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
148 |
|
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
149 |
private static final class VmResourceImpl implements VmResource { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
150 |
private final String name; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
151 |
private final Script script; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
152 |
private final VmResourceId id; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
153 |
|
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
154 |
public VmResourceImpl(VmResourceId id, Script script, String name) { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
155 |
super(); |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
156 |
this.id = id; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
157 |
this.script = script; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
158 |
this.name = name; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
159 |
} |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
160 |
|
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
161 |
public VmResourceId getId() { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
162 |
return id; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
163 |
} |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
164 |
|
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
165 |
public Script getScript() { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
166 |
return script; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
167 |
} |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
168 |
|
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
169 |
public String getFileName() { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
170 |
return name; |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
171 |
} |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
172 |
|
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
173 |
} |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
174 |
|
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
175 |
public void reloadScript(Script script) { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
176 |
System.out.println(script); |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
177 |
|
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
178 |
} |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
179 |
|
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
180 |
public void synchronizeBreakpoints(Direction direction, Callback callback) { |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
181 |
System.out.println(direction); |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
182 |
|
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
183 |
} |
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
184 |
|
06589bf52fa7
Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
185 |
} |