A Swing-based interactive console for evaluating Groovy expressions and scripts with syntax highlighting, code completion, and an integrated AST browser.
npx @tessl/cli install tessl/maven-org-codehaus-groovy--groovy-console@3.0.00
# Groovy Console
1
2
A Swing-based interactive console for evaluating Groovy expressions and scripts with syntax highlighting, code completion, and an integrated AST browser. The Groovy Console provides a comprehensive development environment for writing, executing, and debugging Groovy scripts with real-time visual feedback and extensive analysis tools.
3
4
## Package Information
5
6
- **Package Name**: groovy-console
7
- **Package Type**: maven
8
- **Language**: Groovy/Java
9
- **Installation**: Add dependency `org.codehaus.groovy:groovy-console:3.0.25`
10
11
## Core Imports
12
13
```groovy
14
import groovy.console.ui.Console
15
import groovy.console.ui.ObjectBrowser
16
import groovy.console.ui.AstBrowser
17
```
18
19
**Legacy API (Deprecated):** The `groovy.ui.*` package provides identical functionality but is deprecated:
20
21
```groovy
22
import groovy.ui.Console // @Deprecated - use groovy.console.ui.Console
23
import groovy.inspect.swingui.ObjectBrowser
24
import groovy.inspect.swingui.AstBrowser
25
```
26
27
## Basic Usage
28
29
```groovy
30
// Launch console programmatically
31
def console = new groovy.console.ui.Console()
32
console.run()
33
34
// With custom binding
35
def binding = new Binding()
36
binding.setVariable('myVar', 'Hello World')
37
def console = new groovy.console.ui.Console(binding)
38
console.run([title: 'My Groovy Console'])
39
40
// Inspect objects at runtime
41
groovy.console.ui.ObjectBrowser.inspect(myObject)
42
```
43
44
## Architecture
45
46
The Groovy Console is built around several key components:
47
48
- **Console Application**: Main interactive development environment (`Console` class)
49
- **Text Editor**: Advanced Groovy code editor with syntax highlighting and smart features
50
- **AST Browser**: Abstract Syntax Tree visualization and analysis tools
51
- **Object Inspector**: Runtime object introspection and property browsing
52
- **Platform Integration**: Native UI adaptations for Windows, macOS, and Linux
53
- **Ivy Integration**: Optional dependency management through Apache Ivy
54
55
## Capabilities
56
57
### Console Application
58
59
Interactive Groovy development environment with script execution, file management, and integrated debugging tools.
60
61
```groovy { .api }
62
class Console {
63
Console()
64
Console(Binding binding)
65
Console(ClassLoader parent, Binding binding, CompilerConfiguration baseConfig)
66
67
static void main(String[] args)
68
void run()
69
void run(Map defaults)
70
void run(JApplet applet)
71
}
72
```
73
74
[Console Application](./console-application.md)
75
76
### Text Editing
77
78
Advanced text editor with Groovy syntax highlighting, auto-completion, find/replace, and smart editing features.
79
80
```groovy { .api }
81
class ConsoleTextEditor extends JScrollPane {
82
ConsoleTextEditor()
83
84
TextEditor getTextEditor()
85
void setShowLineNumbers(boolean showLineNumbers)
86
void setEditable(boolean editable)
87
boolean clipBoardAvailable()
88
Action getUndoAction()
89
Action getRedoAction()
90
Action getPrintAction()
91
void enableHighLighter(Class clazz)
92
}
93
```
94
95
[Text Editing](./text-editing.md)
96
97
### AST Browser
98
99
Abstract Syntax Tree visualization and analysis tools for understanding code structure and compilation phases.
100
101
```groovy { .api }
102
class AstBrowser {
103
AstBrowser(inputArea, rootElement, classLoader)
104
105
void refresh()
106
static void main(String[] args)
107
}
108
109
enum CompilePhaseAdapter {
110
INITIALIZATION,
111
PARSING,
112
CONVERSION,
113
SEMANTIC_ANALYSIS,
114
CANONICALIZATION,
115
INSTRUCTION_SELECTION,
116
CLASS_GENERATION,
117
OUTPUT,
118
FINALIZATION
119
}
120
```
121
122
[AST Browser](./ast-browser.md)
123
124
### Object Inspector
125
126
Runtime object inspection and property browsing tools for debugging and exploration.
127
128
```groovy { .api }
129
class ObjectBrowser {
130
static void main(String[] args)
131
static void inspect(Object objectUnderInspection)
132
}
133
```
134
135
[Object Inspector](./object-inspector.md)
136
137
### System Integration
138
139
System output capture, preferences management, and platform-specific features.
140
141
```groovy { .api }
142
class SystemOutputInterceptor extends FilterOutputStream {
143
SystemOutputInterceptor(OutputStream out)
144
}
145
146
class ConsolePreferences {
147
ConsolePreferences()
148
}
149
```
150
151
[System Integration](./system-integration.md)