Marcel Taeumel uploaded a new version of Protocols to project The Trunk:
http://source.squeak.org/trunk/Protocols-jr.67.mcz
==================== Summary ====================
Name: Protocols-jr.67
Author: jr
Time: 10 August 2019, 11:17:13.691208 pm
UUID: 47e86587-b8a1-6341-b25f-624fe55eb0e4
Ancestors: Protocols-jr.66
Harden against missing methods.
Endless debuggers appeared when a message list item whose method was removed from the system was hovered. This can happen if you have an existing message list that was not updated since the method has been removed.
=============== Diff against Protocols-pre.62 ===============
Item was added:
+ ----- Method: ClassDescription>>browseFullProtocol (in category '*Protocols-Tools') -----
+ browseFullProtocol
+ Lexicon new openOnClass: self showingSelector: nil.!
Item was changed:
ProtocolBrowser subclass: #Lexicon
+ instanceVariableNames: 'currentVocabulary categoryList categoryListIndex targetClass limitClass currentQuery currentQueryParameter selectorsVisited compileTargetClass'
- instanceVariableNames: 'currentVocabulary categoryList categoryListIndex targetClass limitClass currentQuery currentQueryParameter selectorsVisited'
classVariableNames: ''
poolDictionaries: ''
category: 'Protocols-Tools'!
+ !Lexicon commentStamp: 'jr 8/4/2019 11:36' prior: 0!
- !Lexicon commentStamp: 'fbs 5/2/2013 08:29' prior: 0!
An instance of Lexicon shows the list of all the method categories known to an object or any of its superclasses, as a "flattened" list, and, within any selected category, shows all methods understood by the class's instances which are associated with that category, again as a "flattened" list. A variant with a search pane rather than a category list is also implemented.
categoryList the list of categories
categoryListIndex index of currently-selected category
targetObject optional -- an instance being viewed
targetClass the class being viewed
lastSearchString the last string searched for
lastSendersSearchSelector the last senders search selector
limitClass optional -- the limit class to search for
selectorsVisited list of selectors visited
selectorsActive not presently in use, subsumed by selectorsVisited
currentVocabulary the vocabulary currently installed
currentQuery what the query category relates to:
+ #senders #selectorName #currentChangeSet
+ compileTargetClass transient -- behavior in which the current contents is
+ accepted/compiled!
- #senders #selectorName #currentChangeSet!
Item was added:
+ ----- Method: Lexicon>>contents:notifying: (in category 'private') -----
+ contents: aString notifying: aController
+ "Make sure a possible choice of the compileTargetClass is not remembered."
+ [^ super contents: aString notifying: aController]
+ ensure: [compileTargetClass := nil]!
Item was added:
+ ----- Method: Lexicon>>contents:oldSelector:in:classified:notifying: (in category 'private') -----
+ contents: aString oldSelector: oldSelector in: aClass classified: category notifying: aController
+ "Update messageList if a method is compiled because the selector might be in a
+ different class now."
+ ^ (super contents: aString oldSelector: oldSelector in: aClass classified: category notifying: aController)
+ ifTrue: [ self reformulateList. ^ true]
+ ifFalse: [false]!
Item was added:
+ ----- Method: Lexicon>>formattedLabel:forSelector:inClass: (in category 'message list') -----
+ formattedLabel: aString forSelector: aSymbol inClass: aClass
+ "Highlight messages implemented in the targetClass in bold print."
+
+ | formattedLabel |
+ formattedLabel := super formattedLabel: aString forSelector: aSymbol inClass: aClass.
+ aClass = targetClass ifTrue:
+ [formattedLabel := formattedLabel asText.
+ (self userInterfaceTheme ownMessageAttributes ifNil: [{TextEmphasis bold}]) do: [:textAttribute |
+ formattedLabel addAttribute: textAttribute]].
+
+ ^ formattedLabel.!
Item was changed:
----- Method: Lexicon>>messageHelpAt: (in category 'message list') -----
messageHelpAt: anIndex
+ "Show the first n lines of the source code of the selected message."
+ Preferences balloonHelpInMessageLists ifFalse: [^ nil].
+ self messageList size < anIndex ifTrue: [^ nil].
+
+ self class parse: (self messageList at: anIndex) toClassAndSelector:
+ [:class :selector |
+ ^ self messageHelpForMethod: (class compiledMethodAt: selector ifAbsent: [^ nil])].
+
- "Not working due to text representation of message list."
^ nil!
Item was changed:
----- Method: Lexicon>>messageIconAt: (in category 'message list') -----
messageIconAt: anIndex
+ Browser showMessageIcons
+ ifFalse: [^ nil].
+ self class parse: (self messageList at: anIndex) toClassAndSelector:
+ [:class :selector |
+ ^ ToolIcons iconNamed: (ToolIcons
+ iconForClass: class
+ selector: selector)].
+
- "Not working due to text representation of message list."
^ nil!
Item was changed:
----- Method: Lexicon>>okayToAccept (in category 'model glue') -----
okayToAccept
"Answer whether it is okay to accept the receiver's input"
+ | ok reply |
- | ok aClass reply |
(ok := super okayToAccept) ifTrue:
+ [((compileTargetClass := self selectedClassOrMetaClass) ~~ targetClass) ifTrue:
- [((aClass := self selectedClassOrMetaClass) ~~ targetClass) ifTrue:
[reply := UIManager default chooseFrom:
+ {'okay, no problem'.
+ 'cancel - let me reconsider'.
+ 'compile into ', targetClass name, ' instead'.
+ 'compile into a new uniclass'} title:
- {'okay, no problem'.
- 'cancel - let me reconsider'.
- 'compile into ', targetClass name, ' instead'.
- 'compile into a new uniclass'} title:
'Caution!! This would be
+ accepted into class ', compileTargetClass name, '.
+ Is that okay?'.
+ reply caseOf:
+ {[1] -> [^ true].
+ [2] -> [^ false].
+ [3] -> [compileTargetClass := targetClass. ^ true]}
+ otherwise: [self notYetImplemented]]].
- accepted into class ', aClass name, '.
- Is that okay?' .
- reply = 1 ifTrue: [^ true].
- reply ~= 2 ifTrue:
- [self notYetImplemented].
- ^ false]].
^ ok!
Item was removed:
- ----- Method: Lexicon>>setClassAndSelectorIn: (in category 'selection') -----
- setClassAndSelectorIn: csBlock
- "Decode strings of the form <selectorName> (<className> [class])"
-
-
- self selection ifNil: [^ csBlock value: targetClass value: nil].
- ^ super setClassAndSelectorIn: csBlock!
Item was added:
+ ----- Method: Lexicon>>targetForContents: (in category 'private') -----
+ targetForContents: aString
+ ^ compileTargetClass!
Item was added:
+ ----- Method: ProtocolBrowser class>>parse:toClassAndSelector: (in category 'utilities') -----
+ parse: aStringOrText toClassAndSelector: csBlock
+ "Decode strings of the form <selectorName> (<className> [class])"
+ | string i classAndSelString|
+ aStringOrText ifNil: [^ csBlock value: nil value: nil].
+ string := aStringOrText asString.
+ i := string indexOf: $(.
+ "Rearrange to <className> [class] <selectorName> , and use MessageSet"
+ classAndSelString := (string copyFrom: i + 1 to: string size - 1) , ' ' ,
+ (string copyFrom: 1 to: i - 1) withoutTrailingBlanks.
+ super parse: classAndSelString toClassAndSelector: csBlock.!
Item was removed:
- ----- Method: ProtocolBrowser>>setClassAndSelectorIn: (in category 'private') -----
- setClassAndSelectorIn: csBlock
- "Decode strings of the form <selectorName> (<className> [class])"
-
- | i classAndSelString selString sel |
-
- sel := self selection ifNil: [^ csBlock value: nil value: nil].
- (sel isKindOf: MethodReference) ifTrue: [
- sel setClassAndSelectorIn: csBlock
- ] ifFalse: [
- selString := sel asString.
- i := selString indexOf: $(.
- "Rearrange to <className> [class] <selectorName> , and use MessageSet"
- classAndSelString := (selString copyFrom: i + 1 to: selString size - 1) , ' ' ,
- (selString copyFrom: 1 to: i - 1) withoutTrailingBlanks.
- MessageSet parse: classAndSelString toClassAndSelector: csBlock.
- ].
- !
Marcel Taeumel uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-jr.859.mcz
==================== Summary ====================
Name: Tools-jr.859
Author: jr
Time: 4 August 2019, 11:23:31.139513 am
UUID: da4ec759-c2aa-6040-9151-53c2942b3e88
Ancestors: Tools-mt.858
Refactor accept in MessageSet such that subclasses can override in which class the contents will be compiled.
This will allow Lexicon (package Protocols) to create an override from an inherited method without switching the tool.
Assumption: setClassAndSelectorIn: must provide the data of the currently selected method and it will not pretend to view a different class.
Also split the contents:notifying: method since it did several things at once and was quite long.
=============== Diff against Tools-mt.858 ===============
Item was changed:
----- Method: MessageSet>>contents:notifying: (in category 'private') -----
contents: aString notifying: aController
"Compile the code in aString. Notify aController of any syntax errors.
Answer false if the compilation fails. Otherwise, if the compilation
created a new method, deselect the current selection. Then answer true."
+ | category class oldSelector |
- | category selector class oldSelector |
self okayToAccept ifFalse: [^ false].
+ class := self targetForContents: aString.
- self setClassAndSelectorIn: [:c :os | class := c. oldSelector := os].
class ifNil: [^ false].
+ self setClassAndSelectorIn: [:c :os | oldSelector := os].
+ (self contents: aString specialSelector: oldSelector in: class notifying: aController)
+ ifTrue: [^ false].
- (oldSelector ~~ nil and: [oldSelector first isUppercase]) ifTrue:
- [oldSelector = #Comment ifTrue:
- [class comment: aString stamp: Utilities changeStamp.
- self changed: #annotation.
- self clearUserEditFlag.
- ^ false].
- oldSelector = #Definition ifTrue:
- ["self defineClass: aString notifying: aController."
- class subclassDefinerClass
- evaluate: aString
- notifying: aController
- logged: true.
- self clearUserEditFlag.
- ^ false].
- oldSelector = #Hierarchy ifTrue:
- [self inform: 'To change the hierarchy, edit the class definitions'.
- ^ false]].
"Normal method accept"
+ category := self selectedMessageCategoryName.
+ ^ self contents: aString
+ oldSelector: oldSelector
+ in: class
+ classified: category
+ notifying: aController!
- category := class organization categoryOfElement: oldSelector.
- selector := class compile: aString
- classified: category
- notifying: aController.
- selector == nil ifTrue: [^ false].
- self noteAcceptanceOfCodeFor: selector.
- selector == oldSelector ifFalse:
- [self reformulateListNoting: selector].
- contents := aString copy.
- self changed: #annotation.
- ^ true!
Item was added:
+ ----- Method: MessageSet>>contents:oldSelector:in:classified:notifying: (in category 'private') -----
+ contents: aString oldSelector: oldSelector in: aClass classified: category notifying: aController
+ "Compile the code in aString. Notify aController of any syntax errors.
+ Answer false if the compilation fails. Otherwise, if the compilation
+ created a new method, deselect the current selection. Then answer true."
+ | selector |
+ selector := aClass compile: aString
+ classified: category
+ notifying: aController.
+ selector == nil ifTrue: [^ false].
+ self noteAcceptanceOfCodeFor: selector.
+ selector == oldSelector ifFalse:
+ [self reformulateListNoting: selector].
+ contents := aString copy.
+ self changed: #annotation.
+ ^ true!
Item was added:
+ ----- Method: MessageSet>>contents:specialSelector:in:notifying: (in category 'private') -----
+ contents: aString specialSelector: oldSelector in: aClass notifying: aController
+ "If the selector is a fake to denote a different definition than that of a method,
+ try to change that different object. Answer whether a special selector was found and
+ handled."
+ (oldSelector ~~ nil and: [oldSelector first isUppercase]) ifFalse: [^ false].
+ oldSelector = #Comment ifTrue:
+ [aClass comment: aString stamp: Utilities changeStamp.
+ self changed: #annotation.
+ self clearUserEditFlag.
+ ^ true].
+ oldSelector = #Definition ifTrue:
+ ["self defineClass: aString notifying: aController."
+ aClass subclassDefinerClass
+ evaluate: aString
+ notifying: aController
+ logged: true.
+ self clearUserEditFlag.
+ ^ true].
+ oldSelector = #Hierarchy ifTrue:
+ [self inform: 'To change the hierarchy, edit the class definitions'.
+ ^ true].
+ ^ false!
Item was added:
+ ----- Method: MessageSet>>targetForContents: (in category 'private') -----
+ targetForContents: aString
+ "Answer the behavior into which the contents will be accepted."
+ self setClassAndSelectorIn: [:c :os | ^ c].
+ ^ nil "fail safe for overriding implementations of setClassAndSelectorIn:"!
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1501.mcz
==================== Summary ====================
Name: Morphic-mt.1501
Author: mt
Time: 14 August 2019, 10:11:26.641413 am
UUID: 6b762838-8fae-d147-baac-4ab0e872b6c2
Ancestors: Morphic-mt.1500
Tally It: Use dialog window instead of pop-up menu to inform about the results.
Maybe add buttons to that dialog to: explore the result, debug the code, tally again, time-profile it? :-)
=============== Diff against Morphic-mt.1500 ===============
Item was changed:
----- Method: SmalltalkEditor>>tallySelection (in category 'do-its') -----
tallySelection
"Treat the current selection as an expression; evaluate it and return the time took for this evaluation"
+ | code result rcvr ctxt v |
- | result rcvr ctxt valueAsString v |
self lineSelectAndEmptyCheck: [^ self].
(model respondsTo: #doItReceiver)
ifTrue: [ rcvr := model doItReceiver.
ctxt := model doItContext]
ifFalse: [rcvr := ctxt := nil].
result := [ | cm |
+ code := self selectionAsStream.
cm := rcvr class evaluatorClass new
+ compiledMethodFor: code
- compiledMethodFor: self selectionAsStream
in: ctxt
to: rcvr
notifying: self
ifFail: [morph flash. ^ self].
Time millisecondsToRun:
[v := cm valueWithReceiver: rcvr arguments: (ctxt ifNil: [#()] ifNotNil: [{ctxt}]) ].
]
on: OutOfScopeNotification
do: [ :ex | ex resume: true].
+
+ UIManager default
+ inform: ('<b>Expression</b>{1}<br>{2}<br><br><b>Time</b> (compile and execute)<br>{3} ms<br><br><b>Result</b><br>{4}' format: {
+ rcvr ifNil: [''] ifNotNil: [' (', (rcvr printString truncateWithElipsisTo: 20), ')'].
+ (code contents truncateWithElipsisTo: 200) copyReplaceAll: String cr with: '<br>'.
+ result printString.
+ v printString truncateWithElipsisTo: 100}) asTextFromHtml.!
-
- "We do not want to have large result displayed"
- valueAsString := v printString.
- (valueAsString size > 30) ifTrue: [valueAsString := (valueAsString copyFrom: 1 to: 30), '...'].
- PopUpMenu
- inform: 'Time to compile and execute: ', result printString, 'ms res: ', valueAsString.
- !
Marcel Taeumel uploaded a new version of Help-Squeak-TerseGuide to project The Trunk:
http://source.squeak.org/trunk/Help-Squeak-TerseGuide-mt.12.mcz
==================== Summary ====================
Name: Help-Squeak-TerseGuide-mt.12
Author: mt
Time: 13 August 2019, 3:51:04.988456 pm
UUID: 9ed56182-dfe0-c144-af89-d6c54ecdf8d4
Ancestors: Help-Squeak-TerseGuide-tpr.11
Do not style the introduction page in our Terse Guide.
=============== Diff against Help-Squeak-TerseGuide-tpr.11 ===============
Item was changed:
----- Method: TerseGuideHelp class>>introduction (in category 'pages') -----
introduction
"This method was automatically generated. Edit it using:"
"TerseGuideHelp edit: #introduction"
+ ^(HelpTopic
- ^HelpTopic
title: 'General'
contents:
'Allowable characters:
- a-z
- A-Z
- 0-9
- .+/\*~<>@%|&?
- blank, tab, cr, ff, lf
Variables:
- variables must be declared before use
- shared vars must begin with uppercase
- local vars must begin with lowercase
- reserved names: nil, true, false, self, super, and Smalltalk
Variable scope:
- Global: defined in Dictionary Smalltalk and accessible by all objects in system
- Special: (reserved) Smalltalk, super, self, true, false, & nil
- Method Temporary: local to a method
- Block Temporary: local to a block
- Pool: variables in a Dictionary object
- Method Parameters: automatic local vars created as a result of message call with params
- Block Parameters: automatic local vars created as a result of value: message call
- Class: shared with all instances of one class & its subclasses
- Class Instance: unique to each instance of a class
- Instance Variables: unique to each instance
"Comments are enclosed in quotes - like this"
Period (.) is the statement separator
+ !!' readStream nextChunkText)
+ key: #introduction;
+ shouldStyle: false;
+ yourself!
- !!' readStream nextChunkText!
Marcel Taeumel uploaded a new version of Help-Squeak-Project to project The Trunk:
http://source.squeak.org/trunk/Help-Squeak-Project-mt.69.mcz
==================== Summary ====================
Name: Help-Squeak-Project-mt.69
Author: mt
Time: 13 August 2019, 3:50:26.755456 pm
UUID: a1feb616-5715-7440-8289-dc9f29d7365f
Ancestors: Help-Squeak-Project-mt.68
Updates styling information for several help topics.
=============== Diff against Help-Squeak-Project-mt.68 ===============
Item was changed:
----- Method: SqueakTutorials class>>introduction (in category 'pages') -----
introduction
"This method was automatically generated. Edit it using:"
"SqueakTutorials edit: #introduction"
+ ^(HelpTopic
- ^HelpTopic
title: 'Introduction'
contents:
+ 'Here you will some short tutorials on how to use Squeak for daily tasks. Feel free to add your own.!!' readStream nextChunkText)
+ key: #introduction;
+ shouldStyle: false;
+ yourself!
- 'Here you will some short tutorials on how to use Squeak for daily tasks. Feel free to add your own.!!' readStream nextChunkText!
Item was changed:
----- Method: SqueakTutorials class>>usefulExpressions (in category 'pages') -----
usefulExpressions
+ ^ (HelpTopic
- ^ CodeStyledHelpTopic
title: 'Useful Expressions'
+ readOnlyContents: Utilities standardWorkspaceContents)
+ shouldStyle: true!
- readOnlyContents: Utilities standardWorkspaceContents!
Item was changed:
+ ----- Method: SqueakTutorialsCommandKey class>>bookName (in category 'accessing') -----
- ----- Method: SqueakTutorialsCommandKey class>>bookName (in category 'as yet unclassified') -----
bookName
^'Command Key Mappings'!
Item was changed:
+ ----- Method: SqueakTutorialsCommandKey class>>commandKeyMappings (in category 'pages') -----
- ----- Method: SqueakTutorialsCommandKey class>>commandKeyMappings (in category 'as yet unclassified') -----
commandKeyMappings
"This method was automatically generated. Edit it using:"
"SqueakTutorialsCommandKey edit: #commandKeyMappings"
^(HelpTopic
title: 'Command Key Mappings'
contents:
'Lower-case command keys
(use with Cmd key on Mac and Alt key on other platforms)
a Select all
b Browse it (selection is a class name or cursor is over a class-list or message-list)
c Copy selection
d Do it (selection is a valid expression)
e Exchange selection with prior selection
f Find text with a dialog
g Find the current selection again
j Repeat the last selection replacement
i Inspect it
k Set font
l Cancel text edit
m Implementors of it
n Senders of it
o Spawn current method
p Print it (selection is a valid expression)
q Query symbol (toggle all possible completion for a given prefix)
s Save (i.e. accept)
t Finds a Transcript (when cursor is over the desktop)
u Toggle alignment
v Paste
w Select/Delete preceding word (over text); Close-window (over morphic desktop)
x Cut selection
y Swap characters
z Undo
Note: for Do it, Senders of it, etc., a null selection will be expanded to a word or to the current line in an attempt to do what you want. Also note that Senders/Implementors of it will find the outermost keyword selector in a large selection, as when you have selected a bracketed expression or an entire line. Finally note that the same cmd-m and cmd-n (and cmd-v for versions) work in the message pane of most browsers.
Upper-case command keys
(use with Shift-Cmd, or Ctrl on Mac
or Shift-Alt on other platforms; sometimes Ctrl works too)
A Advance argument
B Browse it in this same browser (in System browsers only)
C Compare the selected text to the clipboard contents
D Debug-It
E Method strings containing it
F Insert ''ifFalse:''
G fileIn from it (a file name)
H Move cursor to top/home of text
I Inspect via Object Explorer
J Again many (apply the previous text command repeatedly until the end of the text)
K Set style
L Opens a FileList, bringing forward on that already exists if appropriate
M Select current type-in
N References to it (selection is a class name, or cursor is over a class-list or message-list)
O Open single-message browser (in message lists)
P Make project link
R opens a Recent Submissions browser
S Pretty-print a method in the current browser
T Insert ''ifTrue:''
U Convert linefeeds to carriage returns in selection
V Paste author''s initials
W Selectors containing it (in text); show-world-menu (when issued with cursor over desktop)
X Force selection to lowercase
Y Force selection to uppercase
Z Redo
Other special keys
Backspace Backward delete character
Shift-Bksp Backward select or delete word
Del Forward delete character
Shift-Del Forward delete word
Esc Pop up the context menu
Shift+Esc Pop up the World Menu
Cmd+Esc Close the active window
Ctrl+Esc Present a list of open windows
Cmd+\ Send the active window to the back
Tab Insert a tab char in a single-line selection or insert a tab at the beginning of each line in a multi-line selection
Shift-Tab Remove a tab from the beginning of each line in the selection
Shift-Cmd-_ (underscore) condense selection into one line
Cursor keys
left, right,
up, down Move cursor left, right, up or down
Ctrl-left Move cursor left one word
Ctrl-right Move cursor right one word
Home Move cursor to begin of line or begin of text
End Move cursor to end of line or end of text
PgUp, Ctrl-up Move cursor up one page
PgDown, Ctrl-Dn Move cursor down one page
Note all these keys can be used together with Shift to define or enlarge the selection. You cannot however shrink that selection again, as in some other systems.
Other Cmd-key combinations (not available on all platforms)
Return Insert return followed by as many tabs as the previous line
(with a further adjustment for additional brackets in that line)
Space Select the current word as with double clicking
Enclose the selection in a kind of bracket. Each is a toggle.
(not available on all platforms)
Ctrl-( Toggle enclosure within parentheses
Cmd-[ Toggle enclosure within brackets
Crtl-{ Toggle enclosure within curly braces
Ctrl-'' Toggle enclosure within double-quotes
Cmd-'' Toggle enclosure within single-quotes
Note also that you can double-click just inside any of the above delimiters, or at the beginning or end of a line, to select the text enclosed.
Text Emphasis
(not available on all platforms)
Cmd-1 type the first method argument
Cmd-2 type the second method argument
Cmd-3 type the third method argument
Cmd-4 type the fourth method argument
Cmd-5 for future use
Cmd-6 color, action-on-click, link to class comment, link to method, url
Brings up a menu. To remove these properties, select
more than the active part and then use command-0.
Cmd-7 bold
Cmd-8 italic
Cmd-9 negative kern (letters 1 pixel closer)
Cmd-0 make plain (removes all emphasis and kerning)
Cmd-- underlined
Cmd-= struck out
Docking Bar
Ctrl-<n> opens the n-th (where n is between 0 and 7) menu if such exists, otherwise it moves the keyboard focus to the Search Bar. Currently this means:
Ctrl-0 Activates Search Bar or Scratch Pad
Ctrl-1 Squeak menu
Ctrl-2 Projects menu
Ctrl-3 Tools menu
Ctrl-4 Apps menu
Ctrl-5 Extras menu
Ctrl-6 Windows menu
Ctrl-7 Help menu
!!' readStream nextChunkText)
+ key: #commandKeyMappings;
+ shouldStyle: false!
- key: #commandKeyMappings!
Item was changed:
+ ----- Method: SqueakTutorialsCommandKey class>>pages (in category 'accessing') -----
- ----- Method: SqueakTutorialsCommandKey class>>pages (in category 'as yet unclassified') -----
pages
^# (commandKeyMappings)!
Item was changed:
+ ----- Method: SqueakTutorialsOnImage class>>bookName (in category 'accessing') -----
- ----- Method: SqueakTutorialsOnImage class>>bookName (in category 'as yet unclassified') -----
bookName
^'The Squeak Image'!
Item was changed:
+ ----- Method: SqueakTutorialsOnImage class>>pages (in category 'accessing') -----
- ----- Method: SqueakTutorialsOnImage class>>pages (in category 'as yet unclassified') -----
pages
^# (theImage)!
Item was changed:
+ ----- Method: SqueakTutorialsOnImage class>>theImage (in category 'pages') -----
- ----- Method: SqueakTutorialsOnImage class>>theImage (in category 'as yet unclassified') -----
theImage
"This method was automatically generated. Edit it using:"
"SqueakTutorialsOnImage edit: #theImage"
^(HelpTopic
title: 'Working with the Squeak Image'
contents:
'Working with the ecosystem of objects in a Smalltalk image.
The basic tool for this is called an Inspector. Whenever you have an expression, like "3 + 4", you press cmd-i to "inspect it", which opens an inspector on the result. This works in any text area. Try for example inspecting "self" in a class browser, and you will inspect the underlying class object (which the browser shows a high-level view of).
In the Inspector you see the objects referenced by this object (via instance variables or indexed fields) in the left panel. Select any of them and choose "inspect" from the context menu (or press cmd-i again). This way you can inspect all the objects in the system.
A more modern tool than the Inspector (which was around 40 years ago already) is the Object Explorer. It presents you a tree view of an object and its "children", which again are the instance variables and indexed fields of the object. Open it with cmd-shift-i (or "explore" in the context menu).
You can also do the reverse. If you choose "objects pointing to this value" you get an inspector showing all the objects that directly point to this object. Similarly there is a "reverse explorer", which you can open by selecting "explore pointers".
There are two roots to all the objects in the system:
Smalltalk specialObjectsArray
which basically holds everything the Virtual Machine needs to know about, and in turn almost every object in the whole image, and
thisContext
which is the current execution context, holding onto temporary objects. When a garbage collection is performed, any object not reachable form either of these two roots is removed from memory.
An "interesting" global object to explore is
Project current
which holds your current workspace, in particular
Project current world
, the root of all morphs in the world. And of course
Smalltalk
itself is the dictionary that holds all global objects, including all classes (unless they are defined in a non-global environment).
There is also a low-level way to enumerate all objects in memory. "self someObject" will return the very first object in memory (which happens to be the nil object), and "anObject nextObject" will return the next one:
| object count |
count := 0.
object := self someObject.
[0 == object]
whileFalse: [count := count + 1.
object := object nextObject].
count
Interestingly, this also finds objects that are due to be garbage-collected. For example, if you accidentally closed a text window, there is a good chance its contents will still be in memory, and can be retrieved using an expression like
ByteString allInstances last: 10
This makes use of the someInstance/nextInstance methods, which are similar to someObject/nextObject, but restricted to instances of one class only.
!!
]style[(59 2838)bi,!!' readStream nextChunkText)
+ key: #theImage;
+ shouldStyle: false!
- key: #theImage!
Item was added:
+ ----- Method: SqueakTutorialsOnImage class>>usesCodeStyling (in category 'testing') -----
+ usesCodeStyling
+ ^ false!
Item was added:
+ ----- Method: SqueakTutorialsOnXML class>>usesCodeStyling (in category 'testing') -----
+ usesCodeStyling
+ ^ false!
Marcel Taeumel uploaded a new version of HelpSystem-Core to project The Trunk:
http://source.squeak.org/trunk/HelpSystem-Core-mt.115.mcz
==================== Summary ====================
Name: HelpSystem-Core-mt.115
Author: mt
Time: 13 August 2019, 3:48:06.739456 pm
UUID: 4822b284-b8db-9247-b474-e1b5d4fb64d7
Ancestors: HelpSystem-Core-mt.114
Be able to override code styling in help topics. This is useful if you have one introductory page besides a page with source code.
There is no need for CodeStyledHelpTopic anymore. Remove or deprecate? See SqueakTutorials class >> #usefulExpressions .
=============== Diff against HelpSystem-Core-mt.114 ===============
Item was changed:
----- Method: ClassBasedHelpTopic>>accept:for: (in category 'editing') -----
accept: newContents for: subtopic
"Supports indirect content storage in classes other than helpClass."
| topicClass topicMethodSelector code indirect |
(indirect := subtopic contentsAsIs isMessageSend)
ifFalse: [
topicClass := self helpClass.
topicMethodSelector := subtopic key asLegalSelector asSymbol]
ifTrue: [
topicClass := subtopic contentsAsIs receiver.
topicMethodSelector := subtopic contentsAsIs selector].
code := String streamContents:[:s|
s nextPutAll: topicMethodSelector.
s crtab; nextPutAll: '"This method was automatically generated. Edit it using:"'.
s crtab; nextPutAll: '"', self helpClass name,' edit: ', subtopic key storeString,'"'.
indirect ifTrue: [s crtab; nextPutAll: '^ ('] ifFalse: [
s crtab; nextPutAll: '^(HelpTopic'.
s crtab: 2; nextPutAll: 'title: ', subtopic title storeString.
s crtab: 2; nextPutAll: 'contents: '].
s cr; nextPutAll: (String streamContents:[:c| c nextChunkPutWithStyle: newContents]) storeString.
s nextPutAll:' readStream nextChunkText)'.
indirect ifFalse: [
+ subtopic key ifNotNil: [s crtab: 3; nextPutAll: 'key: ', subtopic key storeString; nextPutAll: ';'].
+ subtopic shouldStyle ifNotNil: [s crtab: 3; nextPutAll: 'shouldStyle: ', subtopic shouldStyle storeString; nextPutAll: ';'].
+ s crtab: 3; nextPutAll: 'yourself']
- s crtab: 3; nextPutAll: 'key: ', subtopic key storeString].
].
topicClass class
compile: code
classified: ((topicClass class organization categoryOfElement: topicMethodSelector) ifNil:['pages']).!
Item was changed:
----- Method: ClassBasedHelpTopic>>updateSubtopics (in category 'updating') -----
updateSubtopics
"build a list of subtopics; start with the list of page names specified by the helpClass' #pages method, remembering that it is an ordered list of
- selectors that return a HelpTopic,
- or the name of a class that must in turn provide help topics etc. This allows for hierarchies with 'subtrees in the middle'.
The order of the pages reflects the order of the selectors and class names given.
Then all the subclasses that are not #ignore'd and not already included are added.
Finally the list of class names and messages is used to assemble the actual help topics.
Questions:
is it actually useful to include the possibility of class names as per the CustomHelpHelpBuilder>createTopicFrom: code?
is the #ignore testing worth keeping?"
| pages |
pages := (self helpClass pages collect: [:pageSelectorOrClassName |
(Smalltalk hasClassNamed: pageSelectorOrClassName asString)
ifTrue: [Smalltalk classNamed: pageSelectorOrClassName asString]
ifFalse: [pageSelectorOrClassName]]) asOrderedCollection.
self helpClass subclasses
select: [:cls | cls ignore not]
thenDo: [:cls | pages addIfNotPresent: cls].
^ subtopics := pages withIndexCollect: [:pageSelectorOrClass :priority |
pageSelectorOrClass isBehavior
+ ifFalse: [(self helpClass perform: pageSelectorOrClass)
+ priority: priority - pages size;
+ key: pageSelectorOrClass;
+ in: [:topic |
+ "Use my choice of styling if my subtopics do not care."
+ topic shouldStyle ifNil: [topic shouldStyle: self usesCodeStyling]];
+ yourself]
- ifFalse: [(self helpClass perform: pageSelectorOrClass) priority: priority - pages size; key: pageSelectorOrClass; yourself]
ifTrue: [pageSelectorOrClass asHelpTopic]]!
Item was added:
+ ----- Method: HelpBrowser>>aboutToStyle: (in category 'styling') -----
+ aboutToStyle: aStyler
+
+ ^ (self currentTopic ifNil: [self currentParentTopic]) usesCodeStyling!
Item was changed:
AbstractHelpTopic subclass: #HelpTopic
+ instanceVariableNames: 'title key icon contents subtopics priority isEditable shouldStyle'
- instanceVariableNames: 'title key icon contents subtopics priority isEditable'
classVariableNames: ''
poolDictionaries: ''
category: 'HelpSystem-Core-Model'!
!HelpTopic commentStamp: 'mt 3/25/2015 11:27' prior: 0!
This is a configurable version of a help topic. You can define its contents, title, icon, and subtopics manually.
Help builders make use of this.!
Item was added:
+ ----- Method: HelpTopic>>shouldStyle (in category 'accessing') -----
+ shouldStyle
+ ^ shouldStyle!
Item was added:
+ ----- Method: HelpTopic>>shouldStyle: (in category 'accessing') -----
+ shouldStyle: aBoolean
+ shouldStyle := aBoolean.!
Item was added:
+ ----- Method: HelpTopic>>usesCodeStyling (in category 'testing') -----
+ usesCodeStyling
+
+ ^ self shouldStyle ifNil: [false]!