Workspace.st
author Claus Gittinger <cg@exept.de>
Thu, 19 Feb 2004 15:22:58 +0100
changeset 2893 b96a8967378e
parent 2867 4d21f141d0c9
child 2922 70e3f3ec7980
permissions -rw-r--r--
initial value of #autoDefine was not set correctly
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     1
"
5
claus
parents: 3
diff changeset
     2
 COPYRIGHT (c) 1989 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 58
diff changeset
     3
	      All Rights Reserved
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     4
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    11
"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    12
2277
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
    13
"{ Package: 'stx:libwidg' }"
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
    14
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    15
TextCollector subclass:#Workspace
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
    16
	instanceVariableNames:'doItAction codeStartPosition errorFgColor errorBgColor
2679
1e61847e26f4 autoDefine as doIt added
Claus Gittinger <cg@exept.de>
parents: 2663
diff changeset
    17
		commentStrings autoDefineWorkspaceVariables simulatedSelf
1e61847e26f4 autoDefine as doIt added
Claus Gittinger <cg@exept.de>
parents: 2663
diff changeset
    18
		autoDefineVariables'
2492
740174c1be0f allow separate bg-color from styleSheet
Claus Gittinger <cg@exept.de>
parents: 2489
diff changeset
    19
	classVariableNames:'DefaultViewBackground DefaultErrorForegroundColor
2657
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
    20
		DefaultErrorBackgroundColor WorkspaceVariables DoItHistory'
257
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
    21
	poolDictionaries:''
2097
66d564e3752a category change
Claus Gittinger <cg@exept.de>
parents: 1968
diff changeset
    22
	category:'Interface-Smalltalk'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    23
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    24
32
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
    25
!Workspace class methodsFor:'documentation'!
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
    26
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    27
copyright
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    28
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    29
 COPYRIGHT (c) 1989 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 58
diff changeset
    30
	      All Rights Reserved
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    31
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    32
 This software is furnished under a license and may be used
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    33
 only in accordance with the terms of that license and with the
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    34
 inclusion of the above copyright notice.   This software may not
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    35
 be provided or otherwise made available to, or used by, any
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    36
 other person.  No title to or ownership of the software is
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    37
 hereby transferred.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    38
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    39
!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    40
32
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
    41
documentation
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
    42
"
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
    43
    a view for editable text which can evaluate expressions.
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    44
    I.e. its basically a view for editable text, with added
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    45
    'doIt', 'printIt' and 'inspectIt' functions on the popup-menu.
125
claus
parents: 123
diff changeset
    46
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    47
    The action to be performed on doIt is defined by a block,
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
    48
    which can be defined by the owner of this view.
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    49
    (thus you can put a workspace into more complex widgets, and
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    50
     control what should happen on 'doIt').
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
    51
578
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    52
    A useful default action is automatically defined, which simply 
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    53
    evaluates the selection as a smalltalk expression. 
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    54
    (but, a lisp or prolog workspace would define its own action,
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    55
     to call for another compiler/interpreter  ...)
32
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
    56
123
claus
parents: 121
diff changeset
    57
claus
parents: 121
diff changeset
    58
    Caveat:
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
    59
        in this version, Workspace does not yet support doIt in MVC setups.
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
    60
        For now, simulate this by setting the doItAction, to notify the
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
    61
        model manually about the doIt.
123
claus
parents: 121
diff changeset
    62
claus
parents: 121
diff changeset
    63
578
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    64
    [instance variables:]
32
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
    65
121
claus
parents: 119
diff changeset
    66
      doItAction      <Block>         block to evaluate for doIt
123
claus
parents: 121
diff changeset
    67
121
claus
parents: 119
diff changeset
    68
      errorFgColor    <Color>         fg-Color to be used when highlighting errors 
claus
parents: 119
diff changeset
    69
claus
parents: 119
diff changeset
    70
      errorBgColor    <Color>         bg-Color to be used when highlighting errors
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
    71
578
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    72
      codeStartPosition               private temporary
121
claus
parents: 119
diff changeset
    73
578
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    74
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    75
    [styleSheet values:]
121
claus
parents: 119
diff changeset
    76
claus
parents: 119
diff changeset
    77
      codeErrorSelectionForegroundColor     fg color to highlight errors
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
    78
                                            (default: selection fg)
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
    79
121
claus
parents: 119
diff changeset
    80
      codeErrorSelectionBackgroundColor     bg color to highlight errors
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
    81
                                            (default: selection bg)
578
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    82
1522
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
    83
    [start with:]
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
    84
        Workspace open
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
    85
578
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    86
    [see also:]
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    87
        Workspace EditTextView 
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    88
        Parser ByteCodeCompiler
583
2ec13b7ceba5 documentation
Claus Gittinger <cg@exept.de>
parents: 578
diff changeset
    89
2ec13b7ceba5 documentation
Claus Gittinger <cg@exept.de>
parents: 578
diff changeset
    90
    [author:]
2ec13b7ceba5 documentation
Claus Gittinger <cg@exept.de>
parents: 578
diff changeset
    91
        Claus Gittinger
32
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
    92
"
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    93
! !
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    94
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    95
!Workspace class methodsFor:'defaults'!
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    96
1522
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
    97
defaultLabel
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
    98
    "my default window label"
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
    99
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   100
    ^ 'Workspace'
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   101
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   102
    "Created: / 16.5.1998 / 16:53:37 / cg"
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   103
!
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   104
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   105
updateStyleCache
444
ef26eba8c854 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 430
diff changeset
   106
    "extract values from the styleSheet and cache them in class variables"
ef26eba8c854 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 430
diff changeset
   107
1354
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
   108
    <resource: #style (#'codeErrorSelection.foregroundColor'
2492
740174c1be0f allow separate bg-color from styleSheet
Claus Gittinger <cg@exept.de>
parents: 2489
diff changeset
   109
                       #'codeErrorSelection.backgroundColor'
740174c1be0f allow separate bg-color from styleSheet
Claus Gittinger <cg@exept.de>
parents: 2489
diff changeset
   110
                       #'codeView.backgroundColor' )>
444
ef26eba8c854 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 430
diff changeset
   111
1354
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
   112
    DefaultErrorForegroundColor := StyleSheet colorAt:'codeErrorSelection.foregroundColor'.
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
   113
    DefaultErrorBackgroundColor := StyleSheet colorAt:'codeErrorSelection.backgroundColor'.
2492
740174c1be0f allow separate bg-color from styleSheet
Claus Gittinger <cg@exept.de>
parents: 2489
diff changeset
   114
    DefaultViewBackground := StyleSheet colorAt:'codeView.backgroundColor'.
32
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
   115
! !
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
   116
2776
17dca7ff1f82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2775
diff changeset
   117
!Workspace class methodsFor:'getting a new Workspace'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   118
32
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
   119
open
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   120
    "launch a new workspace"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   121
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   122
    |scr topView workspace f|
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   123
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   124
    topView := StandardSystemView 
1522
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   125
                label:(self classResources string:(self defaultLabel)) 
1901
b3556ff49778 removed minExtent - let topView decide.
Claus Gittinger <cg@exept.de>
parents: 1738
diff changeset
   126
                " minExtent:(100 @ 100)".
23
69f1ba57f67a *** empty log message ***
claus
parents: 15
diff changeset
   127
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   128
    scr := HVScrollableView for:self in:topView.
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   129
    scr origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   130
    workspace := scr scrolledView.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   131
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   132
    "/ adjust topViews extent according to my font
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   133
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   134
    f := workspace font.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   135
    topView extent:((f widthOf:'x') * 40) @ (f height * 10).
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   136
    topView open.
131
claus
parents: 125
diff changeset
   137
    ^ workspace
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   138
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   139
    "
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   140
     Workspace open
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   141
    "
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   142
1522
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   143
    "Modified: / 16.5.1998 / 16:53:53 / cg"
857
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   144
!
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   145
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   146
openForRemote:hostName
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   147
    "launch a new workspace to evaluate expression on some remote machine.
1522
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   148
     Entered expressions are sent over to some partner machine, evaluated there,
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   149
     and the result is shown here.
857
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   150
     This requires the RemoteObjects package to be loaded."
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   151
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   152
    |server remoteCompiler workspace|
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   153
1522
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   154
    RemoteObjectServer isNil ifTrue:[
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   155
        self warn:'no remoteObjectServer available'.
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   156
        ^ nil
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   157
    ].
857
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   158
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   159
    server := RemoteObjectServer on:hostName.
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   160
    remoteCompiler := server get:#Compiler.
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   161
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   162
    workspace := self open.
