Skip to content

Commit

Permalink
Assimilated code style.
Browse files Browse the repository at this point in the history
  • Loading branch information
WorldofJARcraft committed Jul 22, 2019
1 parent 42a8b17 commit 75dc386
Show file tree
Hide file tree
Showing 163 changed files with 375 additions and 180 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ toolbuilder
buildWith: builder

| windowSpec wrongWordSpec alternativesListSpec ignoreButtonSpec ignoreAllButtonSpec addButtonSpec leftButtonSpec rightButtonSpec |

windowSpec := builder pluggableWindowSpec new.
windowSpec
model: self;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
accessing
getWorkspaceContents

self workspace dependents
ifEmpty:[
^ self workspace contents
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
initialize
initialize

self parser: SPCTextParser new.
self clear
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
accessing
inputText: aText
inputText := aText asText. "might be a string"

"might be a string"
inputText := aText asText.
self wrongWords: (SPCSpellChecker instance misspelledWordsIn: aText string).
self keyArray: self wrongWords keys asSortedCollection asOrderedCollection.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ select alternative
replaceTextWithAlternative

| updatedText offset |
offset := self selectedAlternative size - self currentWord size. "this needs to be calculated at the beginning because currentWord cannot be used after the word was replaced"

"this needs to be calculated at the beginning because currentWord cannot be used after the word was replaced"
offset := self selectedAlternative size - self currentWord size.
updatedText := self inputText replaceFrom: self startIndex to: self endIndex with: self selectedAlternative.
self workspace ifNotNil: [self workspace contents: updatedText].
self updateWrongWordsAfter: self endIndex By: offset
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
accessing
selectedAlternative: anObject

(anObject isNil or: [self keyArray isEmpty]) ifTrue: [^self].
selectedAlternative := anObject.
self changed: #selectedAlternative;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"addToDictionary" : "RS 7/25/2018 17:40",
"alternativeWords" : "RS 7/25/2018 16:17",
"alternativeWords:" : "RS 7/25/2018 17:05",
"buildWith:" : "RS 7/25/2018 17:36",
"buildWith:" : "ea 7/22/2019 18:14",
"clear" : "RS 7/25/2018 16:19",
"contextSentence" : "ow 7/14/2018 14:43",
"contextSentence:" : "RS 7/25/2018 17:40",
Expand All @@ -17,20 +17,20 @@
"displayNextWord" : "RS 7/22/2018 22:05",
"displayPreviousWord" : "ow 7/14/2018 14:51",
"endIndex" : "ow 7/14/2018 14:42",
"getWorkspaceContents" : "ea 6/24/2019 16:41",
"getWorkspaceContents" : "ea 7/22/2019 18:12",
"ignoreAll" : "ea 5/11/2019 15:40",
"ignoreCurrent" : "RS 7/25/2018 17:40",
"initialize" : "ea 6/16/2019 17:22",
"initialize" : "ea 7/22/2019 18:12",
"inputText" : "ow 7/14/2018 14:32",
"inputText:" : "ea 6/16/2019 17:33",
"inputText:" : "ea 7/22/2019 18:13",
"keyArray" : "ow 7/14/2018 14:49",
"keyArray:" : "ow 7/14/2018 14:50",
"open" : "pz 5/29/2018 21:55:12",
"parser" : "ow 7/14/2018 14:35",
"parser:" : "ow 7/25/2018 20:15",
"replaceTextWithAlternative" : "RS 7/25/2018 16:32",
"replaceTextWithAlternative" : "ea 7/22/2019 18:13",
"selectedAlternative" : "RS 6/27/2018 15:19:24",
"selectedAlternative:" : "ea 6/24/2019 16:34",
"selectedAlternative:" : "ea 7/22/2019 18:13",
"startIndex" : "ow 7/14/2018 14:51",
"updateDictionaryAfter:By:" : "ow 7/23/2018 17:20",
"updateKeyArrayAfter:By:" : "ow 7/23/2018 17:20",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
paths
affixFileName: aLanguageName

^ ((self selectedLanguageDirectoryPath: aLanguageName) fileNamesMatching: '*.aff') first
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ toolbuilder
buildWith: builder

| windowSpec ignoredWordsListSpec removeButtonSpec languageListSpec importDictionaryButtonSpec downloadDictionaryButtonSpec |

windowSpec := builder pluggableWindowSpec new.
windowSpec
model: self;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
dictionary loading
changed: aSymbol

| indexOfCurrentLanguage present |

(aSymbol = #loadedLanguages) ifTrue: [
self selectedLanguageIndices keys do: [ :key | self selectedLanguageIndices at: key put: false ].
self spellchecker loadedLanguages do: [ :language|
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
dictionary loading
loadLanguage: languageName
| language |

| language |

language := SPCHunspellLanguage new.
language affixPath: (self affixPath: languageName).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ dictionary loading
openDownloadPageOnWindows

| aCollection |

aCollection := OrderedCollection new.
aCollection add: (SPCDictionaryManagementUI downloadPageLink).
(ExternalWindowsOSProcess programName: 'explorer' arguments: aCollection initialEnvironment: '') value
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
accessing
selectedLanguageAt: anIndex

^ self selectedLanguageIndices at: anIndex ifAbsentPut: [ false ]

Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
accessing
selectedLanguageAt: anIndex put: anObject

| languageName |

anObject ifNotNil:[
self selectedLanguageIndices at: anIndex put: anObject.
self changed: #selectedLanguage
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
accessing
selectedLanguageIndices

selectedLanguageIndices ifNil: [ selectedLanguageIndices := Dictionary new ].
^ selectedLanguageIndices
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
dictionary loading
unloadLanguage: languageName
| language |

| language |

language := SPCHunspellLanguage new.
language affixPath: (self affixPath: languageName).
language dictionaryPath: (self dictionaryPath:languageName).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ accessing
usedLanguage

| languages |

languages := OrderedCollection new.
self class defaultDictionaryDirectoryPath entries do: [ :language |
languages add: language name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,34 @@
"unregisterInWorldMenu" : "mka 6/3/2019 21:50" },
"instance" : {
"addedWords" : "ea3 6/18/2019 18:33",
"affixFileName:" : "ea 6/13/2019 11:24",
"affixFileName:" : "ea 7/22/2019 18:14",
"affixPath:" : "ea 6/13/2019 11:22",
"availableLanguages" : "ea 6/13/2019 10:44",
"availableLanguages:" : "ea 6/13/2019 10:44",
"buildWith:" : "ea 7/8/2019 15:07",
"changed:" : "mka 7/16/2019 16:52",
"buildWith:" : "ea 7/22/2019 18:15",
"changed:" : "ea 7/22/2019 18:15",
"dictionaryFileName:" : "ea 6/13/2019 09:44",
"dictionaryPath:" : "ea 6/13/2019 11:22",
"importDictionary" : "mka 7/16/2019 16:53",
"initialize" : "ea 7/22/2019 09:23",
"loadLanguage:" : "ea 7/22/2019 18:04",
"loadLanguage:" : "ea 7/22/2019 18:15",
"loadedLanguages" : "ow 7/12/2018 16:41",
"open" : "RS 7/22/2018 20:56",
"openDownloadPage" : "mka 7/16/2019 16:53",
"openDownloadPageOnMacOS" : "mka 7/8/2019 14:42",
"openDownloadPageOnUnix" : "mka 7/8/2019 14:42",
"openDownloadPageOnWindows" : "ea 7/22/2019 09:24",
"openDownloadPageOnWindows" : "ea 7/22/2019 18:16",
"removeFromIgnoredWords" : "ea3 6/18/2019 18:33",
"selectUsedLanguage" : "ea 6/17/2019 15:58",
"selectedLanguageAt:" : "ea3 6/18/2019 18:22",
"selectedLanguageAt:put:" : "ea 7/22/2019 09:24",
"selectedLanguageAt:" : "ea 7/22/2019 18:16",
"selectedLanguageAt:put:" : "ea 7/22/2019 18:16",
"selectedLanguageDirectoryPath" : "ow 7/12/2018 16:56",
"selectedLanguageDirectoryPath:" : "ea 6/13/2019 09:42",
"selectedLanguageIndices" : "ea 6/13/2019 10:41",
"selectedLanguageIndices" : "ea 7/22/2019 18:16",
"selectedLanguageIndices:" : "ea 7/22/2019 09:23",
"selectedWord" : "ow 7/5/2018 17:05",
"selectedWord:" : "RS 7/22/2018 20:52",
"spellchecker" : "ow 7/25/2018 20:11",
"spellchecker:" : "ow 7/25/2018 20:11",
"unloadLanguage:" : "ea 7/22/2019 09:24",
"usedLanguage" : "ea 6/13/2019 12:20" } }
"unloadLanguage:" : "ea 7/22/2019 18:15",
"usedLanguage" : "ea 7/22/2019 18:16" } }
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
library
empty

^ self basicNew initialize.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
library
fileExists: aPath

^ (FileDirectory forFileName: aPath) fileExists: aPath
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
library
Instance: aValue

Instance := aValue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
library
instance

Instance ifNil: [
Instance := SPCHunspellAPIDecorator new
].
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
library
libraryExists

^ SPCHunspellAPI vmDirectory fileExists: SPCHunspellAPI moduleName
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
library
new

^self shouldNotImplement
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
library
new: dictionaryPath withAffix: affixPath

| hunspell |
hunspell := self empty.
hunspell createHandle: dictionaryPath affix: affixPath.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
library
ressourceDirectory

^ FileDirectory default
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
library
vmDirectory

^ FileDirectory forFileName: Smalltalk vmFileName
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
accessing
affixPath: anObject

affixPath := anObject
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
accessing
affixPath

^ affixPath
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
accessing
apiHandle: anObject

apiHandle := anObject
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
private
createHandle: dictionaryPath affix: affixPath

| handle |

"Local variable for debugging."
self class libraryExists ifTrue: [
self dictionaryPath: dictionaryPath.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
private
createHandle

| handle |

"Left local variable for easier debugging."
self class libraryExists ifTrue: [
self dictionaryPath: SPCSpellChecker defaultAffixPath.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
private
destroyHandle

(self class libraryExists and: [ self handleNotNil]) ifTrue: [
self apiDestroyHandle: self apiHandle
]
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
accessing
dictionaryPath: anObject

dictionaryPath := anObject
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
accessing
dictionaryPath

^ dictionaryPath
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ private
getSuggestionList: aString

| list |

list := SPCHunspellSuggestList externalNew.
(self class libraryExists and: [ self handleNotNil]) ifTrue: [
list listSize: (self apiSuggest: self apiHandle list: list word: aString)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ spellchecking
getSuggestions: aString

| suggestions |

(self getSuggestionList: aString) in: [:suggestionList |
suggestions := suggestionList asCollection.
self freeSuggestionList: suggestionList].
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
private
handleNotNil

^ self apiHandle isNil not
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
accessing
isNilObject

^ false
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
spellchecking
isWordCorrect: aString

(self class libraryExists and: [ self handleNotNil]) ifTrue: [
"Might be a byte array."
aString isString ifTrue: [
Expand Down
Loading

0 comments on commit 75dc386

Please sign in to comment.