Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

split out further subprojects: groovy-shell, groovy-console, groovy-s…

…wing
  • Loading branch information...
commit 51abdcfcc0e3cdc57afb8a33c2292186404319c5 1 parent 66fc910
@paulk-asert paulk-asert authored
Showing with 10,063 additions and 9,941 deletions.
  1. +3 −1 settings.gradle
  2. +1 −0  src/examples/groovy/swing/SwingDemo.groovy
  3. +1 −0  src/examples/groovy/swing/TableDemo.groovy
  4. +1 −0  src/examples/groovy/swing/TableLayoutDemo.groovy
  5. +1 −1  src/examples/swing/Widgets.groovy
  6. +1 −1  src/examples/swing/binding/caricature/Caricature.groovy
  7. +1 −2  src/examples/swing/binding/caricature/JCaricature.java
  8. +1 −1  src/examples/swing/greet/Greet.groovy
  9. +1 −1  src/examples/swing/greet/TwitterAPI.groovy
  10. +1 −1  src/examples/swing/greet/View.groovy
  11. +1 −1  src/examples/swing/timelog/TimeLogMain.groovy
  12. +1 −1  src/examples/swing/timelog/TimeLogModel.groovy
  13. +1 −1  src/examples/swing/timelog/TimeLogView.groovy
  14. +4 −3 src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
  15. +2 −0  src/test/groovy/inspect/swingui/AstNodeToScriptAdapterTest.groovy
  16. +2 −0  src/test/groovy/inspect/swingui/ScriptToTreeNodeAdapterTest.groovy
  17. +17 −0 subprojects/groovy-console/build.gradle
  18. +2 −2 {src/main/groovy/ui → subprojects/groovy-console/src/main/groovy}/Console.groovy
  19. +363 −363 {src/main/groovy/ui → subprojects/groovy-console/src/main/groovy}/ConsoleActions.groovy
  20. +35 −35 {src/main/groovy/ui → subprojects/groovy-console/src/main/groovy}/ConsoleApplet.groovy
  21. 0  {src/main/groovy/ui → subprojects/groovy-console/src/main/groovy}/ConsoleIcon.png
  22. +65 −65 {src/main/groovy/ui → subprojects/groovy-console/src/main/groovy}/ConsoleIvyPlugin.groovy
  23. 0  {src/main/groovy/ui → subprojects/groovy-console/src/main/groovy}/ConsoleSupport.java
  24. +321 −321 {src/main/groovy/ui → subprojects/groovy-console/src/main/groovy}/ConsoleTextEditor.java
  25. +147 −147 {src/main/groovy/ui → subprojects/groovy-console/src/main/groovy}/ConsoleView.groovy
  26. +37 −37 {src/main/groovy/ui → subprojects/groovy-console/src/main/groovy}/HistoryRecord.groovy
  27. 0  {src/main/groovy/ui → subprojects/groovy-console/src/main/groovy}/InteractiveShell.properties
  28. 0  {src/main/groovy/ui → subprojects/groovy-console/src/main/groovy}/OutputTransforms.groovy
  29. 0  {src/main/groovy/ui → subprojects/groovy-console/src/main/groovy}/SystemOutputInterceptor.java
  30. +51 −51 {src/main → subprojects/groovy-console/src/main/groovy}/groovy/inspect/TextNode.groovy
  31. +33 −33 {src/main → subprojects/groovy-console/src/main/groovy}/groovy/inspect/TextTreeNodeMaker.groovy
  32. 0  {src/main → subprojects/groovy-console/src/main/groovy}/groovy/ui/icons/arrow_redo.png
  33. 0  {src/main → subprojects/groovy-console/src/main/groovy}/groovy/ui/icons/arrow_undo.png
  34. 0  {src/main → subprojects/groovy-console/src/main/groovy}/groovy/ui/icons/book_next.png
  35. 0  {src/main → subprojects/groovy-console/src/main/groovy}/groovy/ui/icons/book_previous.png
  36. 0  {src/main → subprojects/groovy-console/src/main/groovy}/groovy/ui/icons/bullet_green.png
  37. +4 −4 {src/main → subprojects/groovy-console/src/main/groovy}/groovy/ui/icons/credits.txt
  38. 0  {src/main → subprojects/groovy-console/src/main/groovy}/groovy/ui/icons/cross.png
  39. 0  {src/main → subprojects/groovy-console/src/main/groovy}/groovy/ui/icons/cut.png
  40. 0  {src/main → subprojects/groovy-console/src/main/groovy}/groovy/ui/icons/cut_red.png
  41. 0  {src/main → subprojects/groovy-console/src/main/groovy}/groovy/ui/icons/disk.png
  42. 0  {src/main → subprojects/groovy-console/src/main/groovy}/groovy/ui/icons/find.png
  43. 0  {src/main → subprojects/groovy-console/src/main/groovy}/groovy/ui/icons/folder_page.png
  44. 0  {src/main → subprojects/groovy-console/src/main/groovy}/groovy/ui/icons/page.png
  45. 0  {src/main → subprojects/groovy-console/src/main/groovy}/groovy/ui/icons/page_copy.png
  46. 0  {src/main → subprojects/groovy-console/src/main/groovy}/groovy/ui/icons/page_paste.png
  47. 0  {src/main → subprojects/groovy-console/src/main/groovy}/groovy/ui/icons/script_go.png
  48. 0  {src/main → subprojects/groovy-console/src/main/groovy}/groovy/ui/icons/text_replace.png
  49. +48 −48 {src/main → subprojects/groovy-console/src/main/groovy}/groovy/ui/text/AutoIndentAction.groovy
  50. 0  {src/main → subprojects/groovy-console/src/main/groovy}/groovy/ui/text/FindReplaceUtility.java
  51. +256 −256 {src/main → subprojects/groovy-console/src/main/groovy}/groovy/ui/text/GroovyFilter.java
  52. +568 −568 .../main → subprojects/groovy-console/src/main/groovy}/groovy/ui/text/StructuredSyntaxDocumentFilter.java
  53. +141 −141 {src/main → subprojects/groovy-console/src/main/groovy}/groovy/ui/text/StructuredSyntaxHandler.java
  54. +82 −82 {src/main → subprojects/groovy-console/src/main/groovy}/groovy/ui/text/StructuredSyntaxResources.java
  55. +555 −555 {src/main → subprojects/groovy-console/src/main/groovy}/groovy/ui/text/TextEditor.java
  56. 0  {src/main → subprojects/groovy-console/src/main/groovy}/groovy/ui/text/TextUndoManager.java
  57. 0  {src/main → subprojects/groovy-console/src/main/groovy}/groovy/ui/text/package.html
  58. +139 −139 {src/main → subprojects/groovy-console/src/main/groovy}/groovy/ui/view/BasicContentPane.groovy
  59. +88 −88 {src/main → subprojects/groovy-console/src/main/groovy}/groovy/ui/view/BasicMenuBar.groovy
  60. +32 −32 {src/main → subprojects/groovy-console/src/main/groovy}/groovy/ui/view/BasicStatusBar.groovy
  61. +41 −41 {src/main → subprojects/groovy-console/src/main/groovy}/groovy/ui/view/BasicToolBar.groovy
  62. +80 −80 {src/main → subprojects/groovy-console/src/main/groovy}/groovy/ui/view/Defaults.groovy
  63. 0  {src/main → subprojects/groovy-console/src/main/groovy}/groovy/ui/view/GTKDefaults.groovy
  64. +79 −79 {src/main → subprojects/groovy-console/src/main/groovy}/groovy/ui/view/MacOSXDefaults.groovy
  65. +121 −121 {src/main → subprojects/groovy-console/src/main/groovy}/groovy/ui/view/MacOSXMenuBar.groovy
  66. +41 −41 {src/main → subprojects/groovy-console/src/main/groovy}/groovy/ui/view/WindowsDefaults.groovy
  67. +2 −2 ...groovy/inspect → subprojects/groovy-console/src/main/groovy/inspect/swingui}/swingui/AstBrowser.groovy
  68. +1 −1  ...pect → subprojects/groovy-console/src/main/groovy/inspect/swingui}/swingui/AstBrowserProperties.groovy
  69. +1 −1  ...ct → subprojects/groovy-console/src/main/groovy/inspect/swingui}/swingui/AstNodeToScriptAdapter.groovy
  70. +1 −1  ...ovy/inspect → subprojects/groovy-console/src/main/groovy/inspect/swingui}/swingui/ObjectBrowser.groovy
  71. +1 −1  ...t → subprojects/groovy-console/src/main/groovy/inspect/swingui}/swingui/ScriptToTreeNodeAdapter.groovy
  72. +1 −1  ...ain/groovy/inspect → subprojects/groovy-console/src/main/groovy/inspect/swingui}/swingui/TableMap.java
  73. +1 −1  .../groovy/inspect → subprojects/groovy-console/src/main/groovy/inspect/swingui}/swingui/TableSorter.java
  74. 0  ...main/groovy/inspect → subprojects/groovy-console/src/main/groovy/inspect/swingui}/swingui/package.html
  75. 0  {src/main/groovy/ui → subprojects/groovy-console/src/main/groovy}/package.html
  76. +17 −0 subprojects/groovy-shell/build.gradle
  77. 0  .../main → subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/BufferManager.groovy
  78. 0  {src/main → subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/Command.groovy
  79. 0  {src/main → subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/CommandAlias.groovy
  80. 0  ...in → subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/CommandAlias.properties
  81. 0  ...ain → subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/CommandRegistry.groovy
  82. 0  ...main → subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/CommandSupport.groovy
  83. 0  ... → subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/CommandSupport.properties
  84. 0  ...arr; subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/ComplexCommandSupport.groovy
  85. 0  ...in → subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/ExitNotification.groovy
  86. 0  {src/main → subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/Groovysh.groovy
  87. 0  {src/main → subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/Groovysh.properties
  88. +1 −1  ...rr; subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/InteractiveShellRunner.groovy
  89. 0  {src/main → subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/Interpreter.groovy
  90. 0  {src/main → subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/Main.groovy
  91. 0  {src/main → subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/Main.properties
  92. 0  {src/main → subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/Parser.groovy
  93. 0  ...→ subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/ReflectionCompletor.groovy
  94. 0  {src/main → subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/Shell.groovy
  95. 0  {src/main → subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/ShellRunner.groovy
  96. 0  {src/main → subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/commands.xml
  97. 0  ...arr; subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/commands/AliasCommand.groovy
  98. 0  ... subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/commands/AliasCommand.properties
  99. 0  ...arr; subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/commands/ClearCommand.groovy
  100. 0  ... subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/commands/ClearCommand.properties
  101. 0  ...r; subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/commands/DisplayCommand.groovy
  102. 0  ...ubprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/commands/DisplayCommand.properties
  103. 0  ...rarr; subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/commands/EditCommand.groovy
  104. 0  ...; subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/commands/EditCommand.properties
  105. 0  ...rarr; subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/commands/ExitCommand.groovy
  106. 0  ...; subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/commands/ExitCommand.properties
  107. 0  ...rarr; subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/commands/HelpCommand.groovy
  108. 0  ...; subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/commands/HelpCommand.properties
  109. 0  ...r; subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/commands/HistoryCommand.groovy
  110. 0  ...ubprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/commands/HistoryCommand.properties
  111. 0  ...rr; subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/commands/ImportCommand.groovy
  112. 0  ...subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/commands/ImportCommand.properties
  113. +1 −1  ...r; subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/commands/InspectCommand.groovy
  114. 0  ...ubprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/commands/InspectCommand.properties
  115. 0  ...rarr; subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/commands/LoadCommand.groovy
  116. 0  ...; subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/commands/LoadCommand.properties
  117. 0  ...arr; subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/commands/PurgeCommand.groovy
  118. 0  ... subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/commands/PurgeCommand.properties
  119. 0  ...rr; subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/commands/RecordCommand.groovy
  120. 0  ...subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/commands/RecordCommand.properties
  121. 0  ...; subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/commands/RegisterCommand.groovy
  122. 0  ...bprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/commands/RegisterCommand.properties
  123. 0  ...rarr; subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/commands/SaveCommand.groovy
  124. 0  ...; subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/commands/SaveCommand.properties
  125. 0  ...→ subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/commands/SetCommand.groovy
  126. 0  ...r; subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/commands/SetCommand.properties
  127. 0  ...rr; subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/commands/ShadowCommand.groovy
  128. 0  ...subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/commands/ShadowCommand.properties
  129. 0  ...rarr; subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/commands/ShowCommand.groovy
  130. 0  ...; subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/commands/ShowCommand.properties
  131. 0  {src/main → subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/package.html
  132. 0  ...r; subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/util/ClassNameCompletor.groovy
  133. 0  ... → subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/util/HelpFormatter.groovy
  134. 0  ...; subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/util/NoExitSecurityManager.java
  135. 0  ... → subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/util/SimpleCompletor.java
  136. 0  ...; subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/util/XmlCommandRegistrar.groovy
  137. 0  {src/main → subprojects/groovy-shell/src/main/groovy}/org/codehaus/groovy/tools/shell/util/package.html
  138. 0  ... subprojects/groovy-shell/src/test/groovy}/org/codehaus/groovy/tools/shell/commands/AliasCommandTest.groovy
  139. 0  ... subprojects/groovy-shell/src/test/groovy}/org/codehaus/groovy/tools/shell/commands/ClearCommandTest.groovy
  140. 0  ...ubprojects/groovy-shell/src/test/groovy}/org/codehaus/groovy/tools/shell/commands/CommandTestSupport.groovy
  141. 0  ...ubprojects/groovy-shell/src/test/groovy}/org/codehaus/groovy/tools/shell/commands/DisplayCommandTest.groovy
  142. 0  ...; subprojects/groovy-shell/src/test/groovy}/org/codehaus/groovy/tools/shell/commands/EchoCommand.properties
  143. 0  ...; subprojects/groovy-shell/src/test/groovy}/org/codehaus/groovy/tools/shell/commands/EditCommandTest.groovy
  144. 0  ...; subprojects/groovy-shell/src/test/groovy}/org/codehaus/groovy/tools/shell/commands/ExitCommandTest.groovy
  145. 0  ...; subprojects/groovy-shell/src/test/groovy}/org/codehaus/groovy/tools/shell/commands/HelpCommandTest.groovy
  146. 0  ...ubprojects/groovy-shell/src/test/groovy}/org/codehaus/groovy/tools/shell/commands/HistoryCommandTest.groovy
  147. 0  ...subprojects/groovy-shell/src/test/groovy}/org/codehaus/groovy/tools/shell/commands/ImportCommandTest.groovy
  148. 0  ...ubprojects/groovy-shell/src/test/groovy}/org/codehaus/groovy/tools/shell/commands/InspectCommandTest.groovy
  149. 0  ...; subprojects/groovy-shell/src/test/groovy}/org/codehaus/groovy/tools/shell/commands/LoadCommandTest.groovy
  150. 0  ... subprojects/groovy-shell/src/test/groovy}/org/codehaus/groovy/tools/shell/commands/PurgeCommandTest.groovy
  151. 0  ...subprojects/groovy-shell/src/test/groovy}/org/codehaus/groovy/tools/shell/commands/RecordCommandTest.groovy
  152. 0  ...bprojects/groovy-shell/src/test/groovy}/org/codehaus/groovy/tools/shell/commands/RegisterCommandTest.groovy
  153. 0  ...; subprojects/groovy-shell/src/test/groovy}/org/codehaus/groovy/tools/shell/commands/SaveCommandTest.groovy
  154. 0  ...r; subprojects/groovy-shell/src/test/groovy}/org/codehaus/groovy/tools/shell/commands/SetCommandTest.groovy
  155. 0  ...; subprojects/groovy-shell/src/test/groovy}/org/codehaus/groovy/tools/shell/commands/ShowCommandTest.groovy
  156. 0  ...jects/groovy-shell/src/test/groovy}/org/codehaus/groovy/tools/shell/expr/ClassWithPrivateConstructor.groovy
  157. 0  .../test → subprojects/groovy-shell/src/test/groovy}/org/codehaus/groovy/tools/shell/expr/ExitTest.groovy
  158. 0  ...rarr; subprojects/groovy-shell/src/test/groovy}/org/codehaus/groovy/tools/shell/expr/ExprTestSupport.groovy
  159. 0  ...est → subprojects/groovy-shell/src/test/groovy}/org/codehaus/groovy/tools/shell/expr/TimeItTest.groovy
  160. 0  ...rr; subprojects/groovy-shell/src/test/groovy}/org/codehaus/groovy/tools/shell/util/MessageSourceTest.groovy
  161. 0  ...subprojects/groovy-shell/src/test/groovy}/org/codehaus/groovy/tools/shell/util/MessageSourceTest.properties
  162. +16 −0 subprojects/groovy-swing/build.gradle
  163. +193 −193 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/LookAndFeelHelper.groovy
  164. +59 −2 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/SwingBuilder.groovy
  165. +75 −75 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/binding/AbstractButtonProperties.java
  166. +94 −94 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/binding/AbstractSyntheticBinding.java
  167. +48 −48 ...n → subprojects/groovy-swing/src/main/groovy}/groovy/swing/binding/AbstractSyntheticMetaMethods.groovy
  168. +48 −48 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/binding/JComboBoxMetaMethods.groovy
  169. +172 −172 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/binding/JComboBoxProperties.java
  170. +146 −146 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/binding/JComponentProperties.java
  171. 0  {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/binding/JListMetaMethods.groovy
  172. +0 −2  {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/binding/JListProperties.groovy
  173. +80 −80 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/binding/JScrollBarProperties.java
  174. +76 −76 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/binding/JSliderProperties.java
  175. +75 −75 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/binding/JSpinnerProperties.java
  176. +81 −81 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/binding/JTableMetaMethods.groovy
  177. +120 −120 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/binding/JTableProperties.java
  178. +88 −88 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/binding/JTextComponentProperties.java
  179. 0  {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/binding/package.html
  180. 0  {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/ActionFactory.groovy
  181. +55 −55 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/BeanFactory.groovy
  182. +62 −62 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/BevelBorderFactory.groovy
  183. +354 −345 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/BindFactory.groovy
  184. +33 −33 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/BindGroupFactory.groovy
  185. +48 −48 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/BindProxyFactory.groovy
  186. 0  {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/BoxFactory.groovy
  187. +2 −2 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/BoxLayoutFactory.groovy
  188. +53 −53 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/ButtonGroupFactory.groovy
  189. 0  {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/CellEditorFactory.groovy
  190. 0  {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/CollectionFactory.groovy
  191. 0  {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/ColumnFactory.groovy
  192. 0  {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/ColumnModelFactory.groovy
  193. +1 −0  {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/ComboBoxFactory.groovy
  194. +47 −47 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/ComponentFactory.groovy
  195. +62 −62 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/CompoundBorderFactory.groovy
  196. +1 −1  {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/DialogFactory.groovy
  197. +58 −58 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/EmptyBorderFactory.groovy
  198. +44 −44 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/EtchedBorderFactory.groovy
  199. 0  {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/FormattedTextFactory.groovy
  200. 0  {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/FrameFactory.groovy
  201. +157 −159 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/GridBagFactory.groovy
  202. +85 −85 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/ImageIconFactory.groovy
  203. +30 −30 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/InternalFrameFactory.groovy
  204. +82 −82 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/LayoutFactory.groovy
  205. +50 −50 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/LineBorderFactory.groovy
  206. +74 −74 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/ListFactory.groovy
  207. 0  {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/MapFactory.groovy
  208. +75 −75 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/MatteBorderFactory.groovy
  209. +64 −64 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/RendererFactory.groovy
  210. 0  {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/RichActionWidgetFactory.groovy
  211. +91 −91 .../main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/RootPaneContainerFactory.groovy
  212. +48 −48 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/ScrollPaneFactory.groovy
  213. 0  {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/SeparatorFactory.groovy
  214. 0  {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/SplitPaneFactory.groovy
  215. +45 −45 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/SwingBorderFactory.groovy
  216. +141 −141 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/TabbedPaneFactory.groovy
  217. +50 −50 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/TableFactory.groovy
  218. +3 −2 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/TableLayoutFactory.groovy
  219. 0  {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/TableModelFactory.groovy
  220. 0  {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/TextArgWidgetFactory.groovy
  221. +88 −88 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/TitledBorderFactory.groovy
  222. 0  {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/WidgetFactory.groovy
  223. 0  {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/WindowFactory.groovy
  224. 0  {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/factory/package.html
  225. 0  {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/impl/ClosureCellEditor.groovy
  226. +202 −202 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/impl/ClosureRenderer.java
  227. 0  {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/impl/DefaultAction.java
  228. 0  {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/impl/TableLayout.java
  229. 0  {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/impl/TableLayoutCell.java
  230. +4 −4 {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/impl/TableLayoutRow.java
  231. 0  {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/impl/package.html
  232. 0  {src/main → subprojects/groovy-swing/src/main/groovy}/groovy/swing/package.html
  233. +1,049 −1,049 {src/main → subprojects/groovy-swing/src/main/java}/org/codehaus/groovy/runtime/SwingGroovyMethods.java
  234. +128 −129 {src/test/groovy/swing → subprojects/groovy-swing/src/test/groovy}/BindPathTest.groovy
  235. +1,190 −1,190 {src/test/groovy/swing → subprojects/groovy-swing/src/test/groovy}/SwingBuilderBindingsTest.groovy
  236. +449 −448 {src/test/groovy/swing → subprojects/groovy-swing/src/test/groovy}/SwingBuilderTableTest.groovy
  237. 0  {src/test/groovy/swing → subprojects/groovy-swing/src/test/groovy}/SwingBuilderTest.groovy
  238. +313 −313 {src/test/groovy/swing → subprojects/groovy-swing/src/test/groovy}/SwingMetaMethodsTest.groovy
  239. +58 −59 ...t/groovy/swing → subprojects/groovy-swing/src/test/groovy}/TitledBorderFactoryJustificationTest.groovy
  240. 0  {src/test → subprojects/groovy-swing/src/test/groovy}/groovy/util/GroovySwingTestCase.groovy
  241. 0  {src/test → subprojects/groovy-test/src/test/groovy}/org/codehaus/groovy/runtime/DummyBean.java
View
4 settings.gradle
@@ -1 +1,3 @@
-include 'subprojects:groovy-bsf', 'subprojects:groovy-jmx', 'subprojects:groovy-jsr223', 'subprojects:groovy-test'
+include 'subprojects:groovy-bsf', 'subprojects:groovy-console', 'subprojects:groovy-jmx',
+ 'subprojects:groovy-jsr223', 'subprojects:groovy-shell', 'subprojects:groovy-swing',
+ 'subprojects:groovy-test'
View
1  src/examples/groovy/swing/SwingDemo.groovy
@@ -3,6 +3,7 @@ package groovy.swing
import java.awt.BorderLayout
import javax.swing.BorderFactory
import groovy.model.MvcDemo
+import groovy.swing.SwingBuilder
class SwingDemo {
View
1  src/examples/groovy/swing/TableDemo.groovy
@@ -2,6 +2,7 @@ package groovy.swing
import java.awt.BorderLayout
import javax.swing.BorderFactory
+import groovy.swing.SwingBuilder
/**
* Demonstrates the use of the Groovy TableModels for viewing tables of any List of objects
View
1  src/examples/groovy/swing/TableLayoutDemo.groovy
@@ -2,6 +2,7 @@ package groovy.swing
import java.awt.BorderLayout
import javax.swing.BorderFactory
+import groovy.swing.SwingBuilder
/**
* Demonstrates the use of the table layout
View
2  src/examples/swing/Widgets.groovy
@@ -1,4 +1,4 @@
-package swing
+package groovy.swing
import java.awt.Color
import javax.swing.SwingConstants
View
2  src/examples/swing/binding/caricature/Caricature.groovy
@@ -1,4 +1,4 @@
-package swing.binding.caricature
+package groovy.swing.binding.caricature
import groovy.swing.SwingBuilder
import java.awt.Color
View
3  src/examples/swing/binding/caricature/JCaricature.java
@@ -7,13 +7,12 @@
* and open the template in the editor.
*/
-package swing.binding.caricature;
+package groovy.swing.binding.caricature;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
-import java.awt.RenderingHints;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
View
2  src/examples/swing/greet/Greet.groovy
@@ -4,7 +4,7 @@
* Date: Apr 26, 2008
* Time: 8:32:03 AM
*/
-package swing.greet
+package groovy.swing.greet
import groovy.beans.Bindable
import groovy.swing.SwingBuilder
View
2  src/examples/swing/greet/TwitterAPI.groovy
@@ -4,7 +4,7 @@
* Date: Apr 25, 2008
* Time: 9:47:20 PM
*/
-package swing.greet
+package groovy.swing.greet
import groovy.beans.Bindable
View
2  src/examples/swing/greet/View.groovy
@@ -4,7 +4,7 @@
* Date: Apr 26, 2008
* Time: 8:31:21 AM
*/
-package swing.greet
+package groovy.swing.greet
import java.awt.Cursor
import java.beans.PropertyChangeListener
View
2  src/examples/swing/timelog/TimeLogMain.groovy
@@ -1,4 +1,4 @@
-package swing.timelog
+package groovy.swing.timelog
import groovy.swing.SwingBuilder
View
2  src/examples/swing/timelog/TimeLogModel.groovy
@@ -1,4 +1,4 @@
-package swing.timelog
+package groovy.swing.timelog
import groovy.beans.Bindable
View
2  src/examples/swing/timelog/TimeLogView.groovy
@@ -1,4 +1,4 @@
-package swing.timelog
+package groovy.swing.timelog
import java.text.SimpleDateFormat
import javax.swing.JFrame
View
7 src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
@@ -131,9 +131,10 @@
DoubleArrayPutAtMetaMethod.class,
};
- public static final Class[] DGM_LIKE_CLASSES = new Class[]{
+ public static final Class[] DGM_LIKE_CLASSES = new Class[]{
DefaultGroovyMethods.class,
- SwingGroovyMethods.class,
+ // TODO provide alternative way for this to be registered
+ //SwingGroovyMethods.class,
SqlGroovyMethods.class,
XmlGroovyMethods.class,
EncodingGroovyMethods.class,
@@ -141,7 +142,7 @@
ProcessGroovyMethods.class
};
- /**
+ /**
* Identity check. Since == is overridden in Groovy with the meaning of equality
* we need some fallback to check for object identity. Invoke using the
* 'is' method, like so: <code>def same = this.is(that)</code>
View
2  src/test/groovy/inspect/swingui/AstNodeToScriptAdapterTest.groovy
@@ -20,6 +20,8 @@ import org.codehaus.groovy.ast.stmt.BlockStatement
import org.codehaus.groovy.ast.stmt.DoWhileStatement
import org.codehaus.groovy.control.CompilePhase
import org.codehaus.groovy.ast.expr.*
+import inspect.swingui.swingui.AstNodeToScriptVisitor
+import inspect.swingui.swingui.AstNodeToScriptAdapter
/**
* Unit test for ScriptToTreeNodeAdapter.
View
2  src/test/groovy/inspect/swingui/ScriptToTreeNodeAdapterTest.groovy
@@ -18,6 +18,8 @@ package groovy.inspect.swingui
import org.codehaus.groovy.control.Phases
import javax.swing.tree.TreeNode
import junit.framework.AssertionFailedError
+import inspect.swingui.swingui.SwingTreeNodeMaker
+import inspect.swingui.swingui.ScriptToTreeNodeAdapter
/**
* Unit test for ScriptToTreeNodeAdapter.
View
17 subprojects/groovy-console/build.gradle
@@ -0,0 +1,17 @@
+apply plugin: 'groovy'
+apply plugin: 'code-quality'
+
+// TODO set these using subprojects?
+checkstyleConfigFileName = "../../config/checkstyle/checkstyle.xml"
+codeNarcConfigFileName = "../../config/codenarc/codenarc.groovy"
+
+repositories {
+ mavenCentral()
+}
+
+dependencies {
+ compile project(':')
+ groovy project(':')
+ compile project(':subprojects:groovy-swing')
+ testCompile project(':subprojects:groovy-test')
+}
View
4 src/main/groovy/ui/Console.groovy → ...cts/groovy-console/src/main/groovy/Console.groovy
@@ -15,8 +15,8 @@
*/
package groovy.ui
-import groovy.inspect.swingui.ObjectBrowser
-import groovy.inspect.swingui.AstBrowser
+import inspect.swingui.swingui.ObjectBrowser
+import inspect.swingui.swingui.AstBrowser
import groovy.swing.SwingBuilder
import groovy.ui.text.FindReplaceUtility
View
726 src/main/groovy/ui/ConsoleActions.groovy → ...ovy-console/src/main/groovy/ConsoleActions.groovy
@@ -1,363 +1,363 @@
-/*
- * Copyright 2003-2007 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package groovy.ui
-
-import java.awt.event.InputEvent
-import java.awt.event.KeyEvent
-import javax.swing.KeyStroke
-
-newFileAction = action(
- name: 'New File',
- closure: controller.&fileNewFile,
- mnemonic: 'N',
- accelerator: shortcut('N'),
- smallIcon: imageIcon(resource:"icons/page.png", class:this),
- shortDescription: 'New Groovy Script'
-)
-
-newWindowAction = action(
- name: 'New Window',
- closure: controller.&fileNewWindow,
- mnemonic: 'W',
- accelerator: shortcut('shift N')
-)
-
-openAction = action(
- name: 'Open',
- closure: controller.&fileOpen,
- mnemonic: 'O',
- accelerator: shortcut('O'),
- smallIcon: imageIcon(resource:"icons/folder_page.png", class:this),
- shortDescription: 'Open Groovy Script'
-)
-
-saveAction = action(
- name: 'Save',
- closure: controller.&fileSave,
- mnemonic: 'S',
- accelerator: shortcut('S'),
- smallIcon: imageIcon(resource:"icons/disk.png", class:this),
- shortDescription: 'Save Groovy Script',
- enabled: false // controller will enable as needed
-)
-
-saveAsAction = action(
- name: 'Save As...',
- closure: controller.&fileSaveAs,
- mnemonic: 'A',
-)
-
-printAction = action(
- name: 'Print...',
- closure: controller.&print,
- mnemonic: 'P',
- accelerator: shortcut('P')
-)
-
-exitAction = action(
- name: 'Exit',
- closure: controller.&exit,
- mnemonic: 'X'
-// whether or not application exit should have an
-// accelerator is debatable in usability circles
-// at the very least a confirm dialog should dhow up
-//accelerator: shortcut('Q')
-)
-
-undoAction = action(
- name: 'Undo',
- closure: controller.&undo,
- mnemonic: 'U',
- accelerator: shortcut('Z'),
- smallIcon: imageIcon(resource:"icons/arrow_undo.png", class:this),
- shortDescription: 'Undo'
-)
-
-redoAction = action(
- name: 'Redo',
- closure: controller.&redo,
- mnemonic: 'R',
- accelerator: shortcut('shift Z'), // is control-shift-Z or control-Y more common?
- smallIcon: imageIcon(resource:"icons/arrow_redo.png", class:this),
- shortDescription: 'Redo'
-)
-
-findAction = action(
- name: 'Find...',
- closure: controller.&find,
- mnemonic: 'F',
- accelerator: shortcut('F'),
- smallIcon: imageIcon(resource:"icons/find.png", class:this),
- shortDescription: 'Find'
-)
-
-findNextAction = action(
- name: 'Find Next',
- closure: controller.&findNext,
- mnemonic: 'N',
- accelerator: KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0)
-)
-
-findPreviousAction = action(
- name: 'Find Previous',
- closure: controller.&findPrevious,
- mnemonic: 'V',
- accelerator: KeyStroke.getKeyStroke(KeyEvent.VK_F3, InputEvent.SHIFT_DOWN_MASK)
-)
-
-replaceAction = action(
- name: 'Replace...',
- closure: controller.&replace,
- mnemonic: 'E',
- accelerator: shortcut('H'),
- smallIcon: imageIcon(resource:"icons/text_replace.png", class:this),
- shortDescription: 'Replace'
-)
-
-cutAction = action(
- name: 'Cut',
- closure: controller.&cut,
- mnemonic: 'T',
- accelerator: shortcut('X'),
- smallIcon: imageIcon(resource:"icons/cut.png", class:this),
- shortDescription: 'Cut'
-)
-
-copyAction = action(
- name: 'Copy',
- closure: controller.&copy,
- mnemonic: 'C',
- accelerator: shortcut('C'),
- smallIcon: imageIcon(resource:"icons/page_copy.png", class:this),
- shortDescription: 'Copy'
-)
-
-pasteAction = action(
- name: 'Paste',
- closure: controller.&paste,
- mnemonic: 'P',
- accelerator: shortcut('V'),
- smallIcon: imageIcon(resource:"icons/page_paste.png", class:this),
- shortDescription: 'Paste'
-)
-
-selectAllAction = action(
- name: 'Select All',
- closure: controller.&selectAll,
- mnemonic: 'A',
- accelerator: shortcut('A')
-)
-
-historyPrevAction = action(
- name: 'Previous',
- closure: controller.&historyPrev,
- mnemonic: 'P',
- accelerator: shortcut(KeyEvent.VK_COMMA),
- smallIcon: imageIcon(resource:"icons/book_previous.png", class:this),
- shortDescription: 'Previous Groovy Script',
- enabled: false // controller will enable as needed
-)
-
-historyNextAction = action(
- name: 'Next',
- closure: controller.&historyNext,
- mnemonic: 'N',
- accelerator: shortcut(KeyEvent.VK_PERIOD),
- smallIcon: imageIcon(resource:"icons/book_next.png", class:this),
- shortDescription: 'Next Groovy Script',
- enabled: false // controller will enable as needed
-)
-
-clearOutputAction = action(
- name: 'Clear Output',
- closure: controller.&clearOutput,
- mnemonic: 'C',
- accelerator: shortcut('W')
-)
-
-runAction = action(
- name: 'Run',
- closure: controller.&runScript,
- mnemonic: 'R',
- keyStroke: shortcut('ENTER'),
- accelerator: shortcut('R'),
- smallIcon: imageIcon(resource:"icons/script_go.png", class:this),
- shortDescription: 'Execute Groovy Script'
-)
-
-runSelectionAction = action(
- name: 'Run Selection',
- closure: controller.&runSelectedScript,
- mnemonic: 'E',
- keyStroke: shortcut('shift ENTER'),
- accelerator: shortcut('shift R')
-)
-
-addClasspathJar = action(
- name: 'Add Jar(s) to ClassPath',
- closure: controller.&addClasspathJar,
- mnemonic: 'J',
-)
-
-addClasspathDir = action(
- name: 'Add Directory to ClassPath',
- closure: controller.&addClasspathDir,
- mnemonic: 'D',
-)
-
-clearClassloader = action(
- name: 'Clear Script Context',
- closure: controller.&clearContext,
- mnemonic: 'C',
-)
-
-inspectLastAction = action(
- name: 'Inspect Last',
- closure: controller.&inspectLast,
- mnemonic: 'I',
- accelerator: shortcut('I')
-)
-
-inspectVariablesAction = action(
- name: 'Inspect Variables',
- closure: controller.&inspectVariables,
- mnemonic: 'V',
- accelerator: shortcut('J')
-)
-
-inspectAstAction = action(
- name: 'Inspect Ast',
- closure: controller.&inspectAst,
- mnemonic: 'A',
- accelerator: shortcut('T'),
-)
-
-captureStdOutAction = action(
- name: 'Capture Standard Output',
- closure: controller.&captureStdOut,
- mnemonic: 'O'
-)
-
-captureStdErrAction = action(
- name: 'Capture Standard Error Output',
- closure: controller.&captureStdErr,
- mnemonic: 'E'
-)
-
-fullStackTracesAction = action(
- name: 'Show Full Stack Traces',
- closure: controller.&fullStackTraces,
- mnemonic: 'F'
-)
-
-showScriptInOutputAction = action(
- name: 'Show Script in Output',
- closure: controller.&showScriptInOutput,
- mnemonic: 'R'
-)
-
-visualizeScriptResultsAction = action(
- name: 'Visualize Script Results',
- closure: controller.&visualizeScriptResults,
- mnemonic: 'V'
-)
-
-showToolbarAction = action(
- name: 'Show Toolbar',
- closure: controller.&showToolbar,
- mnemonic: 'T'
-)
-
-detachedOutputAction = action(
- name: 'Detached Output',
- closure: controller.&detachedOutput,
- mnemonic: 'D'
-)
-
-showOutputWindowAction = action(
- closure: controller.&showOutputWindow,
- keyStroke: shortcut('shift O'),
-)
-
-hideOutputWindowAction1 = action(
- closure: controller.&hideOutputWindow,
- keyStroke: 'SPACE',
-)
-
-hideOutputWindowAction2 = action(
- closure: controller.&hideOutputWindow,
- keyStroke: 'ENTER',
-)
-
-hideOutputWindowAction3 = action(
- closure: controller.&hideOutputWindow,
- keyStroke: 'ESCAPE',
-)
-
-hideOutputWindowAction4 = action(
- closure: controller.&hideAndClearOutputWindow,
- keyStroke: shortcut('W'),
-)
-
-autoClearOutputAction = action(
- name: 'Auto Clear Output On Run',
- closure: controller.&autoClearOutput,
- mnemonic: 'A'
-)
-
-largerFontAction = action(
- name: 'Larger Font',
- closure: controller.&largerFont,
- mnemonic: 'L',
- accelerator: shortcut('shift L')
-)
-
-smallerFontAction = action(
- name: 'Smaller Font',
- closure: controller.&smallerFont,
- mnemonic: 'S',
- accelerator: shortcut('shift S')
-)
-
-aboutAction = action(
- name: 'About',
- closure: controller.&showAbout,
- mnemonic: 'A'
-)
-
-threadInterruptAction = action(
- name: 'Allow Interruption',
- closure: controller.&threadInterruption,
- mnemonic: 'O'
-)
-
-interruptAction = action(
- name: 'Interrupt',
- closure: controller.&doInterrupt,
- mnemonic: 'T',
- smallIcon: imageIcon(resource:"icons/cross.png", class:this),
- shortDescription: 'Interrupt Running Script',
- enabled: false // controller will enable as needed
-)
-
-compileAction = action(
- name: 'Compile',
- closure: controller.&compileScript,
- mnemonic: 'L',
- accelerator: shortcut('L'),
- shortDescription: 'Compile Groovy Script'
-)
+/*
+ * Copyright 2003-2007 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package groovy.ui
+
+import java.awt.event.InputEvent
+import java.awt.event.KeyEvent
+import javax.swing.KeyStroke
+
+newFileAction = action(
+ name: 'New File',
+ closure: controller.&fileNewFile,
+ mnemonic: 'N',
+ accelerator: shortcut('N'),
+ smallIcon: imageIcon(resource:"icons/page.png", class:this),
+ shortDescription: 'New Groovy Script'
+)
+
+newWindowAction = action(
+ name: 'New Window',
+ closure: controller.&fileNewWindow,
+ mnemonic: 'W',
+ accelerator: shortcut('shift N')
+)
+
+openAction = action(
+ name: 'Open',
+ closure: controller.&fileOpen,
+ mnemonic: 'O',
+ accelerator: shortcut('O'),
+ smallIcon: imageIcon(resource:"icons/folder_page.png", class:this),
+ shortDescription: 'Open Groovy Script'
+)
+
+saveAction = action(
+ name: 'Save',
+ closure: controller.&fileSave,
+ mnemonic: 'S',
+ accelerator: shortcut('S'),
+ smallIcon: imageIcon(resource:"icons/disk.png", class:this),
+ shortDescription: 'Save Groovy Script',
+ enabled: false // controller will enable as needed
+)
+
+saveAsAction = action(
+ name: 'Save As...',
+ closure: controller.&fileSaveAs,
+ mnemonic: 'A',
+)
+
+printAction = action(
+ name: 'Print...',
+ closure: controller.&print,
+ mnemonic: 'P',
+ accelerator: shortcut('P')
+)
+
+exitAction = action(
+ name: 'Exit',
+ closure: controller.&exit,
+ mnemonic: 'X'
+// whether or not application exit should have an
+// accelerator is debatable in usability circles
+// at the very least a confirm dialog should dhow up
+//accelerator: shortcut('Q')
+)
+
+undoAction = action(
+ name: 'Undo',
+ closure: controller.&undo,
+ mnemonic: 'U',
+ accelerator: shortcut('Z'),
+ smallIcon: imageIcon(resource:"icons/arrow_undo.png", class:this),
+ shortDescription: 'Undo'
+)
+
+redoAction = action(
+ name: 'Redo',
+ closure: controller.&redo,
+ mnemonic: 'R',
+ accelerator: shortcut('shift Z'), // is control-shift-Z or control-Y more common?
+ smallIcon: imageIcon(resource:"icons/arrow_redo.png", class:this),
+ shortDescription: 'Redo'
+)
+
+findAction = action(
+ name: 'Find...',
+ closure: controller.&find,
+ mnemonic: 'F',
+ accelerator: shortcut('F'),
+ smallIcon: imageIcon(resource:"icons/find.png", class:this),
+ shortDescription: 'Find'
+)
+
+findNextAction = action(
+ name: 'Find Next',
+ closure: controller.&findNext,
+ mnemonic: 'N',
+ accelerator: KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0)
+)
+
+findPreviousAction = action(
+ name: 'Find Previous',
+ closure: controller.&findPrevious,
+ mnemonic: 'V',
+ accelerator: KeyStroke.getKeyStroke(KeyEvent.VK_F3, InputEvent.SHIFT_DOWN_MASK)
+)
+
+replaceAction = action(
+ name: 'Replace...',
+ closure: controller.&replace,
+ mnemonic: 'E',
+ accelerator: shortcut('H'),
+ smallIcon: imageIcon(resource:"icons/text_replace.png", class:this),
+ shortDescription: 'Replace'
+)
+
+cutAction = action(
+ name: 'Cut',
+ closure: controller.&cut,
+ mnemonic: 'T',
+ accelerator: shortcut('X'),
+ smallIcon: imageIcon(resource:"icons/cut.png", class:this),
+ shortDescription: 'Cut'
+)
+
+copyAction = action(
+ name: 'Copy',
+ closure: controller.&copy,
+ mnemonic: 'C',
+ accelerator: shortcut('C'),
+ smallIcon: imageIcon(resource:"icons/page_copy.png", class:this),
+ shortDescription: 'Copy'
+)
+
+pasteAction = action(
+ name: 'Paste',
+ closure: controller.&paste,
+ mnemonic: 'P',
+ accelerator: shortcut('V'),
+ smallIcon: imageIcon(resource:"icons/page_paste.png", class:this),
+ shortDescription: 'Paste'
+)
+
+selectAllAction = action(
+ name: 'Select All',
+ closure: controller.&selectAll,
+ mnemonic: 'A',
+ accelerator: shortcut('A')
+)
+
+historyPrevAction = action(
+ name: 'Previous',
+ closure: controller.&historyPrev,
+ mnemonic: 'P',
+ accelerator: shortcut(KeyEvent.VK_COMMA),
+ smallIcon: imageIcon(resource:"icons/book_previous.png", class:this),
+ shortDescription: 'Previous Groovy Script',
+ enabled: false // controller will enable as needed
+)
+
+historyNextAction = action(
+ name: 'Next',
+ closure: controller.&historyNext,
+ mnemonic: 'N',
+ accelerator: shortcut(KeyEvent.VK_PERIOD),
+ smallIcon: imageIcon(resource:"icons/book_next.png", class:this),
+ shortDescription: 'Next Groovy Script',
+ enabled: false // controller will enable as needed
+)
+
+clearOutputAction = action(
+ name: 'Clear Output',
+ closure: controller.&clearOutput,
+ mnemonic: 'C',
+ accelerator: shortcut('W')
+)
+
+runAction = action(
+ name: 'Run',
+ closure: controller.&runScript,
+ mnemonic: 'R',
+ keyStroke: shortcut('ENTER'),
+ accelerator: shortcut('R'),
+ smallIcon: imageIcon(resource:"icons/script_go.png", class:this),
+ shortDescription: 'Execute Groovy Script'
+)
+
+runSelectionAction = action(
+ name: 'Run Selection',
+ closure: controller.&runSelectedScript,
+ mnemonic: 'E',
+ keyStroke: shortcut('shift ENTER'),
+ accelerator: shortcut('shift R')
+)
+
+addClasspathJar = action(
+ name: 'Add Jar(s) to ClassPath',
+ closure: controller.&addClasspathJar,
+ mnemonic: 'J',
+)
+
+addClasspathDir = action(
+ name: 'Add Directory to ClassPath',
+ closure: controller.&addClasspathDir,
+ mnemonic: 'D',
+)
+
+clearClassloader = action(
+ name: 'Clear Script Context',
+ closure: controller.&clearContext,
+ mnemonic: 'C',
+)
+
+inspectLastAction = action(
+ name: 'Inspect Last',
+ closure: controller.&inspectLast,
+ mnemonic: 'I',
+ accelerator: shortcut('I')
+)
+
+inspectVariablesAction = action(
+ name: 'Inspect Variables',
+ closure: controller.&inspectVariables,
+ mnemonic: 'V',
+ accelerator: shortcut('J')
+)
+
+inspectAstAction = action(
+ name: 'Inspect Ast',
+ closure: controller.&inspectAst,
+ mnemonic: 'A',
+ accelerator: shortcut('T'),
+)
+
+captureStdOutAction = action(
+ name: 'Capture Standard Output',
+ closure: controller.&captureStdOut,
+ mnemonic: 'O'
+)
+
+captureStdErrAction = action(
+ name: 'Capture Standard Error Output',
+ closure: controller.&captureStdErr,
+ mnemonic: 'E'
+)
+
+fullStackTracesAction = action(
+ name: 'Show Full Stack Traces',
+ closure: controller.&fullStackTraces,
+ mnemonic: 'F'
+)
+
+showScriptInOutputAction = action(
+ name: 'Show Script in Output',
+ closure: controller.&showScriptInOutput,
+ mnemonic: 'R'
+)
+
+visualizeScriptResultsAction = action(
+ name: 'Visualize Script Results',
+ closure: controller.&visualizeScriptResults,
+ mnemonic: 'V'
+)
+
+showToolbarAction = action(
+ name: 'Show Toolbar',
+ closure: controller.&showToolbar,
+ mnemonic: 'T'
+)
+
+detachedOutputAction = action(
+ name: 'Detached Output',
+ closure: controller.&detachedOutput,
+ mnemonic: 'D'
+)
+
+showOutputWindowAction = action(
+ closure: controller.&showOutputWindow,
+ keyStroke: shortcut('shift O'),
+)
+
+hideOutputWindowAction1 = action(
+ closure: controller.&hideOutputWindow,
+ keyStroke: 'SPACE',
+)
+
+hideOutputWindowAction2 = action(
+ closure: controller.&hideOutputWindow,
+ keyStroke: 'ENTER',
+)
+
+hideOutputWindowAction3 = action(
+ closure: controller.&hideOutputWindow,
+ keyStroke: 'ESCAPE',
+)
+
+hideOutputWindowAction4 = action(
+ closure: controller.&hideAndClearOutputWindow,
+ keyStroke: shortcut('W'),
+)
+
+autoClearOutputAction = action(
+ name: 'Auto Clear Output On Run',
+ closure: controller.&autoClearOutput,
+ mnemonic: 'A'
+)
+
+largerFontAction = action(
+ name: 'Larger Font',
+ closure: controller.&largerFont,
+ mnemonic: 'L',
+ accelerator: shortcut('shift L')
+)
+
+smallerFontAction = action(
+ name: 'Smaller Font',
+ closure: controller.&smallerFont,
+ mnemonic: 'S',
+ accelerator: shortcut('shift S')
+)
+
+aboutAction = action(
+ name: 'About',
+ closure: controller.&showAbout,
+ mnemonic: 'A'
+)
+
+threadInterruptAction = action(
+ name: 'Allow Interruption',
+ closure: controller.&threadInterruption,
+ mnemonic: 'O'
+)
+
+interruptAction = action(
+ name: 'Interrupt',
+ closure: controller.&doInterrupt,
+ mnemonic: 'T',
+ smallIcon: imageIcon(resource:"icons/cross.png", class:this),
+ shortDescription: 'Interrupt Running Script',
+ enabled: false // controller will enable as needed
+)
+
+compileAction = action(
+ name: 'Compile',
+ closure: controller.&compileScript,
+ mnemonic: 'L',
+ accelerator: shortcut('L'),
+ shortDescription: 'Compile Groovy Script'
+)
View
70 src/main/groovy/ui/ConsoleApplet.groovy → ...oovy-console/src/main/groovy/ConsoleApplet.groovy
@@ -1,35 +1,35 @@
-/*
- * Copyright 2003-2010 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package groovy.ui
-
-import javax.swing.JApplet
-
-/**
- * ConsoleApplet
- */
-public class ConsoleApplet extends JApplet {
-
- Console console
-
- public void start() {
- console = new Console()
- console.run this
- }
-
- public void stop() {
- console.exit()
- }
-}
+/*
+ * Copyright 2003-2010 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package groovy.ui
+
+import javax.swing.JApplet
+
+/**
+ * ConsoleApplet
+ */
+public class ConsoleApplet extends JApplet {
+
+ Console console
+
+ public void start() {
+ console = new Console()
+ console.run this
+ }
+
+ public void stop() {
+ console.exit()
+ }
+}
View
0  src/main/groovy/ui/ConsoleIcon.png → ...ts/groovy-console/src/main/groovy/ConsoleIcon.png
File renamed without changes
View
130 src/main/groovy/ui/ConsoleIvyPlugin.groovy → ...y-console/src/main/groovy/ConsoleIvyPlugin.groovy
@@ -1,65 +1,65 @@
-/*
- * Copyright 2003-2011 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package groovy.ui
-
-import groovy.grape.GrapeIvy
-import groovy.grape.Grape
-
-import org.apache.ivy.core.event.resolve.StartResolveEvent
-import org.apache.ivy.core.event.download.PrepareDownloadEvent
-import org.apache.ivy.core.event.IvyListener
-
-/**
- * Groovy Swing console.
- *
- * Adds Groovy Grape feedback (via an Ivy listener).
- *
- * @author Guillaume Laforge
- * @author Paul King
- */
-class ConsoleIvyPlugin {
- Console savedConsole
- Set<String> resolvedDependencies = []
- Set<String> downloadedArtifacts = []
-
- def addListener(Console console) {
- savedConsole = console
-
- ((GrapeIvy) Grape.instance).ivyInstance.eventManager.addIvyListener([progress: { ivyEvent ->
- switch (ivyEvent) {
- case StartResolveEvent:
- ivyEvent.moduleDescriptor.dependencies.each { it ->
- def name = it.toString()
- if (!resolvedDependencies.contains(name)) {
- resolvedDependencies << name
- savedConsole.showMessage "Resolving ${name} ..."
- }
- }
- break
- case PrepareDownloadEvent:
- ivyEvent.artifacts.each { it ->
- def name = it.toString()
- if (!downloadedArtifacts.contains(name)) {
- downloadedArtifacts << name
- savedConsole.showMessage "Downloading artifact ${name} ..."
- }
- }
- break
- }
- }] as IvyListener)
-
- }
-}
+/*
+ * Copyright 2003-2011 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package groovy.ui
+
+import groovy.grape.GrapeIvy
+import groovy.grape.Grape
+
+import org.apache.ivy.core.event.resolve.StartResolveEvent
+import org.apache.ivy.core.event.download.PrepareDownloadEvent
+import org.apache.ivy.core.event.IvyListener
+
+/**
+ * Groovy Swing console.
+ *
+ * Adds Groovy Grape feedback (via an Ivy listener).
+ *
+ * @author Guillaume Laforge
+ * @author Paul King
+ */
+class ConsoleIvyPlugin {
+ Console savedConsole
+ Set<String> resolvedDependencies = []
+ Set<String> downloadedArtifacts = []
+
+ def addListener(Console console) {
+ savedConsole = console
+
+ ((GrapeIvy) Grape.instance).ivyInstance.eventManager.addIvyListener([progress: { ivyEvent ->
+ switch (ivyEvent) {
+ case StartResolveEvent:
+ ivyEvent.moduleDescriptor.dependencies.each { it ->
+ def name = it.toString()
+ if (!resolvedDependencies.contains(name)) {
+ resolvedDependencies << name
+ savedConsole.showMessage "Resolving ${name} ..."
+ }
+ }
+ break
+ case PrepareDownloadEvent:
+ ivyEvent.artifacts.each { it ->
+ def name = it.toString()
+ if (!downloadedArtifacts.contains(name)) {
+ downloadedArtifacts << name
+ savedConsole.showMessage "Downloading artifact ${name} ..."
+ }
+ }
+ break
+ }
+ }] as IvyListener)
+
+ }
+}
View
0  src/main/groovy/ui/ConsoleSupport.java → ...roovy-console/src/main/groovy/ConsoleSupport.java
File renamed without changes
View
642 src/main/groovy/ui/ConsoleTextEditor.java → ...vy-console/src/main/groovy/ConsoleTextEditor.java
@@ -1,321 +1,321 @@
-/*
- * Copyright 2003-2010 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package groovy.ui;
-
-import groovy.ui.text.GroovyFilter;
-import groovy.ui.text.StructuredSyntaxResources;
-import groovy.ui.text.TextEditor;
-import groovy.ui.text.TextUndoManager;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-import javax.swing.ActionMap;
-import javax.swing.InputMap;
-import javax.swing.JComponent;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.KeyStroke;
-import javax.swing.event.DocumentEvent;
-import javax.swing.event.DocumentListener;
-import javax.swing.text.BadLocationException;
-import javax.swing.text.DefaultStyledDocument;
-import javax.swing.text.Document;
-import java.awt.datatransfer.DataFlavor;
-import java.awt.datatransfer.Transferable;
-import java.awt.event.ActionEvent;
-import java.awt.event.InputEvent;
-import java.awt.event.KeyEvent;
-import java.awt.print.PrinterJob;
-import java.awt.*;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.prefs.Preferences;
-
-import org.codehaus.groovy.runtime.DefaultGroovyMethods;
-
-/**
- * Component which provides a styled editor for the console.
- *
- * @author hippy
- * @author Danno Ferrin
- * @author Tim Yates
- * @author Guillaume Laforge
- */
-public class ConsoleTextEditor extends JScrollPane {
- public String getDefaultFamily() {
- return defaultFamily;
- }
-
- public void setDefaultFamily(String defaultFamily) {
- this.defaultFamily = defaultFamily;
- }
-
- private class LineNumbersPanel extends JPanel {
-
- public LineNumbersPanel() {
- int initialSize = 3 * Preferences.userNodeForPackage(Console.class).getInt("fontSize", 12);
- setMinimumSize(new Dimension(initialSize, initialSize));
- setPreferredSize(new Dimension(initialSize, initialSize));
- }
-
- @Override
- public void paintComponent(Graphics g) {
- super.paintComponent(g);
- // starting position in document
- int start = textEditor.viewToModel(getViewport().getViewPosition());
- // end position in document
- int end = textEditor.viewToModel(new Point(10,
- getViewport().getViewPosition().y +
- (int) textEditor.getVisibleRect().getHeight())
- );
-
- // translate offsets to lines
- Document doc = textEditor.getDocument();
- int startline = doc.getDefaultRootElement().getElementIndex(start) + 1;
- int endline = doc.getDefaultRootElement().getElementIndex(end) + 1;
- Font f = textEditor.getFont();
- int fontHeight = g.getFontMetrics(f).getHeight();
- int fontDesc = g.getFontMetrics(f).getDescent();
- int startingY = -1;
-
- try {
- startingY = textEditor.modelToView(start).y + fontHeight - fontDesc;
- } catch (BadLocationException e1) {
- System.err.println(e1.getMessage());
- }
- g.setFont(f);
- for (int line = startline, y = startingY; line <= endline; y += fontHeight, line++) {
- String lineNumber = DefaultGroovyMethods.padLeft(Integer.toString(line), 4, " ");
- g.drawString(lineNumber, 0, y);
- }
- }
- }
-
- private String defaultFamily = "Monospaced";
-
- private static final PrinterJob PRINTER_JOB = PrinterJob.getPrinterJob();
-
- private LineNumbersPanel numbersPanel = new LineNumbersPanel();
-
- private boolean documentChangedSinceLastRepaint = false;
-
- private TextEditor textEditor = new TextEditor(true, true, true) {
-
- public void paintComponent(Graphics g) {
- super.paintComponent(g);
-
- // only repaint the line numbers in the gutter when the document has changed
- // in case lines (hence line numbers) have been added or removed from the document
- if (documentChangedSinceLastRepaint) {
- numbersPanel.repaint();
- documentChangedSinceLastRepaint = false;
- }
- }
- };
-
- private UndoAction undoAction = new UndoAction();
- private RedoAction redoAction = new RedoAction();
- private PrintAction printAction = new PrintAction();
-
- private boolean editable = true;
-
- private TextUndoManager undoManager;
-
- /**
- * Creates a new instance of ConsoleTextEditor
- */
- public ConsoleTextEditor() {
- textEditor.setFont(new Font(defaultFamily, Font.PLAIN, Preferences.userNodeForPackage(Console.class).getInt("fontSize", 12)));
-
- setViewportView(new JPanel(new BorderLayout()) {{
- add(numbersPanel, BorderLayout.WEST);
- add(textEditor, BorderLayout.CENTER);
- }});
-
- textEditor.setDragEnabled(editable);
-
- getVerticalScrollBar().setUnitIncrement(10);
-
- initActions();
-
- DefaultStyledDocument doc = new DefaultStyledDocument();
- doc.setDocumentFilter(new GroovyFilter(doc));
- textEditor.setDocument(doc);
-
- // add a document listener, to hint whether the line number gutter has to be repainted
- // when the number of lines changes
- doc.addDocumentListener(new DocumentListener() {
- public void insertUpdate(DocumentEvent documentEvent) {
- documentChangedSinceLastRepaint = true;
- }
-
- public void removeUpdate(DocumentEvent documentEvent) {
- documentChangedSinceLastRepaint = true;
- }
-
- public void changedUpdate(DocumentEvent documentEvent) {
- documentChangedSinceLastRepaint = true;
- int width = 3 * Preferences.userNodeForPackage(Console.class).getInt("fontSize", 12);
- numbersPanel.setPreferredSize(new Dimension(width, width));
- }
- });
-
- // create and add the undo/redo manager
- this.undoManager = new TextUndoManager();
- doc.addUndoableEditListener(undoManager);
-
- // add the undo actions
- undoManager.addPropertyChangeListener(undoAction);
- undoManager.addPropertyChangeListener(redoAction);
-
- doc.addDocumentListener(undoAction);
- doc.addDocumentListener(redoAction);
-
- InputMap im = textEditor.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
- KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_Z, InputEvent.CTRL_MASK, false);
- im.put(ks, StructuredSyntaxResources.UNDO);
- ActionMap am = textEditor.getActionMap();
- am.put(StructuredSyntaxResources.UNDO, undoAction);
-
- ks = KeyStroke.getKeyStroke(KeyEvent.VK_Y, InputEvent.CTRL_MASK, false);
- im.put(ks, StructuredSyntaxResources.REDO);
- am.put(StructuredSyntaxResources.REDO, redoAction);
-
- ks = KeyStroke.getKeyStroke(KeyEvent.VK_P, InputEvent.CTRL_MASK, false);
- im.put(ks, StructuredSyntaxResources.PRINT);
- am.put(StructuredSyntaxResources.PRINT, printAction);
- }
-
- public void setShowLineNumbers(boolean showLineNumbers) {
- if (showLineNumbers) {
- setViewportView(new JPanel(new BorderLayout()) {{
- add(numbersPanel, BorderLayout.WEST);
- add(textEditor, BorderLayout.CENTER);
- }});
- } else {
- setViewportView(textEditor);
- }
- }
-
- public void setEditable(boolean editable) {
- textEditor.setEditable(editable);
- }
-
- public boolean clipBoardAvailable() {
- Transferable t = StructuredSyntaxResources.SYSTEM_CLIPBOARD.getContents(this);
- return t.isDataFlavorSupported(DataFlavor.stringFlavor);
- }
-
- public TextEditor getTextEditor() {
- return textEditor;
- }
-
- protected void initActions() {
- ActionMap map = getActionMap();
-
- PrintAction printAction = new PrintAction();
- map.put(StructuredSyntaxResources.PRINT, printAction);
- }
-
- private class PrintAction extends AbstractAction {
-
- public PrintAction() {
- setEnabled(true);
- }
-
- public void actionPerformed(ActionEvent ae) {
- PRINTER_JOB.setPageable(textEditor);
-
- try {
- if (PRINTER_JOB.printDialog()) {
- PRINTER_JOB.print();
- }
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- }
- } // end ConsoleTextEditor.PrintAction
-
- private class RedoAction extends UpdateCaretListener implements PropertyChangeListener {
-
- public RedoAction() {
- setEnabled(false);
- }
-
- public void actionPerformed(ActionEvent ae) {
- undoManager.redo();
- setEnabled(undoManager.canRedo());
- undoAction.setEnabled(undoManager.canUndo());
- super.actionPerformed(ae);
- }
-
- public void propertyChange(PropertyChangeEvent pce) {
- setEnabled(undoManager.canRedo());
- }
- } // end ConsoleTextEditor.RedoAction
-
- private abstract class UpdateCaretListener extends AbstractAction implements DocumentListener {
-
- protected int lastUpdate;
-
- public void changedUpdate(DocumentEvent de) {
- }
-
- public void insertUpdate(DocumentEvent de) {
- lastUpdate = de.getOffset() + de.getLength();
- }
-
- public void removeUpdate(DocumentEvent de) {
- lastUpdate = de.getOffset();
- }
-
- public void actionPerformed(ActionEvent ae) {
- textEditor.setCaretPosition(lastUpdate);
- }
- }
-
- private class UndoAction extends UpdateCaretListener implements PropertyChangeListener {
-
- public UndoAction() {
- setEnabled(false);
- }
-
- public void actionPerformed(ActionEvent ae) {
- undoManager.undo();
- setEnabled(undoManager.canUndo());
- redoAction.setEnabled(undoManager.canRedo());
- super.actionPerformed(ae);
- }
-
- public void propertyChange(PropertyChangeEvent pce) {
- setEnabled(undoManager.canUndo());
- }
- }
-
- public Action getUndoAction() {
- return undoAction;
- }
-
- public Action getRedoAction() {
- return redoAction;
- }
-
- public Action getPrintAction() {
- return printAction;
- }
-
-}
+/*
+ * Copyright 2003-2010 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package groovy.ui;
+
+import groovy.ui.text.GroovyFilter;
+import groovy.ui.text.StructuredSyntaxResources;
+import groovy.ui.text.TextEditor;
+import groovy.ui.text.TextUndoManager;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.ActionMap;
+import javax.swing.InputMap;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.KeyStroke;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.DefaultStyledDocument;
+import javax.swing.text.Document;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.Transferable;
+import java.awt.event.ActionEvent;
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
+import java.awt.print.PrinterJob;
+import java.awt.*;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.prefs.Preferences;
+
+import org.codehaus.groovy.runtime.DefaultGroovyMethods;
+
+/**
+ * Component which provides a styled editor for the console.
+ *
+ * @author hippy
+ * @author Danno Ferrin
+ * @author Tim Yates
+ * @author Guillaume Laforge
+ */
+public class ConsoleTextEditor extends JScrollPane {
+ public String getDefaultFamily() {
+ return defaultFamily;
+ }
+
+ public void setDefaultFamily(String defaultFamily) {
+ this.defaultFamily = defaultFamily;
+ }
+
+ private class LineNumbersPanel extends JPanel {
+
+ public LineNumbersPanel() {
+ int initialSize = 3 * Preferences.userNodeForPackage(Console.class).getInt("fontSize", 12);
+ setMinimumSize(new Dimension(initialSize, initialSize));
+ setPreferredSize(new Dimension(initialSize, initialSize));
+ }
+
+ @Override
+ public void paintComponent(Graphics g) {
+ super.paintComponent(g);
+ // starting position in document
+ int start = textEditor.viewToModel(getViewport().getViewPosition());
+ // end position in document
+ int end = textEditor.viewToModel(new Point(10,
+ getViewport().getViewPosition().y +
+ (int) textEditor.getVisibleRect().getHeight())
+ );
+
+ // translate offsets to lines
+ Document doc = textEditor.getDocument();
+ int startline = doc.getDefaultRootElement().getElementIndex(start) + 1;
+ int endline = doc.getDefaultRootElement().getElementIndex(end) + 1;
+ Font f = textEditor.getFont();
+ int fontHeight = g.getFontMetrics(f).getHeight();
+ int fontDesc = g.getFontMetrics(f).getDescent();
+ int startingY = -1;
+
+ try {
+ startingY = textEditor.modelToView(start).y + fontHeight - fontDesc;
+ } catch (BadLocationException e1) {
+ System.err.println(e1.getMessage());
+ }
+ g.setFont(f);
+ for (int line = startline, y = startingY; line <= endline; y += fontHeight, line++) {
+ String lineNumber = DefaultGroovyMethods.padLeft(Integer.toString(line), 4, " ");
+ g.drawString(lineNumber, 0, y);
+ }
+ }
+ }
+
+ private String defaultFamily = "Monospaced";
+
+ private static final PrinterJob PRINTER_JOB = PrinterJob.getPrinterJob();
+
+ private LineNumbersPanel numbersPanel = new LineNumbersPanel();
+
+ private boolean documentChangedSinceLastRepaint = false;
+
+ private TextEditor textEditor = new TextEditor(true, true, true) {
+
+ public void paintComponent(Graphics g) {
+ super.paintComponent(g);
+
+ // only repaint the line numbers in the gutter when the document has changed
+ // in case lines (hence line numbers) have been added or removed from the document
+ if (documentChangedSinceLastRepaint) {
+ numbersPanel.repaint();
+ documentChangedSinceLastRepaint = false;
+ }
+ }
+ };
+
+ private UndoAction undoAction = new UndoAction();
+ private RedoAction redoAction = new RedoAction();
+ private PrintAction printAction = new PrintAction();
+
+ private boolean editable = true;
+
+ private TextUndoManager undoManager;
+
+ /**
+ * Creates a new instance of ConsoleTextEditor
+ */
+ public ConsoleTextEditor() {
+ textEditor.setFont(new Font(defaultFamily, Font.PLAIN, Preferences.userNodeForPackage(Console.class).getInt("fontSize", 12)));
+
+ setViewportView(new JPanel(new BorderLayout()) {{
+ add(numbersPanel, BorderLayout.WEST);
+ add(textEditor, BorderLayout.CENTER);
+ }});
+
+ textEditor.setDragEnabled(editable);
+
+ getVerticalScrollBar().setUnitIncrement(10);
+
+ initActions();
+
+ DefaultStyledDocument doc = new DefaultStyledDocument();
+ doc.setDocumentFilter(new GroovyFilter(doc));
+ textEditor.setDocument(doc);
+
+ // add a document listener, to hint whether the line number gutter has to be repainted
+ // when the number of lines changes
+ doc.addDocumentListener(new DocumentListener() {
+ public void insertUpdate(DocumentEvent documentEvent) {
+ documentChangedSinceLastRepaint = true;
+ }
+
+ public void removeUpdate(DocumentEvent documentEvent) {
+ documentChangedSinceLastRepaint = true;
+ }
+
+ public void changedUpdate(DocumentEvent documentEvent) {
+ documentChangedSinceLastRepaint = true;
+ int width = 3 * Preferences.userNodeForPackage(Console.class).getInt("fontSize", 12);
+ numbersPanel.setPreferredSize(new Dimension(width, width));
+ }
+ });
+
+ // create and add the undo/redo manager
+ this.undoManager = new TextUndoManager();
+ doc.addUndoableEditListener(undoManager);
+
+ // add the undo actions
+ undoManager.addPropertyChangeListener(undoAction);
+ undoManager.addPropertyChangeListener(redoAction);
+
+ doc.addDocumentListener(undoAction);
+ doc.addDocumentListener(redoAction);
+
+ InputMap im = textEditor.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
+ KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_Z, InputEvent.CTRL_MASK, false);
+ im.put(ks, StructuredSyntaxResources.UNDO);
+ ActionMap am = textEditor.getActionMap();
+ am.put(StructuredSyntaxResources.UNDO, undoAction);
+
+ ks = KeyStroke.getKeyStroke(KeyEvent.VK_Y, InputEvent.CTRL_MASK, false);
+ im.put(ks, StructuredSyntaxResources.REDO);
+ am.put(StructuredSyntaxResources.REDO, redoAction);
+
+ ks = KeyStroke.getKeyStroke(KeyEvent.VK_P, InputEvent.CTRL_MASK, false);
+ im.put(ks, StructuredSyntaxResources.PRINT);
+ am.put(StructuredSyntaxResources.PRINT, printAction);
+ }
+
+ public void setShowLineNumbers(boolean showLineNumbers) {
+ if (showLineNumbers) {
+ setViewportView(new JPanel(new BorderLayout()) {{
+ add(numbersPanel, BorderLayout.WEST);
+ add(textEditor, BorderLayout.CENTER);
+ }});
+ } else {
+ setViewportView(textEditor);
+ }
+ }
+
+ public void setEditable(boolean editable) {
+ textEditor.setEditable(editable);
+ }
+
+ public boolean clipBoardAvailable() {
+ Transferable t = StructuredSyntaxResources.SYSTEM_CLIPBOARD.getContents(this);
+ return t.isDataFlavorSupported(DataFlavor.stringFlavor);
+ }
+
+ public TextEditor getTextEditor() {
+ return textEditor;
+ }
+
+ protected void initActions() {
+ ActionMap map = getActionMap();
+
+ PrintAction printAction = new PrintAction();
+ map.put(StructuredSyntaxResources.PRINT, printAction);
+ }
+
+ private class PrintAction extends AbstractAction {
+
+ public PrintAction() {
+ setEnabled(true);
+ }
+
+ public void actionPerformed(ActionEvent ae) {
+ PRINTER_JOB.setPageable(textEditor);
+
+ try {
+ if (PRINTER_JOB.printDialog()) {
+ PRINTER_JOB.print();
+ }
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ } // end ConsoleTextEditor.PrintAction
+
+ private class RedoAction extends UpdateCaretListener implements PropertyChangeListener {
+
+ public RedoAction() {
+ setEnabled(false);
+ }
+
+ public void actionPerformed(ActionEvent ae) {
+ undoManager.redo();
+ setEnabled(undoManager.canRedo());
+ undoAction.setEnabled(undoManager.canUndo());
+ super.actionPerformed(ae);
+ }
+
+ public void propertyChange(PropertyChangeEvent pce) {
+ setEnabled(undoManager.canRedo());
+ }
+ } // end ConsoleTextEditor.RedoAction
+
+ private abstract class UpdateCaretListener extends AbstractAction implements DocumentListener {
+
+ protected int lastUpdate;
+
+ public void changedUpdate(DocumentEvent de) {
+ }
+
+ public void insertUpdate(DocumentEvent de) {
+ lastUpdate = de.getOffset() + de.getLength();
+ }
+
+ public void removeUpdate(DocumentEvent de) {
+ lastUpdate = de.getOffset();
+ }
+
+ public void actionPerformed(ActionEvent ae) {
+ textEditor.setCaretPosition(lastUpdate);
+ }
+ }
+
+ private class UndoAction extends UpdateCaretListener implements PropertyChangeListener {
+
+ public UndoAction() {
+ setEnabled(false);
+ }
+
+ public void actionPerformed(ActionEvent ae) {
+ undoManager.undo();
+ setEnabled(undoManager.canUndo());
+ redoAction.setEnabled(undoManager.canRedo());
+ super.actionPerformed(ae);
+ }
+
+ public void propertyChange(PropertyChangeEvent pce) {
+ setEnabled(undoManager.canUndo());
+ }
+ }
+
+ public Action getUndoAction() {
+ return undoAction;
+ }
+
+ public Action getRedoAction() {
+ return redoAction;
+ }
+
+ public Action getPrintAction() {
+ return printAction;
+ }
+
+}
View
294 src/main/groovy/ui/ConsoleView.groovy → ...groovy-console/src/main/groovy/ConsoleView.groovy
@@ -1,147 +1,147 @@
-/*
- * Copyright 2003-2009 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package groovy.ui
-
-import groovy.ui.view.Defaults
-import groovy.ui.view.GTKDefaults
-import groovy.ui.view.MacOSXDefaults
-import groovy.ui.view.WindowsDefaults
-import java.awt.datatransfer.DataFlavor
-import java.awt.dnd.*
-import javax.swing.UIManager
-import javax.swing.event.DocumentListener
-
-switch (UIManager.getSystemLookAndFeelClassName()) {
- case 'com.sun.java.swing.plaf.windows.WindowsLookAndFeel':
- case 'com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel':
- build(WindowsDefaults)
- break
-
- case 'apple.laf.AquaLookAndFeel':
- case 'com.apple.laf.AquaLookAndFeel':
- build(MacOSXDefaults)
- break
-
- case 'com.sun.java.swing.plaf.gtk.GTKLookAndFeel':
- build(GTKDefaults)
- break
-
- default:
- build(Defaults)
- break
-}
-
-binding.rootContainerDelegate.delegate = this
-
-consoleFrame = binding['rootContainerDelegate']()
-container(consoleFrame) {
-
- binding.menuBarDelegate.delegate = delegate
- binding['menuBarDelegate'](menuBarClass)
-
- build(contentPaneClass)
-
- build(toolBarClass)
-
- build(statusBarClass)
-}
-
-
-controller.promptStyle = promptStyle
-controller.commandStyle = commandStyle
-controller.outputStyle = outputStyle
-controller.stacktraceStyle = stacktraceStyle
-controller.hyperlinkStyle = hyperlinkStyle
-controller.resultStyle = resultStyle
-
-// add the window close handler
-if (consoleFrame instanceof java.awt.Window) {
- consoleFrame.windowClosing = controller.&exit
-}
-
-// link in references to the controller
-controller.inputEditor = inputEditor
-controller.inputArea = inputEditor.textEditor
-controller.outputArea = outputArea
-controller.outputWindow = outputWindow
-controller.statusLabel = status
-controller.frame = consoleFrame
-controller.rowNumAndColNum = rowNumAndColNum
-controller.toolbar = toolbar
-
-// link actions
-controller.saveAction = saveAction
-controller.prevHistoryAction = historyPrevAction
-controller.nextHistoryAction = historyNextAction
-controller.fullStackTracesAction = fullStackTracesAction
-controller.showToolbarAction = showToolbarAction
-controller.detachedOutputAction = detachedOutputAction
-controller.autoClearOutputAction = autoClearOutputAction
-controller.threadInterruptAction = threadInterruptAction
-controller.showOutputWindowAction = showOutputWindowAction
-controller.hideOutputWindowAction1 = hideOutputWindowAction1
-controller.hideOutputWindowAction2 = hideOutputWindowAction2
-controller.hideOutputWindowAction3 = hideOutputWindowAction3
-controller.hideOutputWindowAction4 = hideOutputWindowAction4
-controller.interruptAction = interruptAction
-controller.origDividerSize = origDividerSize
-controller.splitPane = splitPane
-controller.blank = blank
-controller.scrollArea = scrollArea
-
-// some more UI linkage
-controller.outputArea.addComponentListener(controller)
-controller.inputArea.addComponentListener(controller)
-controller.outputArea.addHyperlinkListener(controller)
-controller.outputArea.addHyperlinkListener(controller)
-controller.outputArea.addFocusListener(controller)
-controller.inputArea.addCaretListener(controller)
-controller.inputArea.document.addDocumentListener({ controller.setDirty(true) } as DocumentListener)
-controller.rootElement = inputArea.document.defaultRootElement
-
-
-def dtListener = [
- dragEnter:{DropTargetDragEvent evt ->
- if (evt.dropTargetContext.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
- evt.acceptDrag(DnDConstants.ACTION_COPY)
- } else {
- evt.rejectDrag()
- }
- },
- dragOver:{DropTargetDragEvent evt ->
- //dragEnter(evt)
- },
- dropActionChanged:{DropTargetDragEvent evt ->
- //dragEnter(evt)
- },
- dragExit:{DropTargetEvent evt ->
- },
- drop:{DropTargetDropEvent evt ->
- evt.acceptDrop DnDConstants.ACTION_COPY
- //println "Dropping! ${evt.transferable.getTransferData(DataFlavor.javaFileListFlavor)}"
- if (controller.askToSaveFile()) {
- controller.loadScriptFile(evt.transferable.getTransferData(DataFlavor.javaFileListFlavor)[0])
- }
- },
-] as DropTargetListener
-
-[consoleFrame, inputArea, outputArea].each {
- new DropTarget(it, DnDConstants.ACTION_COPY, dtListener)
-}
-
-// don't send any return value from the view, all items should be referenced via the bindings
-return null
+/*
+ * Copyright 2003-2009 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package groovy.ui
+
+import groovy.ui.view.Defaults
+import groovy.ui.view.GTKDefaults
+import groovy.ui.view.MacOSXDefaults
+import groovy.ui.view.WindowsDefaults
+import java.awt.datatransfer.DataFlavor
+import java.awt.dnd.*
+import javax.swing.UIManager
+import javax.swing.event.DocumentListener
+
+switch (UIManager.getSystemLookAndFeelClassName()) {
+ case 'com.sun.java.swing.plaf.windows.WindowsLookAndFeel':
+ case 'com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel':
+ build(WindowsDefaults)
+ break
+
+ case 'apple.laf.AquaLookAndFeel':
+ case 'com.apple.laf.AquaLookAndFeel':
+ build(MacOSXDefaults)
+ break
+
+ case 'com.sun.java.swing.plaf.gtk.GTKLookAndFeel':
+ build(GTKDefaults)
+ break
+
+ default:
+ build(Defaults)
+ break
+}
+
+binding.rootContainerDelegate.delegate = this
+
+consoleFrame = binding['rootContainerDelegate']()
+container(consoleFrame) {
+
+ binding.menuBarDelegate.delegate = delegate
+ binding['menuBarDelegate'](menuBarClass)
+
+ build(contentPaneClass)
+
+ build(toolBarClass)
+