1522
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   163
    workspace topView 
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   164
        label:(self classResources string:'Remote Workspace {%1}' with:hostName).
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   165
857
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   166
    workspace doItAction:
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   167
                [:theCode |
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   168
                    remoteCompiler 
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   169
                        evaluate:theCode 
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   170
                        in:nil 
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   171
                        receiver:nil 
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   172
                        notifying:workspace 
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   173
                        logged:true 
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   174
                        ifFail:nil 
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   175
                ]
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   176
    "
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   177
     Workspace openForRemote:'andi'
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   178
    "
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   179
1522
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   180
    "Modified: / 16.5.1998 / 16:57:38 / cg"
2686
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   181
!
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   182
2794
90115a2de9d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   183
openWith:initialText selected:selectedBoolean
2686
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   184
    "launch a new workspace with some initial contents"
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   185
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   186
    |workspace|
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   187
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   188
    workspace := self open.
2794
90115a2de9d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   189
    workspace contents:initialText selected:selectedBoolean.
2686
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   190
    ^ workspace
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   191
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   192
    "
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   193
     Workspace openWith:'Transcript showCR:''hello world'''
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   194
    "
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   195
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   196
2657
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   197
!Workspace class methodsFor:'history'!
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   198
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   199
clearDoItHistory
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   200
    DoItHistory := nil
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   201
!
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   202
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   203
doItHistory
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   204
    ^ DoItHistory
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   205
!
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   206
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   207
doItHistorySize
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   208
    "the number of remembered doIts"
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   209
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   210
    ^ 20
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   211
!
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   212
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   213
rememberDoIt:aString
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   214
    |string|
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   215
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   216
    string := aString asString string withoutSeparators.
2726
f258efeca730 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2717
diff changeset
   217
    (string asCollectionOfWords size <= 1) ifTrue:[
f258efeca730 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2717
diff changeset
   218
        ((Scanner new scanTokens:string) size <= 1) ifTrue:[
f258efeca730 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2717
diff changeset
   219
            "its a variable only"
f258efeca730 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2717
diff changeset
   220
            ^ self
f258efeca730 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2717
diff changeset
   221
        ]
f258efeca730 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2717
diff changeset
   222
    ].
2657
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   223
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   224
    DoItHistory isNil ifTrue:[
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   225
        DoItHistory := OrderedCollection new.
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   226
    ].
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   227
    DoItHistory remove:string ifAbsent:nil.
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   228
    DoItHistory addFirst:string.
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   229
    DoItHistory size > self doItHistorySize ifTrue:[
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   230
        DoItHistory removeLast
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   231
    ].
2726
f258efeca730 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2717
diff changeset
   232
f258efeca730 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2717
diff changeset
   233
    Scanner
2657
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   234
! !
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   235
1523
6c0045d6a91f open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents: 1522
diff changeset
   236
!Workspace class methodsFor:'queries'!
6c0045d6a91f open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents: 1522
diff changeset
   237
6c0045d6a91f open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents: 1522
diff changeset
   238
isVisualStartable
6c0045d6a91f open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents: 1522
diff changeset
   239
    "returns whether this application class can be started via #open
6c0045d6a91f open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents: 1522
diff changeset
   240
     (i.e. via a double click on the class in the browser)"
6c0045d6a91f open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents: 1522
diff changeset
   241
6c0045d6a91f open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents: 1522
diff changeset
   242
    ^ self == Workspace
6c0045d6a91f open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents: 1522
diff changeset
   243
6c0045d6a91f open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents: 1522
diff changeset
   244
    "Created: / 16.5.1998 / 16:59:00 / cg"
6c0045d6a91f open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents: 1522
diff changeset
   245
    "Modified: / 16.5.1998 / 16:59:39 / cg"
6c0045d6a91f open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents: 1522
diff changeset
   246
! !
6c0045d6a91f open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents: 1522
diff changeset
   247
1931
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   248
!Workspace class methodsFor:'workspace variables'!
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   249
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   250
addWorkspaceVariable:name
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   251
    "create a new workspace variable"
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   252
1933
a3d9c133279f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1932
diff changeset
   253
    |holder|
a3d9c133279f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1932
diff changeset
   254
1931
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   255
    WorkspaceVariables isNil ifTrue:[
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   256
        WorkspaceVariables := Dictionary new.
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   257
    ].
2536
2c5081c6e44b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   258
    holder := WorkspaceVariables at:name ifAbsentPut:[ ValueHolder new ].
1933
a3d9c133279f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1932
diff changeset
   259
    ^ holder
1931
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   260
!
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   261
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   262
removeAllWorkspaceVariables
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   263
    "delete all workspace variables"
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   264
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   265
    WorkspaceVariables := nil
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   266
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   267
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   268
!
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   269
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   270
removeWorkspaceVariable:name
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   271
    "delete a workspace variable"
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   272
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   273
    WorkspaceVariables notNil ifTrue:[
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   274
        WorkspaceVariables removeKey:name ifAbsent:nil.
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   275
        WorkspaceVariables isEmpty ifTrue:[
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   276
            WorkspaceVariables := nil
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   277
        ]
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   278
    ].
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   279
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   280
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   281
!
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   282
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   283
workspaceVariableAt:name
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   284
    "retrieve a workspace variable (actually, a holder onto it)"
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   285
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   286
    WorkspaceVariables isNil ifTrue:[^ nil].
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   287
    ^ WorkspaceVariables at:name ifAbsent:nil.
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   288
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   289
1932
a898c608fb9a support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   290
!
a898c608fb9a support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   291
a898c608fb9a support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   292
workspaceVariables
a898c608fb9a support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   293
    "retrieve the collection of workspace variables"
a898c608fb9a support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   294
a898c608fb9a support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   295
    ^ WorkspaceVariables
a898c608fb9a support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   296
a898c608fb9a support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   297
1931
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   298
! !
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   299
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   300
!Workspace methodsFor:'accessing'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   301
2679
1e61847e26f4 autoDefine as doIt added
Claus Gittinger <cg@exept.de>
parents: 2663
diff changeset
   302
autoDefineVariables
1e61847e26f4 autoDefine as doIt added
Claus Gittinger <cg@exept.de>
parents: 2663
diff changeset
   303
    ^ autoDefineVariables 
2535
0884418b7c41 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2534
diff changeset
   304
!
0884418b7c41 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2534
diff changeset
   305
2679
1e61847e26f4 autoDefine as doIt added
Claus Gittinger <cg@exept.de>
parents: 2663
diff changeset
   306
autoDefineVariables:nilOrSymbol
1e61847e26f4 autoDefine as doIt added
Claus Gittinger <cg@exept.de>
parents: 2663
diff changeset
   307
    autoDefineVariables := nilOrSymbol.
1e61847e26f4 autoDefine as doIt added
Claus Gittinger <cg@exept.de>
parents: 2663
diff changeset
   308
!
2535
0884418b7c41 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2534
diff changeset
   309
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   310
commentStrings:anArrayOfCommentStrings
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   311
    "define the comment strings"
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   312
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   313
    commentStrings := anArrayOfCommentStrings
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   314
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   315
    "Created: / 9.11.1997 / 01:05:25 / cg"
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   316
!
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   317
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   318
doItAction
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   319
    "return the action to be performed when 'doIt' is selected"
32
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
   320
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   321
    ^ doItAction
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   322
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   323
2727
4c13da01ea6b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2726
diff changeset
   324
selectAll
4c13da01ea6b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2726
diff changeset
   325
    super selectAll
4c13da01ea6b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2726
diff changeset
   326
!
4c13da01ea6b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2726
diff changeset
   327
2601
d52e69edc760 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2595
diff changeset
   328
simulatedSelf:anObject
d52e69edc760 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2595
diff changeset
   329
    "define what self is in an evaluation"
d52e69edc760 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2595
diff changeset
   330
d52e69edc760 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2595
diff changeset
   331
    simulatedSelf := anObject
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   332
! !
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   333
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   334
!Workspace methodsFor:'compiler interface'!
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   335
2303
a0cce4808d1d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2285
diff changeset
   336
compilerClass
a0cce4808d1d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2285
diff changeset
   337
    ^ Compiler
a0cce4808d1d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2285
diff changeset
   338
!
a0cce4808d1d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2285
diff changeset
   339
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   340
currentSourceCode
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   341
    "special interface to compiler - called by parser
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   342
     to get the updated source code after a corrected error"
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   343
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   344
    ^ self contents
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   345
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   346
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   347
wantChangeLog
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   348
    "sent by the compiler to ask if a changeLog entry should
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   349
     be written. Return true here."
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   350
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   351
    ^ true
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   352
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   353
2754
4e479333efa3 method category rename
Claus Gittinger <cg@exept.de>
parents: 2751
diff changeset
   354
