eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'ChangesBrowser':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: ChangesBrowser


Inheritance:

   Object
   |
   +--GraphicsMedium
      |
      +--DisplaySurface
         |
         +--SimpleView
            |
            +--View
               |
               +--TopView
                  |
                  +--StandardSystemView
                     |
                     +--ChangesBrowser
                        |
                        +--ChangeSetBrowser

Package:
stx:libtool
Category:
Interface-Browsers
Version:
rev: 1.521 date: 2018/05/24 12:57:18
user: cg
file: ChangesBrowser.st directory: libtool
module: stx stc-classLibrary: libtool
Author:
Claus Gittinger

Description:


this implements a browser for the changes-file 
(actually, it can display any sourceFile's contents).
See the extra document 'doc/misc/cbrowser.doc' for how to use this browser.

written jan 90 by claus

This is a very old leftover class (it was one of the very first apps in ST/X
and the Merovingian has not yet detected this one ;-)

At the time this was originally written, I had a 2Mb machine, and every memory byte was a very valuable.
Therefore, the original did not keep any infos in memory, but instead kept a list of change-chunk file offsets,
and parsed the chunks over and over (eg. when searching for classname/selector etc.)
Later, when bigger memories became available, more and more infos where cached in additional arrays (classname,
selector, etc.) and those where finally condensed into a single changeInfo object.
However, now that really enough memory is avail, this is really no longer useful, and we should keep
changeSet entries instead (which hold the same info plus more).
The ChangeSetBrowser does exactly this, but does not support all of the fancy compress/delete etc.
operations of the ChangesBrowser, to which we got used so much.
Thus, this one kept on living its zombie life and gets occasional features added (sigh)...
(Well, like many workhorses, they become ugly when aged, but still do their duty)

It MUST eventually be completely replaced by the ChangeSetBrowser class in the near future.


[Class variables:]
    CompressSnapshotInfo            if true (the default), snapshot entries
                                    are also compressed in the compress function.
                                    Some users prefer them to be not compressed.
                                    Set it to false for this.

Notice:
    this needs a total rewrite, to build up a changeSet from the file
    (which did not exist when the ChangesBrowser was originally written)
    and manipulate that changeSet.

    This way, we get a browser for any upcoming incore changeSets for
    free. Also, this will put the chunk analysation code into Change and
    subclasses (where it belongs) and give a better encapsulation and
    overall structure. Do not take this as an example for good style ;-)

    The Change hierarchy is currently been completed, and the changes browser
    should be adapted soon.


Related information:

    [Using the ChangesBrowser]

Class protocol:

behavior
o  autoSelectNext
returning true here, makes a Delete operation automatically
select the next change

defaults
o  defaultIcon
return the browsers default window icon

o  defaultLabel

o  isVisualStartable
return true, if this application can be started via #open.
(to allow start of a change browser via double-click in the browser)

help specs
o  helpSpec

instance creation
o  openOn: aFilename
create & open a changes browser on a change file

menu specs
o  menuSpec
This resource specification was automatically generated
by the MenuEditor of ST/X.
usage example(s):
     MenuEditor new openOnClass:ChangesBrowser andSelector:#menuSpec
     (Menu new fromLiteralArrayEncoding:(ChangesBrowser menuSpec)) startUp

o  menuSpecBrowse
This resource specification was automatically generated
by the MenuEditor of ST/X.
usage example(s):
     MenuEditor new openOnClass:ChangesBrowser andSelector:#menuSpecBrowse
     (Menu new fromLiteralArrayEncoding:(ChangesBrowser menuSpecBrowse)) startUp

o  menuSpecChange
This resource specification was automatically generated
by the MenuEditor of ST/X.
usage example(s):
     MenuEditor new openOnClass:ChangesBrowser andSelector:#menuSpecChange
     (Menu new fromLiteralArrayEncoding:(ChangesBrowser menuSpecChange)) startUp

o  menuSpecFile
This resource specification was automatically generated
by the MenuEditor of ST/X.
usage example(s):
     MenuEditor new openOnClass:ChangesBrowser andSelector:#menuSpecFile
     (Menu new fromLiteralArrayEncoding:(ChangesBrowser menuSpecFile)) startUp

