Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

This commit was manufactured by cvs2svn to create tag 'v201204101936'.

  • Loading branch information...
commit 72214d92b89112af5be221018c7fbe8fda11ceec 1 parent 357b75a
nitind authored
Showing with 0 additions and 18,717 deletions.
  1. +0 −7 bundles/org.eclipse.wst.jsdt.debug.rhino.debugger/.classpath
  2. +0 −28 bundles/org.eclipse.wst.jsdt.debug.rhino.debugger/.project
  3. +0 −90 bundles/org.eclipse.wst.jsdt.debug.rhino.debugger/.settings/org.eclipse.jdt.core.prefs
  4. +0 −4 bundles/org.eclipse.wst.jsdt.debug.rhino.debugger/.settings/org.eclipse.pde.core.prefs
  5. +0 −16 bundles/org.eclipse.wst.jsdt.debug.rhino.debugger/META-INF/MANIFEST.MF
  6. +0 −12 bundles/org.eclipse.wst.jsdt.debug.rhino.debugger/OSGI-INF/l10n/bundle.properties
  7. +0 −28 bundles/org.eclipse.wst.jsdt.debug.rhino.debugger/about.html
  8. +0 −19 bundles/org.eclipse.wst.jsdt.debug.rhino.debugger/build.properties
  9. +0 −82 ...clipse.wst.jsdt.debug.rhino.debugger/src/org/eclipse/wst/jsdt/debug/internal/rhino/debugger/Breakpoint.java
  10. +0 −369 ...lipse.wst.jsdt.debug.rhino.debugger/src/org/eclipse/wst/jsdt/debug/internal/rhino/debugger/ContextData.java
  11. +0 −290 ...t.jsdt.debug.rhino.debugger/src/org/eclipse/wst/jsdt/debug/internal/rhino/debugger/DebugSessionManager.java
  12. +0 −90 ...se.wst.jsdt.debug.rhino.debugger/src/org/eclipse/wst/jsdt/debug/internal/rhino/debugger/FunctionSource.java
  13. +0 −25 ....eclipse.wst.jsdt.debug.rhino.debugger/src/org/eclipse/wst/jsdt/debug/internal/rhino/debugger/LineData.java
  14. +0 −454 ...se.wst.jsdt.debug.rhino.debugger/src/org/eclipse/wst/jsdt/debug/internal/rhino/debugger/RequestHandler.java
  15. +0 −539 ...wst.jsdt.debug.rhino.debugger/src/org/eclipse/wst/jsdt/debug/internal/rhino/debugger/RhinoDebuggerImpl.java
  16. +0 −479 ...ipse.wst.jsdt.debug.rhino.debugger/src/org/eclipse/wst/jsdt/debug/internal/rhino/debugger/ScriptSource.java
  17. +0 −500 ...clipse.wst.jsdt.debug.rhino.debugger/src/org/eclipse/wst/jsdt/debug/internal/rhino/debugger/StackFrame.java
  18. +0 −180 ...clipse.wst.jsdt.debug.rhino.debugger/src/org/eclipse/wst/jsdt/debug/internal/rhino/debugger/ThreadData.java
  19. +0 −46 ...clipse.wst.jsdt.debug.rhino.debugger/src/org/eclipse/wst/jsdt/debug/internal/rhino/transport/Constants.java
  20. +0 −83 ...ipse.wst.jsdt.debug.rhino.debugger/src/org/eclipse/wst/jsdt/debug/internal/rhino/transport/EventPacket.java
  21. +0 −130 ...se.wst.jsdt.debug.rhino.debugger/src/org/eclipse/wst/jsdt/debug/internal/rhino/transport/JSONConstants.java
  22. +0 −465 ...eclipse.wst.jsdt.debug.rhino.debugger/src/org/eclipse/wst/jsdt/debug/internal/rhino/transport/JSONUtil.java
  23. +0 −130 ....wst.jsdt.debug.rhino.debugger/src/org/eclipse/wst/jsdt/debug/internal/rhino/transport/PipedConnection.java
  24. +0 −163 ...sdt.debug.rhino.debugger/src/org/eclipse/wst/jsdt/debug/internal/rhino/transport/PipedTransportService.java
  25. +0 −91 ...ipse.wst.jsdt.debug.rhino.debugger/src/org/eclipse/wst/jsdt/debug/internal/rhino/transport/RhinoPacket.java
  26. +0 −124 ...pse.wst.jsdt.debug.rhino.debugger/src/org/eclipse/wst/jsdt/debug/internal/rhino/transport/RhinoRequest.java
  27. +0 −168 ...se.wst.jsdt.debug.rhino.debugger/src/org/eclipse/wst/jsdt/debug/internal/rhino/transport/RhinoResponse.java
  28. +0 −102 ...sdt.debug.rhino.debugger/src/org/eclipse/wst/jsdt/debug/internal/rhino/transport/RhinoSocketConnection.java
  29. +0 −66 ...sdt.debug.rhino.debugger/src/org/eclipse/wst/jsdt/debug/internal/rhino/transport/RhinoTransportService.java
  30. +0 −13 ...e.wst.jsdt.debug.rhino.debugger/src/org/eclipse/wst/jsdt/debug/internal/rhino/transport/messages.properties
  31. +0 −66 .../org.eclipse.wst.jsdt.debug.rhino.debugger/src/org/eclipse/wst/jsdt/debug/rhino/debugger/RhinoDebugger.java
  32. +0 −365 ...rg.eclipse.wst.jsdt.debug.rhino.debugger/src/org/eclipse/wst/jsdt/debug/rhino/debugger/shell/DebugMain.java
  33. +0 −132 ...g.eclipse.wst.jsdt.debug.rhino.debugger/src/org/eclipse/wst/jsdt/debug/rhino/debugger/shell/DebugShell.java
  34. +0 −7 bundles/org.eclipse.wst.jsdt.debug.ui/.classpath
  35. +0 −34 bundles/org.eclipse.wst.jsdt.debug.ui/.project
  36. +0 −90 bundles/org.eclipse.wst.jsdt.debug.ui/.settings/org.eclipse.jdt.core.prefs
  37. +0 −35 bundles/org.eclipse.wst.jsdt.debug.ui/META-INF/MANIFEST.MF
  38. +0 −61 bundles/org.eclipse.wst.jsdt.debug.ui/OSGI-INF/l10n/bundle.properties
  39. +0 −28 bundles/org.eclipse.wst.jsdt.debug.ui/about.html
  40. +0 −21 bundles/org.eclipse.wst.jsdt.debug.ui/build.properties
  41. BIN  bundles/org.eclipse.wst.jsdt.debug.ui/icons/dlcl16/brkpd_obj.gif
  42. BIN  bundles/org.eclipse.wst.jsdt.debug.ui/icons/elcl16/brkp_obj.gif
  43. BIN  bundles/org.eclipse.wst.jsdt.debug.ui/icons/elcl16/connect.gif
  44. BIN  bundles/org.eclipse.wst.jsdt.debug.ui/icons/elcl16/jsbook_obj.gif
  45. BIN  bundles/org.eclipse.wst.jsdt.debug.ui/icons/elcl16/localvariable.gif
  46. BIN  bundles/org.eclipse.wst.jsdt.debug.ui/icons/elcl16/proto_var.gif
  47. BIN  bundles/org.eclipse.wst.jsdt.debug.ui/icons/elcl16/script.gif
  48. BIN  bundles/org.eclipse.wst.jsdt.debug.ui/icons/elcl16/script_grp.gif
  49. BIN  bundles/org.eclipse.wst.jsdt.debug.ui/icons/elcl16/scriptbp.gif
  50. BIN  bundles/org.eclipse.wst.jsdt.debug.ui/icons/elcl16/sethitcount_co.gif
  51. BIN  bundles/org.eclipse.wst.jsdt.debug.ui/icons/elcl16/source.gif
  52. BIN  bundles/org.eclipse.wst.jsdt.debug.ui/icons/elcl16/suspend_co.gif
  53. BIN  bundles/org.eclipse.wst.jsdt.debug.ui/icons/elcl16/this_var.gif
  54. BIN  bundles/org.eclipse.wst.jsdt.debug.ui/icons/ovr16/caught_ovr.gif
  55. BIN  bundles/org.eclipse.wst.jsdt.debug.ui/icons/ovr16/caught_ovr_disabled.gif
  56. BIN  bundles/org.eclipse.wst.jsdt.debug.ui/icons/ovr16/conditional_ovr.gif
  57. BIN  bundles/org.eclipse.wst.jsdt.debug.ui/icons/ovr16/conditional_ovr_disabled.gif
  58. BIN  bundles/org.eclipse.wst.jsdt.debug.ui/icons/ovr16/entry_ovr.gif
  59. BIN  bundles/org.eclipse.wst.jsdt.debug.ui/icons/ovr16/entry_ovr_disabled.gif
  60. BIN  bundles/org.eclipse.wst.jsdt.debug.ui/icons/ovr16/exit_ovr.gif
  61. BIN  bundles/org.eclipse.wst.jsdt.debug.ui/icons/ovr16/exit_ovr_disabled.gif
  62. BIN  bundles/org.eclipse.wst.jsdt.debug.ui/icons/ovr16/installed_ovr.gif
  63. BIN  bundles/org.eclipse.wst.jsdt.debug.ui/icons/ovr16/installed_ovr_disabled.gif
  64. BIN  bundles/org.eclipse.wst.jsdt.debug.ui/icons/ovr16/scoped_ovr.gif
  65. BIN  bundles/org.eclipse.wst.jsdt.debug.ui/icons/ovr16/scoped_ovr_disabled.gif
  66. BIN  bundles/org.eclipse.wst.jsdt.debug.ui/icons/ovr16/uncaught_ovr.gif
  67. BIN  bundles/org.eclipse.wst.jsdt.debug.ui/icons/ovr16/uncaught_ovr_disabled.gif
  68. +0 −615 bundles/org.eclipse.wst.jsdt.debug.ui/plugin.xml
  69. +0 −38 bundles/org.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/Constants.java
  70. +0 −35 bundles/org.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/DebugWCManager.java
  71. +0 −52 bundles/org.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/IHelpContextIds.java
  72. +0 −117 bundles/org.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/ISharedImages.java
  73. +0 −100 bundles/org.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/ImageDescriptorRegistry.java
  74. +0 −207 bundles/org.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/JavaScriptDebugUIPlugin.java
  75. +0 −38 ...se.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/JavaScriptDebugUIPreferenceInitializer.java
  76. +0 −188 ...les/org.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/JavaScriptImageDescriptor.java
  77. +0 −149 bundles/org.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/JavaScriptImageRegistry.java
  78. +0 −553 ...s/org.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/JavaScriptModelPresentation.java
  79. +0 −69 bundles/org.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/Messages.java
  80. +0 −70 bundles/org.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/PreferencesManager.java
  81. +0 −507 bundles/org.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/SWTFactory.java
  82. +0 −122 ...pse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/actions/AddScriptLoadBreakpointAction.java
  83. +0 −218 ....eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/actions/BreakpointHitCountAction.java
  84. +0 −70 ...clipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/actions/BreakpointPropertiesAction.java
  85. +0 −103 ...t.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/actions/BreakpointSuspendPolicyToggleAction.java
  86. +0 −253 ...rg.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/actions/BreakpointToggleAction.java
  87. +0 −56 ...les/org.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/actions/EntryToggleAction.java
  88. +0 −367 bundles/org.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/actions/EvaluateAction.java
  89. +0 −89 ...eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/actions/EvaluateEditorPopupAction.java
  90. +0 −56 bundles/org.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/actions/ExitToggleAction.java
  91. +0 −59 .../org.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/actions/FunctionFilterAction.java
  92. +0 −169 bundles/org.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/actions/OpenSourceAction.java
  93. +0 −44 ...les/org.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/actions/ProtoFilterAction.java
  94. +0 −51 ...g.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/actions/ShowLoadedScriptsAction.java
  95. +0 −78 ...pse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/actions/SuspendOnAllScriptLoadsAction.java
  96. +0 −77 ...eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/actions/SuspendOnExceptionsAction.java
  97. +0 −44 bundles/org.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/actions/ThisFilterAction.java
  98. +0 −186 bundles/org.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/actions/ViewFilterAction.java
  99. +0 −169 ...eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/adapters/JavaScriptAdapterFactory.java
  100. +0 −95 ...e.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/adapters/JavaScriptAsyncContentProvider.java
  101. +0 −146 ...st.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/adapters/JavaScriptDebugTargetEventHandler.java
  102. +0 −38 ...lipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/adapters/JavaScriptDebugTargetProxy.java
  103. +0 −41 ...ipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/adapters/JavaScriptModelProxyFactory.java
  104. +0 −81 ....eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/adapters/JavaScriptThreadHandler.java
  105. +0 −186 .../org.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/breakpoints/BreakpointHelper.java
  106. +0 −906 ...ipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/breakpoints/BreakpointLocationFinder.java
  107. +0 −31 ...bug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/breakpoints/BreakpointPropertiesEditorActionDelegate.java
  108. +0 −67 ...t.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/breakpoints/BreakpointPropertiesRulerAction.java
  109. +0 −286 ....jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/breakpoints/JavaScriptBreakpointPropertyPage.java
  110. +0 −196 ...e.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/breakpoints/JavaScriptBreakpointUpdater.java
  111. +0 −89 ....jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/breakpoints/JavaScriptHtmlBreakpointProvider.java
  112. +0 −63 bundles/org.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/breakpoints/Messages.java
  113. +0 −540 ...lipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/breakpoints/ToggleBreakpointAdapter.java
  114. +0 −32 ...bug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/breakpoints/ToggleBreakpointEnablementEditorDelegate.java
  115. +0 −94 ....debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/breakpoints/ToggleBreakpointEnablementRulerAction.java
  116. +0 −33 ...debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/breakpoints/ToggleFunctionBreakpointActionDelegate.java
  117. +0 −289 ...se.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/breakpoints/details/AbstractDetailPane.java
  118. +0 −120 ...dt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/breakpoints/details/BreakpointDetailPaneFactory.java
  119. +0 −56 ...t.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/breakpoints/details/FunctionBreakpointDetailPane.java
  120. +0 −50 ....jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/breakpoints/details/LineBreakpointDetailPane.java
  121. +0 −47 ...t.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/breakpoints/details/StandardBreakpointDetailPane.java
  122. +0 −187 ...g.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/breakpoints/editors/AbstractJavaScriptBreakpointEditor.java
  123. +0 −144 ...jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/breakpoints/editors/CompositeBreakpointEditor.java
  124. +0 −82 ....jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/breakpoints/editors/FunctionBreakpointEditor.java
  125. +0 −356 ....ui/src/org/eclipse/wst/jsdt/debug/internal/ui/breakpoints/editors/JavaScriptBreakpointConditionEditor.java
  126. +0 −257 ...g.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/breakpoints/editors/StandardJavaScriptBreakpointEditor.java
  127. +0 −46 ...es/org.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/breakpoints/messages.properties
  128. +0 −79 ...org.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/dialogs/ScriptSelectionDialog.java
  129. +0 −93 ...st.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/display/JavaScriptDebugViewerConfiguration.java
  130. +0 −273 bundles/org.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/eval/EvaluationManager.java
  131. +0 −441 ....wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/eval/ExpressionInformationControlCreator.java
  132. +0 −193 ...les/org.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/eval/JavaScriptDebugHover.java
  133. +0 −122 ....eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/eval/JavaScriptHyperlinkDetector.java
  134. +0 −158 ....eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/eval/JavaScriptInspectExpression.java
  135. +0 −38 bundles/org.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/eval/Messages.java
  136. +0 −123 bundles/org.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/eval/RunToLineAdapter.java
  137. +0 −325 ...ipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/eval/StepIntoSelectionActionDelegate.java
  138. +0 −306 ...org.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/eval/StepIntoSelectionHandler.java
  139. +0 −149 ...s/org.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/eval/StepIntoSelectionUtils.java
  140. +0 −21 bundles/org.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/eval/messages.properties
  141. +0 −435 ...rg.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/launching/JavaScriptConnectTab.java
  142. +0 −40 .../org.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/launching/JavascriptTabGroup.java
  143. +0 −52 bundles/org.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/messages.properties
  144. +0 −112 ...wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/preferences/JavaScriptDebugPreferencePage.java
  145. +0 −33 bundles/org.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/preferences/Messages.java
  146. +0 −16 ...es/org.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/preferences/messages.properties
  147. +0 −299 ...org.eclipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/source/JavaScriptSourceViewer.java
  148. +0 −211 ...ug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/source/contentassist/JavaScriptContentAssistProcessor.java
  149. +0 −59 ...clipse.wst.jsdt.debug.ui/src/org/eclipse/wst/jsdt/debug/internal/ui/source/contentassist/ScriptContext.java
