[Pkg] The Trunk: HelpSystem-Core-mt.84.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue Nov 24 08:48:10 UTC 2015
Marcel Taeumel uploaded a new version of HelpSystem-Core to project The Trunk:
http://source.squeak.org/trunk/HelpSystem-Core-mt.84.mcz
==================== Summary ====================
Name: HelpSystem-Core-mt.84
Author: mt
Time: 24 November 2015, 9:48:03.135 am
UUID: ce8e1b34-772e-4968-a6f7-ad1afed12b10
Ancestors: HelpSystem-Core-mt.83
Removes dead code. Avoid losing unaccepted changes without confirmation. Like on code editors.
=============== Diff against HelpSystem-Core-mt.83 ===============
Item was changed:
----- Method: HelpBrowser>>accept: (in category 'actions') -----
accept: text
"Accept edited text. Compile it into a HelpTopic"
| code parent topicClass topicMethod |
(self currentParentTopic isNil or: [self currentParentTopic isEditable not])
ifTrue: [^ self inform: 'This help topic cannot be edited.'].
+ self changed: #clearUserEdits.
+
parent := self currentParentTopic.
topicClass := parent helpClass.
topicMethod := self currentTopic key.
code := String streamContents:[:s|
s nextPutAll: topicMethod.
s crtab; nextPutAll: '"This method was automatically generated. Edit it using:"'.
s crtab; nextPutAll: '"', self name,' edit: ', topicMethod storeString,'"'.
s crtab; nextPutAll: '^HelpTopic'.
s crtab: 2; nextPutAll: 'title: ', currentTopic title storeString.
s crtab: 2; nextPutAll: 'contents: '.
s cr; nextPutAll: (String streamContents:[:c| c nextChunkPutWithStyle: text]) storeString.
s nextPutAll:' readStream nextChunkText'.
].
topicClass class
compile: code
classified: ((topicClass class organization categoryOfElement: topicMethod) ifNil:['pages']).
parent refresh.
parent == self rootTopic ifTrue: [self rootTopic: parent].
self currentTopic: (parent subtopics detect: [:t | t key = topicMethod]).!
Item was changed:
----- Method: HelpBrowser>>currentTopic: (in category 'accessing') -----
currentTopic: aHelpTopic
+ self okToChange ifFalse: [^ self].
self currentTopic == aHelpTopic ifTrue: [^ self].
currentTopic := aHelpTopic.
topicPath := nil.
self changed: #currentTopic.
self changed: #topicContents.!
Item was removed:
- ----- Method: HelpBrowser>>find (in category 'actions') -----
- find
- "Prompt the user for a string to search for, and search the receiver from the current selection onward for it."
-
- | reply |
- reply := UIManager default request: 'Find what? ' initialAnswer: ''.
- reply size = 0 ifTrue: [
- ^ self].
- self findStringInHelpTopic: reply
- !
Item was removed:
- ----- Method: HelpBrowser>>find: (in category 'actions') -----
- find: aString
- ^SystemNavigation allMethodsSelect: [:method |
- method hasLiteralSuchThat: [:lit |
- (lit isString and: [lit isSymbol not]) and:
- [lit includesSubstring: aString caseSensitive: false]]]
- localTo: CustomHelp
- !
Item was removed:
- ----- Method: HelpBrowser>>findAgain (in category 'actions') -----
- findAgain
- | i |
- (i := result indexOf: currentTopic) ~= 0
- ifTrue: [i = result size
- ifTrue: [(self confirm: 'Start over?')
- ifTrue: [i := 1]
- ifFalse: [^ self]].
- self
- onItemClicked: (result at: i + 1)]!
Item was removed:
- ----- Method: HelpBrowser>>findStringInHelpTopic: (in category 'actions') -----
- findStringInHelpTopic: aString
-
- result := OrderedCollection new.
- self inSubtopic: self rootTopic find: aString.
- result ifNotEmpty: [self topic: result first].
- !
Item was removed:
- ----- Method: HelpBrowser>>inSubtopic:find: (in category 'actions') -----
- inSubtopic: aTopic find: aString
- ((aTopic title asString includesSubstring: aString caseSensitive: false)
- or: [aTopic contents asString includesSubstring: aString caseSensitive: false])
- ifTrue: [result addIfNotPresent: aTopic].
- aTopic subtopics
- do: [:sub | self inSubtopic: sub find: aString]!
Item was removed:
- ----- Method: HelpBrowser>>inTopic:replaceCurrentTopicWith: (in category 'actions') -----
- inTopic: parentTopic replaceCurrentTopicWith: aNewTopic
-
- parentTopic subtopics
- do: [ :sub | self inTopic: parentTopic replaceSubtopic: sub with: aNewTopic]!
Item was removed:
- ----- Method: HelpBrowser>>inTopic:replaceSubtopic:with: (in category 'actions') -----
- inTopic: parentTopic replaceSubtopic: aTopic with: aNewTopic
- | i |
-
- (aTopic = oldTopic)
- ifTrue: [ i := parentTopic subtopics indexOf: aTopic.
- parentTopic subtopics at: i put: aNewTopic. ^self ].
-
- aTopic subtopics
- do: [ :sub | self inTopic: aTopic replaceSubtopic: sub with: aNewTopic]!
Item was added:
+ ----- Method: HelpBrowser>>okToChange (in category 'updating') -----
+ okToChange
+
+ self canDiscardEdits ifTrue: [^ true].
+ self changed: #wantToChange. "Solicit cancel from view"
+ ^ self canDiscardEdits!
Item was changed:
----- Method: HelpBrowser>>searchTerm: (in category 'searching') -----
searchTerm: aString
"Spawn a new search topic."
| topic |
+ self okToChange ifFalse: [^ self].
+
topic := self searchTopic subtopics
detect: [:t | t term = aString]
ifNone: [ | newTopic |
newTopic := SearchTopic new
term: aString;
yourself.
self searchTopic addSubtopic: newTopic.
newTopic addDependent: self. "Tell me about your updates."
newTopic].
"self changed: #searchTerm."
"Select results and expand searches node if necessary."
self currentTopicPath: {self searchTopic. topic}.
self assert: self currentTopic == topic.
topic
topicsToSearch: self toplevelTopics allButLast;
startSearch.!
More information about the Packages
mailing list