ContextInspectorView.st
changeset 15591 3eee78f89c1e
parent 14616 671b0b0f3632
child 15596 c11cc9c2974d
child 16479 38ff09a72df0
equal deleted inserted replaced
15590:9723cf906e2c 15591:3eee78f89c1e
       
     1 "{ Encoding: utf8 }"
       
     2 
     1 "
     3 "
     2  COPYRIGHT (c) 1993 by Claus Gittinger
     4  COPYRIGHT (c) 1993 by Claus Gittinger
     3 	      All Rights Reserved
     5 	      All Rights Reserved
     4 
     6 
     5  This software is furnished under a license and may be used
     7  This software is furnished under a license and may be used
     8  be provided or otherwise made available to, or used by, any
    10  be provided or otherwise made available to, or used by, any
     9  other person.  No title to or ownership of the software is
    11  other person.  No title to or ownership of the software is
    10  hereby transferred.
    12  hereby transferred.
    11 "
    13 "
    12 "{ Package: 'stx:libtool' }"
    14 "{ Package: 'stx:libtool' }"
       
    15 
       
    16 "{ NameSpace: Smalltalk }"
    13 
    17 
    14 InspectorView subclass:#ContextInspectorView
    18 InspectorView subclass:#ContextInspectorView
    15 	instanceVariableNames:'inspectedContext names showingTemporaries argsOnly contextSize
    19 	instanceVariableNames:'inspectedContext names showingTemporaries argsOnly contextSize
    16 		workspaceVariableNamesInDoIts'
    20 		workspaceVariableNamesInDoIts'
    17 	classVariableNames:''
    21 	classVariableNames:''
   552 !
   556 !
   553 
   557 
   554 stringWithAllNames:names andValues:values
   558 stringWithAllNames:names andValues:values
   555     "helper for '-all local vars' and '-all workspace vars'"
   559     "helper for '-all local vars' and '-all workspace vars'"
   556 
   560 
   557     |s  maxLen varString|
   561     |outStream  maxLen varString|
   558 
   562 
   559     s := '' writeStream.
   563     outStream := CharacterWriteStream new.
   560     maxLen := (names collect:[:eachName | eachName size]) max.
   564     maxLen := (names collect:[:eachName | eachName size]) max.
   561 
   565 
   562     names with:values do:[:eachName :eachValue |
   566     names with:values do:[:eachName :eachValue |
   563         s nextPutAll:((eachName , ' ') paddedTo:maxLen+1 with:$.).
   567         outStream nextPutAll:((eachName , ' ') paddedTo:maxLen+1 with:$.).
   564         s nextPutAll:' : '.
   568         outStream nextPutAll:' : '.
   565 
   569 
   566         [
   570         [
   567             |s|
   571             |s|
   568 
   572 
   569             s := WriteStream on:(String new:10).
   573             s := CharacterWriteStream new.
   570             s writeLimit:100000.
   574             s writeLimit:100000.
   571             eachValue displayOn:s.
   575             eachValue displayOn:s.
   572             varString := s contents.
   576             varString := s contents.
   573 "/            varString := (self valueAtIndex:varIdx) displayString.
       
   574         ] on:Error do:[:ex |
   577         ] on:Error do:[:ex |
   575             varString := ('*** Error in displayString (%1)***' bindWith:ex description)
   578             varString := ('*** Error in displayString (%1)***' bindWith:ex description)
   576         ].
   579         ].
   577         varString := varString ? ''.
       
   578 
   580 
   579         (varString includes:Character cr) ifTrue:[
   581         (varString includes:Character cr) ifTrue:[
   580             varString := varString copyTo:(varString indexOf:Character cr)-1.
   582             varString := varString copyTo:(varString indexOf:Character cr)-1.
   581             varString := varString , '...'.
   583             varString := varString , '...'.
   582         ].
   584         ].
   583         s nextPutAll:varString.
   585         outStream nextPutAll:varString.
   584         s cr.
   586         outStream cr.
   585     ].
   587     ].
   586     ^ s contents
   588     ^ outStream contents
   587 !
   589 !
   588 
   590 
   589 stringWithAllWorkspaceValues
   591 stringWithAllWorkspaceValues
   590     "when clicked on '-all workspace vars'"
   592     "when clicked on '-all workspace vars'"
   591 
   593 
   745 ! !
   747 ! !
   746 
   748 
   747 !ContextInspectorView class methodsFor:'documentation'!
   749 !ContextInspectorView class methodsFor:'documentation'!
   748 
   750 
   749 version
   751 version
   750     ^ '$Header: /cvs/stx/stx/libtool/ContextInspectorView.st,v 1.97 2014-07-08 21:53:39 cg Exp $'
   752     ^ '$Header: /cvs/stx/stx/libtool/ContextInspectorView.st,v 1.98 2015-04-22 17:50:00 stefan Exp $'
   751 !
   753 !
   752 
   754 
   753 version_CVS
   755 version_CVS
   754     ^ '$Header: /cvs/stx/stx/libtool/ContextInspectorView.st,v 1.97 2014-07-08 21:53:39 cg Exp $'
   756     ^ '$Header: /cvs/stx/stx/libtool/ContextInspectorView.st,v 1.98 2015-04-22 17:50:00 stefan Exp $'
   755 ! !
   757 ! !
   756 
   758