o  menuSpecHelp
This resource specification was automatically generated
by the MenuEditor of ST/X.
usage example(s):
     MenuEditor new openOnClass:ChangesBrowser andSelector:#menuSpecHelp
     (Menu new fromLiteralArrayEncoding:(ChangesBrowser menuSpecHelp)) startUp

o  menuSpecSearch
This resource specification was automatically generated
by the MenuEditor of ST/X.
usage example(s):
     MenuEditor new openOnClass:ChangesBrowser andSelector:#menuSpecSearch
     (Menu new fromLiteralArrayEncoding:(ChangesBrowser menuSpecSearch)) startUp

o  menuSpecSettings
This resource specification was automatically generated
by the MenuEditor of ST/X.
usage example(s):
     MenuEditor new openOnClass:ChangesBrowser andSelector:#menuSpecSettings
     (Menu new fromLiteralArrayEncoding:(ChangesBrowser menuSpecSettings)) startUp

o  toolbarMenuSpec
This resource specification was automatically generated
by the MenuEditor of ST/X.
usage example(s):
     MenuEditor new openOnClass:ChangesBrowser andSelector:#toolbarMenuSpec
     (Menu new fromLiteralArrayEncoding:(ChangesBrowser toolbarMenuSpec)) startUp

private-changeFile access
o  readXMLChangesFrom: aStream inBackground: inBackground
read an XML source file (format as in campSmalltalk DTD)

o  readXMLChangesFromFile: changeFileName inBackground: inBackground

utilities
o  isXMLFile: aFilename

o  methodDefinitionSelectors
Squeak support


Instance protocol:

aspects
o  applyInOriginalNameSpace

o  applyNotInOriginalNameSpace

o  autoCompare

o  autoUpdate
enabled/disable automatic update from the change-file (for monitoring)

o  autoloadAsRequired

o  canDeleteChanges
makes the delete buttons in the toolbar visible

o  changeListSelectionHolder

o  editingClassSource

o  hasMultiSelection

o  hasMultiSelectionHolder

o  hasNoMultiSelection

o  hasNoMultiSelectionHolder

o  hasNoSelection

o  hasSelection
true if a change is selected

o  hasSelectionHolder

o  hasSingleSelection

o  ignorePublicPrivateCategories

o  leftCodeLabel: aString
change the string shown above the left codeView (defaults to: 'Current')

o  leftCodeLabelHolder
holds the string shown above the left codeView (defaults to: 'Current')

o  notEditingClassSource

o  notEditingClassSourceAndNotReadOnly

o  notReadOnly

o  readOnly: aBoolean

o  rightCodeLabel: aString
change the string shown above the right codeView (defaults to: 'Change')

o  rightCodeLabelHolder
holds the string shown above the right codeView (defaults to: 'Change')

o  showingDiffs

o  showingDiffsDefault

o  theSingleSelection

o  updateChangeSet

compiler interface
o  wantChangeLog
sent by the compiler to ask if a changeLog entry should
be written when compiling. Return false here.

compiler interface-error handling
o  correctableError: aString position: relPos to: relEndPos from: aCompiler
compiler notifies us of an error - this should really not happen since
changes ought to be correct (did someone edit the changes file ??).
Show the bad change in the codeView and let codeView hilight the error;
no corrections allowed here therefore return false

o  correctableSelectorWarning: aString position: relPos to: relEndPos from: aCompiler
compiler notifies us of a warning

o  correctableWarning: aString position: relPos to: relEndPos from: aCompiler
compiler notifies us of an error - this should really not happen since
changes ought to be correct (did someone edit the changes file ??).
Show the bad change in the codeView and let codeView hilight the error;
no corrections allowed here therefore return false

o  error: aString position: relPos to: relEndPos from: aCompiler
compiler notifies us of an error - this should really not happen since
changes ought to be correct (did someone edit the changes file ??).
Show the bad change in the codeView and let codeView hilight the error

o  unusedVariableWarning: aString position: relPos to: relEndPos from: aCompiler
compiler notifies us of a (or some) unused variables;
hilight the error (relPos to relEndPos) and show a Box asking for continue/correct/abort;
this method should return true to the compiler if user wants the error
to be corrected; false otherwise

o  warning: aString position: relPos to: relEndPos from: aCompiler
compiler notifies us of a warning - ignore it