7 bundles/org.eclipse.wst.jsdt.debug.rhino.debugger/.classpath
View
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
28 bundles/org.eclipse.wst.jsdt.debug.rhino.debugger/.project
View
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.wst.jsdt.debug.rhino.debugger</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
90 bundles/org.eclipse.wst.jsdt.debug.rhino.debugger/.settings/org.eclipse.jdt.core.prefs
View
@@ -1,90 +0,0 @@
-#Fri Apr 30 10:04:28 CDT 2010
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.doc.comment.support=enabled
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.comparingIdentical=error
-org.eclipse.jdt.core.compiler.problem.deadCode=error
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
-org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error
-org.eclipse.jdt.core.compiler.problem.invalidJavadoc=ignore
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=disabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error
-org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag
-org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
-org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=error
-org.eclipse.jdt.core.compiler.problem.nullReference=warning
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=error
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
-org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
-org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=error
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=error
-org.eclipse.jdt.core.compiler.problem.unusedLabel=error
-org.eclipse.jdt.core.compiler.problem.unusedLocal=error
-org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=error
-org.eclipse.jdt.core.compiler.problem.unusedParameter=error
-org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
-org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.3
4 bundles/org.eclipse.wst.jsdt.debug.rhino.debugger/.settings/org.eclipse.pde.core.prefs
View
@@ -1,4 +0,0 @@
-#Sun Feb 28 13:50:08 EST 2010
-eclipse.preferences.version=1
-pluginProject.extensions=false
-resolve.requirebundle=false
16 bundles/org.eclipse.wst.jsdt.debug.rhino.debugger/META-INF/MANIFEST.MF
View
@@ -1,16 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %Bundle-Name
-Bundle-Vendor: %providerName
-Bundle-SymbolicName: org.eclipse.wst.jsdt.debug.rhino.debugger
-Bundle-Version: 1.0.2.qualifier
-Bundle-RequiredExecutionEnvironment: J2SE-1.4
-Export-Package: org.eclipse.wst.jsdt.debug.internal.rhino.debugger;x-internal:=true,
- org.eclipse.wst.jsdt.debug.internal.rhino.transport;x-friends:="org.eclipse.wst.jsdt.debug.rhino",
- org.eclipse.wst.jsdt.debug.rhino.debugger,
- org.eclipse.wst.jsdt.debug.rhino.debugger.shell
-Import-Package: org.mozilla.javascript;resolution:=optional,
- org.mozilla.javascript.debug;resolution:=optional,
- org.mozilla.javascript.tools;resolution:=optional,
- org.mozilla.javascript.tools.shell;resolution:=optional
-Require-Bundle: org.eclipse.wst.jsdt.debug.transport;bundle-version="1.0.0"
12 bundles/org.eclipse.wst.jsdt.debug.rhino.debugger/OSGI-INF/l10n/bundle.properties
View
@@ -1,12 +0,0 @@
-###############################################################################
-# Copyright (c) 2010 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-providerName = Eclipse Web Tools Platform
-Bundle-Name = Rhino Debugger
28 bundles/org.eclipse.wst.jsdt.debug.rhino.debugger/about.html
View
@@ -1,28 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>March 10, 2010</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
-
-</body>
-</html>
19 bundles/org.eclipse.wst.jsdt.debug.rhino.debugger/build.properties
View
@@ -1,19 +0,0 @@
-###############################################################################
-# Copyright (c) 2010, 2011 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- about.html,\
- OSGI-INF/l10n/bundle.properties,\
- OSGI-INF/,\
- OSGI-INF/l10n/
-src.includes = about.html
82 ...pse.wst.jsdt.debug.rhino.debugger/src/org/eclipse/wst/jsdt/debug/internal/rhino/debugger/Breakpoint.java
View
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.debug.internal.rhino.debugger;
-
-import java.util.HashMap;
-
-import org.eclipse.wst.jsdt.debug.internal.rhino.transport.JSONConstants;
-
-
-/**
- * Implementation of a breakpoint wrt Rhino debugging
- *
- * @since 1.0
- */
-public class Breakpoint {
-
- final Long breakpointId;
- final ScriptSource script;
- final Integer lineNumber;
- final Object functionName;
- final String condition;
- final Long threadId;
-
- /**
- * Constructor
- *
- * @param breakpointId the id for the breakpoint
- * @param script the script the breakpoint applies to, <code>null</code> is not accepted
- * @param lineNumber the line number for the breakpoint
- * @param functionName the name of the function the breakpoint is set on, <code>null</code> is accepted
- * @param condition the condition for the breakpoint, <code>null</code> is accepted
- * @param threadId the id of the thread the breakpoint is for
- */
- public Breakpoint(Long breakpointId, ScriptSource script, Integer lineNumber, String functionName, String condition, Long threadId) {
- if (script == null) {
- throw new IllegalArgumentException("The parent script cannot be null"); //$NON-NLS-1$
- }
- this.breakpointId = breakpointId;
- this.script = script;
- this.lineNumber = lineNumber;
- this.functionName = functionName;
- this.condition = condition;
- this.threadId = threadId;
- }
-
- /**
- * @return the breakpoint as a JSON entry
- */
- public Object toJSON() {
- HashMap result = new HashMap();
- result.put(JSONConstants.BREAKPOINT_ID, breakpointId);
- result.put(JSONConstants.SCRIPT_ID, script.getId());
- if (lineNumber != null) {
- result.put(JSONConstants.LINE, lineNumber);
- }
- if (functionName != null) {
- result.put(JSONConstants.FUNCTION, functionName);
- }
- if (condition != null) {
- result.put(JSONConstants.CONDITION, condition);
- }
- if (threadId != null) {
- result.put(JSONConstants.THREAD_ID, threadId);
- }
- return result;
- }
-
- /**
- * Deletes the breakpoint from the script it is associated with. Does
- * not clear any of the handle information so the deleted breakpoint can be
- * returned as an event if required.
- */
- public void delete() {
- this.script.removeBreakpoint(this);
- }
-}
369 ...se.wst.jsdt.debug.rhino.debugger/src/org/eclipse/wst/jsdt/debug/internal/rhino/debugger/ContextData.java
View
@@ -1,369 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 IBM Corporation and others All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.debug.internal.rhino.debugger;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.wst.jsdt.debug.internal.rhino.transport.EventPacket;
-import org.eclipse.wst.jsdt.debug.internal.rhino.transport.JSONConstants;
-
-/**
- * Rhino implementation of {@link ContextData}
- *
- * @since 1.0
- */
-public class ContextData {
- private static final int CONTEXT_RUNNING = 0;
- private static final int CONTEXT_SUSPENDED = 1;
-
- private static final int STEP_CONTINUE = 0;
- private static final int STEP_IN = 1;
- private static final int STEP_NEXT = 2;
- private static final int STEP_OUT = 4;
-
- private final Long threadId;
- private final Long contextId;
- private final RhinoDebuggerImpl debugger;
-
- private final LinkedList frames = new LinkedList();
-
- private int contextState = CONTEXT_RUNNING;
- private int stepState = STEP_CONTINUE;
- private StackFrame stepFrame;
-
- /**
- * Constructor
- *
- * @param threadId
- * @param contextId
- * @param debugger
- */
- public ContextData(Long threadId, Long contextId, RhinoDebuggerImpl debugger) {
- this.threadId = threadId;
- this.contextId = contextId;
- this.debugger = debugger;
- }
-
- /**
- * Returns the unique id of this context data
- *
- * @return the unique id
- */
- public Long getId() {
- return contextId;
- }
-
- /**
- * Returns the live list of {@link DebugFrame}s from this context
- *
- * @return the live list of {@link DebugFrame}s
- */
- public synchronized List getFrameIds() {
- List result = new ArrayList();
- for (Iterator iterator = frames.iterator(); iterator.hasNext();) {
- result.add(((StackFrame) iterator.next()).getId());
- }
- return result;
- }
-
- /**
- * Returns the {@link DebugFrame} with the given id or <code>null</code> if no such {@link DebugFrame} exists
- *
- * @param frameId
- * @return the {@link DebugFrame} with the given id or <code>null</code>
- */
- public synchronized StackFrame getFrame(Long frameId) {
- StackFrame frame = null;
- for (Iterator iterator = frames.iterator(); iterator.hasNext();) {
- frame = (StackFrame) iterator.next();
- if (frame.getId().equals(frameId)) {
- return frame;
- }
- }
- return null;
- }
-
- /**
- * Adds the given frame to the top of the frame stack and sends out a break event as needed
- *
- * @param frame
- * @param script
- * @param lineNumber
- * @param functionName
- */
- public synchronized void pushFrame(StackFrame frame, ScriptSource script, Integer lineNumber, String functionName) {
- frames.addFirst(frame);
- Breakpoint breakpoint = script.getBreakpoint(lineNumber, functionName);
- boolean isStepBreak = stepBreak(STEP_IN);
- if (isStepBreak || breakpoint != null) {
- if (sendBreakEvent(script, frame.getLineNumber(), functionName, breakpoint, isStepBreak, false)) {
- suspendState();
- }
- }
- }
-
- /**
- * Returns if the step operation should cause a break
- *
- * @param step
- * @return true if the operation should break false otherwise
- */
- private boolean stepBreak(int step) {
- return ((0 != (step & stepState)) && (stepFrame == null || stepFrame == frames.getFirst()));
- }
-
- /**
- * Suspends the state via {@link #wait()}
- */
- private void suspendState() {
- contextState = CONTEXT_SUSPENDED;
- while (contextState == CONTEXT_SUSPENDED) {
- try {
- wait();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- }
-
- /**
- * Removes the first {@link DebugFrame} from the current stack
- *
- * @param byThrow
- * @param resultOrException
- */
- public synchronized void popFrame(boolean byThrow, Object resultOrException) {
- if(!frames.isEmpty()) {
- StackFrame frame = (StackFrame) frames.removeFirst();
- if (stepFrame == frame) {
- stepFrame = null;
- stepState = STEP_OUT;
- }
-
- boolean isStepBreak = stepBreak(STEP_IN | STEP_OUT);
- if (isStepBreak) {
- frame = getTopFrame();
- if (frame != null && sendBreakEvent(frame.getScript(), frame.getLineNumber(), null, null, isStepBreak, false)) {
- suspendState();
- }
- }
- }
- }
-
- /**
- * Resume the state with the given step type
- *
- * @param stepType
- */
- public synchronized void resume(String stepType) {
- try {
- if (stepType == null) {
- stepState = STEP_CONTINUE;
- stepFrame = null;
- } else if (stepType.equals(JSONConstants.STEP_IN)) {
- stepState = STEP_IN;
- stepFrame = null;
- } else if (stepType.equals(JSONConstants.STEP_NEXT)) {
- stepState = STEP_NEXT;
- stepFrame = getTopFrame();
- } else if (stepType.equals(JSONConstants.STEP_OUT)) {
- if (frames.size() > 1) {
- stepState = STEP_OUT;
- stepFrame = (StackFrame) frames.get(1);
- } else {
- stepState = STEP_CONTINUE;
- stepFrame = null;
- }
- } else if (stepType.equals(JSONConstants.STEP_ANY)) {
- stepState = STEP_IN | STEP_OUT | STEP_NEXT;
- stepFrame = null;
- } else {
- throw new IllegalStateException("bad stepType: " + stepType); //$NON-NLS-1$
- }
- }
- finally {
- contextState = CONTEXT_RUNNING;
- notifyAll();
- }
- }
-
- /**
- * Returns the top stack frame iff there are frames.
- * Delegate method to prevent {@link NoSuchElementException}s
- *
- * @return the top frame or <code>null</code>
- */
- private StackFrame getTopFrame() {
- if(this.frames != null && !this.frames.isEmpty()) {
- return (StackFrame) this.frames.getFirst();
- }
- return null;
- }
-
- /**
- * Set the step state to the suspend equivalent
- */
- public synchronized void suspend() {
- stepState = STEP_IN | STEP_NEXT | STEP_OUT;
- stepFrame = null;
- }
-
- /**
- * Handles a <code>debugger;</code> statement
- *
- * @param script
- * @param lineNumber
- */
- public synchronized void debuggerStatement(ScriptSource script, Integer lineNumber) {
- Breakpoint breakpoint = script.getBreakpoint(lineNumber, null);
- boolean isStepBreak = stepBreak(STEP_IN | STEP_NEXT);
- if (sendBreakEvent(script, lineNumber, null, breakpoint, isStepBreak, true)) {
- suspendState();
- }
- }
-
- /**
- * Handles a line change
- *
- * @param script
- * @param lineNumber
- */
- public synchronized void lineChange(ScriptSource script, Integer lineNumber) {
- Breakpoint breakpoint = script.getBreakpoint(lineNumber, null);
- boolean isStepBreak = stepBreak(STEP_IN | STEP_NEXT);
- if (isStepBreak || breakpoint != null) {
- if (sendBreakEvent(script, lineNumber, null, breakpoint, isStepBreak, false)) {
- suspendState();
- }
- }
- }
-
- /**
- * Handles forwarding an exception event
- *
- * @param ex
- */
- public synchronized void exceptionThrown(Throwable ex) {
- StackFrame frame = getTopFrame();
- if (sendExceptionEvent(frame.getScript(), frame.getLineNumber(), ex)) {
- suspendState();
- }
- }
-
- /**
- * Sends a JSON message for an exception that has occurred
- *
- * @param script
- * @param lineNumber
- * @param ex
- * @return true if the message was sent successfully, false otherwise
- */
- private boolean sendExceptionEvent(ScriptSource script, Integer lineNumber, Throwable ex) {
- EventPacket exceptionEvent = new EventPacket(JSONConstants.EXCEPTION);
- Map body = exceptionEvent.getBody();
- body.put(JSONConstants.CONTEXT_ID, contextId);
- body.put(JSONConstants.THREAD_ID, threadId);
- body.put(JSONConstants.SCRIPT_ID, script.getId());
- body.put(JSONConstants.LINE, lineNumber);
- body.put(JSONConstants.MESSAGE, ex.getMessage());
- return debugger.sendEvent(exceptionEvent);
- }
-
- /**
- * Sends a JSON message for a break event
- *
- * @param script
- * @param lineNumber
- * @param functionName
- * @param breakpoint
- * @param isStepBreak
- * @param isDebuggerStatement
- * @return true if the message was sent successfully, false otherwise
- */
- private boolean sendBreakEvent(ScriptSource script, Integer lineNumber, String functionName, Breakpoint breakpoint, boolean isStepBreak, boolean isDebuggerStatement) {
- EventPacket breakEvent = new EventPacket(JSONConstants.BREAK);
- Map body = breakEvent.getBody();
- body.put(JSONConstants.THREAD_ID, threadId);
- body.put(JSONConstants.CONTEXT_ID, contextId);
- body.put(JSONConstants.SCRIPT_ID, script.getId());
- if (functionName != null) {
- body.put(JSONConstants.FUNCTION_NAME, functionName);
- }
- body.put(JSONConstants.LINE, lineNumber);
- if (breakpoint != null) {
- body.put(JSONConstants.BREAKPOINT, breakpoint.breakpointId);
- }
-
- if (isStepBreak) {
- String stepType;
- if (stepState == STEP_IN) {
- stepType = JSONConstants.STEP_IN;
- } else if (stepState == STEP_NEXT) {
- stepType = JSONConstants.STEP_NEXT;
- } else if (stepState == STEP_OUT) {
- stepType = JSONConstants.STEP_OUT;
- } else {
- stepType = JSONConstants.SUSPEND;
- }
- body.put(JSONConstants.STEP, stepType);
- stepState = 0;
- }
-
- body.put(JSONConstants.DEBUGGER_STATEMENT, Boolean.valueOf(isDebuggerStatement));
- return debugger.sendEvent(breakEvent);
- }
-
- /**
- * Handles a script load event
- *
- * @param script
- */
- public synchronized void scriptLoaded(ScriptSource script) {
- if (sendScriptEvent(script)) {
- suspendState();
- }
- }
-
- /**
- * Send a JSON message for a script event
- *
- * @param script
- * @return
- */
- private boolean sendScriptEvent(ScriptSource script) {
- EventPacket scriptEvent = new EventPacket(JSONConstants.SCRIPT);
- Map body = scriptEvent.getBody();
- body.put(JSONConstants.THREAD_ID, threadId);
- body.put(JSONConstants.CONTEXT_ID, contextId);
- body.put(JSONConstants.SCRIPT_ID, script.getId());
- return debugger.sendEvent(scriptEvent);
- }
-
- /**
- * Returns the string representation of the state
- *
- * @return the state text
- */
- public synchronized String getState() {
- return contextState == CONTEXT_RUNNING ? JSONConstants.RUNNING : JSONConstants.SUSPENDED;
- }
-
- /**
- * Returns the underlying thread id
- *
- * @return the underlying thread id
- */
- public Long getThreadId() {
- return threadId;
- }
-}
290 ...sdt.debug.rhino.debugger/src/org/eclipse/wst/jsdt/debug/internal/rhino/debugger/DebugSessionManager.java
View
@@ -1,290 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.debug.internal.rhino.debugger;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-import org.eclipse.wst.jsdt.debug.internal.rhino.transport.EventPacket;
-import org.eclipse.wst.jsdt.debug.internal.rhino.transport.JSONConstants;
-import org.eclipse.wst.jsdt.debug.internal.rhino.transport.RhinoRequest;
-import org.eclipse.wst.jsdt.debug.internal.rhino.transport.RhinoResponse;
-import org.eclipse.wst.jsdt.debug.internal.rhino.transport.RhinoTransportService;
-import org.eclipse.wst.jsdt.debug.transport.Connection;
-import org.eclipse.wst.jsdt.debug.transport.DebugSession;
-import org.eclipse.wst.jsdt.debug.transport.ListenerKey;
-import org.eclipse.wst.jsdt.debug.transport.TransportService;
-import org.eclipse.wst.jsdt.debug.transport.exception.DisconnectedException;
-import org.eclipse.wst.jsdt.debug.transport.exception.TimeoutException;
-
-/**
- * Delegate for {@link DebugSession} communication
- *
- * @since 1.1
- */
-public class DebugSessionManager {
-
- public class DebugSessionThread extends Thread {
-
- private ListenerKey listenerKey;
- private Connection connection;
- private RequestHandler requestHandler;
-
- public DebugSessionThread(String name, RhinoDebuggerImpl debugger) {
- super(name);
- requestHandler = new RequestHandler(debugger);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Runnable#run()
- */
- public void run() {
- try {
- listenerKey = transportService.startListening(address);
- while (!shutdown) {
- try {
- acceptConnection(10000);
- } catch (IOException e) {
- if (connection == null) {
- continue;
- }
- }
- while (!shutdown && connection.isOpen()) {
- try {
- RhinoRequest request = (RhinoRequest) debugSession.receive(JSONConstants.REQUEST, 1000);
- if (DEBUG)
- System.out.println(request);
- RhinoResponse response = requestHandler.handleRequest(request);
- if (DEBUG)
- System.out.println(response);
- debugSession.send(response);
- } catch (TimeoutException e) {
- // ignore
- } catch (DisconnectedException e) {
- break;
- }
- }
- closeConnection();
- }
- } catch (IOException e) {
- sendDeathEvent();
- } finally {
- try {
- if (listenerKey != null)
- transportService.stopListening(listenerKey);
- } catch (IOException e) {
- sendDeathEvent();
- }
- }
- }
-
- /**
- * Close the active connection
- *
- * @throws IOException
- */
- private void closeConnection() throws IOException {
- if (connection != null) {
- setDebugSession(null);
- connection.close();
- connection = null;
- }
- }
-
- /**
- * Waits for a connection for the given timeout
- *
- * @param timeout
- * @throws IOException
- */
- private void acceptConnection(long timeout) throws IOException {
- if (connection == null) {
- connection = transportService.accept(listenerKey, timeout, timeout);
- setDebugSession(new DebugSession(connection));
- }
- }
-
- }
-
- private static boolean DEBUG = false;
-
- private static final String ADDRESS = "address"; //$NON-NLS-1$
- private static final String SOCKET = "socket"; //$NON-NLS-1$
- private static final String TRANSPORT = "transport"; //$NON-NLS-1$
-
- private final TransportService transportService;
- private final String address;
- private final boolean startSuspended;
-
- private DebugSession debugSession;
- private Thread debuggerThread;
- private volatile boolean shutdown = false;
-
- /**
- * Constructor
- *
- * @param transportService
- * @param address
- * @param startSuspended
- */
- public DebugSessionManager(TransportService transportService, String address, boolean startSuspended, boolean debug) {
- this.transportService = transportService;
- this.address = address;
- this.startSuspended = startSuspended;
- DEBUG = debug;
- }
-
- /**
- * Creates a new session manager
- *
- * @param configString
- * @return
- */
- static DebugSessionManager create(String configString) {
- Map config = parseConfigString(configString);
- String transport = (String) config.get(TRANSPORT);
- if (!SOCKET.equals(transport)) {
- throw new IllegalArgumentException("Transport service must be 'socket': " + transport); //$NON-NLS-1$
- }
- TransportService parsedTransportService = new RhinoTransportService();
- String parsedAddress = (String) config.get(ADDRESS);
- String suspend = (String) config.get(JSONConstants.SUSPEND);
- boolean parsedStartSuspended = false;
- if (suspend != null) {
- parsedStartSuspended = (Boolean.valueOf(suspend).booleanValue() || suspend.trim().equalsIgnoreCase("y")); //$NON-NLS-1$
- }
- String debug = (String) config.get("trace"); //$NON-NLS-1$
- boolean debugging = false;
- if(debug != null) {
- debugging = (Boolean.valueOf(debug).booleanValue() || debug.trim().equalsIgnoreCase("y")); //$NON-NLS-1$
- }
- return new DebugSessionManager(parsedTransportService, parsedAddress, parsedStartSuspended, debugging);
- }
-
- /**
- * Parses the command line configuration string
- *
- * @param configString
- * @return the map of command line arguments
- */
- private static Map parseConfigString(String configString) {
- Map config = new HashMap();
- StringTokenizer tokenizer = new StringTokenizer(configString, ","); //$NON-NLS-1$
- while (tokenizer.hasMoreTokens()) {
- String token = tokenizer.nextToken();
- int equalsIndex = token.indexOf('=');
- if (equalsIndex == -1)
- config.put(token, null);
- else
- config.put(token.substring(0, equalsIndex), token.substring(equalsIndex + 1));
- }
- return config;
- }
-
- /**
- * @return true if the <code>suspend=true</code> command line argument is
- * set
- */
- public boolean isStartSuspended() {
- return startSuspended;
- }
-
- /**
- * Returns if a {@link DebugSession} has successfully connected to this
- * debugger.
- *
- * @return <code>true</code> if the debugger has a connected
- * {@link DebugSession} <code>false</code> otherwise
- */
- public synchronized boolean isConnected() {
- return debugSession != null;
- }
-
- /**
- * Starts the debugger
- */
- public synchronized void start(RhinoDebuggerImpl debugger) {
- debuggerThread = new DebugSessionThread("RhinoDebugger - RhinoRequest Handler", debugger); //$NON-NLS-1$
- debuggerThread.start();
- if (startSuspended) {
- try {
- wait(300000);
- } catch (InterruptedException e) {
- /* e.printStackTrace(); */
- }
- // TODO: We might want to check if debugSession is null and if so
- // call "stop" and throw an exception
- }
- }
-
- /**
- * Stops the debugger
- */
- public synchronized void stop() {
- shutdown = true;
- try {
- debuggerThread.interrupt();
- while(debuggerThread.isAlive()) {
- wait(1000);
- }
- debuggerThread.join();
- } catch (InterruptedException e) {
- /* e.printStackTrace(); */
- }
- }
-
- private synchronized void setDebugSession(DebugSession session) {
- if (debugSession != session) {
- if (debugSession != null) {
- debugSession.dispose();
- }
- debugSession = session;
- notify();
- }
- }
-
- /**
- * Sends the given {@link EventPacket} using the underlying
- * {@link DebugRuntime} and returns if it was sent successfully
- *
- * @param event
- * @return true if the event was sent successfully, false otherwise
- */
- public synchronized boolean sendEvent(EventPacket event) {
- try {
- if (debugSession != null) {
- if (DEBUG) {
- System.out.println(event);
- }
- debugSession.send(event);
- return true;
- }
- } catch (DisconnectedException e) {
- e.printStackTrace();
- }
- return false;
- }
-
- /**
- * Sends out an event that the debugger has died in an unexpected way.
- * Debugger death can result from:
- * <ul>
- * <li>an {@link IOException} while the debugger is running</li>
- * <li>an {@link InterruptedException} processing I/O</li>
- * </ul>
- */
- private void sendDeathEvent() {
- EventPacket event = new EventPacket(JSONConstants.VMDEATH);
- sendEvent(event);
- }
-}
90 ...wst.jsdt.debug.rhino.debugger/src/org/eclipse/wst/jsdt/debug/internal/rhino/debugger/FunctionSource.java
View
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.debug.internal.rhino.debugger;
-
-
-/**
- * Handle for a {@link DebuggableScript} function
- *
- * @since 1.0
- */
-public class FunctionSource {
-
- final ScriptSource parent;
- final String name;
- String source;
- final int linenumber;
-
- /**
- * Constructor
- *
- * @param script the parent - cannot be <code>null</code>
- * @param name the name of the function - can be <code>null</code>
- * @param source the underlying source for the function - can be <code>null</code>
- */
- public FunctionSource(ScriptSource script, String name, String source, int linenumber) {
- if(script == null) {
- throw new IllegalArgumentException("The parent script cannot be null"); //$NON-NLS-1$
- }
- this.parent = script;
- this.name = name;
- this.source = source;
- this.linenumber = linenumber;
- }
-
- /**
- * @return the parent {@link ScriptSource} this function appears in
- */
- public ScriptSource parent() {
- return this.parent;
- }
-
- /**
- * @return the name of the function
- */
- public String name() {
- return this.name;
- }
-
- /**
- * @return the source for the function
- */
- public String source() {
- return this.source;
- }
-
- /**
- * Sets the underlying source to the given string
- *
- * @param source the new source
- */
- public void setSource(String source) {
- this.source = source;
- }
-
- /**
- * @return the line number this function appears on
- */
- public int linenumber() {
- return this.linenumber;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- public String toString() {
- StringBuffer buffer = new StringBuffer();
- buffer.append("FunctionSource: [name - ").append(this.name).append("] [linenumber - ").append(linenumber).append("]\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- buffer.append("\tparent: ").append(parent.getLocation()); //$NON-NLS-1$
- buffer.append("\tsource: ").append(this.source).append("\n"); //$NON-NLS-1$ //$NON-NLS-2$
- return buffer.toString();
- }
-}
25 ...lipse.wst.jsdt.debug.rhino.debugger/src/org/eclipse/wst/jsdt/debug/internal/rhino/debugger/LineData.java
View
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.debug.internal.rhino.debugger;
-
-/**
- * Class to hold information about a given line such as:
- * <ul>
- * <li>FunctionSource at the line</li>
- * <li>Breakpoint set on the line</li>
- * </ul>
- * @since 1.0
- */
-public class LineData {
-
- Breakpoint breakpoint = null;
- FunctionSource function = null;
-}
454 ...wst.jsdt.debug.rhino.debugger/src/org/eclipse/wst/jsdt/debug/internal/rhino/debugger/RequestHandler.java
View
@@ -1,454 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 IBM Corporation and others All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.debug.internal.rhino.debugger;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.wst.jsdt.debug.internal.rhino.transport.JSONConstants;
-import org.eclipse.wst.jsdt.debug.internal.rhino.transport.RhinoRequest;
-import org.eclipse.wst.jsdt.debug.internal.rhino.transport.RhinoResponse;
-
-/**
- * Rhino request handler used to craft response bodies for given JSON requests
- *
- * @since 1.0
- */
-public class RequestHandler {
-
- public static final String VERSION_1_6 = "1.6"; //$NON-NLS-1$
- private RhinoDebuggerImpl debugger;
-
- /**
- * Constructor
- *
- * @param debugger
- */
- public RequestHandler(RhinoDebuggerImpl debugger) {
- this.debugger = debugger;
- }
-
- /**
- * Handles a general request - delegating to the correct command type
- *
- * @param request
- * @return
- */
- public RhinoResponse handleRequest(RhinoRequest request) {
- String command = request.getCommand();
- RhinoResponse response = new RhinoResponse(request.getSequence(), command);
- try {
- if (command.equals(JSONConstants.VERSION)) {
- handleVersionRequest(request, response);
- } else if (command.equals(JSONConstants.SUSPEND)) {
- handleSuspendRequest(request, response);
- } else if (command.equals(JSONConstants.CONTINUE)) {
- handleContinueRequest(request, response);
- } else if (command.equals(JSONConstants.DISPOSE)) {
- handleDisposeRequest(request, response);
- } else if (command.equals(JSONConstants.THREADS)) {
- handleThreadsRequest(request, response);
- } else if (command.equals(JSONConstants.THREAD)) {
- handleThreadRequest(request, response);
- } else if (command.equals(JSONConstants.FRAMES)) {
- handleFramesRequest(request, response);
- } else if (command.equals(JSONConstants.FRAME)) {
- handleFrameRequest(request, response);
- } else if (command.equals(JSONConstants.SCRIPTS)) {
- handleScriptsRequest(request, response);
- } else if (command.equals(JSONConstants.SCRIPT)) {
- handleScriptRequest(request, response);
- } else if (command.equals(JSONConstants.EVALUATE)) {
- handleEvaluateRequest(request, response);
- } else if (command.equals(JSONConstants.LOOKUP)) {
- handleLookupRequest(request, response);
- } else if (command.equals(JSONConstants.BREAKPOINTS)) {
- handleBreakpointsRequest(request, response);
- } else if (command.equals(JSONConstants.BREAKPOINT)) {
- handleBreakpointRequest(request, response);
- } else if (command.equals(JSONConstants.SETBREAKPOINT)) {
- handleSetBreakpointRequest(request, response);
- } else if (command.equals(JSONConstants.CLEARBREAKPOINT)) {
- handleClearBreakpointRequest(request, response);
- } else {
- response.setSuccess(false);
- response.setMessage("command not supported"); //$NON-NLS-1$
- }
- } catch (Throwable t) {
- response.setSuccess(false);
- response.setMessage(t.getClass().getName() + " - " + t.getMessage()); //$NON-NLS-1$
- t.printStackTrace();
- }
- return response;
- }
-
- /**
- * Handles a clear breakpoint request
- *
- * @param request
- * @param response
- */
- private void handleClearBreakpointRequest(RhinoRequest request, RhinoResponse response) {
- Map arguments = request.getArguments();
- Long breakpointId = numberToLong((Number) arguments.get(JSONConstants.BREAKPOINT_ID));
- if (breakpointId == null) {
- response.setSuccess(false);
- response.setMessage(missingArgument(JSONConstants.BREAKPOINT_ID));
- return;
- }
- Breakpoint breakpoint = debugger.clearBreakpoint(breakpointId);
- if (breakpoint == null) {
- response.setSuccess(false);
- response.setMessage(JSONConstants.NOT_FOUND);
- return;
- }
- response.getBody().put(JSONConstants.BREAKPOINT, breakpoint.toJSON());
- }
-
- /**
- * Handles a set breakpoint request
- *
- * @param request
- * @param response
- */
- private void handleSetBreakpointRequest(RhinoRequest request, RhinoResponse response) {
- Map arguments = request.getArguments();
- Long scriptId = numberToLong((Number) arguments.get(JSONConstants.SCRIPT_ID));
- Integer line = numberToInteger((Number) arguments.get(JSONConstants.LINE));
- String function = (String) arguments.get(JSONConstants.FUNCTION);
- Long threadId = numberToLong((Number) arguments.get(JSONConstants.THREAD_ID));
- String condition = (String) arguments.get(JSONConstants.CONDITION);
- Breakpoint breakpoint = debugger.setBreakpoint(scriptId, line, function, condition, threadId);
- if(breakpoint != null) {
- response.getBody().put(JSONConstants.BREAKPOINT, breakpoint.toJSON());
- }
- }
-
- /**
- * Handles a breakpoint request
- *
- * @param request
- * @param response
- */
- private void handleBreakpointRequest(RhinoRequest request, RhinoResponse response) {
- Map arguments = request.getArguments();
- Long breakpointId = numberToLong((Number) arguments.get(JSONConstants.BREAKPOINT_ID));
- if (breakpointId == null) {
- response.setSuccess(false);
- response.setMessage(missingArgument(JSONConstants.BREAKPOINT_ID));
- return;
- }
- Breakpoint breakpoint = debugger.getBreakpoint(breakpointId);
- if (breakpoint == null) {
- response.setSuccess(false);
- response.setMessage(JSONConstants.NOT_FOUND);
- return;
- }
- response.getBody().put(JSONConstants.BREAKPOINT, breakpoint.toJSON());
- }
-
- /**
- * Handles a breakpoints request
- *
- * @param request
- * @param response
- */
- private void handleBreakpointsRequest(RhinoRequest request, RhinoResponse response) {
- Collection breakpoints = debugger.getBreakpoints();
- response.getBody().put(JSONConstants.BREAKPOINTS, breakpoints);
- }
-
- /**
- * Handles an evaluate request
- *
- * @param request
- * @param response
- */
- private void handleEvaluateRequest(RhinoRequest request, RhinoResponse response) {
- Map arguments = request.getArguments();
- Long threadId = numberToLong((Number) arguments.get(JSONConstants.THREAD_ID));
- if (threadId == null) {
- response.setSuccess(false);
- response.setMessage(missingArgument(JSONConstants.THREAD_ID));
- return;
- }
- Long frameId = numberToLong((Number) arguments.get(JSONConstants.FRAME_ID));
- if (frameId == null) {
- response.setSuccess(false);
- response.setMessage(missingArgument(JSONConstants.FRAME_ID));
- return;
- }
- String evaluate = (String) arguments.get(JSONConstants.EXPRESSION);
- if (evaluate == null) {
- response.setSuccess(false);
- response.setMessage(missingArgument(JSONConstants.EXPRESSION));
- return;
- }
- StackFrame frame = debugger.getFrame(threadId, frameId);
- if (frame == null) {
- response.setSuccess(false);
- response.setMessage(JSONConstants.NOT_FOUND);
- return;
- }
- Object result = frame.evaluate(evaluate);
- response.getBody().put(JSONConstants.EVALUATE, result);
- }
-
- /**
- * Handles a lookup request
- *
- * @param request
- * @param response
- */
- private void handleLookupRequest(RhinoRequest request, RhinoResponse response) {
- Map arguments = request.getArguments();
- Long threadId = numberToLong((Number) arguments.get(JSONConstants.THREAD_ID));
- if (threadId == null) {
- response.setSuccess(false);
- response.setMessage(missingArgument(JSONConstants.THREAD_ID));
- return;
- }
- Long frameId = numberToLong((Number) arguments.get(JSONConstants.FRAME_ID));
- if (frameId == null) {
- response.setSuccess(false);
- response.setMessage(missingArgument(JSONConstants.FRAME_ID));
- return;
- }
- Long handle = numberToLong((Number) arguments.get(JSONConstants.REF));
- if (handle == null) {
- response.setSuccess(false);
- response.setMessage(missingArgument(JSONConstants.REF));
- return;
- }
- StackFrame frame = debugger.getFrame(threadId, frameId);
- if (frame == null) {
- response.setSuccess(false);
- response.setMessage(JSONConstants.NOT_FOUND);
- return;
- }
- Object result = frame.lookup(handle);
- response.getBody().put(JSONConstants.LOOKUP, result);
- }
-
- /**
- * Handles a script request
- *
- * @param request
- * @param response
- */
- private void handleScriptRequest(RhinoRequest request, RhinoResponse response) {
- Map arguments = request.getArguments();
- Long scriptId = numberToLong((Number) arguments.get(JSONConstants.SCRIPT_ID));
- if (scriptId == null) {
- response.setSuccess(false);
- response.setMessage(missingArgument(JSONConstants.SCRIPT_ID));
- return;
- }
- ScriptSource script = debugger.getScript(scriptId);
- if (script == null) {
- response.setSuccess(false);
- response.setMessage(JSONConstants.NOT_FOUND);
- return;
- }
- response.getBody().put(JSONConstants.SCRIPT, script.toJSON());
- }
-
- /**
- * Handles a scripts request
- *
- * @param request
- * @param response
- */
- private void handleScriptsRequest(RhinoRequest request, RhinoResponse response) {
- List scriptIds = debugger.getScriptIds();
- response.getBody().put(JSONConstants.SCRIPTS, scriptIds);
- }
-
- /**
- * Handles a frame request
- *
- * @param request
- * @param response
- */
- private void handleFrameRequest(RhinoRequest request, RhinoResponse response) {
- Map arguments = request.getArguments();
- Long threadId = numberToLong((Number) arguments.get(JSONConstants.THREAD_ID));
- if (threadId == null) {
- response.setSuccess(false);
- response.setMessage(missingArgument(JSONConstants.THREAD_ID));
- return;
- }
- Long frameId = numberToLong((Number) arguments.get(JSONConstants.FRAME_ID));
- if (frameId == null) {
- response.setSuccess(false);
- response.setMessage(missingArgument(JSONConstants.FRAME_ID));
- return;
- }
- StackFrame frame = debugger.getFrame(threadId, frameId);
- if (frame == null) {
- response.setSuccess(false);
- response.setMessage(JSONConstants.NOT_FOUND);
- return;
- }
- response.getBody().put(JSONConstants.FRAME, frame.toJSON());
- }
-
- /**
- * Handles a frames request
- *
- * @param request
- * @param response
- */
- private void handleFramesRequest(RhinoRequest request, RhinoResponse response) {
- Map arguments = request.getArguments();
- Long threadId = numberToLong((Number) arguments.get(JSONConstants.THREAD_ID));
- if (threadId == null) {
- response.setSuccess(false);
- response.setMessage(missingArgument(JSONConstants.THREAD_ID));
- return;
- }
- List frameIds = debugger.getFrameIds(threadId);
- response.getBody().put(JSONConstants.FRAMES, frameIds);
- }
-
- /**
- * Handles a thread request
- *
- * @param request
- * @param response
- */
- private void handleThreadRequest(RhinoRequest request, RhinoResponse response) {
- Map arguments = request.getArguments();
- Long threadId = numberToLong((Number) arguments.get(JSONConstants.THREAD_ID));
- if (threadId == null) {
- response.setSuccess(false);
- response.setMessage(missingArgument(JSONConstants.THREAD_ID));
- return;
- }
- ThreadData threadData = debugger.getThreadData(threadId);
- if (threadData == null) {
- response.setSuccess(false);
- response.setMessage(JSONConstants.NOT_FOUND);
- return;
- }
- response.getBody().put(JSONConstants.THREAD, threadData.toJSON());
- }
-
- /**
- * Reports a missing argument
- *
- * @param key
- * @return
- */
- private String missingArgument(String key) {
- // TODO NLS this
- return "Missing Argument: "+key; //$NON-NLS-1$
- }
-
- /**
- * Handles a threads request
- *
- * @param request
- * @param response
- */
- private void handleThreadsRequest(RhinoRequest request, RhinoResponse response) {
- List threadIds = debugger.getThreadIds();
- response.getBody().put(JSONConstants.THREADS, threadIds);
- }
-
- /**
- * Handles a dispose request by disconnecting the underlying {@link RhinoDebuggerImpl}
- *
- * @param request
- * @param response
- */
- private void handleDisposeRequest(RhinoRequest request, RhinoResponse response) {
- debugger.disconnect();
- }
-
- /**
- * Handles a continue request
- *
- * @param request
- * @param response
- */
- private void handleContinueRequest(RhinoRequest request, RhinoResponse response) {
- Map arguments = request.getArguments();
- Long threadId = numberToLong((Number) arguments.get(JSONConstants.THREAD_ID));
- if (threadId == null) {
- debugger.resumeAll();
- return;
- }
- String stepType = (String) arguments.get(JSONConstants.STEP);
- debugger.resume(threadId, stepType);
- }
-
- /**
- * Handles a suspend request
- *
- * @param request
- * @param response
- */
- private void handleSuspendRequest(RhinoRequest request, RhinoResponse response) {
- Map arguments = request.getArguments();
- Long threadId = numberToLong((Number) arguments.get(JSONConstants.THREAD_ID));
- if (threadId == null) {
- debugger.suspendAll();
- return;
- }
- debugger.suspend(threadId);
- }
-
- /**
- * Wrappers the given {@link Number} as a {@link Long}
- *
- * @param number
- * @return a new {@link Long}
- */
- private static Long numberToLong(Number number) {
- if (number == null)
- return null;
- return new Long(number.longValue());
- }
-
- /**
- * Wrappers the given {@link Number} as an {@link Integer}
- *
- * @param number
- * @return a new {@link Integer}
- */
- private Integer numberToInteger(Number number) {
- if (number == null) {
- return null;
- }
- return new Integer(number.intValue());
- }
-
- /**
- * Appends version infos to the given response body
- *
- * @param request
- * @param response
- *
- * @see JSONConstants#ECMASCRIPT_VERSION
- * @see JSONConstants#JAVASCRIPT_VERSION
- * @see JSONConstants#VM_NAME
- * @see JSONConstants#VM_VENDOR
- * @see JSONConstants#VM_VERSION
- */
- private void handleVersionRequest(RhinoRequest request, RhinoResponse response) {
- Map body = response.getBody();
- body.put(JSONConstants.JAVASCRIPT_VERSION, VERSION_1_6);
- body.put(JSONConstants.ECMASCRIPT_VERSION, "3"); //$NON-NLS-1$
- body.put(JSONConstants.VM_NAME, "Rhino"); //$NON-NLS-1$
- body.put(JSONConstants.VM_VERSION, VERSION_1_6);
- body.put(JSONConstants.VM_VENDOR, "Mozilla"); //$NON-NLS-1$
- }
-}
539 ....jsdt.debug.rhino.debugger/src/org/eclipse/wst/jsdt/debug/internal/rhino/debugger/RhinoDebuggerImpl.java
View
@@ -1,539 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2011 IBM Corporation and others All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.debug.internal.rhino.debugger;
-
-import java.io.File;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.wst.jsdt.debug.internal.rhino.transport.EventPacket;
-import org.eclipse.wst.jsdt.debug.internal.rhino.transport.JSONConstants;
-import org.eclipse.wst.jsdt.debug.internal.rhino.transport.JSONUtil;
-import org.eclipse.wst.jsdt.debug.transport.TransportService;
-import org.mozilla.javascript.Context;
-import org.mozilla.javascript.ContextFactory;
-import org.mozilla.javascript.debug.DebugFrame;
-import org.mozilla.javascript.debug.DebuggableScript;
-import org.mozilla.javascript.debug.Debugger;
-
-/**
- * Rhino implementation of {@link Debugger}
- * <br><br>
- * Events fired:
- * <ul>
- * <li><b>Thread enter event</b> - when a new context is created see: {@link #contextCreated(Context)}</li>
- * <li><b>Thread exit event</b> - when a context is exited see: {@link #contextReleased(Context)}</li>
- * <li><b>VM death event</b> - if the debugger dies: this event can only be received if the underlying communication channel has not been interrupted</li>
- * </ul>
- * @since 1.0
- */
-public class RhinoDebuggerImpl implements Debugger, ContextFactory.Listener {
-
- public static final DebuggableScript[] NO_SCRIPTS = new DebuggableScript[0];
- private static final String RHINO_SCHEME = "rhino"; //$NON-NLS-1$
-
- private final Map threadToThreadId = new HashMap();
- private final Map threadIdToData = new HashMap();
- private final Map breakpoints = new HashMap();
-
- private long currentThreadId = 0L;
- private long currentBreakpointId = 0L;
- private long currentScriptId = 0L;
- private ArrayList disabledThreads = new ArrayList();
-
- /**
- * Mapping of the URI string to the {@link ScriptSource}
- */
- private HashMap/*<String, ScriptSource>*/ uriToScript = new HashMap();
- /**
- * Mapping of the id to the {@link ScriptSource}
- */
- private HashMap/*<Long, ScriptSource>*/ idToScript = new HashMap();
-
- private final DebugSessionManager sessionManager;
-
- /**
- * This constructor will only accept a <code>transport</code> argument
- * of <code>socket</code>. I.e. <code>transport=socket</code>.<br><br>
- *
- * To use a differing {@link TransportService} pleas use the other constructor:
- * {@link #RhinoDebugger(TransportService, String, boolean)}
- *
- * @param configString the configuration string, for example: <code>transport=socket,suspend=y,address=9000</code>
- */
- public RhinoDebuggerImpl(String configString) {
- sessionManager = DebugSessionManager.create(configString);
- }
-
- /**
- * This constructor allows you to specify a custom {@link TransportService} to use other than <code>socket</code>.
- *
- * @param transportService the {@link TransportService} to use for debugger communication
- * @param address the address to communicate on
- * @param startSuspended if the debugger should wait while accepting a connection. The wait time for stating suspended is not indefinite,
- * @param trace if the debugger should be in tracing mode, reporting debug statements to the console
- * and is equal to 300000ms.
- */
- public RhinoDebuggerImpl(TransportService transportService, String address, boolean startSuspended, boolean trace) {
- sessionManager = new DebugSessionManager( transportService, address, startSuspended, trace);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.mozilla.javascript.debug.Debugger#getFrame(org.mozilla.javascript.Context, org.mozilla.javascript.debug.DebuggableScript)
- */
- public synchronized DebugFrame getFrame(Context context, DebuggableScript debuggableScript) {
- ScriptSource script = getScript(debuggableScript);
- if(script != null && !script.isStdIn()) {
- ContextData contextData = (ContextData) context.getDebuggerContextData();
- ThreadData thread = (ThreadData) threadIdToData.get(contextData.getThreadId());
- FunctionSource function = script.getFunction(debuggableScript);
- return thread.getFrame(context, function, script);
- }
- return null;
- }
-
- /**
- * Returns the root {@link ScriptSource} context
- *
- * @param script
- * @return the root {@link ScriptSource} context
- */
- private ScriptSource getScript(DebuggableScript script) {
- synchronized (uriToScript) {
- DebuggableScript root = script;
- while (!root.isTopLevel()) {
- root = root.getParent();
- }
- URI uri = getSourceUri(root, parseSourceProperties(root.getSourceName()));
- if(uri != null) {
- return (ScriptSource) uriToScript.get(uri);
- }
- }
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.mozilla.javascript.debug.Debugger#handleCompilationDone(org.mozilla.javascript.Context, org.mozilla.javascript.debug.DebuggableScript, java.lang.String)
- */
- public void handleCompilationDone(Context context, DebuggableScript script, String source) {
- if (!script.isTopLevel()) {
- return;
- }
- Map properties = parseSourceProperties(script.getSourceName());
- URI uri = getSourceUri(script, properties);
- if(uri == null) {
- //if the source cannot be located don't load or notify
- return;
- }
- final ScriptSource newscript = new ScriptSource(script, source, uri, script.isGeneratedScript(), properties);
- synchronized (uriToScript) {
- ScriptSource old = (ScriptSource) uriToScript.remove(uri);
- Long id = null;
- if(old != null) {
- //recycle the id for a re-loaded script
- //https://bugs.eclipse.org/bugs/show_bug.cgi?id=306832
- id = old.getId();
- idToScript.remove(id);
- newscript.setId(id);
- //clean up the cache of breakpoints
- old.clearBreakpoints(this);
- }
- else {
- //a totally new script is loaded
- id = scriptId();
- newscript.setId(id);
- }
- uriToScript.put(uri, newscript);
- idToScript.put(id, newscript);
- }
- ContextData contextData = (ContextData) context.getDebuggerContextData();
- contextData.scriptLoaded(newscript);
- }
-
- /**
- * Composes a {@link URI} representing the path to the source of the given script
- *
- * @param script the script to create a {@link URI} for
- * @param properties any special properties @see {@link #parseSourceProperties(String)}
- * @return the {@link URI} for the source or <code>null</code>
- */
- private URI getSourceUri(DebuggableScript script, Map properties) {
- String sourceName = script.getSourceName();
- if(properties != null) {
- String jsonName = (String) properties.get(JSONConstants.NAME);
- if (jsonName != null)
- sourceName = jsonName;
- }
-
- // handle null sourceName
- if (sourceName == null)
- return null;
-
- // handle input from the Rhino Shell
- if (sourceName.equals("<stdin>")) { //$NON-NLS-1$
- sourceName = "stdin"; //$NON-NLS-1$
- }
- if(sourceName.equals("<command>")) { //$NON-NLS-1$
- sourceName = "command"; //$NON-NLS-1$
- }
- else {
- // try to parse it as a file
- File sourceFile = new File(sourceName);
- if (sourceFile.exists())
- return sourceFile.toURI();
-
- //try to just create a URI from the name
- try {
- return new URI(sourceName);
- } catch(URISyntaxException e) {
- //do nothing and fall through
- }
- }
-
- //fall back to creating a rhino specific URI from the script source name as a path
- try {
- if (! (sourceName.charAt(0) == '/'))
- sourceName = "/" + sourceName; //$NON-NLS-1$
- return new URI(RHINO_SCHEME, null, sourceName, null);
- } catch (URISyntaxException e) {
- return null;
- }
- }
-
- /**
- * Returns any special properties specified in the source name or <code>null</code>
- *
- * @param sourceName
- * @return any special properties specified in the source name or <code>null</code>
- */
- Map parseSourceProperties(String sourceName) {
- if (sourceName != null && sourceName.charAt(0) == '{') {
- try {
- Object json = JSONUtil.read(sourceName);
- if (json instanceof Map) {
- return (Map) json;
- }
- } catch (RuntimeException e) {
- // ignore
- }
- }
- return null;
- }
-
- /**
- * Returns the next script id to use
- *
- * @return the next id
- */
- synchronized Long scriptId() {
- return new Long(currentScriptId++);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.mozilla.javascript.ContextFactory.Listener#contextCreated(org.mozilla.javascript.Context)
- */
- public synchronized void contextCreated(Context context) {
- Thread thread = Thread.currentThread();
- if (disabledThreads.contains(thread)) {
- return;
- }
- Long threadId = (Long) threadToThreadId.get(thread);
- if (threadId == null) {
- threadId = new Long(currentThreadId++);
- threadToThreadId.put(thread, threadId);
- }
- ThreadData threadData = (ThreadData) threadIdToData.get(threadId);
- if (threadData == null) {
- threadData = new ThreadData(threadId, this);
- threadIdToData.put(threadId, threadData);
- sendThreadEvent(JSONConstants.ENTER, threadId);
- }
- threadData.contextCreated(context);
- }
-
- /**
- * Sends a thread event for the given type
- *
- * @param type the type of event to send
- * @param threadId the id of the thread the even is for
- *
- * @see JSONConstants#ENTER
- * @see JSONConstants#EXIT
- */
- private void sendThreadEvent(String type, Long threadId) {
- EventPacket threadEvent = new EventPacket(JSONConstants.THREAD);
- Map body = threadEvent.getBody();
- body.put(JSONConstants.TYPE, type);
- body.put(JSONConstants.THREAD_ID, threadId);
- sendEvent(threadEvent);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.mozilla.javascript.ContextFactory.Listener#contextReleased(org.mozilla.javascript.Context)
- */
- public synchronized void contextReleased(Context context) {
- Thread thread = Thread.currentThread();
- if (disabledThreads.contains(thread)) {
- return;
- }
- Long threadId = (Long) threadToThreadId.get(thread);
- if (threadId == null) {
- return;
- }
- ThreadData threadData = (ThreadData) threadIdToData.get(threadId);
- threadData.contextReleased(context);
- if (!threadData.hasContext()) {
- threadToThreadId.remove(thread);
- threadIdToData.remove(threadId);
- sendThreadEvent(JSONConstants.EXIT, threadId);
- }
- }
-
- /**
- * Resumes a thread with the given id for the given step type. Has no effect if no such thread exists
- *
- * @param threadId
- * @param stepType
- */
- public synchronized void resume(Long threadId, String stepType) {
- ThreadData threadData = (ThreadData) threadIdToData.get(threadId);
- if (threadData != null) {
- threadData.resume(stepType);
- }
- }
-
- /**
- * Resumes all threads currently in the debugger
- */
- public synchronized void resumeAll() {
- for (Iterator it = threadIdToData.keySet().iterator(); it.hasNext();) {
- Long threadId = (Long) it.next();
- resume(threadId, null);
- }
- }
-
- /**
- * Suspend the thread with the given id. Has no effect if no such thread exists
- *
- * @param threadId
- */
- public synchronized void suspend(Long threadId) {
- ThreadData threadData = (ThreadData) threadIdToData.get(threadId);
- if (threadData != null) {
- threadData.suspend();
- }
- }
-
- /**
- * Suspend all threads currently in the debugger
- */
- public synchronized void suspendAll() {
- for (Iterator it = threadIdToData.keySet().iterator(); it.hasNext();) {
- Long threadId = (Long) it.next();
- suspend(threadId);
- }
- }
-
- /**
- * Disconnects the debugger
- */
- public void disconnect() {
- }
-
- /**
- * Returns all of the stack frame ids for the thread with the given id. Returns an empty list if no such thread exists, never <code>null</code>
- *
- * @param threadId
- * @return the complete list of stack frame ids from the thread with the given id
- */
- public synchronized List getFrameIds(Long threadId) {
- ThreadData threadData = (ThreadData) threadIdToData.get(threadId);
- if (threadData == null) {
- return Collections.EMPTY_LIST;
- }
- return threadData.getFrameIds();
- }
-
- /**
- * Returns a {@link DebugFrame} with the given id from the thread with the given thread id. Returns <code>null</code> if the no such thread exists with the given id and / or no such {@link DebugFrame} exists with the given id
- *
- * @param threadId
- * @param frameId
- * @return the {@link DebugFrame} with the given id from the thread with the given id
- */
- public synchronized StackFrame getFrame(Long threadId, Long frameId) {
- ThreadData threadData = (ThreadData) threadIdToData.get(threadId);
- if (threadData != null) {
- return threadData.getFrame(frameId);
- }
- return null;
- }
-
- /**
- * @return the ids of all of the scripts currently known to the debugger
- */
- public synchronized List getScriptIds() {
- return new ArrayList(idToScript.keySet());
- }
-
- /**
- * Returns the script with the given id or <code>null</code> if no such script exists with the given id
- *
- * @param scriptId
- * @return the script with the given id or <code>null</code>
- */
- public synchronized ScriptSource getScript(Long scriptId) {
- return (ScriptSource) idToScript.get(scriptId);
- }
-
- /**
- * @return the complete collection of breakpoints currently known to the debugger
- */
- public synchronized Collection getBreakpoints() {
- return breakpoints.keySet();
- }
-
- /**
- * Creates a breakpoint in the script with the given id and the given breakpoint attributes.
- * Returns the new breakpoint or <code>null</code> if:
- * <ul>
- * <li>no such script exists with the given id</li>
- * <li>the given line number is not a valid line number</li>
- * </ul>
- * <p>
- * If a breakpoint already exists at the given location it is removed and the new breakpoint is set.
- * </p>
- * @param scriptId
- * @param lineNumber
- * @param functionName
- * @param condition
- * @param threadId
- * @return the new breakpoint or <code>null</code> if no script exists with the given id
- */
- public synchronized Breakpoint setBreakpoint(Long scriptId, Integer lineNumber, String functionName, String condition, Long threadId) {
- ScriptSource script = (ScriptSource) idToScript.get(scriptId);
- if (script == null || !script.isValid(lineNumber, functionName)) {
- return null;
- }
-
-
- Breakpoint newbreakpoint = new Breakpoint(nextBreakpointId(), script, lineNumber, functionName, condition, threadId);
- Breakpoint oldbp = script.getBreakpoint(lineNumber, functionName);
- if(oldbp != null) {
- breakpoints.remove(oldbp.breakpointId);
- }
- breakpoints.put(newbreakpoint.breakpointId, newbreakpoint);
- script.addBreakpoint(newbreakpoint);
- return newbreakpoint;
- }
-
- /**
- * @return the next unique breakpoint id to use
- */
- private synchronized Long nextBreakpointId() {
- return new Long(currentBreakpointId++);
- }
-
- /**
- * Clears the breakpoint out of the cache with the given id and returns it. Returns <code>null</code> if no breakpoint exists with the given id.
- *
- * @param breakpointId
- * @return the removed breakpoint or <code>null</code>
- */
- public synchronized Breakpoint clearBreakpoint(Long breakpointId) {
- Breakpoint breakpoint = (Breakpoint) breakpoints.remove(breakpointId);
- if (breakpoint != null) {
- breakpoint.delete();
- }
- return breakpoint;
- }
-
- /**
- * Sends the given {@link EventPacket} using the underlying {@link DebugRuntime} and returns if it was sent successfully
- *
- * @param event
- * @return true if the event was sent successfully, false otherwise
- */
- public boolean sendEvent(EventPacket event) {
- return sessionManager.sendEvent(event);
- }
-
- /**
- * Gets a breakpoint with the given id, returns <code>null</code> if no such breakpoint exists with the given id
- *
- * @param breakpointId
- * @return the breakpoint with the given id or <code>null</code>
- */
- public Breakpoint getBreakpoint(Long breakpointId) {
- return (Breakpoint) breakpoints.get(breakpointId);
- }
-
- /**
- * Gets the thread for the thread with the given id, returns <code>null</code> if no such thread exists with the given id
- *
- * @param threadId
- * @return the thread data for the thread with the given id or <code>null</code>
- */
- public synchronized ThreadData getThreadData(Long threadId) {
- return (ThreadData) threadIdToData.get(threadId);
- }
-
- /**
- * @return the complete list of thread ids known to the debugger
- */
- public synchronized List getThreadIds() {
- return new ArrayList(threadIdToData.keySet());
- }
-
- /**
- * Caches the current thread as disabled
- */
- public synchronized void disableThread() {
- disabledThreads.add(Thread.currentThread());
- }
-
- /**
- * Removes the current thread as being disabled
- */
- public synchronized void enableThread() {
- disabledThreads.remove(Thread.currentThread());
- }
-
- public void start() {
- sessionManager.start(this);
- }
-
- public void stop() {
- sessionManager.stop();
- }
-
- /**
- * Returns if a {@link DebugSession} has successfully connected to this debugger.
- *
- * @return <code>true</code> if the debugger has a connected {@link DebugSession} <code>false</code> otherwise
- */
- public boolean isConnected() {
- return sessionManager.isConnected();
- }
-}
479 ...e.wst.jsdt.debug.rhino.debugger/src/org/eclipse/wst/jsdt/debug/internal/rhino/debugger/ScriptSource.java
View
@@ -1,479 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2011 IBM Corporation and others All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.debug.internal.rhino.debugger;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.wst.jsdt.debug.internal.rhino.transport.Constants;
-import org.eclipse.wst.jsdt.debug.internal.rhino.transport.JSONConstants;
-import org.mozilla.javascript.debug.DebuggableScript;
-import org.mozilla.javascript.debug.Debugger;
-
-/**
- * Rhino script implementation
- *
- * @since 1.0
- */
-public class ScriptSource {
-
- /**
- * No line information
- */
- static final LineData[] NO_LINES = new LineData[0];
-
- /**
- * The id of the script
- */
- private Long scriptId;
- /**
- * Any special source properties to consider
- */
- private final Map properties;
- /**
- * The backing source String that was compiled to give us this proxy
- */
- private final String source;
- /**
- * If this {@link ScriptSource} was generated
- */
- private final boolean generated;
- /**
- * The ordered list of function names
- */
- private ArrayList functionNames = null;
-
- private Integer firstLine = null;
-
- /**
- * The location of the script
- */
- private URI uri = null;
- /**
- * The array of cached {@link FunctionSource}s
- */
- private FunctionSource[] functionSources = null;
- /**
- * Sparse array of line information. This array only has entries present for
- * lines that are returned
- */
- private LineData[] lines = null;
- /**
- * Mapping of the {@link DebuggableScript} backing the FunctionSource to the FunctionSource handle
- */
- private HashMap/*<DebuggableScript, FunctionSource>*/ scriptToFunction = new HashMap();
-
- /**
- * Constructor
- *
- * @param scriptId
- * @param debuggableScript
- * @param source
- */
- public ScriptSource(DebuggableScript script, String source, URI uri, boolean generated, Map properties) {
- this.uri = uri;
- this.source = source;
- this.properties = properties;
- this.generated = generated;
-
- if(isStdIn()) {
- //do not compute line data
- return;
- }
- int[] rootlines = script.getLineNumbers();
- DebuggableScript[] functions = collectFunctions(script);
- int flength = functions.length;
- int max = 0;
- int min = Integer.MAX_VALUE;
- HashSet lineNumbers = new HashSet(flength+rootlines.length+1);
- //dump in the line #'s from the root script
- for (int i = 0; i < rootlines.length; i++) {
- int line = rootlines[i];
- if(line > max) {
- max = line;
- }
- if(line < min) {
- min = line;
- }
- lineNumbers.add(new Integer(line));
- }
- //dump in the line numbers from the expanded set of functions
- if(flength > 0) {
- functionSources = new FunctionSource[flength];
- functionNames = new ArrayList(flength);
-
- int start = 0, end = 0;;
- for (int i = 0; i < functions.length; i++) {
- int[] lines = functions[i].getLineNumbers();
- if(lines != null && lines.length > 0) {
- start = lines[0] + 1;
- for (int j = 0; j < lines.length; j++) {
- int currentLine = lines[j];
- if(currentLine > max) {
- max = currentLine;
- }
- if(currentLine < min) {
- min = currentLine;
- }
- if (currentLine < start) {
- start = currentLine;
- }
- else if(currentLine > end) {
- end = currentLine;
- }
- lineNumbers.add(new Integer(currentLine));
- }
- }
- String name = functions[i].getFunctionName();
- name = (name == null ? Constants.EMPTY_STRING : name);
- functionSources[i] = new FunctionSource(this, name, computeFunctionSource(0, 0, source), start);
- functionNames.add(name);
- scriptToFunction.put(functions[i], functionSources[i]);
- start = 0;
- }
- }
- //create the sparse array and populate the valid line numbers
- if(max == 0) {
- this.lines = NO_LINES;
- }
- else {
- this.lines = new LineData[max+1];
- for (Iterator iter = lineNumbers.iterator(); iter.hasNext();) {
- Integer value = (Integer) iter.next();
- this.lines[value.intValue()] = new LineData();
- iter.remove();
- }
- lineNumbers = null;
- }
- this.firstLine = new Integer(min);
- }
-
- /**
- * Returns the first executable line in the script
- *
- * @return the first executable line in the script
- */
- public Integer firstLine() {
- return this.firstLine;
- }
-
- /**
- * @return if this script represents the stdin script
- */
- public boolean isStdIn() {
- return this.uri.toString().endsWith("stdin"); //$NON-NLS-1$
- }
-
- /**
- * Clears the breakpoints from this script out of the given {@link Debugger}
- */
- void clearBreakpoints(RhinoDebuggerImpl debugger) {
- if(this.lines != null) {
- for (int i = 0; i < this.lines.length; i++) {
- if(lines[i] != null) {
- Breakpoint bp = lines[i].breakpoint;
- if(bp != null) {
- debugger.clearBreakpoint(bp.breakpointId);
- }
- }
- }
- }
- }
-
- /**
- * Collects all of the {@link DebuggableScript} objects for the functions
- * @param root the root script
- * @return the collected array of functions - {@link DebuggableScript} - objects or an empty array
- */
- DebuggableScript[] collectFunctions(DebuggableScript root) {
- ArrayList functions = new ArrayList();
- collectFunctions(root, functions);
- int size = functions.size();
- if(size < 1) {
- return RhinoDebuggerImpl.NO_SCRIPTS;
- }
- DebuggableScript[] funcs = new DebuggableScript[size];
- functions.toArray(funcs);
- return funcs;
- }
-
- /**
- * Recursively collects function {@link DebuggableScript}s
- *
- * @param root
- * @param collector