This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/groovy.git
commit 8976bed0749520402ebc5a80359cb006385a16e4 Author: Paul King <[email protected]> AuthorDate: Wed May 15 18:53:40 2019 +1000 GROOVY-8647: Split package renaming (groovy-console) --- .../src/main/groovy/groovy/console/TextNode.groovy | 2 +- .../groovy/groovy/console/TextTreeNodeMaker.groovy | 4 +- .../groovy/groovy/console/ui/AstBrowser.groovy | 124 +++--- .../console/ui/AstNodeToScriptAdapter.groovy | 4 +- .../console/ui/ButtonOrDefaultRenderer.groovy | 7 +- .../groovy/console/ui/ButtonOrTextEditor.groovy | 11 +- .../main/groovy/groovy/console/ui/Console.groovy | 207 ++++----- .../groovy/groovy/console/ui/ConsoleActions.groovy | 466 ++++++++++----------- .../groovy/console/ui/ConsoleIvyPlugin.groovy | 2 +- .../groovy/console/ui/ConsolePreferences.groovy | 12 +- .../groovy/groovy/console/ui/ConsoleSupport.java | 11 +- .../groovy/console/ui/ConsoleTextEditor.java | 16 +- .../groovy/groovy/console/ui/ConsoleView.groovy | 62 +-- .../groovy/groovy/console/ui/HistoryRecord.groovy | 6 +- .../groovy/groovy/console/ui/ObjectBrowser.groovy | 9 +- .../groovy/console/ui/OutputTransforms.groovy | 2 +- .../console/ui/ScriptToTreeNodeAdapter.groovy | 2 +- .../groovy/console/ui/SystemOutputInterceptor.java | 2 +- .../src/main/groovy/groovy/console/ui/package.html | 40 +- .../groovy/console/ui/text/AutoIndentAction.groovy | 5 +- .../groovy/console/ui/text/FindReplaceUtility.java | 2 +- .../groovy/console/ui/text/GroovyFilter.java | 2 +- .../console/ui/text/MatchingHighlighter.java | 2 +- .../console/ui/text/SmartDocumentFilter.java | 2 +- .../ui/text/StructuredSyntaxDocumentFilter.java | 2 +- .../console/ui/text/StructuredSyntaxHandler.java | 2 +- .../console/ui/text/StructuredSyntaxResources.java | 2 +- .../groovy/groovy/console/ui/text/TextEditor.java | 2 +- .../groovy/console/ui/text/TextUndoManager.java | 2 +- .../groovy/groovy/console/ui/text/package.html | 2 +- .../groovy/console/ui/view/BasicContentPane.groovy | 28 +- .../groovy/console/ui/view/BasicMenuBar.groovy | 2 +- .../groovy/console/ui/view/BasicStatusBar.groovy | 21 +- .../groovy/console/ui/view/BasicToolBar.groovy | 51 +-- .../groovy/groovy/console/ui/view/Defaults.groovy | 16 +- .../groovy/console/ui/view/GTKDefaults.groovy | 7 +- .../groovy/console/ui/view/MacOSXDefaults.groovy | 8 +- .../groovy/console/ui/view/MacOSXMenuBar.groovy | 5 +- .../groovy/console/ui/view/WindowsDefaults.groovy | 4 +- .../src/main/groovy/groovy/ui/Console.groovy | 1 + .../src/main/groovy/groovy/ui/ConsoleApplet.groovy | 3 +- .../main/groovy/groovy/ui/ConsoleIvyPlugin.groovy | 1 + .../groovy/groovy/ui/ConsolePreferences.groovy | 1 + .../src/main/groovy/groovy/ui/ConsoleSupport.java | 1 + .../main/groovy/groovy/ui/ConsoleTextEditor.java | 1 + .../src/main/groovy/groovy/ui/HistoryRecord.groovy | 1 + .../main/groovy/groovy/ui/OutputTransforms.groovy | 1 + .../groovy/groovy/ui/SystemOutputInterceptor.java | 1 + .../groovy/groovy/ui/text/AutoIndentAction.groovy | 1 + .../groovy/groovy/ui/text/FindReplaceUtility.java | 1 + .../main/groovy/groovy/ui/text/GroovyFilter.java | 1 + .../groovy/groovy/ui/text/MatchingHighlighter.java | 1 + .../groovy/groovy/ui/text/SmartDocumentFilter.java | 1 + .../ui/text/StructuredSyntaxDocumentFilter.java | 1 + .../groovy/ui/text/StructuredSyntaxHandler.java | 1 + .../groovy/ui/text/StructuredSyntaxResources.java | 1 + .../src/main/groovy/groovy/ui/text/TextEditor.java | 1 + .../groovy/groovy/ui/text/TextUndoManager.java | 1 + .../groovy/console/ui/AstBrowserProperties.groovy | 3 +- .../SwingBuilderConsoleTest.groovy | 10 +- .../ui}/AstNodeToScriptAdapterTest.groovy | 0 .../ui/HistoryRecordGetTextToRunTests.groovy | 3 +- .../ui}/ScriptToTreeNodeAdapterTest.groovy | 4 +- .../{ => console}/ui/text/GroovyFilterTests.groovy | 0 64 files changed, 621 insertions(+), 576 deletions(-) diff --git a/subprojects/groovy-console/src/main/groovy/groovy/console/TextNode.groovy b/subprojects/groovy-console/src/main/groovy/groovy/console/TextNode.groovy index 1179769..93ea1fa 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/console/TextNode.groovy +++ b/subprojects/groovy-console/src/main/groovy/groovy/console/TextNode.groovy @@ -19,7 +19,7 @@ /** * Represents a plain text node for use in the AST tree made by ASTBrowser */ -package groovy.inspect +package groovy.console import groovy.transform.CompileStatic diff --git a/subprojects/groovy-console/src/main/groovy/groovy/console/TextTreeNodeMaker.groovy b/subprojects/groovy-console/src/main/groovy/groovy/console/TextTreeNodeMaker.groovy index d47db95..9e5aa78 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/console/TextTreeNodeMaker.groovy +++ b/subprojects/groovy-console/src/main/groovy/groovy/console/TextTreeNodeMaker.groovy @@ -19,9 +19,9 @@ /** * A factory class for plain text nodes for use in the AST tree made by ASTBrowser */ -package groovy.inspect +package groovy.console -import groovy.inspect.swingui.AstBrowserNodeMaker +import groovy.console.ui.AstBrowserNodeMaker import groovy.transform.CompileStatic @CompileStatic diff --git a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/AstBrowser.groovy b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/AstBrowser.groovy index 87001af..09150fd 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/AstBrowser.groovy +++ b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/AstBrowser.groovy @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package groovy.inspect.swingui +package groovy.console.ui import groovy.lang.GroovyClassLoader.ClassCollector import groovy.swing.SwingBuilder @@ -31,16 +31,21 @@ import org.objectweb.asm.ClassReader import org.objectweb.asm.util.ASMifier import org.objectweb.asm.util.TraceClassVisitor -import javax.swing.* +import javax.swing.Action +import javax.swing.JFrame +import javax.swing.JSplitPane +import javax.swing.KeyStroke +import javax.swing.UIManager +import javax.swing.WindowConstants import javax.swing.event.TreeSelectionEvent import javax.swing.event.TreeSelectionListener import javax.swing.tree.DefaultMutableTreeNode import javax.swing.tree.DefaultTreeModel import javax.swing.tree.TreeNode import javax.swing.tree.TreeSelectionModel -import java.awt.* +import java.awt.Cursor +import java.awt.Font import java.awt.event.KeyEvent -import java.util.List import java.util.prefs.Preferences import java.util.regex.Pattern @@ -54,10 +59,9 @@ import static java.awt.GridBagConstraints.WEST /** * This object is a GUI for looking at the AST that Groovy generates. * - * Usage: java groovy.inspect.swingui.AstBrowser [filename] + * Usage: java groovy.console.ui.AstBrowser [filename] * where [filename] is an existing Groovy script. */ - class AstBrowser { private static final String BYTECODE_MSG_SELECT_NODE = '// Please select a class node in the tree view.' @@ -83,14 +87,14 @@ class AstBrowser { static void main(args) { if (!args) { - println 'Usage: java groovy.inspect.swingui.AstBrowser [filename]\nwhere [filename] is a Groovy script' + println 'Usage: java groovy.console.ui.AstBrowser [filename]\nwhere [filename] is a Groovy script' } else { def file = new File((String) args[0]) if (!file.exists()) { println "File $args[0] cannot be found." } else { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()) - new AstBrowser(null, null, new GroovyClassLoader()).run({file.text}, file.path) + new AstBrowser(null, null, new GroovyClassLoader()).run({ file.text }, file.path) } } } @@ -118,7 +122,7 @@ class AstBrowser { frame = swing.frame(title: 'Groovy AST Browser' + (name ? " - $name" : ''), location: prefs.frameLocation, size: prefs.frameSize, - iconImage: swing.imageIcon(groovy.ui.Console.ICON_PATH).image, + iconImage: swing.imageIcon(Console.ICON_PATH).image, defaultCloseOperation: WindowConstants.DISPOSE_ON_CLOSE, windowClosing: { event -> prefs.save(frame, splitterPane, mainSplitter, showScriptFreeForm, showScriptClass, showClosureClasses, phasePicker.selectedItem, showTreeView, showIndyBytecode) }) { @@ -146,8 +150,12 @@ class AstBrowser { } } menu(text: 'View', mnemonic: 'V') { - menuItem {action(name: 'Larger Font', closure: this.&largerFont, mnemonic: 'L', accelerator: shortcut('shift L'))} - menuItem {action(name: 'Smaller Font', closure: this.&smallerFont, mnemonic: 'S', accelerator: shortcut('shift S'))} + menuItem { + action(name: 'Larger Font', closure: this.&largerFont, mnemonic: 'L', accelerator: shortcut('shift L')) + } + menuItem { + action(name: 'Smaller Font', closure: this.&smallerFont, mnemonic: 'S', accelerator: shortcut('shift S')) + } menuItem { refreshAction = action(name: 'Refresh', closure: { decompile(phasePicker.selectedItem.phaseId, script()) @@ -157,7 +165,7 @@ class AstBrowser { } } menu(text: 'Help', mnemonic: 'H') { - menuItem {action(name: 'About', closure: this.&showAbout, mnemonic: 'A')} + menuItem { action(name: 'About', closure: this.&showAbout, mnemonic: 'A') } } } panel { @@ -182,7 +190,7 @@ class AstBrowser { }, constraints: gbc(gridx: 2, gridy: 0, gridwidth: 1, gridheight: 1, weightx: 0, weighty: 0, anchor: NORTHEAST, fill: NONE, insets: [2, 2, 2, 3])) splitterPane = splitPane( - visible: showTreeView, + visible: showTreeView, leftComponent: scrollPane { jTree = tree( name: 'AstTreeView', rowHeight: 0, /* force recalc */ @@ -197,16 +205,17 @@ class AstBrowser { } } } - ) { } + ) {} mainSplitter = splitPane( orientation: JSplitPane.VERTICAL_SPLIT, topComponent: splitterPane, bottomComponent: tabbedPane { - widget(decompiledSource = new groovy.ui.ConsoleTextEditor(editable: false, showLineNumbers: false), title:'Source') - widget(bytecodeView = new groovy.ui.ConsoleTextEditor(editable: false, showLineNumbers: false), title:getByteCodeTitle()) - widget(asmifierView = new groovy.ui.ConsoleTextEditor(editable: false, showLineNumbers: false), title:getASMifierTitle()) + widget(decompiledSource = new ConsoleTextEditor(editable: false, showLineNumbers: false), title: 'Source') + widget(bytecodeView = new ConsoleTextEditor(editable: false, showLineNumbers: false), title: getByteCodeTitle()) + widget(asmifierView = new ConsoleTextEditor(editable: false, showLineNumbers: false), title: getASMifierTitle()) }, - constraints: gbc(gridx: 0, gridy: 2, gridwidth: 3, gridheight: 1, weightx: 1.0, weighty: 1.0, anchor: NORTHWEST, fill: BOTH, insets: [2, 2, 2, 2])) { } + constraints: gbc(gridx: 0, gridy: 2, gridwidth: 3, gridheight: 1, weightx: 1.0, weighty: 1.0, anchor: NORTHWEST, fill: BOTH, insets: [2, 2, 2, 2])) { + } } } @@ -215,7 +224,7 @@ class AstBrowser { propertyTable.model.rows.clear() //for some reason this suppress an empty row - jTree.cellRenderer.setLeafIcon(swing.imageIcon(groovy.ui.Console.NODE_ICON_PATH)) + jTree.cellRenderer.setLeafIcon(swing.imageIcon(Console.NODE_ICON_PATH)) jTree.selectionModel.selectionMode = TreeSelectionModel.SINGLE_TREE_SELECTION jTree.addTreeSelectionListener({ TreeSelectionEvent e -> @@ -224,38 +233,38 @@ class AstBrowser { propertyTable.columnModel.getColumn(1).cellEditor = new ButtonOrTextEditor() TreeNode node = jTree.lastSelectedPathComponent if (node instanceof TreeNodeWithProperties) { - def titleSuffix = node.properties.find{ it[0] == 'text' }?.get(1) + def titleSuffix = node.properties.find { it[0] == 'text' }?.get(1) for (it in node.properties) { def propList = it if (propList[2] == "ListHashMap" && propList[1] != 'null' && propList[1] != '[:]') { //If the class is a ListHashMap, make it accessible in a new frame through a button def btnPanel = swing.button( - text: "See key/value pairs", - actionPerformed: { - def mapTable - String title = titleSuffix ? propList[0] + " (" + titleSuffix + ")" : propList[0] - def props = swing.frame(title: title, defaultCloseOperation: JFrame.DISPOSE_ON_CLOSE, - show: true, locationRelativeTo: null) { - lookAndFeel("system") - panel { - scrollPane() { - mapTable = swing.table() { - tableModel(list: [[:]]) { - propertyColumn(header: 'Name', propertyName: 'name') - propertyColumn(header: 'Value', propertyName: 'value') + text: "See key/value pairs", + actionPerformed: { + def mapTable + String title = titleSuffix ? propList[0] + " (" + titleSuffix + ")" : propList[0] + def props = swing.frame(title: title, defaultCloseOperation: JFrame.DISPOSE_ON_CLOSE, + show: true, locationRelativeTo: null) { + lookAndFeel("system") + panel { + scrollPane { + mapTable = swing.table { + tableModel(list: [[:]]) { + propertyColumn(header: 'Name', propertyName: 'name') + propertyColumn(header: 'Value', propertyName: 'value') + } } } } } - } - mapTable.model.rows.clear() - propList[1].substring(1, propList[1].length() - 1).tokenize(',').each { - def kv = it.tokenize(':') - if (kv) - mapTable.model.rows << ["name": kv[0], "value": kv[1]] - } - props.pack() - }) + mapTable.model.rows.clear() + propList[1].substring(1, propList[1].length() - 1).tokenize(',').each { + def kv = it.tokenize(':') + if (kv) + mapTable.model.rows << ["name": kv[0], "value": kv[1]] + } + props.pack() + }) propertyTable.model.rows << ["name": propList[0], "value": btnPanel, "type": propList[2]] btnPanel.updateUI() } else { @@ -265,7 +274,9 @@ class AstBrowser { if (inputArea && rootElement) { // get the line / column information to select the text represented by the current selected node - def lineInfo = node.properties.findAll { it[0] in ['lineNumber', 'columnNumber', 'lastLineNumber', 'lastColumnNumber'] } + def lineInfo = node.properties.findAll { + it[0] in ['lineNumber', 'columnNumber', 'lastLineNumber', 'lastColumnNumber'] + } def lineInfoMap = lineInfo.inject([:]) { map, info -> map[(info[0])] = Integer.valueOf(info[1]); return map } // when there are valid line / column information (ie. != -1), create a selection in the input area @@ -295,11 +306,15 @@ class AstBrowser { def methodDescriptor = node.getPropertyValue('descriptor') boolean isMethodNameAndMethodDescriptorAvailable = methodName && methodDescriptor - String bytecodeSource = generateSource(bytecode, {writer -> new TraceClassVisitor(new PrintWriter(writer))}) - showSource(bytecodeView, bytecodeSource, showOnlyMethodCode, isMethodNameAndMethodDescriptorAvailable, {"^.*\\n.*${Pattern.quote(methodName + methodDescriptor)}[\\s\\S]*?\\n[}|\\n]"}) + String bytecodeSource = generateSource(bytecode, { writer -> new TraceClassVisitor(new PrintWriter(writer)) }) + showSource(bytecodeView, bytecodeSource, showOnlyMethodCode, isMethodNameAndMethodDescriptorAvailable, { + "^.*\\n.*${Pattern.quote(methodName + methodDescriptor)}[\\s\\S]*?\\n[}|\\n]" + }) - String asmifierSource = generateSource(bytecode, {writer -> new TraceClassVisitor(null, new ASMifier(), new PrintWriter(writer))}) - showSource(asmifierView, asmifierSource, showOnlyMethodCode, isMethodNameAndMethodDescriptorAvailable, {"^.*\\n.*${Pattern.quote(methodName)}.*?${Pattern.quote(methodDescriptor)}[\\s\\S]*?\\n[}|\\n]"}) + String asmifierSource = generateSource(bytecode, { writer -> new TraceClassVisitor(null, new ASMifier(), new PrintWriter(writer)) }) + showSource(asmifierView, asmifierSource, showOnlyMethodCode, isMethodNameAndMethodDescriptorAvailable, { + "^.*\\n.*${Pattern.quote(methodName)}.*?${Pattern.quote(methodDescriptor)}[\\s\\S]*?\\n[}|\\n]" + }) } else { swing.doLater { bytecodeView.textEditor.text = NO_BYTECODE_AVAILABLE_AT_THIS_PHASE @@ -335,7 +350,8 @@ class AstBrowser { private static final int INITIAL_CAPACITY = 64 * 1024 // 64K private String generateSource(byte[] bytecode, getVisitor) { - def sw = new StringBuilderWriter(INITIAL_CAPACITY) // the generated code of `println 123` occupies about 618 bytes, so we should increase the initial capacity to 64K + def sw = new StringBuilderWriter(INITIAL_CAPACITY) + // the generated code of `println 123` occupies about 618 bytes, so we should increase the initial capacity to 64K new ClassReader(bytecode).accept(getVisitor(sw), 0) return sw.toString() } @@ -400,7 +416,7 @@ class AstBrowser { showScriptClass = evt.source.selected } - void showClosureClasses(EventObject evt) { + void showClosureClasses(EventObject evt) { showClosureClasses = evt.source.selected } @@ -425,7 +441,7 @@ class AstBrowser { def tabPane = mainSplitter.bottomComponent int tabCount = tabPane.getTabCount() for (int i = 0; i < tabCount; i++) { - def component = tabPane.getComponentAt(i); + def component = tabPane.getComponentAt(i) if (bytecodeView.is(component)) { tabPane.setTitleAt(i, getByteCodeTitle()) } else if (asmifierView.is(component)) { @@ -452,7 +468,7 @@ class AstBrowser { String result = new AstNodeToScriptAdapter().compileToScript(source, phaseId, classLoader, showScriptFreeForm, showScriptClass, config) swing.doLater { - decompiledSource.textEditor.text = result + decompiledSource.textEditor.text = result decompiledSource.textEditor.setCaretPosition(0) decompiledSource.textEditor.setCursor(Cursor.defaultCursor) } @@ -537,7 +553,7 @@ class AstBrowserUiPreferences { } } - def save(frame, vSplitter, hSplitter, scriptFreeFormPref, scriptClassPref, closureClassesPref, CompilePhaseAdapter phase, showTreeView, showIndyBytecode=false) { + def save(frame, vSplitter, hSplitter, scriptFreeFormPref, scriptClassPref, closureClassesPref, CompilePhaseAdapter phase, showTreeView, showIndyBytecode = false) { Preferences prefs = Preferences.userNodeForPackage(AstBrowserUiPreferences) prefs.putInt('decompiledFontSize', decompiledSourceFontSize as int) prefs.putInt('frameX', frame.location.x as int) @@ -601,7 +617,7 @@ class TreeNodeWithProperties extends DefaultMutableTreeNode { this.properties = properties } - String getPropertyValue(String name) { + String getPropertyValue(String name) { def match = properties.find { n, v, t -> name == n } return match != null ? match[1] : null } @@ -643,7 +659,7 @@ class BytecodeCollector extends ClassCollector { Map<String, byte[]> bytecode - BytecodeCollector(ClassCollector delegate, Map<String,byte[]> bytecode) { + BytecodeCollector(ClassCollector delegate, Map<String, byte[]> bytecode) { super(delegate.cl, delegate.unit, delegate.su) this.bytecode = bytecode } diff --git a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/AstNodeToScriptAdapter.groovy b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/AstNodeToScriptAdapter.groovy index 52489ff..292a8ae 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/AstNodeToScriptAdapter.groovy +++ b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/AstNodeToScriptAdapter.groovy @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package groovy.inspect.swingui +package groovy.console.ui import groovy.transform.CompileStatic import org.apache.groovy.io.StringBuilderWriter @@ -199,7 +199,7 @@ class AstNodeToScriptVisitor extends PrimaryClassNodeOperation implements Groovy boolean showScriptClass boolean scriptHasBeenVisited - def AstNodeToScriptVisitor(Writer writer, boolean showScriptFreeForm = true, boolean showScriptClass = true) { + AstNodeToScriptVisitor(Writer writer, boolean showScriptFreeForm = true, boolean showScriptClass = true) { this._out = writer this.showScriptFreeForm = showScriptFreeForm this.showScriptClass = showScriptClass diff --git a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ButtonOrDefaultRenderer.groovy b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ButtonOrDefaultRenderer.groovy index 95348c8..7aa3b4e 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ButtonOrDefaultRenderer.groovy +++ b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ButtonOrDefaultRenderer.groovy @@ -17,13 +17,14 @@ * under the License. * */ -package groovy.inspect.swingui +package groovy.console.ui import groovy.transform.CompileStatic -import javax.swing.* +import javax.swing.JComponent +import javax.swing.JTable import javax.swing.table.DefaultTableCellRenderer -import java.awt.* +import java.awt.Component /** * A table cell renderer that will return a component instead of drawing it, diff --git a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ButtonOrTextEditor.groovy b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ButtonOrTextEditor.groovy index 1045b36..18ff1a0 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ButtonOrTextEditor.groovy +++ b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ButtonOrTextEditor.groovy @@ -17,13 +17,17 @@ * under the License. * */ -package groovy.inspect.swingui +package groovy.console.ui import groovy.transform.CompileStatic -import javax.swing.* +import javax.swing.AbstractCellEditor +import javax.swing.JButton +import javax.swing.JComponent +import javax.swing.JTable +import javax.swing.JTextArea import javax.swing.table.TableCellEditor -import java.awt.* +import java.awt.Component import java.awt.event.ActionListener import java.awt.event.FocusListener @@ -58,4 +62,3 @@ class ButtonOrTextEditor extends AbstractCellEditor implements TableCellEditor { editorComponent } } - diff --git a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/Console.groovy b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/Console.groovy index 038f88f..4470721 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/Console.groovy +++ b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/Console.groovy @@ -16,18 +16,17 @@ * specific language governing permissions and limitations * under the License. */ -package groovy.ui +package groovy.console.ui import groovy.cli.picocli.CliBuilder import groovy.cli.picocli.OptionAccessor -import groovy.inspect.swingui.AstBrowser -import groovy.inspect.swingui.ObjectBrowser import groovy.swing.SwingBuilder import groovy.transform.CompileStatic import groovy.transform.ThreadInterrupt -import groovy.ui.text.FindReplaceUtility -import groovy.ui.text.GroovyFilter -import groovy.ui.text.SmartDocumentFilter +import groovy.console.ui.text.FindReplaceUtility +import groovy.console.ui.text.GroovyFilter +import groovy.console.ui.text.SmartDocumentFilter +import groovy.ui.GroovyMain import org.apache.groovy.io.StringBuilderWriter import org.apache.groovy.parser.antlr4.GroovyLangLexer import org.apache.groovy.util.SystemUtil @@ -84,6 +83,7 @@ import java.awt.event.ComponentEvent import java.awt.event.ComponentListener import java.awt.event.FocusEvent import java.awt.event.FocusListener +import java.util.logging.Logger import java.util.prefs.Preferences /** @@ -106,7 +106,7 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo Boolean.valueOf(SystemUtil.getSystemPropertySafe('groovy.console.enable.smart.highlighter', 'true'))) boolean fullStackTraces = prefs.getBoolean('fullStackTraces', - Boolean.valueOf(System.getProperty('groovy.full.stacktrace', 'false'))) + Boolean.valueOf(System.getProperty('groovy.full.stacktrace', 'false'))) Action fullStackTracesAction boolean showScriptInOutput = prefs.getBoolean('showScriptInOutput', true) @@ -155,7 +155,7 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo int maxHistory = 10 // Maximum number of characters to show on console at any time - int maxOutputChars = System.getProperty('groovy.console.output.limit','20000') as int + int maxOutputChars = System.getProperty('groovy.console.output.limit', '20000') as int // File to output stdout & stderr, in addition to console PrintWriter outputPrintWriter = null @@ -187,7 +187,7 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo // Internal history List history = [] int historyIndex = 1 // valid values are 0..history.length() - HistoryRecord pendingRecord = new HistoryRecord( allText: '', selectionStart: 0, selectionEnd: 0) + HistoryRecord pendingRecord = new HistoryRecord(allText: '', selectionStart: 0, selectionEnd: 0) Action prevHistoryAction Action nextHistoryAction @@ -212,8 +212,10 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo Closure beforeExecution Closure afterExecution - public static URL ICON_PATH = Console.class.classLoader.getResource('groovy/ui/ConsoleIcon.png') // used by ObjectBrowser and AST Viewer - public static URL NODE_ICON_PATH = Console.class.classLoader.getResource('groovy/ui/icons/bullet_green.png') // used by AST Viewer + public static URL ICON_PATH = Console.class.classLoader.getResource('groovy/ui/ConsoleIcon.png') + // used by ObjectBrowser and AST Viewer + public static URL NODE_ICON_PATH = Console.class.classLoader.getResource('groovy/ui/icons/bullet_green.png') + // used by AST Viewer static groovyFileFilter = new GroovyFileFilter() boolean scriptRunning = false @@ -260,7 +262,7 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo } // full stack trace should not be logged to the output window - GROOVY-4663 - java.util.logging.Logger.getLogger(StackTraceUtils.STACK_LOG_NAME).useParentHandlers = false + Logger.getLogger(StackTraceUtils.STACK_LOG_NAME).useParentHandlers = false //when starting via main set the look and feel to system UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()) @@ -376,10 +378,11 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo // listen for Ivy events if Ivy is on the Classpath try { if (Class.forName('org.apache.ivy.core.event.IvyListener')) { - def ivyPluginClass = Class.forName('groovy.ui.ConsoleIvyPlugin') + def ivyPluginClass = Class.forName('groovy.console.ui.ConsoleIvyPlugin') ivyPluginClass.newInstance().addListener(this) } - } catch(ClassNotFoundException ignore) { } + } catch (ClassNotFoundException ignore) { + } binding.variables._outputTransforms = OutputTransforms.loadOutputTransforms() } @@ -394,12 +397,12 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo } static frameConsoleDelegates = [ - rootContainerDelegate:{ + rootContainerDelegate: { frame( - title: 'GroovyConsole', - //location: [100,100], // in groovy 2.0 use platform default location - iconImage: imageIcon('/groovy/ui/ConsoleIcon.png').image, - defaultCloseOperation: JFrame.DO_NOTHING_ON_CLOSE, + title: 'GroovyConsole', + //location: [100,100], // in groovy 2.0 use platform default location + iconImage: imageIcon('/groovy/ui/ConsoleIcon.png').image, + defaultCloseOperation: JFrame.DO_NOTHING_ON_CLOSE, ) { try { current.locationByPlatform = true @@ -409,40 +412,43 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo containingWindows += current } }, - menuBarDelegate: {arg-> - current.JMenuBar = build(arg)} - ] + menuBarDelegate : { arg -> + current.JMenuBar = build(arg) + } + ] void run() { run(frameConsoleDelegates) } + @Deprecated void run(JApplet applet) { run([ - rootContainerDelegate:{ - containingWindows += SwingUtilities.getRoot(applet.getParent()) - applet - }, - menuBarDelegate: {arg-> - current.JMenuBar = build(arg)} + rootContainerDelegate: { + containingWindows += SwingUtilities.getRoot(applet.getParent()) + applet + }, + menuBarDelegate : { arg -> + current.JMenuBar = build(arg) + } ]) } void run(Map defaults) { swing = new SwingBuilder() - defaults.each{k, v -> swing[k] = v} + defaults.each { k, v -> swing[k] = v } // tweak what the stack traces filter out to be fairly broad System.setProperty('groovy.sanitized.stacktraces', '''org.codehaus.groovy.runtime. org.codehaus.groovy. + org.apache.groovy. groovy.lang. gjdk.groovy.lang. sun. java.lang.reflect. java.lang.Thread - groovy.ui.Console''') - + groovy.console.ui.Console''') // add controller to the swingBuilder bindings swing.controller = this @@ -456,8 +462,8 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo bindResults() // stitch some actions together - swing.bind(source:swing.inputEditor.undoAction, sourceProperty:'enabled', target:swing.undoAction, targetProperty:'enabled') - swing.bind(source:swing.inputEditor.redoAction, sourceProperty:'enabled', target:swing.redoAction, targetProperty:'enabled') + swing.bind(source: swing.inputEditor.undoAction, sourceProperty: 'enabled', target: swing.undoAction, targetProperty: 'enabled') + swing.bind(source: swing.inputEditor.redoAction, sourceProperty: 'enabled', target: swing.redoAction, targetProperty: 'enabled') if (swing.consoleFrame instanceof Window) { nativeFullScreenForMac(swing.consoleFrame) @@ -516,7 +522,7 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo } // Append a string to the output area - void appendOutput(String text, AttributeSet style){ + void appendOutput(String text, AttributeSet style) { def doc = outputArea.styledDocument insertString(doc, doc.length, text, style) ensureNoDocLengthOverflow(doc) @@ -560,7 +566,7 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo int initialLength = doc.length def matcher = line =~ stacktracePattern - def fileName = matcher.matches() ? matcher[0][-5] : '' + def fileName = matcher.matches() ? matcher[0][-5] : '' if (fileName == scriptFile?.name || fileName.startsWith(DEFAULT_SCRIPT_NAME_START)) { def fileNameAndLineNumber = matcher[0][-6] @@ -573,9 +579,9 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo hrefAttr.addAttribute(HTML.Attribute.HREF, 'file://' + fileNameAndLineNumber) style.addAttribute(HTML.Tag.A, hrefAttr) - insertString(doc, initialLength, line[0..<index], stacktraceStyle) - insertString(doc, initialLength + index, line[index..<(index + length)], style) - insertString(doc, initialLength + index + length, line[(index + length)..-1] + '\n', stacktraceStyle) + insertString(doc, initialLength, line[0..<index], stacktraceStyle) + insertString(doc, initialLength + index, line[index..<(index + length)], style) + insertString(doc, initialLength + index + length, line[(index + length)..-1] + '\n', stacktraceStyle) } else { insertString(doc, initialLength, line + '\n', stacktraceStyle) } @@ -622,9 +628,8 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo return true } switch (JOptionPane.showConfirmDialog(frame, - 'Save changes' + (scriptFile != null ? " to ${scriptFile.name}" : '') + '?', - 'GroovyConsole', JOptionPane.YES_NO_CANCEL_OPTION)) - { + 'Save changes' + (scriptFile != null ? " to ${scriptFile.name}" : '') + '?', + 'GroovyConsole', JOptionPane.YES_NO_CANCEL_OPTION)) { case JOptionPane.YES_OPTION: return fileSave() case JOptionPane.NO_OPTION: @@ -641,7 +646,7 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo // Binds the '_' and '__' variables in the shell void bindResults() { shell.setVariable('_', getLastResult()) // lastResult doesn't seem to work - shell.setVariable('__', history.collect {it.result}) + shell.setVariable('__', history.collect { it.result }) } // Handles menu event @@ -658,7 +663,7 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo void fullStackTraces(EventObject evt) { fullStackTraces = evt.source.selected System.setProperty('groovy.full.stacktrace', - Boolean.toString(fullStackTraces)) + Boolean.toString(fullStackTraces)) prefs.putBoolean('fullStackTraces', fullStackTraces) } @@ -738,7 +743,7 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo } } - void caretUpdate(CaretEvent e){ + void caretUpdate(CaretEvent e) { textSelectionStart = Math.min(dot(e), mark(e)) textSelectionEnd = Math.max(dot(e), mark(e)) setRowNumAndColNum() @@ -762,9 +767,9 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo // If at exit time, a script is running, the user is given an option to interrupt it first def askToInterruptScript() { - if(!scriptRunning) return true + if (!scriptRunning) return true def rc = JOptionPane.showConfirmDialog(frame, "Script executing. Press 'OK' to attempt to interrupt it before exiting.", - 'GroovyConsole', JOptionPane.OK_CANCEL_OPTION) + 'GroovyConsole', JOptionPane.OK_CANCEL_OPTION) if (rc == JOptionPane.OK_OPTION) { doInterrupt() return true @@ -811,13 +816,13 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo // Start a new window with a copy of current variables void fileNewWindow(EventObject evt = null) { Console consoleController = new Console( - new Binding( - new HashMap(shell.getContext().variables))) + new Binding( + new HashMap(shell.getContext().variables))) consoleController.systemOutInterceptor = systemOutInterceptor consoleController.systemErrorInterceptor = systemErrorInterceptor SwingBuilder swing = new SwingBuilder() consoleController.swing = swing - frameConsoleDelegates.each {k, v -> swing[k] = v} + frameConsoleDelegates.each { k, v -> swing[k] = v } swing.controller = consoleController swing.build(ConsoleActions) swing.build(ConsoleView) @@ -888,7 +893,7 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo } def finishException(Throwable t, boolean executing) { - if(executing) { + if (executing) { statusLabel.text = 'Execution terminated with exception.' history[-1].exception = t } else { @@ -932,7 +937,7 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo reportException(t) } - if(!executing) { + if (!executing) { bindResults() } @@ -953,7 +958,7 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo appendOutputNl('Exception thrown\n', commandStyle) Writer sw = new StringBuilderWriter() - new PrintWriter(sw).withWriter {pw -> StackTraceUtils.deepSanitize(t).printStackTrace(pw) } + new PrintWriter(sw).withWriter { pw -> StackTraceUtils.deepSanitize(t).printStackTrace(pw) } appendStacktrace("\n${sw.builder}\n") } @@ -964,8 +969,8 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo statusLabel.text = 'Execution complete.' appendOutputNl('Result: ', promptStyle) def obj = (visualizeScriptResults - ? OutputTransforms.transformResult(result, shell.getContext()._outputTransforms) - : result.toString()) + ? OutputTransforms.transformResult(result, shell.getContext()._outputTransforms) + : result.toString()) // multi-methods are magical! appendOutput(obj, resultStyle) @@ -987,7 +992,7 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo outputArea.setPreferredSize(null) outputWindow.pack() outputArea.setPreferredSize([calcPreferredSize(outputWindow.getWidth(), inputEditor.getWidth(), 120), - calcPreferredSize(outputWindow.getHeight(), inputEditor.getHeight(), 60)] as Dimension) + calcPreferredSize(outputWindow.getHeight(), inputEditor.getHeight(), 60)] as Dimension) outputWindow.pack() } @@ -1024,10 +1029,10 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo } } - void inspectLast(EventObject evt = null){ + void inspectLast(EventObject evt = null) { if (null == lastResult) { JOptionPane.showMessageDialog(frame, 'The last result is null.', - 'Cannot Inspect', JOptionPane.INFORMATION_MESSAGE) + 'Cannot Inspect', JOptionPane.INFORMATION_MESSAGE) return } ObjectBrowser.inspect(lastResult) @@ -1038,7 +1043,7 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo } void inspectAst(EventObject evt = null) { - new AstBrowser(inputArea, rootElement, shell.getClassLoader(), config).run({ inputArea.getText() } ) + new AstBrowser(inputArea, rootElement, shell.getClassLoader(), config).run({ inputArea.getText() }) } void inspectTokens(EventObject evt = null) { @@ -1066,15 +1071,14 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo if (console) { console.appendOutputLines(str, console.outputStyle) } else { - consoleControllers.each {it.appendOutputLines(str, it.outputStyle)} + consoleControllers.each { it.appendOutputLines(str, it.outputStyle) } } } // Put onto GUI if (EventQueue.isDispatchThread()) { doAppend.call() - } - else { + } else { SwingUtilities.invokeLater doAppend } return false @@ -1091,15 +1095,14 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo if (console) { console.appendStacktrace(str) } else { - consoleControllers.each {it.appendStacktrace(str)} + consoleControllers.each { it.appendStacktrace(str) } } } // Put onto GUI if (EventQueue.isDispatchThread()) { doAppend.call() - } - else { + } else { SwingUtilities.invokeLater doAppend } return false @@ -1116,19 +1119,19 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo // actually run the script void runScript(EventObject evt = null) { - if (saveOnRun && scriptFile != null) { + if (saveOnRun && scriptFile != null) { if (fileSave(evt)) runScriptImpl(false) } else { runScriptImpl(false) } } - void saveOnRun(EventObject evt = null) { + void saveOnRun(EventObject evt = null) { saveOnRun = evt.source.selected prefs.putBoolean('saveOnRun', saveOnRun) } - void indy(EventObject evt = null) { + void indy(EventObject evt = null) { indy = evt.source.selected prefs.putBoolean('indy', indy) if (indy) { @@ -1185,7 +1188,7 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo List<URL> urls = [] ClassLoader cl = shell.classLoader - while(cl instanceof URLClassLoader) { + while (cl instanceof URLClassLoader) { cl.getURLs().each { url -> urls << url } cl = cl.parent } @@ -1194,11 +1197,11 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo List data = urls.unique().collect { url -> [name: new File(url.toURI()).name, path: isWin ? url.path.substring(1).replace('/', '\\') : url.path] } data.sort { it.name.toLowerCase() } - JScrollPane scrollPane = swing.scrollPane{ + JScrollPane scrollPane = swing.scrollPane { table { - tableModel(list : data) { + tableModel(list: data) { propertyColumn(header: 'Name', propertyName: 'name', editable: false) - propertyColumn(header:' Path', propertyName: 'path', editable: false) + propertyColumn(header: ' Path', propertyName: 'path', editable: false) } } } @@ -1219,7 +1222,7 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo } private void runScriptImpl(boolean selected) { - if(scriptRunning) { + if (scriptRunning) { statusLabel.text = 'Cannot run script now as a script is already running. Please wait or use "Interrupt Script" option.' return } @@ -1227,10 +1230,10 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo interruptAction.enabled = true stackOverFlowError = false // reset this flag before running a script def endLine = System.getProperty('line.separator') - def record = new HistoryRecord( allText: inputArea.getText().replaceAll(endLine, '\n'), - selectionStart: textSelectionStart, selectionEnd: textSelectionEnd) + def record = new HistoryRecord(allText: inputArea.getText().replaceAll(endLine, '\n'), + selectionStart: textSelectionStart, selectionEnd: textSelectionEnd) addToHistory(record) - pendingRecord = new HistoryRecord(allText:'', selectionStart:0, selectionEnd:0) + pendingRecord = new HistoryRecord(allText: '', selectionStart: 0, selectionEnd: 0) if (prefs.getBoolean('autoClearOutput', false)) clearOutput() @@ -1250,11 +1253,11 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo systemOutInterceptor.setConsoleId(this.getConsoleId()) SwingUtilities.invokeLater { showExecutingMessage() } String name = scriptFile?.name ?: (DEFAULT_SCRIPT_NAME_START + scriptNameCounter++) - if(beforeExecution) { + if (beforeExecution) { beforeExecution() } def result - if(useScriptClassLoaderForScriptExecution) { + if (useScriptClassLoaderForScriptExecution) { ClassLoader savedThreadContextClassLoader = Thread.currentThread().contextClassLoader try { Thread.currentThread().contextClassLoader = shell.classLoader @@ -1263,16 +1266,15 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo finally { Thread.currentThread().contextClassLoader = savedThreadContextClassLoader } - } - else { + } else { result = shell.run(record.getTextToRun(selected), name, []) } - if(afterExecution) { + if (afterExecution) { afterExecution() } SwingUtilities.invokeLater { finishNormal(result) } } catch (Throwable t) { - if(t instanceof StackOverflowError) { + if (t instanceof StackOverflowError) { // set the flag that will be used in printing exception details in output pane stackOverFlowError = true clearOutput() @@ -1288,14 +1290,14 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo } void compileScript(EventObject evt = null) { - if(scriptRunning) { + if (scriptRunning) { statusLabel.text = 'Cannot compile script now as a script is already running. Please wait or use "Interrupt Script" option.' return } stackOverFlowError = false // reset this flag before running a script def endLine = System.getProperty('line.separator') - def record = new HistoryRecord( allText: inputArea.getText().replaceAll(endLine, '\n'), - selectionStart: textSelectionStart, selectionEnd: textSelectionEnd) + def record = new HistoryRecord(allText: inputArea.getText().replaceAll(endLine, '\n'), + selectionStart: textSelectionStart, selectionEnd: textSelectionEnd) if (prefs.getBoolean('autoClearOutput', false)) clearOutput() @@ -1328,7 +1330,7 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo fc.fileSelectionMode = JFileChooser.FILES_ONLY fc.acceptAllFileFilterUsed = true fc.fileFilter = groovyFileFilter - if(name == 'Save') { + if (name == 'Save') { fc.selectedFile = new File('*.groovy') } if (fc.showDialog(frame, name) == JFileChooser.APPROVE_OPTION) { @@ -1350,8 +1352,8 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo private void setInputTextFromHistory(newIndex) { def endLine = System.getProperty('line.separator') if (historyIndex >= history.size()) { - pendingRecord = new HistoryRecord( allText: inputArea.getText().replaceAll(endLine, '\n'), - selectionStart: textSelectionStart, selectionEnd: textSelectionEnd) + pendingRecord = new HistoryRecord(allText: inputArea.getText().replaceAll(endLine, '\n'), + selectionStart: textSelectionStart, selectionEnd: textSelectionEnd) } historyIndex = newIndex def record @@ -1383,7 +1385,7 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo void showAbout(EventObject evt = null) { def version = GroovySystem.getVersion() def pane = swing.optionPane() - // work around GROOVY-1048 + // work around GROOVY-1048 pane.setMessage('Welcome to the Groovy Console for evaluating Groovy scripts\nVersion ' + version) def dialog = pane.createDialog(frame, 'About GroovyConsole') dialog.show() @@ -1399,9 +1401,9 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo void findPrevious(EventObject evt = null) { def reverseEvt = new ActionEvent( - evt.getSource(), evt.getID(), - evt.getActionCommand(), evt.getWhen(), - ActionEvent.SHIFT_MASK) //reverse + evt.getSource(), evt.getID(), + evt.getActionCommand(), evt.getWhen(), + ActionEvent.SHIFT_MASK) //reverse FindReplaceUtility.FIND_ACTION.actionPerformed(reverseEvt) } @@ -1440,9 +1442,9 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo int endOffset = rowElement.getEndOffset() String rowText = inputArea.document.getText(startOffset, endOffset - startOffset) if (allCommented) { - // Uncomment this line if it is already commented - int slashOffset = rowText.indexOf("//") - inputArea.document.remove(slashOffset + startOffset, 2) + // Uncomment this line if it is already commented + int slashOffset = rowText.indexOf("//") + inputArea.document.remove(slashOffset + startOffset, 2) } else { // Add comment string in front of this line inputArea.document.insertString(startOffset, "//", new SimpleAttributeSet()) @@ -1549,7 +1551,7 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo hideOutputWindow() } - void smallerFont(EventObject evt = null){ + void smallerFont(EventObject evt = null) { updateFontSize(inputArea.font.size - 2) } @@ -1566,7 +1568,7 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo title += ' (Indy)' } if (scriptFile != null) { - frame.title = scriptFile.name + (dirty?' * ':'') + ' - ' + title + frame.title = scriptFile.name + (dirty ? ' * ' : '') + ' - ' + title } else { frame.title = title } @@ -1667,9 +1669,9 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo } } - void componentHidden(ComponentEvent e) { } + void componentHidden(ComponentEvent e) {} - void componentMoved(ComponentEvent e) { } + void componentMoved(ComponentEvent e) {} void componentResized(ComponentEvent e) { def component = e.getComponent() @@ -1683,7 +1685,7 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo } } - void componentShown(ComponentEvent e) { } + void componentShown(ComponentEvent e) {} void focusGained(FocusEvent e) { // remember component with focus for text-copy functionality @@ -1692,11 +1694,12 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo } } - void focusLost(FocusEvent e) { } + void focusLost(FocusEvent e) {} private static boolean isWindows() { return getOsName().startsWith("windows") } + private static String getOsName() { return System.getProperty("os.name").toLowerCase() } @@ -1711,7 +1714,7 @@ class GroovyFileFilter extends FileFilter { if (f.isDirectory()) { return true } - GROOVY_SOURCE_EXTENSIONS.find {it == getExtension(f)} ? true : false + GROOVY_SOURCE_EXTENSIONS.find { it == getExtension(f) } ? true : false } String getDescription() { @@ -1722,7 +1725,7 @@ class GroovyFileFilter extends FileFilter { def ext = null def s = f.getName() def i = s.lastIndexOf('.') - if (i > 0 && i < s.length() - 1) { + if (i > 0 && i < s.length() - 1) { ext = s.substring(i).toLowerCase() } "*$ext" diff --git a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ConsoleActions.groovy b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ConsoleActions.groovy index 50b536e..33419ed 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ConsoleActions.groovy +++ b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ConsoleActions.groovy @@ -16,65 +16,65 @@ * specific language governing permissions and limitations * under the License. */ -package groovy.ui +package groovy.console.ui -import javax.swing.* -import java.awt.* +import javax.swing.KeyStroke +import java.awt.Toolkit import java.awt.event.InputEvent import java.awt.event.KeyEvent 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' + 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') + 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' + 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 + 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', + name: 'Save As...', + closure: controller.&fileSaveAs, + mnemonic: 'A', ) printAction = action( - name: 'Print...', - closure: controller.&print, - mnemonic: 'P', - accelerator: shortcut('P') + name: 'Print...', + closure: controller.&print, + mnemonic: 'P', + accelerator: shortcut('P') ) exitAction = action( - name: 'Exit', - closure: controller.&exit, - mnemonic: 'X' + 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 @@ -82,284 +82,284 @@ exitAction = action( ) undoAction = action( - name: 'Undo', - closure: controller.&undo, - mnemonic: 'U', - accelerator: shortcut('Z'), - smallIcon: imageIcon(resource:'icons/arrow_undo.png', class:this), - shortDescription: 'Undo' + 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' + 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' + 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) + 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) + 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' + 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' + 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.©, - mnemonic: 'C', - accelerator: shortcut('C'), - smallIcon: imageIcon(resource:'icons/page_copy.png', class:this), - shortDescription: 'Copy' + name: 'Copy', + closure: controller.©, + 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' + 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') + 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 + 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 + 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'), - smallIcon: imageIcon(resource:'icons/clear.png', class:this), - shortDescription: 'Clear Output Area' + name: 'Clear Output', + closure: controller.&clearOutput, + mnemonic: 'C', + accelerator: shortcut('W'), + smallIcon: imageIcon(resource: 'icons/clear.png', class: this), + shortDescription: 'Clear Output Area' ) 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' + 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') + 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', + name: 'Add Jar(s) to ClassPath', + closure: controller.&addClasspathJar, + mnemonic: 'J', ) addClasspathDir = action( - name: 'Add Directory to ClassPath', - closure: controller.&addClasspathDir, - mnemonic: 'D', + name: 'Add Directory to ClassPath', + closure: controller.&addClasspathDir, + mnemonic: 'D', ) listClasspath = action( - name: 'List Classpath', - closure: controller.&listClasspath + name: 'List Classpath', + closure: controller.&listClasspath ) clearClassloader = action( - name: 'Clear Script Context', - closure: controller.&clearContext, - mnemonic: 'C', + name: 'Clear Script Context', + closure: controller.&clearContext, + mnemonic: 'C', ) inspectLastAction = action( - name: 'Inspect Last', - closure: controller.&inspectLast, - mnemonic: 'I', - accelerator: shortcut('I') + name: 'Inspect Last', + closure: controller.&inspectLast, + mnemonic: 'I', + accelerator: shortcut('I') ) inspectVariablesAction = action( - name: 'Inspect Variables', - closure: controller.&inspectVariables, - mnemonic: 'V', - accelerator: shortcut('J') + name: 'Inspect Variables', + closure: controller.&inspectVariables, + mnemonic: 'V', + accelerator: shortcut('J') ) inspectAstAction = action( - name: 'Inspect Ast', - closure: controller.&inspectAst, - mnemonic: 'A', - accelerator: shortcut('T'), + name: 'Inspect Ast', + closure: controller.&inspectAst, + mnemonic: 'A', + accelerator: shortcut('T'), ) inspectTokensAction = action( - name: 'Inspect Tokens', - closure: controller.&inspectTokens, - mnemonic: 'T', - accelerator: shortcut('K'), + name: 'Inspect Tokens', + closure: controller.&inspectTokens, + mnemonic: 'T', + accelerator: shortcut('K'), ) captureStdOutAction = action( - name: 'Capture Standard Output', - closure: controller.&captureStdOut, - mnemonic: 'O' + name: 'Capture Standard Output', + closure: controller.&captureStdOut, + mnemonic: 'O' ) captureStdErrAction = action( - name: 'Capture Standard Error Output', - closure: controller.&captureStdErr, - mnemonic: 'E' + name: 'Capture Standard Error Output', + closure: controller.&captureStdErr, + mnemonic: 'E' ) fullStackTracesAction = action( - name: 'Show Full Stack Traces', - closure: controller.&fullStackTraces, - mnemonic: 'F' + name: 'Show Full Stack Traces', + closure: controller.&fullStackTraces, + mnemonic: 'F' ) showScriptInOutputAction = action( - name: 'Show Script in Output', - closure: controller.&showScriptInOutput, - mnemonic: 'R' + name: 'Show Script in Output', + closure: controller.&showScriptInOutput, + mnemonic: 'R' ) visualizeScriptResultsAction = action( - name: 'Visualize Script Results', - closure: controller.&visualizeScriptResults, - mnemonic: 'V' + name: 'Visualize Script Results', + closure: controller.&visualizeScriptResults, + mnemonic: 'V' ) showToolbarAction = action( - name: 'Show Toolbar', - closure: controller.&showToolbar, - mnemonic: 'T' + name: 'Show Toolbar', + closure: controller.&showToolbar, + mnemonic: 'T' ) detachedOutputAction = action( - name: 'Detached Output', - closure: controller.&detachedOutput, - mnemonic: 'D' + name: 'Detached Output', + closure: controller.&detachedOutput, + mnemonic: 'D' ) orientationVerticalAction = action( - name: 'Vertical Orientation', - closure: controller.&orientationVertical, - mnemonic: 'n' + name: 'Vertical Orientation', + closure: controller.&orientationVertical, + mnemonic: 'n' ) showOutputWindowAction = action( - closure: controller.&showOutputWindow, - keyStroke: shortcut('shift O'), + closure: controller.&showOutputWindow, + keyStroke: shortcut('shift O'), ) hideOutputWindowAction1 = action( - closure: controller.&hideOutputWindow, - keyStroke: 'SPACE', + closure: controller.&hideOutputWindow, + keyStroke: 'SPACE', ) hideOutputWindowAction2 = action( - closure: controller.&hideOutputWindow, - keyStroke: 'ENTER', + closure: controller.&hideOutputWindow, + keyStroke: 'ENTER', ) hideOutputWindowAction3 = action( - closure: controller.&hideOutputWindow, - keyStroke: 'ESCAPE', + closure: controller.&hideOutputWindow, + keyStroke: 'ESCAPE', ) hideOutputWindowAction4 = action( - closure: controller.&hideAndClearOutputWindow, - keyStroke: shortcut('W'), + closure: controller.&hideAndClearOutputWindow, + keyStroke: shortcut('W'), ) autoClearOutputAction = action( - name: 'Auto Clear Output On Run', - closure: controller.&autoClearOutput, - mnemonic: 'A' + name: 'Auto Clear Output On Run', + closure: controller.&autoClearOutput, + mnemonic: 'A' ) saveOnRunAction = action( - name: 'Auto Save on Runs', - closure: controller.&saveOnRun, - mnemonic: 'A' + name: 'Auto Save on Runs', + closure: controller.&saveOnRun, + mnemonic: 'A' ) largerFontAction = action( - name: 'Larger Font', - closure: controller.&largerFont, - mnemonic: 'L', - accelerator: shortcut('shift L') + 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') + name: 'Smaller Font', + closure: controller.&smallerFont, + mnemonic: 'S', + accelerator: shortcut('shift S') ) smartHighlighterAction = action( @@ -368,61 +368,61 @@ smartHighlighterAction = action( ) aboutAction = action( - name: 'About', - closure: controller.&showAbout, - mnemonic: 'A' + name: 'About', + closure: controller.&showAbout, + mnemonic: 'A' ) threadInterruptAction = action( - name: 'Allow Interruption', - closure: controller.&threadInterruption, - mnemonic: 'O' + 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 + 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' + name: 'Compile', + closure: controller.&compileScript, + mnemonic: 'L', + accelerator: shortcut('L'), + shortDescription: 'Compile Groovy Script' ) commentAction = action( - name: 'Comment', - closure: controller.&comment, - mnemonic: 'C', - // Ctrl or Command + / - accelerator: KeyStroke.getKeyStroke(KeyEvent.VK_SLASH, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), - shortDescription: 'Comment/Uncomment Selected Script' + name: 'Comment', + closure: controller.&comment, + mnemonic: 'C', + // Ctrl or Command + / + accelerator: KeyStroke.getKeyStroke(KeyEvent.VK_SLASH, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), + shortDescription: 'Comment/Uncomment Selected Script' ) selectBlockAction = action( - name: 'Select Block', - closure: controller.&selectBlock, - mnemonic: 'B', - accelerator: shortcut('B'), - shortDescription: 'Selects current Word, Line or Block in Script' + name: 'Select Block', + closure: controller.&selectBlock, + mnemonic: 'B', + accelerator: shortcut('B'), + shortDescription: 'Selects current Word, Line or Block in Script' ) indyAction = action( - name: 'Enable Indy Compilation', - closure: controller.&indy, - mnemonic: 'I', - shortDescription: 'Enable InvokeDynamic (Indy) compilation for scripts' + name: 'Enable Indy Compilation', + closure: controller.&indy, + mnemonic: 'I', + shortDescription: 'Enable InvokeDynamic (Indy) compilation for scripts' ) preferencesAction = action( - name: 'Preferences', - closure: controller.&preferences, - mnemonic: 'S', - shortDescription: 'Preference Settings' + name: 'Preferences', + closure: controller.&preferences, + mnemonic: 'S', + shortDescription: 'Preference Settings' ) \ No newline at end of file diff --git a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ConsoleIvyPlugin.groovy b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ConsoleIvyPlugin.groovy index c411035..9af8fce 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ConsoleIvyPlugin.groovy +++ b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ConsoleIvyPlugin.groovy @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package groovy.ui +package groovy.console.ui import groovy.grape.Grape import groovy.grape.GrapeIvy diff --git a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ConsolePreferences.groovy b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ConsolePreferences.groovy index 63be4a1..e2e24b2 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ConsolePreferences.groovy +++ b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ConsolePreferences.groovy @@ -16,21 +16,23 @@ * specific language governing permissions and limitations * under the License. */ -package groovy.ui +package groovy.console.ui import groovy.beans.Bindable import groovy.swing.SwingBuilder import org.codehaus.groovy.tools.shell.util.MessageSource -import javax.swing.* -import java.awt.* +import javax.swing.JDialog +import javax.swing.JFileChooser +import java.awt.Dimension class ConsolePreferences { // Default maximum number of characters to show on console at any time static int DEFAULT_MAX_OUTPUT_CHARS = 20000 - @Bindable int maxOutputChars + @Bindable + int maxOutputChars private final console private final MessageSource T @@ -150,7 +152,7 @@ class ConsolePreferences { javax.swing.UIManager.setLookAndFeel(javax.swing.UIManager.getSystemLookAndFeelClassName()) def c = new Expando().with { swing = new SwingBuilder() - frame = swing.frame(title: 'foo', size:[800, 800]) + frame = swing.frame(title: 'foo', size: [800, 800]) DEFAULT_MAX_OUTPUT_CHARS = 25000 maxOutputChars = 25000 loadMaxOutputChars = { 20000 } diff --git a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ConsoleSupport.java b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ConsoleSupport.java index eb6e590..d304f5b 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ConsoleSupport.java +++ b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ConsoleSupport.java @@ -16,16 +16,16 @@ * specific language governing permissions and limitations * under the License. */ -package groovy.ui; +package groovy.console.ui; import groovy.lang.GroovyShell; -import javax.swing.*; +import javax.swing.JTextPane; import javax.swing.text.Style; import javax.swing.text.StyleConstants; import javax.swing.text.StyleContext; import javax.swing.text.StyledDocument; -import java.awt.*; +import java.awt.Color; /** * Base class for console @@ -79,12 +79,11 @@ public abstract class ConsoleSupport { String name = "Script" + counter++; try { return getShell().evaluate(text, name); - } - catch (Exception e) { + } catch (Exception e) { handleException(text, e); return null; } } - + protected abstract void handleException(String text, Exception e); } \ No newline at end of file diff --git a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ConsoleTextEditor.java b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ConsoleTextEditor.java index 4adf7fa..f4aca41 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ConsoleTextEditor.java +++ b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ConsoleTextEditor.java @@ -16,14 +16,14 @@ * specific language governing permissions and limitations * under the License. */ -package groovy.ui; - -import groovy.ui.text.GroovyFilter; -import groovy.ui.text.MatchingHighlighter; -import groovy.ui.text.SmartDocumentFilter; -import groovy.ui.text.StructuredSyntaxResources; -import groovy.ui.text.TextEditor; -import groovy.ui.text.TextUndoManager; +package groovy.console.ui; + +import groovy.console.ui.text.GroovyFilter; +import groovy.console.ui.text.MatchingHighlighter; +import groovy.console.ui.text.SmartDocumentFilter; +import groovy.console.ui.text.StructuredSyntaxResources; +import groovy.console.ui.text.TextEditor; +import groovy.console.ui.text.TextUndoManager; import org.codehaus.groovy.runtime.StringGroovyMethods; import javax.swing.AbstractAction; diff --git a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ConsoleView.groovy b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ConsoleView.groovy index b70cf00..487405b 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ConsoleView.groovy +++ b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ConsoleView.groovy @@ -16,16 +16,18 @@ * specific language governing permissions and limitations * under the License. */ -package groovy.ui +package groovy.console.ui -import groovy.ui.view.Defaults -import groovy.ui.view.GTKDefaults -import groovy.ui.view.MacOSXDefaults -import groovy.ui.view.WindowsDefaults +import groovy.console.ui.view.Defaults +import groovy.console.ui.view.GTKDefaults +import groovy.console.ui.view.MacOSXDefaults +import groovy.console.ui.view.WindowsDefaults -import javax.swing.* +import javax.swing.Action +import javax.swing.UIManager import javax.swing.event.DocumentListener import javax.swing.text.DefaultEditorKit +import java.awt.Window import java.awt.datatransfer.DataFlavor import java.awt.dnd.DnDConstants import java.awt.dnd.DropTarget @@ -96,7 +98,7 @@ controller.hyperlinkStyle = hyperlinkStyle controller.resultStyle = resultStyle // add the window close handler -if (consoleFrame instanceof java.awt.Window) { +if (consoleFrame instanceof Window) { consoleFrame.windowClosing = controller.&exit } @@ -148,29 +150,29 @@ controller.inputArea.document.addDocumentListener({ controller.setDirty(true) } 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]) - } - }, +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 { diff --git a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/HistoryRecord.groovy b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/HistoryRecord.groovy index 5d5f833..6eddf0d 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/HistoryRecord.groovy +++ b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/HistoryRecord.groovy @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package groovy.ui +package groovy.console.ui import groovy.transform.CompileStatic @@ -29,7 +29,7 @@ class HistoryRecord { Object result Throwable exception - public String getTextToRun(boolean useSelection) { + String getTextToRun(boolean useSelection) { if (useSelection && selectionStart != selectionEnd) { // Retrieve all the imports included in the script before the current selection def before = allText[0 ..< selectionStart].split("\n") @@ -41,7 +41,7 @@ class HistoryRecord { return allText } - public Object getValue() { + Object getValue() { return exception ? exception : result } } diff --git a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ObjectBrowser.groovy b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ObjectBrowser.groovy index 76cac96..2c117ae 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ObjectBrowser.groovy +++ b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ObjectBrowser.groovy @@ -16,13 +16,14 @@ * specific language governing permissions and limitations * under the License. */ -package groovy.inspect.swingui +package groovy.console.ui import groovy.inspect.Inspector +import groovy.inspect.swingui.TableSorter import groovy.swing.SwingBuilder -import javax.swing.* -import java.awt.* +import javax.swing.WindowConstants +import java.awt.FlowLayout import static groovy.inspect.Inspector.MEMBER_DECLARER_IDX import static groovy.inspect.Inspector.MEMBER_EXCEPTIONS_IDX @@ -61,7 +62,7 @@ class ObjectBrowser { frame = swing.frame(title: 'Groovy Object Browser', location: [200, 200], size: [800, 600], pack: true, show: true, - iconImage: swing.imageIcon(groovy.ui.Console.ICON_PATH).image, + iconImage: swing.imageIcon(Console.ICON_PATH).image, defaultCloseOperation: WindowConstants.DISPOSE_ON_CLOSE) { menuBar { diff --git a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/OutputTransforms.groovy b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/OutputTransforms.groovy index 033ae94..5946426 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/OutputTransforms.groovy +++ b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/OutputTransforms.groovy @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package groovy.ui +package groovy.console.ui import groovy.transform.CompileStatic import org.codehaus.groovy.runtime.InvokerHelper diff --git a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ScriptToTreeNodeAdapter.groovy b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ScriptToTreeNodeAdapter.groovy index 7a460ba..d458ead 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ScriptToTreeNodeAdapter.groovy +++ b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ScriptToTreeNodeAdapter.groovy @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package groovy.inspect.swingui +package groovy.console.ui import groovy.text.GStringTemplateEngine import groovy.text.Template diff --git a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/SystemOutputInterceptor.java b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/SystemOutputInterceptor.java index 219c213..94851de 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/SystemOutputInterceptor.java +++ b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/SystemOutputInterceptor.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package groovy.ui; +package groovy.console.ui; import groovy.lang.Closure; diff --git a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/package.html b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/package.html index 7b601f9..665a71b 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/package.html +++ b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/package.html @@ -1,28 +1,26 @@ <!-- - - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you 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. - ---> + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you 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. + --> <html> <head> - <title>package groovy.inspect.swingui.*</title> + <title>package groovy.console.ui.*</title> </head> <body> - <p>Classes associated with the Swing GUI for inspecting objects.</p> + <p>An interactive command line terminal along with a Swing console for evaluating Groovy scripts and inspecting objects, AST and bytecode information.</p> </body> </html> diff --git a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/AutoIndentAction.groovy b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/AutoIndentAction.groovy index 2054c06..e7bd67b 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/AutoIndentAction.groovy +++ b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/AutoIndentAction.groovy @@ -16,11 +16,12 @@ * specific language governing permissions and limitations * under the License. */ -package groovy.ui.text +package groovy.console.ui.text import groovy.transform.CompileStatic -import javax.swing.* +import javax.swing.AbstractAction +import javax.swing.JTextPane import javax.swing.text.AttributeSet import javax.swing.text.SimpleAttributeSet import java.awt.event.ActionEvent diff --git a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/FindReplaceUtility.java b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/FindReplaceUtility.java index 11caad0..de25a1f 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/FindReplaceUtility.java +++ b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/FindReplaceUtility.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package groovy.ui.text; +package groovy.console.ui.text; import javax.swing.*; import javax.swing.event.EventListenerList; diff --git a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/GroovyFilter.java b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/GroovyFilter.java index b804235..b1155f7 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/GroovyFilter.java +++ b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/GroovyFilter.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package groovy.ui.text; +package groovy.console.ui.text; import javax.swing.*; import javax.swing.text.BadLocationException; diff --git a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/MatchingHighlighter.java b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/MatchingHighlighter.java index eec3a91..95a594f 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/MatchingHighlighter.java +++ b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/MatchingHighlighter.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package groovy.ui.text; +package groovy.console.ui.text; import groovy.lang.Tuple2; import groovy.lang.Tuple3; diff --git a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/SmartDocumentFilter.java b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/SmartDocumentFilter.java index 8539a2f..e561ea5 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/SmartDocumentFilter.java +++ b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/SmartDocumentFilter.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package groovy.ui.text; +package groovy.console.ui.text; import org.antlr.v4.runtime.CharStream; import org.antlr.v4.runtime.CharStreams; diff --git a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/StructuredSyntaxDocumentFilter.java b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/StructuredSyntaxDocumentFilter.java index 93fa288..6df8fc1 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/StructuredSyntaxDocumentFilter.java +++ b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/StructuredSyntaxDocumentFilter.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package groovy.ui.text; +package groovy.console.ui.text; import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; diff --git a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/StructuredSyntaxHandler.java b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/StructuredSyntaxHandler.java index 2979bf5..236bd5f 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/StructuredSyntaxHandler.java +++ b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/StructuredSyntaxHandler.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package groovy.ui.text; +package groovy.console.ui.text; import org.xml.sax.Attributes; import org.xml.sax.SAXException; diff --git a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/StructuredSyntaxResources.java b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/StructuredSyntaxResources.java index e04feaf..16a9cd2 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/StructuredSyntaxResources.java +++ b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/StructuredSyntaxResources.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package groovy.ui.text; +package groovy.console.ui.text; import java.awt.*; import java.awt.datatransfer.Clipboard; diff --git a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/TextEditor.java b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/TextEditor.java index ec30af1..5be4773 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/TextEditor.java +++ b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/TextEditor.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package groovy.ui.text; +package groovy.console.ui.text; import javax.swing.*; import javax.swing.plaf.ComponentUI; diff --git a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/TextUndoManager.java b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/TextUndoManager.java index 7cfc89d..4435893 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/TextUndoManager.java +++ b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/TextUndoManager.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package groovy.ui.text; +package groovy.console.ui.text; import javax.swing.event.SwingPropertyChangeSupport; import javax.swing.event.UndoableEditEvent; diff --git a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/package.html b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/package.html index 390544d..9530e97 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/package.html +++ b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/text/package.html @@ -20,7 +20,7 @@ --> <html> <head> - <title>package groovy.ui.text.*</title> + <title>package groovy.console.ui.text.*</title> </head> <body> <p>Text processing helpers for the interactive command line terminal.</p> diff --git a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/view/BasicContentPane.groovy b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/view/BasicContentPane.groovy index d7794b8..e31ac29 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/view/BasicContentPane.groovy +++ b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/view/BasicContentPane.groovy @@ -16,11 +16,11 @@ * specific language governing permissions and limitations * under the License. */ -package groovy.ui.view +package groovy.console.ui.view -import groovy.ui.Console -import groovy.ui.ConsoleTextEditor -import groovy.ui.text.SmartDocumentFilter +import groovy.console.ui.Console +import groovy.console.ui.ConsoleTextEditor +import groovy.console.ui.text.SmartDocumentFilter import javax.swing.JSplitPane import javax.swing.WindowConstants @@ -43,7 +43,7 @@ import static javax.swing.JSplitPane.VERTICAL_SPLIT Preferences prefs = Preferences.userNodeForPackage(Console) def detachedOutputFlag = prefs.getBoolean('detachedOutput', false) -outputWindow = frame(visible:false, defaultCloseOperation: WindowConstants.HIDE_ON_CLOSE) { +outputWindow = frame(visible: false, defaultCloseOperation: WindowConstants.HIDE_ON_CLOSE) { blank = glue() blank.preferredSize = [0, 0] as Dimension } @@ -54,7 +54,7 @@ splitPane = splitPane(resizeWeight: 0.5, orientation: if (smartHighlighterEnabled) { editor.enableHighLighter(SmartDocumentFilter) } - inputEditor = widget(editor, border:emptyBorder(0)) + inputEditor = widget(editor, border: emptyBorder(0)) buildOutputArea(prefs) } @@ -76,7 +76,7 @@ inputArea = inputEditor.textEditor // attach ctrl-enter to input area // need to wrap in actions to keep it from being added as a component actions { - container(inputArea, name: 'inputArea', font:new Font('Monospaced', Font.PLAIN, prefs.getInt('fontSize', 12)), border:emptyBorder(4)) { + container(inputArea, name: 'inputArea', font: new Font('Monospaced', Font.PLAIN, prefs.getInt('fontSize', 12)), border: emptyBorder(4)) { action(runAction) action(runSelectionAction) action(showOutputWindowAction) @@ -95,7 +95,7 @@ StyledDocument doc = outputArea.styledDocument Style defStyle = StyleContext.defaultStyleContext.getStyle(StyleContext.DEFAULT_STYLE) -def applyStyle = {Style style, values -> values.each{k, v -> style.addAttribute(k, v)}} +def applyStyle = { Style style, values -> values.each { k, v -> style.addAttribute(k, v) } } Style regular = doc.addStyle('regular', defStyle) applyStyle(regular, styles.regular) @@ -121,7 +121,7 @@ applyStyle(hyperlinkStyle, styles.hyperlink) // redo styles for editor doc = inputArea.styledDocument StyleContext styleContext = StyleContext.defaultStyleContext -styles.each {styleName, defs -> +styles.each { styleName, defs -> Style style = styleContext.getStyle(styleName) if (style) { applyStyle(style, defs) @@ -135,17 +135,17 @@ styles.each {styleName, defs -> // set the preferred size of the input and output areas // this is a good enough solution, there are margins and scrollbars and such to worry about for 80x12x2 -Graphics g = GraphicsEnvironment.localGraphicsEnvironment.createGraphics (new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB)) +Graphics g = GraphicsEnvironment.localGraphicsEnvironment.createGraphics(new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB)) FontMetrics fm = g.getFontMetrics(outputArea.font) outputArea.preferredSize = [ - prefs.getInt('outputAreaWidth', fm.charWidth(0x77) * 81), - prefs.getInt('outputAreaHeight', (fm.getHeight() + fm.getLeading()) * 12) + prefs.getInt('outputAreaWidth', fm.charWidth(0x77) * 81), + prefs.getInt('outputAreaHeight', (fm.getHeight() + fm.getLeading()) * 12) ] as Dimension inputEditor.preferredSize = [ - prefs.getInt('inputAreaWidth', fm.charWidth(0x77) * 81), - prefs.getInt('inputAreaHeight', (fm.getHeight() + fm.getLeading()) * 12) + prefs.getInt('inputAreaWidth', fm.charWidth(0x77) * 81), + prefs.getInt('inputAreaHeight', (fm.getHeight() + fm.getLeading()) * 12) ] as Dimension origDividerSize = -1 diff --git a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/view/BasicMenuBar.groovy b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/view/BasicMenuBar.groovy index 737c4a1..8fe74e0 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/view/BasicMenuBar.groovy +++ b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/view/BasicMenuBar.groovy @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package groovy.ui.view +package groovy.console.ui.view menuBar { menu(text: 'File', mnemonic: 'F') { diff --git a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/view/BasicStatusBar.groovy b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/view/BasicStatusBar.groovy index 02048f1..36c649b 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/view/BasicStatusBar.groovy +++ b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/view/BasicStatusBar.groovy @@ -16,19 +16,20 @@ * specific language governing permissions and limitations * under the License. */ -package groovy.ui.view +package groovy.console.ui.view -import javax.swing.* -import java.awt.* +import javax.swing.SwingConstants +import java.awt.BorderLayout +import java.awt.GridBagConstraints statusPanel = panel(constraints: BorderLayout.SOUTH) { gridBagLayout() - separator(gridwidth:GridBagConstraints.REMAINDER, fill:GridBagConstraints.HORIZONTAL) + separator(gridwidth: GridBagConstraints.REMAINDER, fill: GridBagConstraints.HORIZONTAL) status = label("Welcome to Groovy ${GroovySystem.version}.", - weightx:1.0, - anchor:GridBagConstraints.WEST, - fill:GridBagConstraints.HORIZONTAL, - insets: [1,3,1,3]) - separator(orientation:SwingConstants.VERTICAL, fill:GridBagConstraints.VERTICAL) - rowNumAndColNum = label('1:1', insets: [1,3,1,3]) + weightx: 1.0, + anchor: GridBagConstraints.WEST, + fill: GridBagConstraints.HORIZONTAL, + insets: [1, 3, 1, 3]) + separator(orientation: SwingConstants.VERTICAL, fill: GridBagConstraints.VERTICAL) + rowNumAndColNum = label('1:1', insets: [1, 3, 1, 3]) } diff --git a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/view/BasicToolBar.groovy b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/view/BasicToolBar.groovy index 849ca16..ae39ccc 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/view/BasicToolBar.groovy +++ b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/view/BasicToolBar.groovy @@ -16,31 +16,32 @@ * specific language governing permissions and limitations * under the License. */ -package groovy.ui.view +package groovy.console.ui.view -import javax.swing.* -import java.awt.* +import javax.swing.SwingConstants +import java.awt.BorderLayout -toolbar = toolBar(rollover:true, visible:controller.showToolbar, constraints:BorderLayout.NORTH) { - button(newFileAction, text:null) - button(openAction, text:null) - button(saveAction, text:null) - separator(orientation:SwingConstants.VERTICAL) - button(undoAction, text:null) - button(redoAction, text:null) - separator(orientation:SwingConstants.VERTICAL) - button(cutAction, text:null) - button(copyAction, text:null) - button(pasteAction, text:null) - separator(orientation:SwingConstants.VERTICAL) - button(findAction, text:null) - button(replaceAction, text:null) - separator(orientation:SwingConstants.VERTICAL) - button(historyPrevAction, text:null) - button(historyNextAction, text:null) - separator(orientation:SwingConstants.VERTICAL) - button(runAction, text:null) - button(interruptAction, text:null) - separator(orientation:SwingConstants.VERTICAL) - button(clearOutputAction,text:null) + +toolbar = toolBar(rollover: true, visible: controller.showToolbar, constraints: BorderLayout.NORTH) { + button(newFileAction, text: null) + button(openAction, text: null) + button(saveAction, text: null) + separator(orientation: SwingConstants.VERTICAL) + button(undoAction, text: null) + button(redoAction, text: null) + separator(orientation: SwingConstants.VERTICAL) + button(cutAction, text: null) + button(copyAction, text: null) + button(pasteAction, text: null) + separator(orientation: SwingConstants.VERTICAL) + button(findAction, text: null) + button(replaceAction, text: null) + separator(orientation: SwingConstants.VERTICAL) + button(historyPrevAction, text: null) + button(historyNextAction, text: null) + separator(orientation: SwingConstants.VERTICAL) + button(runAction, text: null) + button(interruptAction, text: null) + separator(orientation: SwingConstants.VERTICAL) + button(clearOutputAction, text: null) } diff --git a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/view/Defaults.groovy b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/view/Defaults.groovy index 254454a..e4c1cc9 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/view/Defaults.groovy +++ b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/view/Defaults.groovy @@ -16,21 +16,21 @@ * specific language governing permissions and limitations * under the License. */ -package groovy.ui.view +package groovy.console.ui.view -import groovy.ui.text.GroovyFilter +import groovy.console.ui.text.GroovyFilter import javax.swing.text.StyleConstants import javax.swing.text.StyleContext -import java.awt.* +import java.awt.Color import java.util.prefs.Preferences -menuBarClass = groovy.ui.view.BasicMenuBar -contentPaneClass = groovy.ui.view.BasicContentPane -toolBarClass = groovy.ui.view.BasicToolBar -statusBarClass = groovy.ui.view.BasicStatusBar +menuBarClass = BasicMenuBar +contentPaneClass = BasicContentPane +toolBarClass = BasicToolBar +statusBarClass = BasicStatusBar -def prefs = Preferences.userNodeForPackage(groovy.ui.Console) +def prefs = Preferences.userNodeForPackage(Console) def fontFamily = prefs.get("fontName", "Monospaced") styles = [ diff --git a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/view/GTKDefaults.groovy b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/view/GTKDefaults.groovy index 59017b7..1bfeff1 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/view/GTKDefaults.groovy +++ b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/view/GTKDefaults.groovy @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package groovy.ui.view +package groovy.console.ui.view import javax.swing.text.StyleConstants import javax.swing.text.StyleContext @@ -24,7 +24,7 @@ import java.util.prefs.Preferences build(Defaults) -def prefs = Preferences.userNodeForPackage(groovy.ui.Console) +def prefs = Preferences.userNodeForPackage(groovy.console.ui.Console) def fontFamily = prefs.get("fontName", "DejaVu Sans Mono") // change font to DejaVu Sans Mono, much clearer @@ -53,6 +53,3 @@ try { enabled: false ) } - - - diff --git a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/view/MacOSXDefaults.groovy b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/view/MacOSXDefaults.groovy index 15f50c0..1822f7c 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/view/MacOSXDefaults.groovy +++ b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/view/MacOSXDefaults.groovy @@ -16,12 +16,12 @@ * specific language governing permissions and limitations * under the License. */ -package groovy.ui.view +package groovy.console.ui.view -import groovy.ui.text.GroovyFilter +import groovy.console.ui.text.GroovyFilter import javax.swing.text.StyleConstants -import java.awt.* +import java.awt.Color import java.util.prefs.Preferences build(Defaults) @@ -30,7 +30,7 @@ build(Defaults) System.setProperty('apple.laf.useScreenMenuBar', 'true') System.setProperty('com.apple.mrj.application.apple.menu.about.name', 'GroovyConsole') -def prefs = Preferences.userNodeForPackage(groovy.ui.Console) +def prefs = Preferences.userNodeForPackage(groovy.console.ui.Console) def fontFamily = prefs.get("fontName", "Monaco") // redo output styles diff --git a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/view/MacOSXMenuBar.groovy b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/view/MacOSXMenuBar.groovy index b40e26d..9588592 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/view/MacOSXMenuBar.groovy +++ b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/view/MacOSXMenuBar.groovy @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package groovy.ui.view +package groovy.console.ui.view import org.codehaus.groovy.vmplugin.VMPluginFactory @@ -34,7 +34,7 @@ handler.setQuitHandler(controller.&exitDesktop) handler.setPreferencesHandler(controller.&preferences) handler """ : """ -package groovy.ui +package groovy.console.ui import com.apple.mrj.* @@ -146,4 +146,3 @@ menuBar { menuItem(inspectTokensAction, icon:null) } } - diff --git a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/view/WindowsDefaults.groovy b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/view/WindowsDefaults.groovy index 14ebcd3..6261916 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/view/WindowsDefaults.groovy +++ b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/view/WindowsDefaults.groovy @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package groovy.ui.view +package groovy.console.ui.view import javax.swing.text.StyleConstants import javax.swing.text.StyleContext @@ -24,7 +24,7 @@ import java.util.prefs.Preferences build(Defaults) -def prefs = Preferences.userNodeForPackage(groovy.ui.Console) +def prefs = Preferences.userNodeForPackage(groovy.console.ui.Console) def fontFamily = prefs.get("fontName", "Consolas") // change fonts for vista diff --git a/subprojects/groovy-console/src/main/groovy/groovy/ui/Console.groovy b/subprojects/groovy-console/src/main/groovy/groovy/ui/Console.groovy index 038f88f..09049ff 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/ui/Console.groovy +++ b/subprojects/groovy-console/src/main/groovy/groovy/ui/Console.groovy @@ -91,6 +91,7 @@ import java.util.prefs.Preferences * * Allows user to interactively enter and execute Groovy. */ +@Deprecated class Console implements CaretListener, HyperlinkListener, ComponentListener, FocusListener { static final String DEFAULT_SCRIPT_NAME_START = 'ConsoleScript' diff --git a/subprojects/groovy-console/src/main/groovy/groovy/ui/ConsoleApplet.groovy b/subprojects/groovy-console/src/main/groovy/groovy/ui/ConsoleApplet.groovy index ac11820..5147d2e 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/ui/ConsoleApplet.groovy +++ b/subprojects/groovy-console/src/main/groovy/groovy/ui/ConsoleApplet.groovy @@ -20,12 +20,13 @@ package groovy.ui import groovy.transform.CompileStatic -import javax.swing.* +import javax.swing.JApplet /** * ConsoleApplet */ @CompileStatic +@Deprecated class ConsoleApplet extends JApplet { Console console diff --git a/subprojects/groovy-console/src/main/groovy/groovy/ui/ConsoleIvyPlugin.groovy b/subprojects/groovy-console/src/main/groovy/groovy/ui/ConsoleIvyPlugin.groovy index c411035..787da0e 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/ui/ConsoleIvyPlugin.groovy +++ b/subprojects/groovy-console/src/main/groovy/groovy/ui/ConsoleIvyPlugin.groovy @@ -29,6 +29,7 @@ import org.apache.ivy.core.event.resolve.StartResolveEvent * * Adds Groovy Grape feedback (via an Ivy listener). */ +@Deprecated class ConsoleIvyPlugin { Console savedConsole Set<String> resolvedDependencies = [] diff --git a/subprojects/groovy-console/src/main/groovy/groovy/ui/ConsolePreferences.groovy b/subprojects/groovy-console/src/main/groovy/groovy/ui/ConsolePreferences.groovy index 63be4a1..577f20a 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/ui/ConsolePreferences.groovy +++ b/subprojects/groovy-console/src/main/groovy/groovy/ui/ConsolePreferences.groovy @@ -25,6 +25,7 @@ import org.codehaus.groovy.tools.shell.util.MessageSource import javax.swing.* import java.awt.* +@Deprecated class ConsolePreferences { // Default maximum number of characters to show on console at any time diff --git a/subprojects/groovy-console/src/main/groovy/groovy/ui/ConsoleSupport.java b/subprojects/groovy-console/src/main/groovy/groovy/ui/ConsoleSupport.java index eb6e590..3086c46 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/ui/ConsoleSupport.java +++ b/subprojects/groovy-console/src/main/groovy/groovy/ui/ConsoleSupport.java @@ -30,6 +30,7 @@ import java.awt.*; /** * Base class for console */ +@Deprecated public abstract class ConsoleSupport { Style promptStyle; diff --git a/subprojects/groovy-console/src/main/groovy/groovy/ui/ConsoleTextEditor.java b/subprojects/groovy-console/src/main/groovy/groovy/ui/ConsoleTextEditor.java index 4adf7fa..6356aa1 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/ui/ConsoleTextEditor.java +++ b/subprojects/groovy-console/src/main/groovy/groovy/ui/ConsoleTextEditor.java @@ -59,6 +59,7 @@ import java.util.prefs.Preferences; /** * Component which provides a styled editor for the console. */ +@Deprecated public class ConsoleTextEditor extends JScrollPane { public String getDefaultFamily() { return defaultFamily; diff --git a/subprojects/groovy-console/src/main/groovy/groovy/ui/HistoryRecord.groovy b/subprojects/groovy-console/src/main/groovy/groovy/ui/HistoryRecord.groovy index 5d5f833..8035ddc 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/ui/HistoryRecord.groovy +++ b/subprojects/groovy-console/src/main/groovy/groovy/ui/HistoryRecord.groovy @@ -21,6 +21,7 @@ package groovy.ui import groovy.transform.CompileStatic @CompileStatic +@Deprecated class HistoryRecord { String allText int selectionStart diff --git a/subprojects/groovy-console/src/main/groovy/groovy/ui/OutputTransforms.groovy b/subprojects/groovy-console/src/main/groovy/groovy/ui/OutputTransforms.groovy index 033ae94..19609c7 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/ui/OutputTransforms.groovy +++ b/subprojects/groovy-console/src/main/groovy/groovy/ui/OutputTransforms.groovy @@ -36,6 +36,7 @@ import java.awt.Window import java.awt.image.BufferedImage @CompileStatic +@Deprecated class OutputTransforms { @Lazy static List<Closure> localTransforms = loadOutputTransforms() diff --git a/subprojects/groovy-console/src/main/groovy/groovy/ui/SystemOutputInterceptor.java b/subprojects/groovy-console/src/main/groovy/groovy/ui/SystemOutputInterceptor.java index 219c213..1ff8efb 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/ui/SystemOutputInterceptor.java +++ b/subprojects/groovy-console/src/main/groovy/groovy/ui/SystemOutputInterceptor.java @@ -27,6 +27,7 @@ import java.io.PrintStream; /** * Intercepts System.out/System.err. Implementation helper for Console.groovy. */ +@Deprecated public class SystemOutputInterceptor extends FilterOutputStream { private Closure callback; diff --git a/subprojects/groovy-console/src/main/groovy/groovy/ui/text/AutoIndentAction.groovy b/subprojects/groovy-console/src/main/groovy/groovy/ui/text/AutoIndentAction.groovy index 2054c06..d2be1ea 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/ui/text/AutoIndentAction.groovy +++ b/subprojects/groovy-console/src/main/groovy/groovy/ui/text/AutoIndentAction.groovy @@ -26,6 +26,7 @@ import javax.swing.text.SimpleAttributeSet import java.awt.event.ActionEvent @CompileStatic +@Deprecated class AutoIndentAction extends AbstractAction { AttributeSet simpleAttributeSet = new SimpleAttributeSet() diff --git a/subprojects/groovy-console/src/main/groovy/groovy/ui/text/FindReplaceUtility.java b/subprojects/groovy-console/src/main/groovy/groovy/ui/text/FindReplaceUtility.java index 11caad0..574934d 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/ui/text/FindReplaceUtility.java +++ b/subprojects/groovy-console/src/main/groovy/groovy/ui/text/FindReplaceUtility.java @@ -35,6 +35,7 @@ import java.awt.event.TextEvent; import java.awt.event.TextListener; import java.util.EventListener; +@Deprecated public final class FindReplaceUtility { public static final String FIND_ACTION_COMMAND = "Find"; diff --git a/subprojects/groovy-console/src/main/groovy/groovy/ui/text/GroovyFilter.java b/subprojects/groovy-console/src/main/groovy/groovy/ui/text/GroovyFilter.java index b804235..85a1e69 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/ui/text/GroovyFilter.java +++ b/subprojects/groovy-console/src/main/groovy/groovy/ui/text/GroovyFilter.java @@ -32,6 +32,7 @@ import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; +@Deprecated public class GroovyFilter extends StructuredSyntaxDocumentFilter { // java tab policy action diff --git a/subprojects/groovy-console/src/main/groovy/groovy/ui/text/MatchingHighlighter.java b/subprojects/groovy-console/src/main/groovy/groovy/ui/text/MatchingHighlighter.java index eec3a91..12e4a0c 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/ui/text/MatchingHighlighter.java +++ b/subprojects/groovy-console/src/main/groovy/groovy/ui/text/MatchingHighlighter.java @@ -55,6 +55,7 @@ import static org.apache.groovy.parser.antlr4.GroovyLexer.RPAREN; * * @since 3.0.0 */ +@Deprecated public class MatchingHighlighter implements CaretListener { private final SmartDocumentFilter smartDocumentFilter; private final JTextPane textEditor; diff --git a/subprojects/groovy-console/src/main/groovy/groovy/ui/text/SmartDocumentFilter.java b/subprojects/groovy-console/src/main/groovy/groovy/ui/text/SmartDocumentFilter.java index 8539a2f..7802c3d 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/ui/text/SmartDocumentFilter.java +++ b/subprojects/groovy-console/src/main/groovy/groovy/ui/text/SmartDocumentFilter.java @@ -111,6 +111,7 @@ import static org.apache.groovy.parser.antlr4.GroovyLexer.WHILE; * * @since 3.0.0 */ +@Deprecated public class SmartDocumentFilter extends DocumentFilter { private static final String MONOSPACED = "Monospaced"; private final DefaultStyledDocument styledDocument; diff --git a/subprojects/groovy-console/src/main/groovy/groovy/ui/text/StructuredSyntaxDocumentFilter.java b/subprojects/groovy-console/src/main/groovy/groovy/ui/text/StructuredSyntaxDocumentFilter.java index 93fa288..848965e 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/ui/text/StructuredSyntaxDocumentFilter.java +++ b/subprojects/groovy-console/src/main/groovy/groovy/ui/text/StructuredSyntaxDocumentFilter.java @@ -40,6 +40,7 @@ import java.util.TreeSet; import java.util.regex.Matcher; import java.util.regex.Pattern; +@Deprecated public class StructuredSyntaxDocumentFilter extends DocumentFilter { public static final String TAB_REPLACEMENT = " "; diff --git a/subprojects/groovy-console/src/main/groovy/groovy/ui/text/StructuredSyntaxHandler.java b/subprojects/groovy-console/src/main/groovy/groovy/ui/text/StructuredSyntaxHandler.java index 2979bf5..00f7e90 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/ui/text/StructuredSyntaxHandler.java +++ b/subprojects/groovy-console/src/main/groovy/groovy/ui/text/StructuredSyntaxHandler.java @@ -23,6 +23,7 @@ import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import org.xml.sax.helpers.DefaultHandler; +@Deprecated public class StructuredSyntaxHandler extends DefaultHandler { //StyleConstants. diff --git a/subprojects/groovy-console/src/main/groovy/groovy/ui/text/StructuredSyntaxResources.java b/subprojects/groovy-console/src/main/groovy/groovy/ui/text/StructuredSyntaxResources.java index e04feaf..2c060c1 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/ui/text/StructuredSyntaxResources.java +++ b/subprojects/groovy-console/src/main/groovy/groovy/ui/text/StructuredSyntaxResources.java @@ -25,6 +25,7 @@ import java.awt.datatransfer.Clipboard; * Contains all the basic resources and values used by the utility frame work * framework. */ +@Deprecated public final class StructuredSyntaxResources { // ================================================== diff --git a/subprojects/groovy-console/src/main/groovy/groovy/ui/text/TextEditor.java b/subprojects/groovy-console/src/main/groovy/groovy/ui/text/TextEditor.java index ec30af1..371096b 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/ui/text/TextEditor.java +++ b/subprojects/groovy-console/src/main/groovy/groovy/ui/text/TextEditor.java @@ -45,6 +45,7 @@ import java.util.regex.Pattern; /** * A simple text pane that is printable and wrapping is optional. */ +@Deprecated public class TextEditor extends JTextPane implements Pageable, Printable { public static final String FIND = "Find..."; diff --git a/subprojects/groovy-console/src/main/groovy/groovy/ui/text/TextUndoManager.java b/subprojects/groovy-console/src/main/groovy/groovy/ui/text/TextUndoManager.java index 7cfc89d..4a32300 100644 --- a/subprojects/groovy-console/src/main/groovy/groovy/ui/text/TextUndoManager.java +++ b/subprojects/groovy-console/src/main/groovy/groovy/ui/text/TextUndoManager.java @@ -30,6 +30,7 @@ import java.beans.PropertyChangeListener; * and then create actions to call undo/redo as needed (checking can undo/redo * first, of course). */ +@Deprecated public class TextUndoManager extends UndoManager { private SwingPropertyChangeSupport propChangeSupport = diff --git a/subprojects/groovy-console/src/main/resources/groovy/console/ui/AstBrowserProperties.groovy b/subprojects/groovy-console/src/main/resources/groovy/console/ui/AstBrowserProperties.groovy index ab707ca..2866d30 100644 --- a/subprojects/groovy-console/src/main/resources/groovy/console/ui/AstBrowserProperties.groovy +++ b/subprojects/groovy-console/src/main/resources/groovy/console/ui/AstBrowserProperties.groovy @@ -16,8 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package groovy.inspect.swingui - +package groovy.console.ui org { codehaus { diff --git a/subprojects/groovy-console/src/test/groovy/groovy/swing/SwingBuilderConsoleTest.groovy b/subprojects/groovy-console/src/test/groovy/groovy/console/SwingBuilderConsoleTest.groovy similarity index 99% rename from subprojects/groovy-console/src/test/groovy/groovy/swing/SwingBuilderConsoleTest.groovy rename to subprojects/groovy-console/src/test/groovy/groovy/console/SwingBuilderConsoleTest.groovy index 912a0de..597022e 100644 --- a/subprojects/groovy-console/src/test/groovy/groovy/swing/SwingBuilderConsoleTest.groovy +++ b/subprojects/groovy-console/src/test/groovy/groovy/console/SwingBuilderConsoleTest.groovy @@ -18,10 +18,10 @@ */ package groovy.swing -import groovy.ui.Console -import groovy.ui.ConsoleActions -import groovy.ui.view.BasicMenuBar -import groovy.ui.view.MacOSXMenuBar +import groovy.console.ui.Console +import groovy.console.ui.ConsoleActions +import groovy.console.ui.view.BasicMenuBar +import groovy.console.ui.view.MacOSXMenuBar import org.codehaus.groovy.control.CompilerConfiguration import javax.swing.JTextPane @@ -193,7 +193,7 @@ class SwingBuilderConsoleTest extends GroovySwingTestCase { void testImageIcon() { testInEDT { def swing = new SwingBuilder() - final String ICON_PATH = '/groovy/ui/ConsoleIcon.png' + final String ICON_PATH = '/groovy/console/ui/ConsoleIcon.png' String baseDir = new File('src/main/resources').absolutePath String resource = ICON_PATH diff --git a/subprojects/groovy-console/src/test/groovy/groovy/inspect/swingui/AstNodeToScriptAdapterTest.groovy b/subprojects/groovy-console/src/test/groovy/groovy/console/ui/AstNodeToScriptAdapterTest.groovy similarity index 100% rename from subprojects/groovy-console/src/test/groovy/groovy/inspect/swingui/AstNodeToScriptAdapterTest.groovy rename to subprojects/groovy-console/src/test/groovy/groovy/console/ui/AstNodeToScriptAdapterTest.groovy diff --git a/subprojects/groovy-console/src/test/groovy/groovy/ui/HistoryRecordGetTextToRunTests.groovy b/subprojects/groovy-console/src/test/groovy/groovy/console/ui/HistoryRecordGetTextToRunTests.groovy similarity index 97% rename from subprojects/groovy-console/src/test/groovy/groovy/ui/HistoryRecordGetTextToRunTests.groovy rename to subprojects/groovy-console/src/test/groovy/groovy/console/ui/HistoryRecordGetTextToRunTests.groovy index c012233..2a9127e 100644 --- a/subprojects/groovy-console/src/test/groovy/groovy/ui/HistoryRecordGetTextToRunTests.groovy +++ b/subprojects/groovy-console/src/test/groovy/groovy/console/ui/HistoryRecordGetTextToRunTests.groovy @@ -16,8 +16,9 @@ * specific language governing permissions and limitations * under the License. */ -package groovy.ui +package groovy.console.ui +import groovy.ui.HistoryRecord import junit.framework.TestCase class HistoryRecordGetTextToRunTests extends TestCase { diff --git a/subprojects/groovy-console/src/test/groovy/groovy/inspect/swingui/ScriptToTreeNodeAdapterTest.groovy b/subprojects/groovy-console/src/test/groovy/groovy/console/ui/ScriptToTreeNodeAdapterTest.groovy similarity index 99% rename from subprojects/groovy-console/src/test/groovy/groovy/inspect/swingui/ScriptToTreeNodeAdapterTest.groovy rename to subprojects/groovy-console/src/test/groovy/groovy/console/ui/ScriptToTreeNodeAdapterTest.groovy index 2e64fea..b01645f 100644 --- a/subprojects/groovy-console/src/test/groovy/groovy/inspect/swingui/ScriptToTreeNodeAdapterTest.groovy +++ b/subprojects/groovy-console/src/test/groovy/groovy/console/ui/ScriptToTreeNodeAdapterTest.groovy @@ -16,8 +16,10 @@ * specific language governing permissions and limitations * under the License. */ -package groovy.inspect.swingui +package groovy.console.ui +import groovy.inspect.swingui.ScriptToTreeNodeAdapter +import groovy.inspect.swingui.SwingTreeNodeMaker import org.codehaus.groovy.control.CompilePhase import org.codehaus.groovy.control.Phases diff --git a/subprojects/groovy-console/src/test/groovy/groovy/ui/text/GroovyFilterTests.groovy b/subprojects/groovy-console/src/test/groovy/groovy/console/ui/text/GroovyFilterTests.groovy similarity index 100% rename from subprojects/groovy-console/src/test/groovy/groovy/ui/text/GroovyFilterTests.groovy rename to subprojects/groovy-console/src/test/groovy/groovy/console/ui/text/GroovyFilterTests.groovy