event handling
o  handlesKeyPress: key inView: view
this method is reached via delegation: are we prepared to handle
a keyPress in some other view ?

o  keyPress: key x: x y: y view: view
this method is reached via delegation from the changeListView

help
o  showActivity: someMessage
some activityNotification to be forwarded to the user;
show it in the windows title area here.

initialization & release
o  autoCompareChanged
sent from the compare-toggle

o  changeListMenu
return the menu for the change (upper) list

o  destroy
destroy the receiver; make certain, that boxes are destroyed too

o  initialize
oldStyle := true.

o  postRealize
(comment from inherited method)
postRealize actions - tell the application (if any).

o  pullDownMenu
return the top (pullDown) menu

o  setupTabSpec

o  toolbarMenu
return the top (pullDown) menu

o  update: what with: aParameter from: changedObject
smalltalk is about to shut down -
- if change list was modified, ask user and save if requested.

menu actions
o  doApply
user wants a change to be applied

o  doApplyAll
user wants all changes to be applied

o  doApplyClassFromBeginning
user wants all changes for this class from 1 to changeNr to be applied

o  doApplyClassRest
user wants all changes for this class from changeNr to be applied

o  doApplyFromBeginning
user wants all changes from 1 to changeNr to be applied

o  doApplyRest
apply all changes from changeNr to the end

o  doApplyToConflictOrEnd
apply all changes from changeNr to either a conflict (i.e. method exists)
or the end.

o  doBrowse
user wants a browser on the class of a change

o  doBrowseImplementors
open an implementors-browser

o  doBrowseSenders
user wants a browser on the class of a change

o  doCheckinAndDeleteClassAll
first checkin the selected changes class then delete all changes
for it.

o  doCleanup
cleanup the changefile/changeset.
actions done:
- from the end, find changes which are equal to the current version
and not in the current changeset (i.e. represents the current version as built from CVS).
Then delete it incl. previous versions of it.

o  doCompare
compare change with current system version

o  doCompareAndCompress
remove all changes, which are equivalent to the current image version

o  doCompress
compress the change-set; this replaces multiple method-changes by the last
(i.e. the most recent) change

o  doCompressClass
compress changes for the selected class.
this replaces multiple method-changes by the last (i.e. the most recent) change.

o  doCompressSelector
compress changes for the selected class & selector.
this replaces multiple method-changes by the last (i.e. the most recent) change.

o  doCopyToClipboard
user wants a change text to be copied to the clipboard

o  doDelete
delete currently selected change(s)

o  doDeleteAllForNamespace
delete all changes for classes with same namespace as currently selected change

o  doDeleteAndSelectPrevious
delete currently selected change(s)

o  doDeleteClassAll
delete all changes with same class as currently selected change

o  doDeleteClassAndPrivateClassesAll
delete all changes with same class and private classes
as currently selected change

o  doDeleteClassFromBeginning
delete changes with same class as currently selected change from the beginning
up to the selected change.
Useful to get rid of obsolete changes before a fileout or checkin entry.

o  doDeleteClassRest
delete rest of changes with same class as currently selected change

o  doDeleteClassSelectorAll
delete all changes with same class and selector as currently selected change

o  doDeleteClassSelectorOlder
delete this and older changes with same class and selector as currently selected change(s)

o  doDeleteFromBeginning
delete all changes from 1 to the current

o  doDeleteRest
delete all changes from current to the end

o  doFileoutAndDeleteClassAll
first fileOut the selected changes class then delete all changes
for it.

o  doMakePatch
user wants a change to be made a patch
- copy it over to the patches file

o  doMakePermanent
user wants a change to be made permanent
- rewrite the source file where this change has to go

o  doSave
user wants a change to be appended to a file

o  doSaveClass
user wants changes for some class from current to end to be appended to a file

o  doSaveClassAll
user wants changes for some class from current to end to be appended to a file

o  doSaveClassFrom: startNr
user wants changes from current to end to be appended to a file

o  doSaveClassRest
user wants changes for some class from current to end to be appended to a file

o  doSaveRest
user wants changes from current to end to be appended to a file

o  doUpdate
reread the changes-file

o  doWriteBack
write back the list onto the changes file

o  findClass
findClass menu action: let user enter a classes name, and select the next change for that class