!Workspace methodsFor:'compiler interface-error handling'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   355
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   356
correctableError:aString position:relPos to:relEndPos from:aCompiler
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   357
    "compiler notifies us of a correctable error;
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   358
     hilight the error (relPos to relEndPos) and show a Box asking for continue/correct/abort;
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   359
     this method should return true to the compiler if user wants the error
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   360
     to be corrected; false otherwise"
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   361
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   362
    |action|
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   363
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   364
    self highlightingErrorPosition:relPos to:relEndPos do:[
368
53476ee1fbee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
   365
        action := OptionBox 
53476ee1fbee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
   366
                      request:aString
2549
d1471f715ee6 error messages
Claus Gittinger <cg@exept.de>
parents: 2536
diff changeset
   367
                      label:'Correctable Error'
368
53476ee1fbee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
   368
                      form:(WarningBox iconBitmap)
2440
ef28b23ad538 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2418
diff changeset
   369
                      buttonLabels:#('Cancel' 'Declare as...' 'Correct...' 'Continue')
1930
5852350f36f4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1925
diff changeset
   370
                      values:#(#abort #declare #correct #continue)
2391
f8cd579704db optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents: 2388
diff changeset
   371
                      default:#continue
f8cd579704db optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents: 2388
diff changeset
   372
                      onCancel:#abort.
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   373
    ].
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   374
1930
5852350f36f4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1925
diff changeset
   375
    action == #declare ifTrue:[
5852350f36f4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1925
diff changeset
   376
        ^ action
5852350f36f4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1925
diff changeset
   377
    ].
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   378
    action == #abort ifTrue:[
2477
8a324269ee7a class based exceptions - abortSignal;
Claus Gittinger <cg@exept.de>
parents: 2471
diff changeset
   379
        AbortOperationRequest raise.
368
53476ee1fbee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
   380
        ^ false
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   381
    ].
368
53476ee1fbee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
   382
    ^ action == #correct
53476ee1fbee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
   383
2477
8a324269ee7a class based exceptions - abortSignal;
Claus Gittinger <cg@exept.de>
parents: 2471
diff changeset
   384
    "Modified: / 16.11.2001 / 17:39:26 / cg"
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   385
!
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   386
2104
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   387
correctableSelectorWarning:aString position:relPos to:relEndPos from:aCompiler
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   388
    "compiler notifies us of a correctable selector warning;
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   389
     hilight the error (relPos to relEndPos) and show a Box asking for continue/correct/abort;
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   390
     this method should return true to the compiler if user wants the error
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   391
     to be corrected; false otherwise"
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   392
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   393
    |action|
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   394
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   395
    self highlightingErrorPosition:relPos to:relEndPos do:[
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   396
        action := OptionBox 
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   397
                      request:aString
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   398
                      label:'Warning'
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   399
                      form:(WarningBox iconBitmap)
2471
fc8c179c4228 finished remove unused vars;
Claus Gittinger <cg@exept.de>
parents: 2470
diff changeset
   400
                      buttonLabels:(resources array:#('Cancel' 'Correct...' 'Generate' 'Continue'))
2338
4c67cec79a84 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2326
diff changeset
   401
                      values:#(#abort #correct #generate #continue)
2391
f8cd579704db optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents: 2388
diff changeset
   402
                      default:#continue
f8cd579704db optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents: 2388
diff changeset
   403
                      onCancel:#abort.
2104
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   404
    ].
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   405
2338
4c67cec79a84 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2326
diff changeset
   406
    action == #generate ifTrue:[
4c67cec79a84 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2326
diff changeset
   407
        ^ action
4c67cec79a84 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2326
diff changeset
   408
    ].
4c67cec79a84 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2326
diff changeset
   409
