diff --git a/BaselineOfMatchTool.package/BaselineOfMatchTool.class/instance/baseline..st b/BaselineOfMatchTool.package/BaselineOfMatchTool.class/instance/baseline..st index d8b67c4..e9d0ce5 100644 --- a/BaselineOfMatchTool.package/BaselineOfMatchTool.class/instance/baseline..st +++ b/BaselineOfMatchTool.package/BaselineOfMatchTool.class/instance/baseline..st @@ -3,7 +3,7 @@ baseline: spec spec for: #'pharo6.x' do: [ spec package: 'MatchTool' ]. - spec for: #'pharo7.x' do: [ + spec for: #(#'pharo7.x' #'pharo8.x') do: [ spec package: 'MatchTool'. spec package: 'MatchTool-Pharo7' with: [ spec requires: 'MatchTool' ] ]. diff --git a/MatchTool.package/MatchTextModel.class/instance/initialize.st b/MatchTool.package/MatchTextModel.class/instance/initialize.st index 51d2d06..77ffd0d 100644 --- a/MatchTool.package/MatchTextModel.class/instance/initialize.st +++ b/MatchTool.package/MatchTextModel.class/instance/initialize.st @@ -12,5 +12,4 @@ initialize self changed: #isForMethod: with: { bool } ]. self - beForCode; aboutToStyle: true. \ No newline at end of file diff --git a/MatchTool.package/MatchTextModel.class/properties.json b/MatchTool.package/MatchTextModel.class/properties.json index e3ed9b0..5aff897 100644 --- a/MatchTool.package/MatchTextModel.class/properties.json +++ b/MatchTool.package/MatchTextModel.class/properties.json @@ -1,6 +1,6 @@ { "commentStamp" : "YuriyTymchuk 7/28/2016 23:41", - "super" : "TextModel", + "super" : "CodePresenter", "category" : "MatchTool-ExtraSpec", "classinstvars" : [ ], "pools" : [ ], diff --git a/MatchTool.package/MatchTool.class/instance/extent.st b/MatchTool.package/MatchTool.class/instance/initialExtent.st similarity index 56% rename from MatchTool.package/MatchTool.class/instance/extent.st rename to MatchTool.package/MatchTool.class/instance/initialExtent.st index 52eb69b..27bacc5 100644 --- a/MatchTool.package/MatchTool.class/instance/extent.st +++ b/MatchTool.package/MatchTool.class/instance/initialExtent.st @@ -1,4 +1,4 @@ api -extent +initialExtent ^ 800 @ 400 \ No newline at end of file diff --git a/MatchTool.package/MatchTool.class/instance/initializeLists.st b/MatchTool.package/MatchTool.class/instance/initializeLists.st index 9358876..a04453d 100644 --- a/MatchTool.package/MatchTool.class/instance/initializeLists.st +++ b/MatchTool.package/MatchTool.class/instance/initializeLists.st @@ -5,7 +5,5 @@ initializeLists displayBlock: [ :assoc | assoc key formattedCode ]. matchMap disable; - allowToSelect: false; - displayBlock: [ :assoc | - {assoc key formattedCode. - assoc value formattedCode} ] \ No newline at end of file + addColumn: (StringTableColumn evaluated: [:assoc | assoc key formattedCode]); + addColumn: (StringTableColumn evaluated: [:assoc | assoc value formattedCode]). diff --git a/MatchTool.package/MatchTool.class/instance/initializePresenter.st b/MatchTool.package/MatchTool.class/instance/initializePresenter.st index 4c4f697..bd9b096 100644 --- a/MatchTool.package/MatchTool.class/instance/initializePresenter.st +++ b/MatchTool.package/MatchTool.class/instance/initializePresenter.st @@ -1,20 +1,18 @@ initialization initializePresenter matchExpression + beForPatternCode; whenCodeEdited: [ self disableLists ]; whenMethodStateChangedDo: [ self disableLists ]; whenMethodActivatedDo: [ self matchMethodActivated ]. - testExpression whenCodeEdited: [ self disableLists ]; whenMethodStateChangedDo: [ self disableLists ]; whenMethodDeactivatedDo: [ self testMethodDeactivated ]. - executeButton action: [ self performMatching ]. helpButton action: [ HelpBrowser openOn: MatchToolHelp ]. - resultList - whenSelectedItemChanged: [ :assoc | - self selectedResultsItemChanged: assoc ]; - whenListChanged: - [ :newItems | self resultsChanged: newItems ]. \ No newline at end of file + whenSelectionChangedDo: [ :selection | + [ :assoc | self selectedResultsItemChanged: assoc ] + cull: selection selectedItem ]; + whenModelChangedDo: [ :newItems | self resultsChanged: newItems ] \ No newline at end of file diff --git a/MatchTool.package/MatchTool.class/instance/initializeWidgets.st b/MatchTool.package/MatchTool.class/instance/initializeWidgets.st index f7609ff..0ed03d3 100644 --- a/MatchTool.package/MatchTool.class/instance/initializeWidgets.st +++ b/MatchTool.package/MatchTool.class/instance/initializeWidgets.st @@ -1,20 +1,17 @@ initialization initializeWidgets self instantiateWidgets. - matchExpression title: 'Pattern code'; - beForPatternCode. + beForPatternCode. testExpression title: 'Test code'. - executeButton - icon: #smallDoIt asIcon; + icon: + (self iconNamed: #smallDoIt); label: 'Match'; shortcut: Character cr meta. - helpButton - icon: (#questionIcon asIcon scaledToSize: 22 @ 22); + icon: ((self iconNamed: #questionIcon) scaledToSize: 22 @ 22); shortcut: $h meta. - self initializeLists. self initializeFocusOrder \ No newline at end of file diff --git a/MatchTool.package/MatchTool.class/instance/instantiateWidgets.st b/MatchTool.package/MatchTool.class/instance/instantiateWidgets.st index 29ea681..ddc5827 100644 --- a/MatchTool.package/MatchTool.class/instance/instantiateWidgets.st +++ b/MatchTool.package/MatchTool.class/instance/instantiateWidgets.st @@ -5,4 +5,4 @@ instantiateWidgets resultList := self newList. executeButton := self newButton. helpButton := self newButton. - matchMap := self newMultiColumnList \ No newline at end of file + matchMap := self newTable \ No newline at end of file diff --git a/MatchTool.package/MatchTool.class/instance/resultsChanged..st b/MatchTool.package/MatchTool.class/instance/resultsChanged..st index 0fc9ecf..dd439e3 100644 --- a/MatchTool.package/MatchTool.class/instance/resultsChanged..st +++ b/MatchTool.package/MatchTool.class/instance/resultsChanged..st @@ -1,7 +1,7 @@ initialization resultsChanged: newItems matchMap items: #(). - resultList resetSelection. + resultList unselectAll. ^ newItems ifEmpty: [ resultList borderColor: Color red ] ifNotEmpty: [ resultList borderColor: Color green ] \ No newline at end of file diff --git a/MatchTool.package/MatchTool.class/properties.json b/MatchTool.package/MatchTool.class/properties.json index 2099f70..043a69d 100644 --- a/MatchTool.package/MatchTool.class/properties.json +++ b/MatchTool.package/MatchTool.class/properties.json @@ -1,6 +1,6 @@ { "commentStamp" : "YuriyTymchuk 7/24/2016 10:38", - "super" : "ComposableModel", + "super" : "ComposablePresenter", "category" : "MatchTool", "classinstvars" : [ ], "pools" : [ ], diff --git a/MatchTool.package/MatchToolHelp.class/class/listPatterns.st b/MatchTool.package/MatchToolHelp.class/class/listPatterns.st index 2375250..bd6d2cc 100644 --- a/MatchTool.package/MatchToolHelp.class/class/listPatterns.st +++ b/MatchTool.package/MatchToolHelp.class/class/listPatterns.st @@ -3,7 +3,7 @@ listPatterns ^ HelpTopic title: '(`@) List Pattern Nodes' - contents: 'To have a complete flexibility there is a possibility to use at sign (@) before the name of a pattern not which turns the node into a “list pattern node”. These node can match more than a single entity. For example + contents: 'To have complete flexibility there is the possibility to use the at sign (@) before the name of a pattern node which turns the node into a “list pattern node”. These nodes can match more than a single entity. For example `@expr isPatternVariable @@ -30,7 +30,7 @@ Similarly you can match a list of temporary variables: `@method: `@args | `temp `@temps | -This will match any method with one or more temporary variables and without any statement. The first temporary variable will be mapped to `temp the rest ones — to `@temps. +This will match any method with one or more temporary variables and without any statement. The first temporary variable will be mapped to `temp the remaining ones — to `@temps. Finally you can have a list of statements: @@ -38,10 +38,10 @@ Finally you can have a list of statements: [ `.@Statements. `var := `@object ] -this expression will match a block which has an assignment of an expression to a variable as a last statement. It can be preceded by any number of other statement (including 0). +this expression will match a block which has an assignment of an expression to a variable as its last statement. It can be preceded by any number of other statement (including 0). The list patterns does not make any sense for literal nodes i.e. `#@literal. -P.S. In the end it does not matter whether you will write `.@Statement or `@.Statement. But I like to put @ closer to the variable name as the character is larger itself and the name looks nicer this way.' \ No newline at end of file +P.S. In the end it does not matter whether you write `.@Statement or `@.Statement. But I like to put @ closer to the variable name as the character is larger itself and the name looks nicer this way.' \ No newline at end of file diff --git a/MatchTool.package/MatchToolHelp.class/class/namingImportant.st b/MatchTool.package/MatchToolHelp.class/class/namingImportant.st index 5ffe2dd..f51d32b 100644 --- a/MatchTool.package/MatchToolHelp.class/class/namingImportant.st +++ b/MatchTool.package/MatchToolHelp.class/class/namingImportant.st @@ -3,8 +3,8 @@ namingImportant ^ HelpTopic title: 'Naming is Important' - contents: 'The pattern nodes are that so you can match anything in their place. But their naming is also important as the code get’s mapped to them by name. For example: + contents: 'The pattern nodes work so they can match anything that fits. But their naming is important as the code get’s mapped to them by name. For example: `block value: `@expression value: `@expression -will match only those “value:value:” messages that have exactly the same expressions as both argument. It is like that because we used the same pattern variable name.' \ No newline at end of file +will match only those “value:value:” messages that have exactly the same expressions as both arguments. It is like that because we used the same pattern variable name.' \ No newline at end of file diff --git a/MatchTool.package/MatchToolHelp.class/class/patternCodeIntro.st b/MatchTool.package/MatchToolHelp.class/class/patternCodeIntro.st index d08d918..8f12647 100644 --- a/MatchTool.package/MatchToolHelp.class/class/patternCodeIntro.st +++ b/MatchTool.package/MatchToolHelp.class/class/patternCodeIntro.st @@ -3,14 +3,14 @@ patternCodeIntro ^ HelpTopic title: 'Pattern Code Introduction' - contents: 'Pattern code is very similar to an ordinary Smalltalk code, but allows to specify some “wildcards”. The purpose is fairly simple. Imagine that you have a piece of code + contents: 'Pattern code is very similar to ordinary Smalltalk code, but allows to specify some “wildcards”. The purpose is fairly simple. Imagine that you have a piece of code car isNil ifTrue: [ ^ self ]. -You can positively compare it with the same piece of code for equality, but won’t it be cool if you could compare something similar, but ignoring the fact that the receiver it named “car”? With pattern rules you can do exactly that. Consider the following code and notice backtick before car: +You can positively compare it with the same piece of code for equality, but won’t it be cool if you could compare something similar, but ignoring the fact that the receiver is named “car”? With pattern rules you can do exactly that. Consider the following code and notice the backtick before car: `car isNil ifTrue: [ ^ self ]. -Now this expression can match any other expression where “isNil ifTrue: [ ^ self ]” is sent to any variable (or literal). With such power you can find all the usages of “isNil ifTrue:” and replace them with “ifNil”. +Now this expression can match any other expression where “isNil ifTrue: [ ^ self ]” is sent to any variable (or literal). With such power you can find all the users of “isNil ifTrue:” and replace them with “ifNil”. The following sections will go over different kinds of wildcards (pattern nodes).' \ No newline at end of file diff --git a/MatchTool.package/MatchToolHelp.class/class/uiExplanation.st b/MatchTool.package/MatchToolHelp.class/class/uiExplanation.st index 03d366a..8b67e2e 100644 --- a/MatchTool.package/MatchToolHelp.class/class/uiExplanation.st +++ b/MatchTool.package/MatchToolHelp.class/class/uiExplanation.st @@ -7,9 +7,9 @@ uiExplanation The main window consist of 3 columns. -Fists column consists of two code areas. The top one should be used to enter a *match code* also known as pattern code, while the bottom one should be used for entering a plain Smalltalk code as a *test sample*. Both text areas can be switched into a "method mode" when they will parse the entered text as it is method, otherwise they expect the entered code to be an expression. +The first column consists of two code areas. The top one should be used to enter a *match code* also known as pattern code, while the bottom one should be used for entering plain Smalltalk code as a *test sample*. Both text areas can be switched into a "method mode" when they will parse the entered text as it is method, otherwise they expect the entered code to be an expression. -Second column contains **result of matching**, **help button** and the main **execute button** (with a "cmd(ctrl)+enter" shortcut) on top of it. After the button is pressed, both match code and test code are accepted and if there are no errors the matching is performed. MatchTool searches for the match pattern in all the test sample and list the detected matches in the result list. Clicking on the items from the result list highlights the matched interval in the test sample code area and shows the **match map** of the pattern code in the third column. +The second column contains the **result of matching**, **help button** and the main **execute button** (with a "cmd(ctrl)+enter" shortcut) on top of it. After the button is pressed, both match code and test code are accepted and if there are no errors the matching is performed. MatchTool searches for the match pattern in all the test sample and lists the detected matches in the result list. Clicking on the items from the result list highlights the matched interval in the test sample code area and shows the **match map** of the pattern code in the third column. Match map probably needs more explanation. Imagine you have a pattern @@ -17,6 +17,6 @@ Match map probably needs more explanation. Imagine you have a pattern While it will match a test sample - url printOn: FileStream stdout + url printOn: (ZnCharacterWriteStream on: Stdio stdout) -the match map list will tell you that <`item> was mapped to while <`@expr> was mapped to .' \ No newline at end of file +the match map list will tell you that <`item> was mapped to while <`@expr> was mapped to <(ZnCharacterWriteStream on: Stdio stdout)>.' \ No newline at end of file diff --git a/MatchTool.package/MatchToolHelp.class/class/whatNext.st b/MatchTool.package/MatchToolHelp.class/class/whatNext.st index 1c880da..d7d11b2 100644 --- a/MatchTool.package/MatchToolHelp.class/class/whatNext.st +++ b/MatchTool.package/MatchToolHelp.class/class/whatNext.st @@ -3,7 +3,7 @@ whatNext ^ HelpTopic title: 'What Next?' - contents: 'At the moment you can create quality rule that use pattern expression to detect and even automatically fix violations. If you are interested in implementing new rules based on the pattern code I recommend you to read the documentation about Renraku, the quality model. Just DoIt: + contents: 'At the moment you can create quality rules that use pattern expressions to detect and even automatically fix violations. If you are interested in implementing new rules based on the pattern code I recommend you to read the documentation about Renraku, the quality model. Just DoIt: HelpBrowser openOn: RenrakuHelp diff --git a/MatchTool.package/MatchToolSnippetWidget.class/properties.json b/MatchTool.package/MatchToolSnippetWidget.class/properties.json index c05e9e3..bd5e901 100644 --- a/MatchTool.package/MatchToolSnippetWidget.class/properties.json +++ b/MatchTool.package/MatchToolSnippetWidget.class/properties.json @@ -1,6 +1,6 @@ { "commentStamp" : "YuriyTymchuk 7/28/2016 23:11", - "super" : "ComposableModel", + "super" : "ComposablePresenter", "category" : "MatchTool", "classinstvars" : [ ], "pools" : [ ], diff --git a/MatchTool.package/MchToolCodeExpressionMode.class/instance/updateMode.st b/MatchTool.package/MchToolCodeExpressionMode.class/instance/updateMode.st new file mode 100644 index 0000000..ff02931 --- /dev/null +++ b/MatchTool.package/MchToolCodeExpressionMode.class/instance/updateMode.st @@ -0,0 +1,5 @@ +initialize-release +updateMode + self textArea shoutStyler styler + beForSmalltalkCode; + beForExpression. \ No newline at end of file diff --git a/MatchTool.package/MchToolCodeExpressionMode.class/instance/updateTextAreaWhenPlugged.st b/MatchTool.package/MchToolCodeExpressionMode.class/instance/updateTextAreaWhenPlugged.st deleted file mode 100644 index 7510856..0000000 --- a/MatchTool.package/MchToolCodeExpressionMode.class/instance/updateTextAreaWhenPlugged.st +++ /dev/null @@ -1,9 +0,0 @@ -initialize-release -updateTextAreaWhenPlugged - super updateTextAreaWhenPlugged. - - self textArea shoutStyler styler - beForSmalltalkCode; - beForExpression. - - self restyleTextArea. \ No newline at end of file diff --git a/MatchTool.package/MchToolCodeMethodMode.class/instance/updateTextAreaWhenPlugged.st b/MatchTool.package/MchToolCodeMethodMode.class/instance/updateMode.st similarity index 51% rename from MatchTool.package/MchToolCodeMethodMode.class/instance/updateTextAreaWhenPlugged.st rename to MatchTool.package/MchToolCodeMethodMode.class/instance/updateMode.st index 8c3a2ef..25d42a9 100644 --- a/MatchTool.package/MchToolCodeMethodMode.class/instance/updateTextAreaWhenPlugged.st +++ b/MatchTool.package/MchToolCodeMethodMode.class/instance/updateMode.st @@ -1,9 +1,5 @@ initialize-release -updateTextAreaWhenPlugged - super updateTextAreaWhenPlugged. - +updateMode self textArea shoutStyler styler beForSmalltalkCode; beForMethod. - - self restyleTextArea. \ No newline at end of file diff --git a/MatchTool.package/MchToolMatchExpressionMode.class/instance/updateMode.st b/MatchTool.package/MchToolMatchExpressionMode.class/instance/updateMode.st new file mode 100644 index 0000000..d86f75a --- /dev/null +++ b/MatchTool.package/MchToolMatchExpressionMode.class/instance/updateMode.st @@ -0,0 +1,5 @@ +initialize-release +updateMode + self textArea shoutStyler styler + beForMatchCode; + beForExpression \ No newline at end of file diff --git a/MatchTool.package/MchToolMatchExpressionMode.class/instance/updateTextAreaWhenPlugged.st b/MatchTool.package/MchToolMatchExpressionMode.class/instance/updateTextAreaWhenPlugged.st deleted file mode 100644 index 3c83e19..0000000 --- a/MatchTool.package/MchToolMatchExpressionMode.class/instance/updateTextAreaWhenPlugged.st +++ /dev/null @@ -1,8 +0,0 @@ -initialize-release -updateTextAreaWhenPlugged - super updateTextAreaWhenPlugged. - self textArea shoutStyler styler - beForMatchCode; - beForExpression. - - self restyleTextArea. \ No newline at end of file diff --git a/MatchTool.package/MchToolMatchMethodMode.class/instance/updateMode.st b/MatchTool.package/MchToolMatchMethodMode.class/instance/updateMode.st new file mode 100644 index 0000000..6d37190 --- /dev/null +++ b/MatchTool.package/MchToolMatchMethodMode.class/instance/updateMode.st @@ -0,0 +1,5 @@ +initialize-release +updateMode + self textArea shoutStyler styler + beForMatchCode; + beForMethod. \ No newline at end of file diff --git a/MatchTool.package/MchToolMatchMethodMode.class/instance/updateTextAreaWhenPlugged.st b/MatchTool.package/MchToolMatchMethodMode.class/instance/updateTextAreaWhenPlugged.st deleted file mode 100644 index 1cd0757..0000000 --- a/MatchTool.package/MchToolMatchMethodMode.class/instance/updateTextAreaWhenPlugged.st +++ /dev/null @@ -1,8 +0,0 @@ -initialize-release -updateTextAreaWhenPlugged - super updateTextAreaWhenPlugged. - self textArea shoutStyler styler - beForMatchCode; - beForMethod. - - self restyleTextArea. \ No newline at end of file diff --git a/MatchTool.package/MchToolMode.class/instance/updateMode.st b/MatchTool.package/MchToolMode.class/instance/updateMode.st new file mode 100644 index 0000000..9641da0 --- /dev/null +++ b/MatchTool.package/MchToolMode.class/instance/updateMode.st @@ -0,0 +1,3 @@ +initialize-release +updateMode + self subclassResponsibility \ No newline at end of file diff --git a/MatchTool.package/MchToolMode.class/instance/updateTextAreaWhenPlugged.st b/MatchTool.package/MchToolMode.class/instance/updateTextAreaWhenPlugged.st index ec81617..da4555a 100644 --- a/MatchTool.package/MchToolMode.class/instance/updateTextAreaWhenPlugged.st +++ b/MatchTool.package/MchToolMode.class/instance/updateTextAreaWhenPlugged.st @@ -1,4 +1,7 @@ initialize-release updateTextAreaWhenPlugged self withShoutStyler. - self textArea shoutStyler beForMatchTool. \ No newline at end of file + self textArea shoutStyler beForMatchTool. + self updateMode. + self restyleTextArea + \ No newline at end of file