o  findFirstForClass
findNextForClass menu action: select the next change for the selected changes class

o  findFirstForClass: className
findNextForClass menu action: select the next change for the selected changes class

o  findLastForClass
findPreviousForClass menu action: select the previous change for the selected changes class

o  findLastForClass: className
findPreviousForClass menu action: select the previous change for the selected changes class

o  findLastSnapshot
findLastSnapshot menu action: select the last change which is for a snapShot-image save action

o  findNext
findNext menu action: select the next change.
Searches for what the last search was for; i.e. either same class or same selector

o  findNextDifference
same

o  findNextForClass
findNextForClass menu action: select the next change for the selected changes class

o  findNextForClass: className startingAt: startNr
findNextForClass menu action: select the next change for the selected changes class

o  findNextForClassStartingAt: startNr
findNextForClass menu action: select the next change for the selected changes class

o  findNextForSelector
findNextForSelector menu action: select the next change for the selected changes selector

o  findNextForString

o  findNextForWhich: aBlock
helper: select the next change for which aBlock evaluates to true

o  findNextForWhich: aBlock startingAt: changeNrToStartSearch
helper: select the next change for which aBlock evaluates to true

o  findNextOrPrevious: direction forWhich: aBlock startingAt: changeNrToStartSearch
helper: find and select the next or previous change for which aBlock evaluates to true

o  findNextSnapshot
findNextSnapshot menu action: select the next change which is for a snapShot-image save action

o  findNextWithString: searchString

o  findPrevious
findPrevious menu action: select the previous change.
Searches for what the last search was for; i.e. either same class or same selector

o  findPreviousDifference
same

o  findPreviousForClass
findPreviousForClass menu action: select the previous change for the selected changes class

o  findPreviousForClass: className startingAt: startNr
findPreviousForClass menu action: select the previous change for the selected changes class

o  findPreviousForClassStartingAt: startNr
findPreviousForClass menu action: select the previous change for the selected changes class

o  findPreviousForSelector
findPreviousForSelector menu action: select the previous change for the selected changes selector

o  findPreviousForString

o  findPreviousForWhich: aBlock
helper: select the previous change for which aBlock evaluates to true

o  findPreviousForWhich: aBlock startingAt: changeNrToStartSearch
helper: select the previous change for which aBlock evaluates to true

o  findPreviousSnapshot
findPreviousSnapshot menu action: select the previous change which is for a snapShot-image save action

o  findPreviousWithString: searchString

o  findSelector
findSelector menu action: let user enter a selector, and select the next change for that selector

o  findString

o  ignorePublicPrivateCategories: aBoolean

o  menuExit

o  openAboutThisApplication
opens an about box for this application.

o  openHTMLDocument: relativeDocPath

o  openSettingsDialog
#('Syntax Color' #'AbstractSettingsApplication::SyntaxColorSettingsAppl' )

o  setEnforcedNameSpace