2391
f8cd579704db optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents: 2388
diff changeset
   410
    (action isNil or:[action == #abort]) ifTrue:[
2477
8a324269ee7a class based exceptions - abortSignal;
Claus Gittinger <cg@exept.de>
parents: 2471
diff changeset
   411
        AbortOperationRequest raise.
2104
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   412
        ^ false
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   413
    ].
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   414
    ^ action == #correct
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   415
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   416
    "Created: / 19.1.2000 / 16:27:28 / cg"
2477
8a324269ee7a class based exceptions - abortSignal;
Claus Gittinger <cg@exept.de>
parents: 2471
diff changeset
   417
    "Modified: / 16.11.2001 / 17:39:29 / cg"
2104
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   418
!
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   419
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   420
error:aString position:relPos to:relEndPos asWarning:asWarning
2277
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   421
    "obsolete - no longer invoked"
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   422
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   423
    ^ self error:aString position:relPos to:relEndPos from:nil asWarning:asWarning
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   424
!
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   425
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   426
error:aString position:relPos to:relEndPos from:aCompiler
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   427
    "compiler notifies us of an error; hilight the error (relPos to relEndPos) 
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   428
     and show a Box asking for continue/abort."
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   429
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   430
    ^ self error:aString position:relPos to:relEndPos from:aCompiler asWarning:false
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   431
!
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   432
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   433
error:aString position:relPos to:relEndPos from:aCompiler asWarning:asWarning
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   434
    "compiler notifies us of an error; hilight the error (relPos to relEndPos) 
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   435
     and show a Box asking for continue/abort."
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   436
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   437
    |answer|
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   438
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   439
    self highlightingErrorPosition:relPos to:relEndPos do:[
2799
4d9967d1052e support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 2794
diff changeset
   440
        |box lbl doNotShowAgainHolder l1 y1 y2 l2|
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   441
213
6286d3f36c14 raise warningSignal if handled (allows warnBoxes from compiler to be suppressed in debugger)
Claus Gittinger <cg@exept.de>
parents: 208
diff changeset
   442
        WarningSignal isHandled ifTrue:[
6286d3f36c14 raise warningSignal if handled (allows warnBoxes from compiler to be suppressed in debugger)
Claus Gittinger <cg@exept.de>
parents: 208
diff changeset
   443
            WarningSignal raiseErrorString:aString.
6286d3f36c14 raise warningSignal if handled (allows warnBoxes from compiler to be suppressed in debugger)
Claus Gittinger <cg@exept.de>
parents: 208
diff changeset
   444
            ^ false
6286d3f36c14 raise warningSignal if handled (allows warnBoxes from compiler to be suppressed in debugger)
Claus Gittinger <cg@exept.de>
parents: 208
diff changeset
   445
        ].
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   446
213
6286d3f36c14 raise warningSignal if handled (allows warnBoxes from compiler to be suppressed in debugger)
Claus Gittinger <cg@exept.de>
parents: 208
diff changeset
   447
        "
6286d3f36c14 raise warningSignal if handled (allows warnBoxes from compiler to be suppressed in debugger)
Claus Gittinger <cg@exept.de>
parents: 208
diff changeset
   448
         ask if we should abort or continue
6286d3f36c14 raise warningSignal if handled (allows warnBoxes from compiler to be suppressed in debugger)
Claus Gittinger <cg@exept.de>
parents: 208
diff changeset
   449
        "
2400
8035556d539f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2393
diff changeset
   450
        box := YesNoBox 
8035556d539f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2393
diff changeset
   451
                title:aString
2471
fc8c179c4228 finished remove unused vars;
Claus Gittinger <cg@exept.de>
parents: 2470
diff changeset
   452
                yesText:(resources string:'Continue')
fc8c179c4228 finished remove unused vars;
Claus Gittinger <cg@exept.de>
parents: 2470
diff changeset
   453
                noText:(resources string:'Abort').
213
6286d3f36c14 raise warningSignal if handled (allows warnBoxes from compiler to be suppressed in debugger)
Claus Gittinger <cg@exept.de>
parents: 208
diff changeset
   454
2277
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   455
        lbl := aCompiler isNil ifTrue:['Compiler'] ifFalse:[aCompiler class name].
213
6286d3f36c14 raise warningSignal if handled (allows warnBoxes from compiler to be suppressed in debugger)
Claus Gittinger <cg@exept.de>
parents: 208
diff changeset
   456
        asWarning ifTrue:[
2549
d1471f715ee6 error messages
Claus Gittinger <cg@exept.de>
parents: 2536
diff changeset
   457
            lbl := lbl , ' Warning'
213
6286d3f36c14 raise warningSignal if handled (allows warnBoxes from compiler to be suppressed in debugger)
Claus Gittinger <cg@exept.de>
parents: 208
diff changeset
   458
        ] ifFalse:[
2549
d1471f715ee6 error messages
Claus Gittinger <cg@exept.de>
parents: 2536
diff changeset
   459
            lbl := lbl , ' Error'.
213
6286d3f36c14 raise warningSignal if handled (allows warnBoxes from compiler to be suppressed in debugger)
Claus Gittinger <cg@exept.de>
parents: 208
diff changeset
   460
        ].
6286d3f36c14 raise warningSignal if handled (allows warnBoxes from compiler to be suppressed in debugger)
Claus Gittinger <cg@exept.de>
parents: 208
diff changeset
   461
        box label:lbl.
6286d3f36c14 raise warningSignal if handled (allows warnBoxes from compiler to be suppressed in debugger)
Claus Gittinger <cg@exept.de>
parents: 208
diff changeset
   462
        box form:(WarningBox iconBitmap).
2799
4d9967d1052e support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 2794
diff changeset
   463
4d9967d1052e support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 2794
diff changeset
   464
        aCompiler class doNotShowCompilerWarningAgainActionQuery isHandled ifTrue:[
4d9967d1052e support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 2794
diff changeset
   465
            doNotShowAgainHolder := false asValue.
2804
c95ac7facca0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2799
diff changeset
   466
            box addCheckBox:'Do not show this dialog again (reenable via Launchers Settings Dialog)' on:doNotShowAgainHolder.
2799
4d9967d1052e support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 2794
diff changeset
   467
        ].
4d9967d1052e support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 2794
diff changeset
   468
921
459081e64241 destroy box after use
Claus Gittinger <cg@exept.de>
parents: 858
diff changeset
   469
        answer := box confirm.  
2799
4d9967d1052e support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 2794
diff changeset
   470
4d9967d1052e support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 2794
diff changeset
   471
        doNotShowAgainHolder value == true ifTrue:[
4d9967d1052e support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 2794
diff changeset
   472
            aCompiler class doNotShowCompilerWarningAgainActionQuery actionQuery value    
4d9967d1052e support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 2794
diff changeset
   473
        ].
4d9967d1052e support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 2794
diff changeset
   474
921
459081e64241 destroy box after use
Claus Gittinger <cg@exept.de>
parents: 858
diff changeset
   475
        box destroy.
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   476
    ].
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   477
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   478
    "
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   479
     do the abort if we have to
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   480
    "
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   481
    answer ifFalse:[    
2477
8a324269ee7a class based exceptions - abortSignal;
Claus Gittinger <cg@exept.de>
parents: 2471
diff changeset
   482
        AbortOperationRequest raise.
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   483
    ].
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   484
    ^ false
213
6286d3f36c14 raise warningSignal if handled (allows warnBoxes from compiler to be suppressed in debugger)
Claus Gittinger <cg@exept.de>
parents: 208
diff changeset
   485
2471
fc8c179c4228 finished remove unused vars;
Claus Gittinger <cg@exept.de>
parents: 2470
diff changeset
   486
    "Created: / 24.11.1995 / 22:56:34 / cg"
2477
8a324269ee7a class based exceptions - abortSignal;
Claus Gittinger <cg@exept.de>
parents: 2471
diff changeset
   487
    "Modified: / 16.11.2001 / 17:39:31 / cg"
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   488
!
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   489
2663
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
   490
highlightingErrorLine:lineNr do:aBlock
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
   491
    "evaluate aBlock while some selection is shown highlighted with error colors."
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
   492
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
   493
    |linePosition|
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
   494
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
   495
    linePosition := self characterPositionOfLine:lineNr col:1.
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
   496
    self highlightingErrorPosition:linePosition to:nil do:aBlock
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
   497
!
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
   498
59
450ce95a72a4 *** empty log message ***
claus
parents: 58
diff changeset
   499
highlightingErrorPosition:relPos to:relEndPos do:aBlock
450ce95a72a4 *** empty log message ***
claus
parents: 58
diff changeset
   500
    "evaluate aBlock while some selection is shown highlighted with error colors."
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   501
59
450ce95a72a4 *** empty log message ***
claus
parents: 58
diff changeset
   502
    |absPosition fg bg|
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   503
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   504
    "
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   505
     change color of selection & hide cursor
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   506
    "
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   507
    fg := selectionFgColor.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   508
    bg := selectionBgColor.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   509
    selectionBgColor := errorBgColor.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   510
    selectionFgColor := errorFgColor.
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   511
    self hideCursor.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   512
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   513
    "
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   514
     select the text - relEndPos may be nil in which case the whole line is selected
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   515
     we have to adjust the positions given by the compiler, since they
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   516
     are relative to the texts start (the compiler did stream-read the code).
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   517
    "
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   518
    codeStartPosition isNil ifTrue:[codeStartPosition := 1].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   519
    absPosition := codeStartPosition + relPos - 1.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   520
    relEndPos isNil ifTrue:[
2519
a088ad3bb1e5 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 2492
diff changeset
   521
        self selectLineWhereCharacterPosition:absPosition
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   522
    ] ifFalse:[
2519
a088ad3bb1e5 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 2492
diff changeset
   523
        self selectFromCharacterPosition:absPosition to:(codeStartPosition + relEndPos - 1)
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   524
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   525
    self makeSelectionVisible.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   526
155
claus
parents: 146
diff changeset
   527
    device flush.
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   528
2519
a088ad3bb1e5 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 2492
diff changeset
   529
    aBlock ensure:[
a088ad3bb1e5 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 2492
diff changeset
   530
        "
a088ad3bb1e5 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 2492
diff changeset
   531
         undo selection color change and show cursor again
a088ad3bb1e5 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 2492
diff changeset
   532
        "
a088ad3bb1e5 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 2492
diff changeset
   533
        selectionFgColor := fg.
a088ad3bb1e5 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 2492
diff changeset
   534
        selectionBgColor := bg.
a088ad3bb1e5 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 2492
diff changeset
   535
        self showCursor.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   536
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   537
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   538
2386
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   539
unusedVariableWarning:aString position:relPos to:relEndPos from:aCompiler
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   540
    "compiler notifies us of a (or some) unused variables;
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   541
     hilight the error (relPos to relEndPos) and show a Box asking for continue/correct/abort;
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   542
     this method should return true to the compiler if user wants the error
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   543
     to be corrected; false otherwise"
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   544
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   545
    |action|
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   546
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   547
    self highlightingErrorPosition:relPos to:relEndPos do:[
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   548
        action := OptionBox 
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   549
                      request:aString
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   550
                      label:'Warning'
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   551
                      form:(WarningBox iconBitmap)
2470
240b6d2d5511 finished remove unused vars;
Claus Gittinger <cg@exept.de>
parents: 2462
diff changeset
   552
                      buttonLabels:#('Cancel' 'Remove Variable(s)' 'Continue')
240b6d2d5511 finished remove unused vars;
Claus Gittinger <cg@exept.de>
parents: 2462
diff changeset
   553
                      values:#(#abort #correct #continue)
2386
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   554
                      default:#continue.
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   555
    ].
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   556
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   557
    action == #abort ifTrue:[
2477
8a324269ee7a class based exceptions - abortSignal;
Claus Gittinger <cg@exept.de>
parents: 2471
diff changeset
   558
        AbortOperationRequest raise.
2386
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   559
        ^ false
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   560
    ].
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   561
    ^ action == #correct
2470
240b6d2d5511 finished remove unused vars;
Claus Gittinger <cg@exept.de>
parents: 2462
diff changeset
   562
2477
8a324269ee7a class based exceptions - abortSignal;
Claus Gittinger <cg@exept.de>
parents: 2471
diff changeset
   563
    "Modified: / 16.11.2001 / 17:39:34 / cg"
2386
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   564
!
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   565
116
claus
parents: 97
diff changeset
   566
warning:aString position:relPos to:relEndPos from:aCompiler 
32
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
   567
    "compiler notifies us of a warning - same behavior as error"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   568
2277
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   569
    self error:aString position:relPos to:relEndPos from:aCompiler asWarning:true 
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   570
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   571
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   572
!Workspace methodsFor:'editing'!
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   573
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   574
commentFrom:line1 to:line2
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   575
    "convenient function to comment out a block.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   576
     All lines from line1 to line2 get an end-of-line comment
1925
e73fe37177a0 comment
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
   577
     in the first col 
e73fe37177a0 comment
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
   578
     (if no eol comment is available, a bracketing comment is used)."
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   579
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   580
    |eolComment opening closing|
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   581
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   582
    eolComment := commentStrings at:1.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   583
    eolComment isNil ifTrue:[
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   584
        opening := (commentStrings at:2) at:1.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   585
        closing := (commentStrings at:2) at:2.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   586
        (opening isNil or:[closing isNil]) ifTrue:[^ self].
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   587
    ].
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   588
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   589
    line1 to:line2 do:[:lineNr |
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   590
        |l|
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   591
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   592
        l := self listAt:lineNr.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   593
        l isNil ifTrue:[l := ''].
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   594
        eolComment notNil ifTrue:[
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   595
            l := eolComment , l
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   596
        ] ifFalse:[
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   597
            l := opening , l , closing
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   598
        ].
1903
86d3493c6a59 when commenting, do all without change notifications,
Claus Gittinger <cg@exept.de>
parents: 1901
diff changeset
   599
        self at:lineNr basicPut:l
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   600
    ].
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   601
    self textChanged.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   602
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   603
    "Modified: / 7.1.1997 / 20:15:06 / cg"
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   604
    "Created: / 9.11.1997 / 01:05:35 / cg"
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   605
!
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   606
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   607
commentSelection
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   608
    "convenient function to comment out a block.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   609
     All lines from line1 to line2 get an end-of-line comment
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   610
     in the first col."
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   611
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   612
    |e commentPair opening closing|
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   613
1481
a5fb903ee745 moved readOnlyCheck.
Claus Gittinger <cg@exept.de>
parents: 1395
diff changeset
   614
    (self checkModificationsAllowed) ifFalse:[ ^ self].
a5fb903ee745 moved readOnlyCheck.
Claus Gittinger <cg@exept.de>
parents: 1395
diff changeset
   615
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   616
    selectionStartLine notNil ifTrue:[
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   617
        (selectionStartCol == 1 and:[selectionEndCol == 0]) ifTrue:[
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   618
            self commentFrom:selectionStartLine to:selectionEndLine-1
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   619
        ] ifFalse:[
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   620
            commentPair := commentStrings at:2.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   621
            opening := commentPair at:1.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   622
            closing := commentPair at:2.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   623
            (opening isNil or:[closing isNil]) ifTrue:[^ self].
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   624
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   625
            e := selectionEndCol.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   626
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   627
            self insertString:closing atLine:selectionEndLine col:e+1.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   628
            self insertString:opening atLine:selectionStartLine col:selectionStartCol.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   629
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   630
            selectionStartLine == selectionEndLine ifTrue:[e := e + opening size].
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   631
            self selectFromLine:selectionStartLine col:selectionStartCol
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   632
                         toLine:selectionEndLine col:e+closing size.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   633
        ]
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   634
    ]
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   635
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   636
    "Created: / 9.11.1997 / 01:05:40 / cg"
1481
a5fb903ee745 moved readOnlyCheck.
Claus Gittinger <cg@exept.de>
parents: 1395
diff changeset
   637
    "Modified: / 5.4.1998 / 16:52:23 / cg"
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   638
!
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   639
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   640
uncommentFrom:line1 to:line2
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   641
    "convenient function to comment out a block.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   642
     All lines from line1 to line2 get an end-of-line comment
1925
e73fe37177a0 comment
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
   643
     in the first col.
e73fe37177a0 comment
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
   644
     (if no eol comment is available, a bracketing comment is removed)"
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   645
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   646
    |eolComment opening closing rest|
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   647
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   648
    eolComment := commentStrings at:1.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   649
    eolComment isNil ifTrue:[
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   650
        opening := (commentStrings at:2) at:1.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   651
        closing := (commentStrings at:2) at:2.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   652
        (opening isNil or:[closing isNil]) ifTrue:[^ self].
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   653
    ] ifFalse:[
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   654
        rest := eolComment size + 1.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   655
    ].
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   656
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   657
    line1 to:line2 do:[:lineNr |
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   658
        |l|
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   659
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   660
        l := self listAt:lineNr.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   661
        l notNil ifTrue:[
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   662
            eolComment notNil ifTrue:[
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   663
                (l startsWith:eolComment) ifTrue:[
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   664
                    l := l copyFrom:rest
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   665
                ]
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   666
            ] ifFalse:[
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   667
                ((l startsWith:opening)
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   668
                and:[l endsWith:closing]) ifTrue:[
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   669
                    l := l copyFrom:opening size + 1.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   670
                    l := l copyWithoutLast:closing size.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   671
                ]
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   672
            ].
1903
86d3493c6a59 when commenting, do all without change notifications,
Claus Gittinger <cg@exept.de>
parents: 1901
diff changeset
   673
            self at:lineNr basicPut:l
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   674
        ]
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   675
    ].
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   676
    self textChanged.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   677
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   678
    "Modified: / 7.1.1997 / 20:17:44 / cg"
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   679
    "Created: / 9.11.1997 / 01:05:43 / cg"
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   680
!
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   681
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   682
uncommentSelection
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   683
    "convenient function to comment out a block.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   684
     All lines from line1 to line2 get an end-of-line comment
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   685
     in the first col."
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   686
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   687
    |e commentPair opening closing sz1 sz2|
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   688
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   689
    selectionStartLine notNil ifTrue:[
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   690
        (selectionStartCol == 1 and:[selectionEndCol == 0]) ifTrue:[
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   691
            self uncommentFrom:selectionStartLine to:selectionEndLine-1
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   692
        ] ifFalse:[
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   693
            commentPair := commentStrings at:2.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   694
            opening := commentPair at:1.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   695
            closing := commentPair at:2.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   696
            (opening isNil or:[closing isNil]) ifTrue:[^ self].
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   697
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   698
            sz1 := opening size.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   699
            sz2 := closing size.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   700
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   701
            ((self 
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   702
                stringAtLine:selectionStartLine 
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   703
                from:selectionStartCol
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   704
                to:selectionStartCol+sz1 - 1) = opening
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   705
            and:[(self 
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   706
                stringAtLine:selectionEndLine 
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   707
                from:selectionEndCol - sz2 + 1
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   708
                to:selectionEndCol) = closing ]) ifTrue:[
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   709
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   710
                self deleteCharsAtLine:selectionEndLine fromCol:selectionEndCol-sz2+1 toCol:selectionEndCol.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   711
                self deleteCharsAtLine:selectionStartLine fromCol:selectionStartCol toCol:selectionStartCol+sz1-1.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   712
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   713
                e := selectionEndCol - sz2.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   714
                selectionStartLine == selectionEndLine ifTrue:[e := e - sz1].
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   715
                self selectFromLine:selectionStartLine col:selectionStartCol
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   716
                             toLine:selectionEndLine col:e.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   717
            ]
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   718
        ]
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   719
    ]
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   720
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   721
    "Modified: / 7.1.1997 / 20:13:32 / cg"
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   722
    "Created: / 9.11.1997 / 01:05:46 / cg"
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   723
! !
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   724
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   725
!Workspace methodsFor:'events'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   726
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   727
keyPress:key x:x y:y
2418
bd16446247c5 lifted keyboardMacro handling to editTextView
Claus Gittinger <cg@exept.de>
parents: 2410
diff changeset
   728
    <resource: #keyboard (#DoIt #InspectIt #PrintIt #BrowseIt)>
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
   729
32
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
   730
    (key == #DoIt)      ifTrue:[^ self doIt].
23
69f1ba57f67a *** empty log message ***
claus
parents: 15
diff changeset
   731
    (key == #InspectIt) ifTrue:[^ self inspectIt].
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   732
    (key == #PrintIt)   ifTrue:[^ self printIt].
2307
dde2b8397b88 added #BrowseIt shortKey
Claus Gittinger <cg@exept.de>
parents: 2303
diff changeset
   733
    (key == #BrowseIt)  ifTrue:[^ self browseIt].
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
   734
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   735
    super keyPress:key x:x y:y
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   736
! !
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   737
2143
ae0c3ae5de15 category rename
Claus Gittinger <cg@exept.de>
parents: 2104
diff changeset
   738
!Workspace methodsFor:'executing'!
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   739
1501
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
   740
do:code withValueDo:aBlock
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   741
    "helper for doIt, printIt and inspectIt. 
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   742
     Evaluate the selection and, if all went well, evaluate the argument, 
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   743
     aBlock with the value.
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   744
     Most work is in preparing for proper cleanup in case of abort
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   745
     or other exception while the evaluation is performed.
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   746
     (restore cursor, selectionColors etc.)"
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   747
1501
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
   748
    |selLine selCol endLine endCol cLine cCol cleanUp|
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   749
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   750
    code notNil ifTrue:[
2409
489866f85d58 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2408
diff changeset
   751
        code asString withoutSeparators isEmpty ifTrue:[ ^ self ].
2408
73edbd1475ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
   752
257
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   753
        codeStartPosition := self characterPositionOfSelection.
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   754
257
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   755
        "
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   756
         remember selection for later - if there is an error,
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   757
         the notification method will highlight it.
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   758
         thus destroying the current selection
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   759
        "
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   760
        selLine := selectionStartLine.
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   761
        selCol := selectionStartCol.
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   762
        endLine := selectionEndLine.
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   763
        endCol := selectionEndCol.
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   764
        cCol := cursorCol.
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   765
        cLine := cursorLine.
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   766
257
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   767
        "
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   768
         cleanup: restore previous selection and cursor positions
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   769
        "
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   770
        cleanUp := [
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   771
                self selectFromLine:selLine col:selCol toLine:endLine col:endCol.
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   772
                cLine notNil ifTrue:[
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   773
                    self cursorLine:cLine col:cCol
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   774
                ].
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   775
        ].
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   776
257
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   777
        "
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   778
         perform the action.
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   779
         Be careful to release the reference to the value;
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   780
         otherwise, we could keep lots of garbage from being freed
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   781
         until the view gets closed
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   782
        "
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   783
        self topView withExecuteCursorDo:[
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   784
            [
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   785
                AbortSignal handle:[:ex |
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   786
                     ex return
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   787
                ] do:[
929
22265f1bb110 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
   788
                    |value|
22265f1bb110 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
   789
257
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   790
                    doItAction notNil ifTrue:[
929
22265f1bb110 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
   791
                        value := doItAction value:(code asString).
257
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   792
                        cleanUp value. cleanUp := nil.
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   793
                        aBlock value:value.
2726
f258efeca730 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2717
diff changeset
   794
                        value := nil.
2657
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   795
                        self class rememberDoIt:code.
257
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   796
                    ]
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   797
                ]
2519
a088ad3bb1e5 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 2492
diff changeset
   798
            ] ensure:[
929
22265f1bb110 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
   799
                cleanUp notNil ifTrue:[
22265f1bb110 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
   800
                    cleanUp value. cleanUp := nil
22265f1bb110 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
   801
                ].
257
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   802
            ]
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   803
        ].
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   804
    ]
257
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   805
1501
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
   806
    "Modified: / 22.4.1998 / 21:56:13 / ca"
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
   807
    "Created: / 22.4.1998 / 21:57:05 / ca"
2409
489866f85d58 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2408
diff changeset
   808
    "Modified: / 26.9.2001 / 17:32:59 / cg"
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   809
! !
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   810
2751
dcba8a160aed method category rename
Claus Gittinger <cg@exept.de>
parents: 2733
diff changeset
   811
!Workspace methodsFor:'initialization & release'!
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   812
2733
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
   813
doItAction:aOneArgBlock
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
   814
    "define the action to be performed when 'doIt' is selected.
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
   815
     The block will be evaluated, passing the selection as a String argument. 
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
   816
     A default doItAction is set for you in the initialize method."
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
   817
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
   818
    doItAction := aOneArgBlock
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
   819
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
   820
    "Modified: 27.2.1996 / 15:31:37 / cg"
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
   821
!
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
   822
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
   823
executeDoIt:theCode
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
   824
    ^ self compilerClass 
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
   825
        evaluate:theCode 
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
   826
        in:nil 
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
   827
        receiver:simulatedSelf 
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
   828
        notifying:self 
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
   829
        logged:true 
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
   830
        ifFail:nil 
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
   831
!
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
   832
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   833
initStyle
966
824e0ecc0e6f comments
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   834
    "setup viewStyle specifics"
824e0ecc0e6f comments
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   835
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   836
    super initStyle.
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   837
2492
740174c1be0f allow separate bg-color from styleSheet
Claus Gittinger <cg@exept.de>
parents: 2489
diff changeset
   838
    DefaultViewBackground notNil ifTrue:[
740174c1be0f allow separate bg-color from styleSheet
Claus Gittinger <cg@exept.de>
parents: 2489
diff changeset
   839
        viewBackground := DefaultViewBackground.
740174c1be0f allow separate bg-color from styleSheet
Claus Gittinger <cg@exept.de>
parents: 2489
diff changeset
   840
        self backgroundColor:viewBackground.
740174c1be0f allow separate bg-color from styleSheet
Claus Gittinger <cg@exept.de>
parents: 2489
diff changeset
   841
    ].
740174c1be0f allow separate bg-color from styleSheet
Claus Gittinger <cg@exept.de>
parents: 2489
diff changeset
   842
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   843
    errorFgColor := DefaultErrorForegroundColor.
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   844
    errorFgColor isNil ifTrue:[errorFgColor := selectionFgColor].
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   845
    errorBgColor := DefaultErrorBackgroundColor.
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   846
    errorBgColor isNil ifTrue:[
966
824e0ecc0e6f comments
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   847
        device hasColors ifTrue:[
824e0ecc0e6f comments
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   848
            errorBgColor := Color red
824e0ecc0e6f comments
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   849
        ] ifFalse:[
824e0ecc0e6f comments
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   850
            errorBgColor := selectionBgColor
824e0ecc0e6f comments
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   851
        ]
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   852
    ].
966
824e0ecc0e6f comments
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   853
824e0ecc0e6f comments
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
   854
    "Modified: 22.1.1997 / 11:58:00 / cg"
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   855
!
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   856
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   857
initialize
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   858
    super initialize.
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   859
2775
6adda7eef10a cursorMovement default
penk
parents: 2754
diff changeset
   860
    scrollWhenUpdating := #beginOfText.
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   861
    showMatchingParenthesis := true.
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   862
    commentStrings := #(
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   863
                        '"/'
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   864
                        ('"' '"')
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   865
                       ).
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   866
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   867
    self initializeDoITAction.
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   868
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   869
    "Modified: / 9.11.1997 / 01:10:18 / cg"
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   870
!
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   871
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   872
initializeDoITAction
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   873
    "set up the block to be evaluated for doIts.
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   874
     This is done here in a separate method to allow easier
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   875
     redefinition in subclasses"
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   876
2733
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
   877
    doItAction := [:theCode | self executeDoIt:theCode].
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   878
! !
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   879
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   880
!Workspace methodsFor:'menu & menu actions'!
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   881
2285
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
   882
browseClass
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
   883
    "user selected 'browseClass' from menu; evaluate the code
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
   884
     and open a browser on the resulting class (if it evaluates to one)"
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
   885
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
   886
    ^ self 
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
   887
        do:(self selection) 
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
   888
        withValueDo:[:result | result isBehavior ifTrue:[
2410
c7a829465c03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2409
diff changeset
   889
                                  result browserClass openInClass:result selector:nil
2285
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
   890
                               ] ifFalse:[
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
   891
                                  self warn:'Selection does not evaluate to a class'
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
   892
                               ]
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
   893
                    ].
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
   894
2410
c7a829465c03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2409
diff changeset
   895
    "Modified: / 26.9.2001 / 17:37:35 / cg"
2285
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
   896
!
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
   897
2451
ae246b6c4df7 added browse implementors menu item
Claus Gittinger <cg@exept.de>
parents: 2440
diff changeset
   898
browseImplementorsOfIt
ae246b6c4df7 added browse implementors menu item
Claus Gittinger <cg@exept.de>
parents: 2440
diff changeset
   899
    "open a browser on the implementors of the selected text"
ae246b6c4df7 added browse implementors menu item
Claus Gittinger <cg@exept.de>
parents: 2440
diff changeset
   900
2714
7756ee36bb16 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   901
    |selectedText selector browserClass|
2457
0c1beddda9cb disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
   902
2714
7756ee36bb16 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   903
    selectedText := self selectionAsString.
7756ee36bb16 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   904
    selectedText size > 0 ifTrue:[
2457
0c1beddda9cb disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
   905
        self windowGroup withWaitCursorDo:[
2714
7756ee36bb16 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   906
            selector := Parser selectorInExpression:selectedText.
7756ee36bb16 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   907
7756ee36bb16 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   908
            browserClass := UserPreferences current systemBrowserClass.
7756ee36bb16 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   909
7756ee36bb16 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   910
            (selector notNil and:[selector ~~ selectedText]) ifTrue:[
7756ee36bb16 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   911
                browserClass browseImplementorsOfAny:(Set with:selector with:selectedText)
2534
55df9165ddd7 findImplementorsOfAny if in doubt
Claus Gittinger <cg@exept.de>
parents: 2519
diff changeset
   912
            ] ifFalse:[
2714
7756ee36bb16 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   913
                browserClass browseImplementorsOf:(selector ? selectedText)
2534
55df9165ddd7 findImplementorsOfAny if in doubt
Claus Gittinger <cg@exept.de>
parents: 2519
diff changeset
   914
            ]
2457
0c1beddda9cb disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
   915
        ]
0c1beddda9cb disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
   916
    ].
2451
ae246b6c4df7 added browse implementors menu item
Claus Gittinger <cg@exept.de>
parents: 2440
diff changeset
   917
ae246b6c4df7 added browse implementors menu item
Claus Gittinger <cg@exept.de>
parents: 2440
diff changeset
   918
    "Created: / 5.11.2001 / 17:32:23 / cg"
2485
1e4ab722cb11 browse senders/implementors: better selector check
Claus Gittinger <cg@exept.de>
parents: 2477
diff changeset
   919
    "Modified: / 19.11.2001 / 22:15:17 / cg"
2451
ae246b6c4df7 added browse implementors menu item
Claus Gittinger <cg@exept.de>
parents: 2440
diff changeset
   920
!
ae246b6c4df7 added browse implementors menu item
Claus Gittinger <cg@exept.de>
parents: 2440
diff changeset
   921
2307
dde2b8397b88 added #BrowseIt shortKey
Claus Gittinger <cg@exept.de>
parents: 2303
diff changeset
   922
browseIt
dde2b8397b88 added #BrowseIt shortKey
Claus Gittinger <cg@exept.de>
parents: 2303
diff changeset
   923
    "evaluate the code and open a browser on the resulting class (if it evaluates to one),
2713
07d3292d2965 in browseIt:
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
   924
     or the class of the resulting object (if it does not evaluate to a class).
07d3292d2965 in browseIt:
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
   925
07d3292d2965 in browseIt:
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
   926
     Added feature: if selection is of the form class >> selector,  immediately switch to that selector."
07d3292d2965 in browseIt:
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
   927
07d3292d2965 in browseIt:
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
   928
    |codeToEvaluate idx selector|
07d3292d2965 in browseIt:
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
   929
07d3292d2965 in browseIt:
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
   930
    codeToEvaluate := self selection asString withoutSeparators.
07d3292d2965 in browseIt:
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
   931
    idx := codeToEvaluate indexOfSubCollection:'>>'.
07d3292d2965 in browseIt:
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
   932
    idx ~~ 0 ifTrue:[
2717
Claus Gittinger <cg@exept.de>
parents: 2715
diff changeset
   933
        selector := (codeToEvaluate copyFrom:idx+2) withoutSeparators string.
2713
07d3292d2965 in browseIt:
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
   934
        codeToEvaluate := codeToEvaluate copyTo:idx-1.   
07d3292d2965 in browseIt:
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
   935
    ].
2307
dde2b8397b88 added #BrowseIt shortKey
Claus Gittinger <cg@exept.de>
parents: 2303
diff changeset
   936
dde2b8397b88 added #BrowseIt shortKey
Claus Gittinger <cg@exept.de>
parents: 2303
diff changeset
   937
    ^ self 
2713
07d3292d2965 in browseIt:
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
   938
        do:codeToEvaluate 
2307
dde2b8397b88 added #BrowseIt shortKey
Claus Gittinger <cg@exept.de>
parents: 2303
diff changeset
   939
        withValueDo:[:result | result isBehavior ifTrue:[
2713
07d3292d2965 in browseIt:
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
   940
                                  result browserClass openInClass:result selector:selector
2307
dde2b8397b88 added #BrowseIt shortKey
Claus Gittinger <cg@exept.de>
parents: 2303
diff changeset
   941
                               ] ifFalse:[
2410
c7a829465c03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2409
diff changeset
   942
                                  result class browserClass openInClass:(result class) selector:nil
2307
dde2b8397b88 added #BrowseIt shortKey
Claus Gittinger <cg@exept.de>
parents: 2303
diff changeset
   943
                               ]
dde2b8397b88 added #BrowseIt shortKey
Claus Gittinger <cg@exept.de>
parents: 2303
diff changeset
   944
                    ].
2410
c7a829465c03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2409
diff changeset
   945
c7a829465c03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2409
diff changeset
   946
    "Modified: / 26.9.2001 / 17:37:50 / cg"
2307
dde2b8397b88 added #BrowseIt shortKey
Claus Gittinger <cg@exept.de>
parents: 2303
diff changeset
   947
!
dde2b8397b88 added #BrowseIt shortKey
Claus Gittinger <cg@exept.de>
parents: 2303
diff changeset
   948
2285
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
   949
browseItsClass
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
   950
    "user selected 'browseItsClass' from menu; evaluate the code
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
   951
     and open a browser on the results class"
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
   952
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
   953
    ^ self 
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
   954
        do:(self selection) 
2410
c7a829465c03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2409
diff changeset
   955
        withValueDo:[:result | 
c7a829465c03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2409
diff changeset
   956
                        result class browserClass openInClass:result class selector:nil
c7a829465c03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2409
diff changeset
   957
                    ]
2285
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
   958
2410
c7a829465c03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2409
diff changeset
   959
    "Modified: / 26.9.2001 / 17:38:06 / cg"
2285
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
   960
!
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
   961
2454
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
   962
browseReferencesToIt
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
   963
    "open a browser on all references to the selected global"
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
   964
2457
0c1beddda9cb disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
   965
    |sel|
0c1beddda9cb disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
   966
0c1beddda9cb disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
   967
    sel := self selectionAsString.
0c1beddda9cb disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
   968
    sel size > 0 ifTrue:[
0c1beddda9cb disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
   969
        self windowGroup withWaitCursorDo:[
0c1beddda9cb disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
   970
            (UserPreferences current systemBrowserClass)
0c1beddda9cb disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
   971
                browseReferendsOf:sel
0c1beddda9cb disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
   972
        ].
2454
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
   973
    ].
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
   974
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
   975
    "Created: / 5.11.2001 / 17:32:23 / cg"
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
   976
    "Modified: / 5.11.2001 / 17:32:38 / cg"
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
   977
!
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
   978
2462
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
   979
browseSendersOfIt
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
   980
    "open a browser on the senders of the selected text"
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
   981
2715
b6802cd279d0 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   982
    |selectedText selector|
2462
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
   983
2715
b6802cd279d0 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   984
    selectedText := self selectionAsString.
b6802cd279d0 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   985
    selectedText size > 0 ifTrue:[
2462
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
   986
        self windowGroup withWaitCursorDo:[
2715
b6802cd279d0 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   987
            selector := Parser selectorInExpression:selectedText.
2462
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
   988
            (UserPreferences current systemBrowserClass)
2715
b6802cd279d0 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   989
                browseAllCallsOn:(selector ? selectedText)
2462
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
   990
        ]
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
   991
    ].
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
   992
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
   993
    "Created: / 5.11.2001 / 17:32:23 / cg"
2485
1e4ab722cb11 browse senders/implementors: better selector check
Claus Gittinger <cg@exept.de>
parents: 2477
diff changeset
   994
    "Modified: / 19.11.2001 / 22:15:27 / cg"
2462
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
   995
!
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
   996
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   997
doIt
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   998
    "user selected 'doIt' from menu; show a wait-cursor, evaluate the code
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   999
     and finally restore cursor; return result of evaluation"
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1000
1521
e2bb7811e4db removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
  1001
    ^ self 
e2bb7811e4db removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
  1002
        do:(self selection) 
e2bb7811e4db removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
  1003
        withValueDo:[:result | ]
e2bb7811e4db removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
  1004
e2bb7811e4db removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
  1005
    "Modified: / 16.5.1998 / 16:45:01 / cg"
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1006
!
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1007
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1008
editMenu
1107
25753e7f960f commentary
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1009
    "return my popUpMenu; thats the superclasses menu
25753e7f960f commentary
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1010
     PLUS st-evaluation items: doIt, printIt and inspectIt."
25753e7f960f commentary
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1011
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1012
    <resource: #keyboard (#DoIt #PrintIt #InspectIt 
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1013
                          #CommentSelection #UncommentSelection
2573
52c995a1ea78 accelerators for browseIt and implementorsOfIt
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  1014
                          #BrowseIt #ImplementorsOfIt
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1015
                         )>
1262
d69149b5be1f resource flag: #menu -> #programMenu
Claus Gittinger <cg@exept.de>
parents: 1251
diff changeset
  1016
    <resource: #programMenu>
489
5816aa12fec8 resources
Claus Gittinger <cg@exept.de>
parents: 444
diff changeset
  1017
2867
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1018
    |m sub subsub idx sensor s s2|
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1019
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1020
    m := super editMenu.
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1021
    ((sensor := self sensor) notNil and:[sensor ctrlDown]) ifTrue:[
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1022
        sub := m.
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1023
        m := nil.
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1024
    ] ifFalse:[
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1025
        sub := m subMenuAt:#others.
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1026
    ].
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1027
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1028
    sub notNil ifTrue:[
2867
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1029
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1030
        "
2867
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1031
         workspaces support #browse, implementors etc. add them after paste.
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1032
        "
2867
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1033
        sub 
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1034
            addItemList:#(
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1035
                ('-'                                                               )
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1036
                ('Browse'               browseIt                BrowseIt            )
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1037
                ('Senders of It'        browseSendersOfIt                           )
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1038
                ('Implementors of It'   browseImplementorsOfIt  ImplementorsOfIt    )
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1039
                ('References to It'     browseReferencesToIt                        )
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1040
                ('-'                                                                )
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1041
                ('TimeIt'               timeIt                                      )
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1042
                ('SpyOnIt'              spyOnIt                                     ))
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1043
          after:#gotoLine.
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1044
2867
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1045
        subsub := sub subMenuAt:#tools.
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1046
        subsub notNil ifTrue:[
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1047
            subsub
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1048
                addItemList:#(
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1049
                    ('-'                                                                )
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1050
                    ('Comment'              commentSelection        CommentSelection    )
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1051
                    ('Uncomment'            uncommentSelection      UncommentSelection  ))
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1052
              after:#'indent'.
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1053
        ].
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1054
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1055
        self hasSelection ifFalse:[
2461
54d220735048 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
  1056
            sub disableAll:#(browseIt browseImplementorsOfIt browseSendersOfIt browseReferencesToIt timeIt spyOnIt
54d220735048 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2459
diff changeset
  1057
                              commentSelection uncommentSelection ) 
2454
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
  1058
        ] ifTrue:[
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
  1059
            s := self selectionAsString.
2485
1e4ab722cb11 browse senders/implementors: better selector check
Claus Gittinger <cg@exept.de>
parents: 2477
diff changeset
  1060
            s2 := Parser selectorInExpression:s.
1e4ab722cb11 browse senders/implementors: better selector check
Claus Gittinger <cg@exept.de>
parents: 2477
diff changeset
  1061
            s2 notNil ifTrue:[
1e4ab722cb11 browse senders/implementors: better selector check
Claus Gittinger <cg@exept.de>
parents: 2477
diff changeset
  1062
                s2 := s2 asSymbolIfInterned.
1e4ab722cb11 browse senders/implementors: better selector check
Claus Gittinger <cg@exept.de>
parents: 2477
diff changeset
  1063
            ].
1e4ab722cb11 browse senders/implementors: better selector check
Claus Gittinger <cg@exept.de>
parents: 2477
diff changeset
  1064
            s notNil ifTrue:[
1e4ab722cb11 browse senders/implementors: better selector check
Claus Gittinger <cg@exept.de>
parents: 2477
diff changeset
  1065
                s := s asSymbolIfInterned.
2454
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
  1066
            ].
2487
47e0a1faf544 disabling of impl/senders menu
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
  1067
            (s2 isNil and:[s isNil]) ifTrue:[
2485
1e4ab722cb11 browse senders/implementors: better selector check
Claus Gittinger <cg@exept.de>
parents: 2477
diff changeset
  1068
                sub disableAll:#(browseImplementorsOfIt browseSendersOfIt).
1e4ab722cb11 browse senders/implementors: better selector check
Claus Gittinger <cg@exept.de>
parents: 2477
diff changeset
  1069
            ].
1e4ab722cb11 browse senders/implementors: better selector check
Claus Gittinger <cg@exept.de>
parents: 2477
diff changeset
  1070
            (s isNil 
1e4ab722cb11 browse senders/implementors: better selector check
Claus Gittinger <cg@exept.de>
parents: 2477
diff changeset
  1071
            or:[(Smalltalk includesKey:s) not])
1e4ab722cb11 browse senders/implementors: better selector check
Claus Gittinger <cg@exept.de>
parents: 2477
diff changeset
  1072
            ifTrue:[
1e4ab722cb11 browse senders/implementors: better selector check
Claus Gittinger <cg@exept.de>
parents: 2477
diff changeset
  1073
                sub disable:#browseReferencesToIt.
1e4ab722cb11 browse senders/implementors: better selector check
Claus Gittinger <cg@exept.de>
parents: 2477
diff changeset
  1074
            ].
2595
b09b515077b4 disable readOnly items
Claus Gittinger <cg@exept.de>
parents: 2573
diff changeset
  1075
            self isReadOnly ifTrue:[
2641
8a74823899f4 ctrl-menu
Claus Gittinger <cg@exept.de>
parents: 2601
diff changeset
  1076
                sub disableAll:#(commentSelection uncommentSelection) 
2595
b09b515077b4 disable readOnly items
Claus Gittinger <cg@exept.de>
parents: 2573
diff changeset
  1077
            ].
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1078
        ].
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1079
    ].
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1080
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1081
    m notNil ifTrue:[
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1082
        "
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1083
         workspaces support #doIt, #printIt and #inspectIt
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1084
         add them after paste.
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1085
        "
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1086
        idx := m indexOf:#paste.
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1087
        idx == 0 ifTrue:[idx := m indexOf:#pasteOrReplace].
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1088
        idx ~~ 0 ifTrue:[
2867
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1089
            m 
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1090
              addItemList:#(
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1091
                ('-'                                )
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1092
                ('DoIt'         doIt        DoIt     )
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1093
                ('PrintIt'      printIt     PrintIt  )
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1094
                ('InspectIt'    inspectIt   InspectIt))
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1095
              after:idx.
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1096
            
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1097
        ].
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1098
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1099
        self hasSelection ifFalse:[
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1100
            m disableAll:#(printIt doIt inspectIt) 
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1101
        ].
2595
b09b515077b4 disable readOnly items
Claus Gittinger <cg@exept.de>
parents: 2573
diff changeset
  1102
        self isReadOnly ifTrue:[
b09b515077b4 disable readOnly items
Claus Gittinger <cg@exept.de>
parents: 2573
diff changeset
  1103
            m disable:#printIt 
b09b515077b4 disable readOnly items
Claus Gittinger <cg@exept.de>
parents: 2573
diff changeset
  1104
        ].
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1105
    ].
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1106
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1107
    ^ m ? sub.
430
022b667e0d70 added accelerator display
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  1108
1501
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1109
    "Modified: / 22.4.1998 / 21:49:06 / ca"
2485
1e4ab722cb11 browse senders/implementors: better selector check
Claus Gittinger <cg@exept.de>
parents: 2477
diff changeset
  1110
    "Modified: / 19.11.2001 / 23:12:01 / cg"
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1111
!
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1112
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1113
inspectIt
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1114
    "user selected 'inspectIt' from menu; use doIt to evaluate the code
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1115
     and start an inspector on the result"
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1116
1521
e2bb7811e4db removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
  1117
    ^ self 
e2bb7811e4db removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
  1118
        do:(self selection) 
e2bb7811e4db removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
  1119
        withValueDo:[:result | result inspect]
e2bb7811e4db removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
  1120
e2bb7811e4db removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
  1121
    "Modified: / 16.5.1998 / 16:44:56 / cg"
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1122
!
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1123
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1124
printIt
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1125
    "user selected 'printIt' from menu; use doIt to evaluate the code
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1126
     and insert result of evaluation into my text.
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1127
     If the text is readOnly, do nothing."
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1128
1734
e71982a6a4c5 use self isReadonly
Claus Gittinger <cg@exept.de>
parents: 1523
diff changeset
  1129
    self isReadOnly ifTrue:[
693
8369529a2ac4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 658
diff changeset
  1130
        self beep
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1131
    ] ifFalse:[ 
1521
e2bb7811e4db removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
  1132
        self 
e2bb7811e4db removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
  1133
            do:(self selection) 
e2bb7811e4db removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
  1134
            withValueDo:[:result | 
e2bb7811e4db removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
  1135
                self cursorLine:selectionEndLine col:(selectionEndCol + 1).
e2bb7811e4db removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
  1136
                self insertSelectedStringAtCursor:(result displayString "printString")
e2bb7811e4db removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
  1137
            ]
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1138
    ]
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1139
1521
e2bb7811e4db removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
  1140
    "Modified: / 16.5.1998 / 16:44:44 / cg"
1501
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1141
!
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1142
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1143
spyOnIt
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1144
    "user selected 'spyOnIt' from menu; show a wait-cursor, evaluate the code
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1145
     and finally restore cursor; return result of evaluation"
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1146
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1147
    |code|
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1148
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1149
    code := 'MessageTally spyOn:[' , self selection asString string, ']'.
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1150
    self do:code withValueDo:[:result | ]
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1151
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1152
    "Modified: / 22.4.1998 / 22:03:53 / ca"
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1153
!
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1154
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1155
timeIt
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1156
    "user selected 'timeIt' from menu; show a wait-cursor, evaluate the code
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1157
     and finally restore cursor; return result of evaluation"
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1158
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1159
    |code|
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1160
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1161
    code := '|t| t := Time millisecondsToRun:[' , self selection asString string, '].
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1162
Transcript showCR:''execution time: '' , t printString , '' ms''.'.
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1163
    self do:code withValueDo:[:result | ]
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1164
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1165
    "Modified: / 22.4.1998 / 22:03:51 / ca"
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1166
! !
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1167
2646
dcee45d1c5ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2641
diff changeset
  1168
!Workspace methodsFor:'queries'!
dcee45d1c5ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2641
diff changeset
  1169
dcee45d1c5ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2641
diff changeset
  1170
isWorkspace
dcee45d1c5ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2641
diff changeset
  1171
    ^ true
dcee45d1c5ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2641
diff changeset
  1172
! !
dcee45d1c5ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2641
diff changeset
  1173
206
2363a64a7c88 version at the end
Claus Gittinger <cg@exept.de>
parents: 201
diff changeset
  1174
!Workspace class methodsFor:'documentation'!
2363a64a7c88 version at the end
Claus Gittinger <cg@exept.de>
parents: 201
diff changeset
  1175
2363a64a7c88 version at the end
Claus Gittinger <cg@exept.de>
parents: 201
diff changeset
  1176
version
2893
b96a8967378e initial value of #autoDefine was not set correctly
Claus Gittinger <cg@exept.de>
parents: 2867
diff changeset
  1177
    ^ '$Header: /cvs/stx/stx/libwidg/Workspace.st,v 1.137 2004-02-19 14:22:58 cg Exp $'
858
ef7ba327189b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  1178
! !