o  setEnforcedPackage
Smalltalk allClassesDo:[:eachClass |

o  showAboutSTX

private
o  autoSelect: changeNr
select a change

o  autoSelectLast
select the last change

o  autoSelectOrEnd: changeNr
select the next change or the last

o  changeChunkAt: index
^ changeChunks at:index

o  changeClassNameAt: index

o  checkClassIsLoaded: aClass
check for and warn if a class is unloaded (helper for compare-change)

o  checkSingleSelectedChange
just a helper, check for a single selection

o  classFromEvaluatingTree: aParseTree

o  clearCodeView
clear the (lower) code view.

o  currentSourceForParseTree: parseTree
thisClass := self classFromEvaluatingTree:receiver receiver.

o  isChangeSetBrowser

o  makeDiffViewInvisible

o  makeDiffViewVisible

o  nameSpaceForApply

o  newLabel: how

o  parseExpression: chunk
parse an expression; return a parseTree

o  parseExpression: text inNameSpace: nameSpace
parse an expression; return a parseTree
usage example(s):
^ Parser parseExpression:text inNameSpace:nameSpace.

o  queryCloseText
made this a method for easy redefinition in subclasses

o  selectChange: changeNr

o  selectedClassNames

o  setChangeList
update the selection-list;
called after the changeList has been modified

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  setSingleSelection: changeNr

o  showNumberOfChanges

o  sourceOfChange: changeNr

o  timeStampPrintStringOf: ts
self basicNew timeStampPrintStringOf:(Timestamp now)

o  unselect
common unselect

o  updateChangeList
update the selection-list;
called after the changeList has been modified

o  withSelectedChangesDo: aBlock
just a helper, check for a selected change and evaluate aBlock
with busy cursor

o  withSelectedChangesInOrder: order do: aBlock
just a helper, check for a selected change and evaluate aBlock
with busy cursor

o  withSelectedChangesReverseDo: aBlock
just a helper, check for a selected change and evaluate aBlock
with busy cursor

o  withSingleSelectedChangeDo: aBlock
just a helper, check for a single selection, and evaluate aBlock
with busy cursor

private-change access
o  changeIsFollowupMethodChange: changeNr
return true, if a change is a followup change (i.e. a followup change
in a bunch of methodsFor-changes)

o  changeIsSnapShotInfo: changeNr
return true, if a change is a snapShot info chunk

o  classNameFromAttributeChangeParseTree: aParseTree
mhmh - seems to always return the name of the nonMeta class - is this OK?

o  classNameFromClassDefinitionChange: changeNr
must parse the full changes text, to get privacy information.

o  classNameFromReceiverInParseTree: aParseTree
extrat the class name from a method-change, methodRemove or comment-change's
parse tree

o  classNameFromRemoveClassParseTree: aParseTree
tree is: Smalltalk removeClass: class

o  classNameFromRenameClassParseTree: aParseTree
tree is: Smalltalk renameClass: oldClass to: 'newName'

o  classNameOfChange: changeNr
return the classname of a change
(for classChanges (i.e. xxx class), the non-metaClassName (i.e. xxx) is returned)

o  extractSelectorOfMethodChange: changeNr
return a method-changes selector, or nil if it's not a methodChange

o  fullClassNameOfChange: changeNr
return the full classname of a change
(for classChanges (i.e. xxx class), a string ending in ' class' is returned.

o  namespaceOfChange: changeNr
return the namespace of a change or nil

o  numberOfChanges

o  ownerClassNameOfChange: changeNr
return the owner classname of a change
For a normal class, this is the className;
for a private class, this is the name of the owning class

o  realClassNameOfChange: changeNr
return the classname of a change.
- since parsing ascii methods is slow, keep result cached in
changeClassNames for the next query

o  selectorOfMethodCategoryChange: changeNr
return a methodCategory-change's selector,
or nil if it's not a methodCategoryChange

o  selectorOfMethodChange: changeNr
return a method-change's selector,
or nil if it's not a methodChange

o  sourceOfMethodChange: changeNr
return a method-changes source code, or nil if it's not a methodChange.

o  streamForChange: changeNr
answer a stream for change

private-changeFile access
o  changeFileName: aFileName
set the name of the changeFile

o  checkIfFileHasChanged
check if the changeFile has been modified since the last check;
install a timeout for rechecking after some time.

o  readChangesFile
read the changes file, create a list of header-lines (changeChunks)
and a list of chunk-positions (changePositions)

o  readChangesFileInBackground: inBackground
read the changes file, create a list of header-lines (changeChunks)
and a list of chunk-positions (changePositions).
Starting with 2.10.3, the entries are multi-col entries;
the cols are:
1 delta (only if comparing)
'+' -> new method (w.r.t. current state)
'-' -> removed method (w.r.t. current state)
'?' -> class does not exist currently
'=' -> change is the same as current methods source
'~' -> change is almost the same as current methods source
2 class/selector
3 type of change
doit
method
category change
4 timestamp

since comparing slows down startup time, it is now disabled by
default and can be enabled via a toggle.

o  writeBackChanges
write back the changes file. To avoid problems when the disk is full
or a crash occurs while writing (well, or someone kills us),
first write the stuff to a new temporary file. If this works ok,
rename the old change-file to a .bak file and finally rename the
tempfile back to the change-file.
That way, if anything happens, either the original file is left unchanged,
or we have at least a backup of the previous change file.

private-user interaction ops
o  appendChange: changeNr toFile: aFileNameOrFileNameString
append change to a file. return true if ok.

o  applyChange: changeNr
fileIn a change.
Answer true, if everything went ok.

o  compareCategoryChange: parseTree

o  compareChange: changeNr
compare a change with the current (in-image) version;
show the result of the compare (as dialog)

o  compareChange: changeNr showResult: doShowResult
compare a change with current version.
Return the result of the compare
same -> true,
different -> false,
uncomparable -> nil.
If doShowResult is true, the outcome is shown in a dialog/diffViewer.

o  compareCommentChange: parseTree

o  compareInstanceVariableNamesChange: parseTree

o  compareMethodSource: newSource withVersionInClass: thisClass into: aThreeArgBlock
returns true/false/nil if same,different,undecided;
also provides a message and a beep-boolean via the passed in block

o  comparePackageChange: parseTree

o  compareRemoveSelectorChange: parseTree

o  compressForClass: aClassNameOrNil
compress the change-set;
this replaces multiple method-changes by the last (i.e. the most recent) change.
If the class argument is nil, compress for all classes.
otherwise, only changes for that class are compressed.

o  compressForClass: aClassNameOrNil selector: selectorToCompressOrNil
compress the change-set;
this replaces multiple method-changes by the last (i.e. the most recent) change.
If the class argument is nil, compress for all classes.
otherwise, only changes for that class are compressed.

o  deleteChange: changeNr
delete a change

o  deleteChangesFrom: start to: stop
delete a range of changes

o  makeChangeAPatch: changeNr
append change to patchfile

o  makeChangePermanent: changeNr
rewrite the source file where change changeNr lies

o  silentDeleteChange: changeNr
delete a change do not update changeListView

o  silentDeleteChangesFor: aClassName from: start to: stop
delete changes for a given class in a range.
Return the number of deleted changes.

o  silentDeleteChangesFor: aClassName selector: selector from: start to: stop
delete changes for given class/selector in a range.
Return the number of deleted changes.

o  silentDeleteChangesForClassAndPrivateClasses: aClassName from: start to: stop
delete changes for a given class and its private classes in a range.
Return the number of deleted changes.

o  silentDeleteChangesForNamespace: aNamespace from: start to: stop
delete changes for a given namespace in a range.
Return the number of deleted changes.

o  silentDeleteInternalChange: changeNr
delete a change do not update changeListView

o  silentDeleteMethodCategoryChangesFor: aClassName selector: selector from: start to: stop
delete method category changes for given class/selector in a range.
Return the number of deleted changes.

o  silentDeleteMethodChangesFor: aClassName selector: selector from: start to: stop
delete method changes for given class/selector in a range.
Return the number of deleted changes.

o  updateDiffView

o  updateDiffViewFor: changeNr
not a method-change

termination
o  askIfChangesAreToBeWrittenBack

o  closeRequest
window manager wants us to go away

o  saveAndTerminate
update the changes file and quit.
Don't depend on this being sent, not all window managers
send it; instead, they simply destroy the view.

user interaction
o  askForSearch: msg initialAnswer: initial thenSearchUsing: searchBlock2 onCancel: cancelBlock

o  askForSearchString: msg initialAnswer: initial directionInto: aValueHolder
common code to open a search box
usage example(s):
     self new askForSearchString:'foo' initialAnswer:'bla' directionInto:(false asValue)

o  autoUpdate: aBoolean
enabled/disable automatic update from the change-file (for monitoring)

o  autoloadAsRequired: aBoolean
enabled/disable automatic load of unloaded classes

o  changeSelection: lineNrCollection
show a change in the codeView

o  classOfChange: changeNr
self warn:msg.

o  classOfChange: changeNr ifAbsent: exceptionBlock
answer the class that is subject to the change at changeNr.
The classes owning class may be autoloaded, if autoloadAsRequired is true.

o  doubleClickOnChange: lineNr
action performed when a change-list entry is doubleClicked

o  noChangesAllowed
show a warning that changes cannot be changed

o  saveClass: aClassName from: startNr
user wants changes from current to end to be appended to a file

o  selectionChanged

o  updateInfoAfterChangedSelection
update the info label

o  updateSourceCodeAfterChangedSelection
show a change in the codeView


Private classes:

    ChangeFileReader
    ChangeInfo

Demonstration:


    ChangesBrowser open



ST/X 7.1.0.0; WebServer 1.663 at exept.de:8081; Wed, 19 Sep 2018 11:10:46 GMT