Workspace.st
author Claus Gittinger <cg@exept.de>
Fri, 24 Oct 2008 15:15:54 +0200
changeset 3744 c206f437042e
parent 3742 30ee702cd146
child 3785 8d8d84e1b72c
permissions -rw-r--r--
turn on/off selector warnings
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
"
2277
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
    12
"{ Package: 'stx:libwidg' }"
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
    13
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    14
TextCollector subclass:#Workspace
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
    15
	instanceVariableNames:'doItAction codeStartPosition errorFgColor errorBgColor
2679
1e61847e26f4 autoDefine as doIt added
Claus Gittinger <cg@exept.de>
parents: 2663
diff changeset
    16
		commentStrings autoDefineWorkspaceVariables simulatedSelf
3537
1761370c0869 sharedPool access in doIts
Claus Gittinger <cg@exept.de>
parents: 3511
diff changeset
    17
		autoDefineVariables compilerClass allowValueDrop
1761370c0869 sharedPool access in doIts
Claus Gittinger <cg@exept.de>
parents: 3511
diff changeset
    18
		poolsConsideredInDoIts'
2492
740174c1be0f allow separate bg-color from styleSheet
Claus Gittinger <cg@exept.de>
parents: 2489
diff changeset
    19
	classVariableNames:'DefaultViewBackground DefaultErrorForegroundColor
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
    20
		DefaultErrorBackgroundColor DefaultWarningBackgroundColor
3712
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
    21
		DefaultWarningForegroundColor WorkspaceVariables DoItHistory
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
    22
		Sniplets'
257
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
    23
	poolDictionaries:''
2097
66d564e3752a category change
Claus Gittinger <cg@exept.de>
parents: 1968
diff changeset
    24
	category:'Interface-Smalltalk'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    25
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    26
3155
15d43d2ea850 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
    27
Workspace comment:'declared from: ..\..\..\stx\libwidg\abbrev.stc'
15d43d2ea850 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
    28
!
15d43d2ea850 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
    29
32
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
    30
!Workspace class methodsFor:'documentation'!
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
    31
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    32
copyright
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    33
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    34
 COPYRIGHT (c) 1989 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 58
diff changeset
    35
	      All Rights Reserved
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    36
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    37
 This software is furnished under a license and may be used
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    38
 only in accordance with the terms of that license and with the
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    39
 inclusion of the above copyright notice.   This software may not
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    40
 be provided or otherwise made available to, or used by, any
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    41
 other person.  No title to or ownership of the software is
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    42
 hereby transferred.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    43
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    44
!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    45
32
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
    46
documentation
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
    47
"
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
    48
    a view for editable text which can evaluate expressions.
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    49
    I.e. its basically a view for editable text, with added
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    50
    'doIt', 'printIt' and 'inspectIt' functions on the popup-menu.
125
claus
parents: 123
diff changeset
    51
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    52
    The action to be performed on doIt is defined by a block,
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
    53
    which can be defined by the owner of this view.
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    54
    (thus you can put a workspace into more complex widgets, and
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    55
     control what should happen on 'doIt').
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
    56
578
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    57
    A useful default action is automatically defined, which simply 
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    58
    evaluates the selection as a smalltalk expression. 
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    59
    (but, a lisp or prolog workspace would define its own action,
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    60
     to call for another compiler/interpreter  ...)
32
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
    61
123
claus
parents: 121
diff changeset
    62
claus
parents: 121
diff changeset
    63
    Caveat:
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
    64
        in this version, Workspace does not yet support doIt in MVC setups.
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
    65
        For now, simulate this by setting the doItAction, to notify the
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
    66
        model manually about the doIt.
123
claus
parents: 121
diff changeset
    67
claus
parents: 121
diff changeset
    68
578
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    69
    [instance variables:]
32
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
    70
121
claus
parents: 119
diff changeset
    71
      doItAction      <Block>         block to evaluate for doIt
123
claus
parents: 121
diff changeset
    72
121
claus
parents: 119
diff changeset
    73
      errorFgColor    <Color>         fg-Color to be used when highlighting errors 
claus
parents: 119
diff changeset
    74
claus
parents: 119
diff changeset
    75
      errorBgColor    <Color>         bg-Color to be used when highlighting errors
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
    76
578
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    77
      codeStartPosition               private temporary
121
claus
parents: 119
diff changeset
    78
578
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    79
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    80
    [styleSheet values:]
121
claus
parents: 119
diff changeset
    81
claus
parents: 119
diff changeset
    82
      codeErrorSelectionForegroundColor     fg color to highlight errors
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
    83
                                            (default: selection fg)
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
    84
121
claus
parents: 119
diff changeset
    85
      codeErrorSelectionBackgroundColor     bg color to highlight errors
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
    86
                                            (default: selection bg)
578
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    87
1522
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
    88
    [start with:]
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
    89
        Workspace open
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
    90
578
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    91
    [see also:]
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    92
        Workspace EditTextView 
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    93
        Parser ByteCodeCompiler
583
2ec13b7ceba5 documentation
Claus Gittinger <cg@exept.de>
parents: 578
diff changeset
    94
2ec13b7ceba5 documentation
Claus Gittinger <cg@exept.de>
parents: 578
diff changeset
    95
    [author:]
2ec13b7ceba5 documentation
Claus Gittinger <cg@exept.de>
parents: 578
diff changeset
    96
        Claus Gittinger
32
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
    97
"
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    98
! !
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    99
3712
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
   100
!Workspace class methodsFor:'accessing'!
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
   101
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
   102
sniplets
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
   103
    Sniplets isNil ifTrue:[
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
   104
        Sniplets := Dictionary new.
3713
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
   105
        self initializeDefaultAbbreviations.
3712
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
   106
    ].
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
   107
    ^ Sniplets
3713
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
   108
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
   109
    "
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
   110
     Sniplets := nil
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
   111
    "
3712
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
   112
!
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
   113
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
   114
sniplets:something
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
   115
    Sniplets := something.
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
   116
! !
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
   117
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   118
!Workspace class methodsFor:'defaults'!
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   119
1522
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   120
defaultLabel
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   121
    "my default window label"
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   122
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   123
    ^ 'Workspace'
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   124
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   125
    "Created: / 16.5.1998 / 16:53:37 / cg"
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   126
!
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   127
3716
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   128
initializeDefaultAbbreviations
3728
5bbf7c4a0231 more abbrevs
Claus Gittinger <cg@exept.de>
parents: 3726
diff changeset
   129
    "default sniplets/abbreviations"
5bbf7c4a0231 more abbrevs
Claus Gittinger <cg@exept.de>
parents: 3726
diff changeset
   130
3735
3b616f1c9f9b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3728
diff changeset
   131
    "flush and reinitialize sniplets with:
3741
d86e1e2dd088 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   132
     Sniplets := nil.
d86e1e2dd088 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   133
    "
d86e1e2dd088 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   134
    "update after a code change with:
d86e1e2dd088 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   135
     self initializeDefaultAbbreviations.
3735
3b616f1c9f9b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3728
diff changeset
   136
    "
3716
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   137
    Sniplets
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   138
        at: 'in'    put: 'isNil ';
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   139
        at: 'nn'    put: 'notNil ';
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   140
        at: 'it'    put: 'ifTrue: [!!]';
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   141
        at: 'if'    put: 'ifFalse: [!!]';
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   142
        at: 'itf'    put: 'ifTrue: [!!] ifFalse: []';
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   143
        at: 'int'   put: 'isNil ifTrue: [!!]';
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   144
        at: 'inf'   put: 'isNil ifFalse: [!!]';
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   145
        at: 'ints'  put: 'isNil ifTrue: [^self]';
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   146
        at: 'infs'  put: 'isNil ifFalse: [^self]';
3728
5bbf7c4a0231 more abbrevs
Claus Gittinger <cg@exept.de>
parents: 3726
diff changeset
   147
        at: 'iftrue'   put: 'ifTrue';
5bbf7c4a0231 more abbrevs
Claus Gittinger <cg@exept.de>
parents: 3726
diff changeset
   148
        at: 'iffalse'  put: 'ifFalse';
5bbf7c4a0231 more abbrevs
Claus Gittinger <cg@exept.de>
parents: 3726
diff changeset
   149
        at: 'iftrue:'   put: 'ifTrue:';
5bbf7c4a0231 more abbrevs
Claus Gittinger <cg@exept.de>
parents: 3726
diff changeset
   150
        at: 'iffalse:'  put: 'ifFalse:';
3716
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   151
        at: 'wt'    put: 'whileTrue: [!!]';
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   152
        at: 'wf'    put: 'whileFalse: [!!]';
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   153
        at: 'do'    put: 'do: [:each | !!]';
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   154
        at: 'dt'    put: 'detect: [:each | !!]';   
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   155
        at: 'de'    put: 'detect: [:each | !!]';
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   156
        at: 'det'   put: 'detect: [:each | !!]';
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   157
        at: 'dtn'   put: 'detect: [:each | !!] ifNone: []';
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   158
        at: 'cl'    put: 'collect: [:each | !!]';
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   159
        at: 'co'    put: 'collect: [:each | !!]';
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   160
        at: 'col'   put: 'collect: [:each | !!]';
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   161
        at: 'sl'    put: 'select: [:each | !!]';
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   162
        at: 'se'    put: 'select: [:each | !!]';
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   163
        at: 'sel'   put: 'select: [:each | !!]';
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   164
        at: 'rj'    put: 'reject: [:each | !!]';
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   165
        at: 're'    put: 'reject: [:each | !!]';
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   166
        at: 'rej'   put: 'reject: [:each | !!]';
3728
5bbf7c4a0231 more abbrevs
Claus Gittinger <cg@exept.de>
parents: 3726
diff changeset
   167
        at: 'inj'   put: 'inject: !! into:[:pValue :each | ]';
5bbf7c4a0231 more abbrevs
Claus Gittinger <cg@exept.de>
parents: 3726
diff changeset
   168
        at: 'ex'    put: 'Error handle:[ex | !!] do:[]';
3716
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   169
        at: 'np'    put: 'nextPut: ';
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   170
        at: 'npa'   put: 'nextPutAll: ';
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   171
        at: 'y'     put: 'yourself.';
3728
5bbf7c4a0231 more abbrevs
Claus Gittinger <cg@exept.de>
parents: 3726
diff changeset
   172
        at: 's'     put: 'self ';
3716
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   173
        at: 'sh'    put: 'self halt.';
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   174
        at: 'ps'    put: 'printString';
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   175
        at: 'sr'    put: 'self subclassResponsibility';
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   176
        at: 'st'    put: 'Smalltalk';
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   177
        at: 'ts'    put: 'Transcript showCR: ';
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   178
        at: 'trs'   put: 'Transcript showCR: ';
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   179
        at: 'ik'    put: 'includesKey: #';
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   180
        at: 'abb'   put: 'Workspace sniplets inspect';
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   181
        at: 'ws'    put: 'Delay waitForSeconds: 1'; 
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   182
        at: 'wfs'   put: 'Delay waitForSeconds: 1'; 
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   183
        at: 'wfm'   put: 'Delay waitForMilliseconds: 1000'; 
3728
5bbf7c4a0231 more abbrevs
Claus Gittinger <cg@exept.de>
parents: 3726
diff changeset
   184
        at: 'eslf'  put: 'self';
3716
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   185
        at: 'slef'  put: 'self';
3728
5bbf7c4a0231 more abbrevs
Claus Gittinger <cg@exept.de>
parents: 3726
diff changeset
   186
        at: 'sefl'  put: 'self';
3738
d3cf61eabaaf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
   187
        at: 'elf'   put: 'self';
d3cf61eabaaf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
   188
        at: 'slf'   put: 'self';
d3cf61eabaaf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
   189
        at: 'sel'   put: 'self';
d3cf61eabaaf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
   190
        at: 'sef'   put: 'self';
3716
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   191
        at: 'ati'   put: 'at:!! ifAbsent: ';
3728
5bbf7c4a0231 more abbrevs
Claus Gittinger <cg@exept.de>
parents: 3726
diff changeset
   192
        at: 'ini'   put: 'initialize', String lf,'    super initialize.', String lf, '    ';
5bbf7c4a0231 more abbrevs
Claus Gittinger <cg@exept.de>
parents: 3726
diff changeset
   193
        at: 'newi'  put: 'new', String lf,'    ^ super new initialize.';
3735
3b616f1c9f9b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3728
diff changeset
   194
        at: 'upd'   put: 'update:something with:aParameter from:changedObject', String lf,'    !!', String lf,'    ^ super update:something with:aParameter from:changedObject.';
3716
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   195
        at: 'A'     put: 'Array';
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   196
        at: 'An'    put: 'Array new:';
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   197
        at: 'OC'    put: 'OrderedCollection';
3741
d86e1e2dd088 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   198
        at: 'SC'    put: 'SortedCollection';
3742
30ee702cd146 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3741
diff changeset
   199
        at: 'D'     put: 'Dictionary';
3716
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   200
        at: 'ID'    put: 'IdentityDictionary';
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   201
        at: 'Id'    put: 'IdentityDictionary';
3717
d3c323d0fa98 more abbs
fm
parents: 3716
diff changeset
   202
        at: 'OCn'   put: 'OrderedCollection new.';
3741
d86e1e2dd088 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   203
        at: 'SCn'   put: 'SortedCollection new.';
d86e1e2dd088 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   204
        at: 'IDn'   put: 'IdentityDictionary new';
d86e1e2dd088 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   205
        at: 'Dn'    put: 'Dictionary new';
d86e1e2dd088 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   206
        at: 'Sn'    put: 'Set new';
3717
d3c323d0fa98 more abbs
fm
parents: 3716
diff changeset
   207
        at: 'Aw'    put: 'Array with:';
d3c323d0fa98 more abbs
fm
parents: 3716
diff changeset
   208
        at: 'Aww'   put: 'Array with:!! with:';
d3c323d0fa98 more abbs
fm
parents: 3716
diff changeset
   209
        at: 'Awww'  put: 'Array with:!! with: with:';
3742
30ee702cd146 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3741
diff changeset
   210
        at: 'Awwww' put: 'Array with:!! with: with: with:';
3728
5bbf7c4a0231 more abbrevs
Claus Gittinger <cg@exept.de>
parents: 3726
diff changeset
   211
        at: '0'     put: '(0.0 @ 0.0)';
5bbf7c4a0231 more abbrevs
Claus Gittinger <cg@exept.de>
parents: 3726
diff changeset
   212
        at: '['     put: '[:!! ] ';
3716
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   213
        yourself
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   214
!
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   215
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   216
updateStyleCache
444
ef26eba8c854 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 430
diff changeset
   217
    "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
   218
1354
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
   219
    <resource: #style (#'codeErrorSelection.foregroundColor'
2492
740174c1be0f allow separate bg-color from styleSheet
Claus Gittinger <cg@exept.de>
parents: 2489
diff changeset
   220
                       #'codeErrorSelection.backgroundColor'
740174c1be0f allow separate bg-color from styleSheet
Claus Gittinger <cg@exept.de>
parents: 2489
diff changeset
   221
                       #'codeView.backgroundColor' )>
444
ef26eba8c854 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 430
diff changeset
   222
1354
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
   223
    DefaultErrorForegroundColor := StyleSheet colorAt:'codeErrorSelection.foregroundColor'.
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
   224
    DefaultErrorBackgroundColor := StyleSheet colorAt:'codeErrorSelection.backgroundColor'.
2492
740174c1be0f allow separate bg-color from styleSheet
Claus Gittinger <cg@exept.de>
parents: 2489
diff changeset
   225
    DefaultViewBackground := StyleSheet colorAt:'codeView.backgroundColor'.
32
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
   226
! !
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
   227
2776
17dca7ff1f82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2775
diff changeset
   228
!Workspace class methodsFor:'getting a new Workspace'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   229
32
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
   230
open
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   231
    "launch a new workspace"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   232
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   233
    |scr topView workspace f|
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   234
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   235
    topView := StandardSystemView 
1522
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   236
                label:(self classResources string:(self defaultLabel)) 
1901
b3556ff49778 removed minExtent - let topView decide.
Claus Gittinger <cg@exept.de>
parents: 1738
diff changeset
   237
                " minExtent:(100 @ 100)".
23
69f1ba57f67a *** empty log message ***
claus
parents: 15
diff changeset
   238
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   239
    scr := HVScrollableView for:self in:topView.
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   240
    scr origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   241
    workspace := scr scrolledView.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   242
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   243
    "/ adjust topViews extent according to my font
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   244
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   245
    f := workspace font.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   246
    topView extent:((f widthOf:'x') * 40) @ (f height * 10).
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   247
    topView open.
131
claus
parents: 125
diff changeset
   248
    ^ workspace
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   249
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   250
    "
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   251
     Workspace open
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   252
    "
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   253
1522
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   254
    "Modified: / 16.5.1998 / 16:53:53 / cg"
857
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   255
!
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   256
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   257
openForRemote:hostName
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   258
    "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
   259
     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
   260
     and the result is shown here.
857
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   261
     This requires the RemoteObjects package to be loaded."
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   262
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   263
    |server remoteCompiler workspace|
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   264
1522
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   265
    RemoteObjectServer isNil ifTrue:[
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   266
        self warn:'no remoteObjectServer available'.
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   267
        ^ nil
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   268
    ].
857
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   269
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   270
    server := RemoteObjectServer on:hostName.
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   271
    remoteCompiler := server get:#Compiler.
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   272
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   273
    workspace := self open.
1522
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   274
    workspace topView 
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   275
        label:(self classResources string:'Remote Workspace {%1}' with:hostName).
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   276
857
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   277
    workspace doItAction:
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   278
                [:theCode |
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   279
                    remoteCompiler 
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   280
                        evaluate:theCode 
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   281
                        in:nil 
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   282
                        receiver:nil 
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   283
                        notifying:workspace 
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   284
                        logged:true 
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   285
                        ifFail:nil 
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   286
                ]
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   287
    "
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   288
     Workspace openForRemote:'andi'
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   289
    "
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   290
1522
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   291
    "Modified: / 16.5.1998 / 16:57:38 / cg"
2686
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   292
!
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   293
2794
90115a2de9d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   294
openWith:initialText selected:selectedBoolean
2686
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   295
    "launch a new workspace with some initial contents"
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   296
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   297
    |workspace|
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   298
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   299
    workspace := self open.
2794
90115a2de9d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   300
    workspace contents:initialText selected:selectedBoolean.
2686
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   301
    ^ workspace
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   302
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   303
    "
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   304
     Workspace openWith:'Transcript showCR:''hello world'''
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   305
    "
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   306
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   307
2657
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   308
!Workspace class methodsFor:'history'!
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   309
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   310
clearDoItHistory
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   311
    DoItHistory := nil
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   312
!
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   313
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   314
doItHistory
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   315
    ^ DoItHistory
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   316
!
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   317
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   318
doItHistorySize
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   319
    "the number of remembered doIts"
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   320
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   321
    ^ 20
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   322
!
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   323
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   324
rememberDoIt:aString
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   325
    |string|
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   326
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   327
    string := aString asString string withoutSeparators.
2726
f258efeca730 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2717
diff changeset
   328
    (string asCollectionOfWords size <= 1) ifTrue:[
f258efeca730 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2717
diff changeset
   329
        ((Scanner new scanTokens:string) size <= 1) ifTrue:[
f258efeca730 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2717
diff changeset
   330
            "its a variable only"
f258efeca730 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2717
diff changeset
   331
            ^ self
f258efeca730 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2717
diff changeset
   332
        ]
f258efeca730 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2717
diff changeset
   333
    ].
2657
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   334
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   335
    DoItHistory isNil ifTrue:[
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   336
        DoItHistory := OrderedCollection new.
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   337
    ].
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   338
    DoItHistory remove:string ifAbsent:nil.
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   339
    DoItHistory addFirst:string.
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   340
    DoItHistory size > self doItHistorySize ifTrue:[
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   341
        DoItHistory removeLast
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   342
    ].
2726
f258efeca730 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2717
diff changeset
   343
f258efeca730 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2717
diff changeset
   344
    Scanner
2657
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   345
! !
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   346
1523
6c0045d6a91f open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents: 1522
diff changeset
   347
!Workspace class methodsFor:'queries'!
6c0045d6a91f open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents: 1522
diff changeset
   348
6c0045d6a91f open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents: 1522
diff changeset
   349
isVisualStartable
6c0045d6a91f open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents: 1522
diff changeset
   350
    "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
   351
     (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
   352
6c0045d6a91f open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents: 1522
diff changeset
   353
    ^ self == Workspace
6c0045d6a91f open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents: 1522
diff changeset
   354
6c0045d6a91f open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents: 1522
diff changeset
   355
    "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
   356
    "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
   357
! !
6c0045d6a91f open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents: 1522
diff changeset
   358
1931
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   359
!Workspace class methodsFor:'workspace variables'!
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   360
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   361
addWorkspaceVariable:name
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   362
    "create a new workspace variable"
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   363
1933
a3d9c133279f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1932
diff changeset
   364
    |holder|
a3d9c133279f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1932
diff changeset
   365
3325
b7e01a88b167 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3319
diff changeset
   366
    holder := self workspaceVariables at:name ifAbsentPut:[ ValueHolder new ].
1933
a3d9c133279f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1932
diff changeset
   367
    ^ holder
1931
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   368
!
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   369
3157
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   370
anyWorkspaceVariableIsDefined
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   371
    ^ WorkspaceVariables notEmptyOrNil
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   372
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   373
    "Created: / 20-04-2005 / 11:57:53 / cg"
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   374
!
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   375
1931
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   376
removeAllWorkspaceVariables
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   377
    "delete all workspace variables"
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   378
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   379
    WorkspaceVariables := nil
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   380
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   381
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   382
!
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   383
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   384
removeWorkspaceVariable:name
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   385
    "delete a workspace variable"
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   386
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   387
    WorkspaceVariables notNil ifTrue:[
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   388
        WorkspaceVariables removeKey:name ifAbsent:nil.
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   389
        WorkspaceVariables isEmpty ifTrue:[
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   390
            WorkspaceVariables := nil
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   391
        ]
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   392
    ].
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   393
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   394
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   395
!
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   396
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   397
workspaceVariableAt:name
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   398
    "retrieve a workspace variable (actually, a holder onto it)"
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   399
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   400
    WorkspaceVariables isNil ifTrue:[^ nil].
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   401
    ^ WorkspaceVariables at:name ifAbsent:nil.
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   402
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   403
1932
a898c608fb9a support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   404
!
a898c608fb9a support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   405
3157
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   406
workspaceVariableNames
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   407
    "retrieve the collection of workspace variable names"
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   408
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   409
    WorkspaceVariables isNil ifTrue:[^ #()].
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   410
    ^ WorkspaceVariables keys
1932
a898c608fb9a support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   411
3157
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   412
    "Created: / 20-04-2005 / 11:42:45 / cg"
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   413
!
1932
a898c608fb9a support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   414
3157
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   415
workspaceVariables
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   416
    "retrieve the collection of workspace variables.
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   417
     That is a dictionary associating names to values."
1932
a898c608fb9a support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   418
3325
b7e01a88b167 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3319
diff changeset
   419
    WorkspaceVariables isNil ifTrue:[
b7e01a88b167 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3319
diff changeset
   420
        WorkspaceVariables := Dictionary new.
b7e01a88b167 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3319
diff changeset
   421
    ].
b7e01a88b167 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3319
diff changeset
   422
    ^ WorkspaceVariables
3157
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   423
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   424
    "Modified: / 20-04-2005 / 11:43:14 / cg"
1931
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   425
! !
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   426
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   427
!Workspace methodsFor:'accessing'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   428
3428
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
   429
allowValueDrop:aBoolean
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
   430
    "if on (the default), any smalltalk value can be dropped and leads to a workspace variable
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
   431
     holding on to that being defined. Can be turned off, if youdont like this (for standAlone apps)"
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
   432
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
   433
    allowValueDrop := aBoolean.
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
   434
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
   435
    "Created: / 28-11-2006 / 16:13:02 / cg"
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
   436
!
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
   437
2679
1e61847e26f4 autoDefine as doIt added
Claus Gittinger <cg@exept.de>
parents: 2663
diff changeset
   438
autoDefineVariables
1e61847e26f4 autoDefine as doIt added
Claus Gittinger <cg@exept.de>
parents: 2663
diff changeset
   439
    ^ autoDefineVariables 
2535
0884418b7c41 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2534
diff changeset
   440
!
0884418b7c41 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2534
diff changeset
   441
2679
1e61847e26f4 autoDefine as doIt added
Claus Gittinger <cg@exept.de>
parents: 2663
diff changeset
   442
autoDefineVariables:nilOrSymbol
3429
670414b849dd allow value drop to be disabled
Claus Gittinger <cg@exept.de>
parents: 3428
diff changeset
   443
    "undefined variables handling:
670414b849dd allow value drop to be disabled
Claus Gittinger <cg@exept.de>
parents: 3428
diff changeset
   444
        are automatically defined as workspace variable if nilOrSymbol is #workspace.
670414b849dd allow value drop to be disabled
Claus Gittinger <cg@exept.de>
parents: 3428
diff changeset
   445
        are automatically defined as doit variable if nilOrSymbol is #doit.
670414b849dd allow value drop to be disabled
Claus Gittinger <cg@exept.de>
parents: 3428
diff changeset
   446
        are left undefined if nilOrSymbol is nil."
670414b849dd allow value drop to be disabled
Claus Gittinger <cg@exept.de>
parents: 3428
diff changeset
   447
2679
1e61847e26f4 autoDefine as doIt added
Claus Gittinger <cg@exept.de>
parents: 2663
diff changeset
   448
    autoDefineVariables := nilOrSymbol.
3429
670414b849dd allow value drop to be disabled
Claus Gittinger <cg@exept.de>
parents: 3428
diff changeset
   449
670414b849dd allow value drop to be disabled
Claus Gittinger <cg@exept.de>
parents: 3428
diff changeset
   450
    "Modified: / 28-11-2006 / 16:21:01 / cg"
2679
1e61847e26f4 autoDefine as doIt added
Claus Gittinger <cg@exept.de>
parents: 2663
diff changeset
   451
!
2535
0884418b7c41 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2534
diff changeset
   452
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   453
commentStrings:anArrayOfCommentStrings
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   454
    "define the comment strings"
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   455
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   456
    commentStrings := anArrayOfCommentStrings
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   457
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   458
    "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
   459
!
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   460
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   461
doItAction
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   462
    "return the action to be performed when 'doIt' is selected"
32
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
   463
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   464
    ^ doItAction
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   465
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   466
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   467
errorBackgroundColor
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   468
    errorBgColor notNil ifTrue:[ ^ errorBgColor ].
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   469
    DefaultErrorBackgroundColor notNil ifTrue:[ ^ DefaultErrorBackgroundColor ].
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   470
    device hasColors ifTrue:[ ^ Color red ].
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   471
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   472
    ^ selectionBgColor
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   473
!
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   474
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   475
errorForegroundColor
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   476
    errorFgColor notNil ifTrue:[ ^ errorFgColor ].
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   477
    DefaultErrorForegroundColor notNil ifTrue:[ ^ DefaultErrorForegroundColor ].
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   478
    ^ selectionFgColor
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   479
!
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   480
3279
087a9e32c714 oops - autoselect for doIt was done too early
Claus Gittinger <cg@exept.de>
parents: 3272
diff changeset
   481
hasSelectionOrTextInCursorLine
087a9e32c714 oops - autoselect for doIt was done too early
Claus Gittinger <cg@exept.de>
parents: 3272
diff changeset
   482
    ^ (self selectionOrTextOfCursorLine:false) notNil
087a9e32c714 oops - autoselect for doIt was done too early
Claus Gittinger <cg@exept.de>
parents: 3272
diff changeset
   483
!
087a9e32c714 oops - autoselect for doIt was done too early
Claus Gittinger <cg@exept.de>
parents: 3272
diff changeset
   484
3537
1761370c0869 sharedPool access in doIts
Claus Gittinger <cg@exept.de>
parents: 3511
diff changeset
   485
poolsConsideredInDoIts:something
1761370c0869 sharedPool access in doIts
Claus Gittinger <cg@exept.de>
parents: 3511
diff changeset
   486
    poolsConsideredInDoIts := something.
1761370c0869 sharedPool access in doIts
Claus Gittinger <cg@exept.de>
parents: 3511
diff changeset
   487
!
1761370c0869 sharedPool access in doIts
Claus Gittinger <cg@exept.de>
parents: 3511
diff changeset
   488
2727
4c13da01ea6b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2726
diff changeset
   489
selectAll
4c13da01ea6b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2726
diff changeset
   490
    super selectAll
4c13da01ea6b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2726
diff changeset
   491
!
4c13da01ea6b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2726
diff changeset
   492
3272
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
   493
selectionOrTextOfCursorLine
3279
087a9e32c714 oops - autoselect for doIt was done too early
Claus Gittinger <cg@exept.de>
parents: 3272
diff changeset
   494
    ^ self selectionOrTextOfCursorLine:true
087a9e32c714 oops - autoselect for doIt was done too early
Claus Gittinger <cg@exept.de>
parents: 3272
diff changeset
   495
!
087a9e32c714 oops - autoselect for doIt was done too early
Claus Gittinger <cg@exept.de>
parents: 3272
diff changeset
   496
087a9e32c714 oops - autoselect for doIt was done too early
Claus Gittinger <cg@exept.de>
parents: 3272
diff changeset
   497
selectionOrTextOfCursorLine:doSelect
3272
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
   498
    |sel lNr line|
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
   499
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
   500
    sel := self selectionAsString.
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
   501
    sel notNil ifTrue:[^ sel].
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
   502
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
   503
    lNr := self cursorLine.
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
   504
    line := self listAt:lNr.
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
   505
    line notEmptyOrNil ifTrue:[
3279
087a9e32c714 oops - autoselect for doIt was done too early
Claus Gittinger <cg@exept.de>
parents: 3272
diff changeset
   506
        doSelect ifTrue:[
087a9e32c714 oops - autoselect for doIt was done too early
Claus Gittinger <cg@exept.de>
parents: 3272
diff changeset
   507
            self selectLine:lNr.
087a9e32c714 oops - autoselect for doIt was done too early
Claus Gittinger <cg@exept.de>
parents: 3272
diff changeset
   508
        ].
3272
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
   509
        ^ line
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
   510
    ].
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
   511
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
   512
    ^ nil
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
   513
!
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
   514
2601
d52e69edc760 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2595
diff changeset
   515
simulatedSelf:anObject
d52e69edc760 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2595
diff changeset
   516
    "define what self is in an evaluation"
d52e69edc760 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2595
diff changeset
   517
d52e69edc760 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2595
diff changeset
   518
    simulatedSelf := anObject
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   519
!
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   520
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   521
warningBackgroundColor
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   522
    DefaultWarningBackgroundColor notNil ifTrue:[ ^ DefaultWarningBackgroundColor ].
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   523
    device hasColors ifTrue:[ ^ Color orange ].
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   524
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   525
    ^ selectionBgColor
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   526
!
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   527
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   528
warningForegroundColor
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   529
    DefaultWarningForegroundColor notNil ifTrue:[ ^ DefaultWarningForegroundColor ].
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   530
    ^ selectionFgColor
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   531
! !
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   532
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   533
!Workspace methodsFor:'compiler interface'!
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   534
2303
a0cce4808d1d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2285
diff changeset
   535
compilerClass
2980
37d217fbca80 syntax setting
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   536
    ^ compilerClass ? Compiler
37d217fbca80 syntax setting
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   537
!
37d217fbca80 syntax setting
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   538
37d217fbca80 syntax setting
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   539
compilerClass:aCompilerClass
37d217fbca80 syntax setting
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   540
    compilerClass := aCompilerClass
2303
a0cce4808d1d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2285
diff changeset
   541
!
a0cce4808d1d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2285
diff changeset
   542
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   543
currentSourceCode
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   544
    "special interface to compiler - called by parser
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   545
     to get the updated source code after a corrected error"
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   546
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   547
    ^ self contents
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   548
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   549
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   550
wantChangeLog
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   551
    "sent by the compiler to ask if a changeLog entry should
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   552
     be written. Return true here."
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   553
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   554
    ^ true
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   555
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   556
2754
4e479333efa3 method category rename
Claus Gittinger <cg@exept.de>
parents: 2751
diff changeset
   557
!Workspace methodsFor:'compiler interface-error handling'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   558
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   559
correctableError:aString position:relPos to:relEndPos from:aCompiler
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   560
    "compiler notifies us of a correctable error;
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   561
     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
   562
     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
   563
     to be corrected; false otherwise"
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   564
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   565
    |action|
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   566
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   567
    self highlightingErrorPosition:relPos to:relEndPos do:[
3383
41470ff2567d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   568
        Dialog aboutToOpenBoxNotificationSignal handle:[:ex |
41470ff2567d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   569
            |box declareButton|
41470ff2567d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   570
41470ff2567d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   571
            box := ex parameter.
41470ff2567d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   572
            declareButton := box buttons at:2.
41470ff2567d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   573
            declareButton pressAction:declareButton controller releaseAction.
41470ff2567d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   574
            declareButton controller beTriggerOnDown.
41470ff2567d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   575
            ex proceed.
41470ff2567d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   576
        ] do:[
41470ff2567d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   577
            action := OptionBox 
41470ff2567d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   578
                          request:aString
3592
cb6f9f060e62 changed #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 3579
diff changeset
   579
                          label:(resources string:'Correctable Error')
3383
41470ff2567d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   580
                          image:(WarningBox iconBitmap)
3592
cb6f9f060e62 changed #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 3579
diff changeset
   581
                          buttonLabels:(resources array:#('Cancel' 'Declare as...' 'Correct...' 'Continue'))
3383
41470ff2567d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   582
                          values:#(#abort #declare #correct #continue)
41470ff2567d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   583
                          default:#continue
41470ff2567d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   584
                          onCancel:#abort.
41470ff2567d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   585
        ].
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   586
    ].
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   587
1930
5852350f36f4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1925
diff changeset
   588
    action == #declare ifTrue:[
5852350f36f4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1925
diff changeset
   589
        ^ action
5852350f36f4 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1925
diff changeset
   590
    ].
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   591
    action == #abort ifTrue:[
2477
8a324269ee7a class based exceptions - abortSignal;
Claus Gittinger <cg@exept.de>
parents: 2471
diff changeset
   592
        AbortOperationRequest raise.
368
53476ee1fbee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
   593
        ^ false
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   594
    ].
368
53476ee1fbee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
   595
    ^ action == #correct
53476ee1fbee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
   596
3383
41470ff2567d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   597
    "Modified: / 05-09-2006 / 12:20:42 / cg"
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   598
!
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   599
2104
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   600
correctableSelectorWarning:aString position:relPos to:relEndPos from:aCompiler
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   601
    "compiler notifies us of a correctable selector warning;
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   602
     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
   603
     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
   604
     to be corrected; false otherwise"
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   605
3744
c206f437042e turn on/off selector warnings
Claus Gittinger <cg@exept.de>
parents: 3742
diff changeset
   606
    |action doNotShowAgainHolder|
2104
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   607
3261
62a2ab999d42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3252
diff changeset
   608
    self highlightingWarningPosition:relPos to:relEndPos do:[
3744
c206f437042e turn on/off selector warnings
Claus Gittinger <cg@exept.de>
parents: 3742
diff changeset
   609
        doNotShowAgainHolder := false asValue.
c206f437042e turn on/off selector warnings
Claus Gittinger <cg@exept.de>
parents: 3742
diff changeset
   610
        Dialog aboutToOpenBoxNotificationSignal handle:[:ex |
c206f437042e turn on/off selector warnings
Claus Gittinger <cg@exept.de>
parents: 3742
diff changeset
   611
            (aCompiler notNil and:[aCompiler class doNotShowCompilerWarningAgainActionQuery isHandled]) ifTrue:[
c206f437042e turn on/off selector warnings
Claus Gittinger <cg@exept.de>
parents: 3742
diff changeset
   612
                ex parameter addCheckBox:'Do not show this dialog again (reenable via Launchers Settings Dialog)' on:doNotShowAgainHolder.
c206f437042e turn on/off selector warnings
Claus Gittinger <cg@exept.de>
parents: 3742
diff changeset
   613
            ].
c206f437042e turn on/off selector warnings
Claus Gittinger <cg@exept.de>
parents: 3742
diff changeset
   614
            ex proceed.
c206f437042e turn on/off selector warnings
Claus Gittinger <cg@exept.de>
parents: 3742
diff changeset
   615
        ] do:[
c206f437042e turn on/off selector warnings
Claus Gittinger <cg@exept.de>
parents: 3742
diff changeset
   616
            action := OptionBox 
2104
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   617
                      request:aString
3593
0de12c5b752a changed #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 3592
diff changeset
   618
                      label:(resources string:'Warning')
2983
910b4d5f7b1b dont send obsolete message (OptionBox request:..form:..)
Claus Gittinger <cg@exept.de>
parents: 2982
diff changeset
   619
                      image:(WarningBox iconBitmap)
2471
fc8c179c4228 finished remove unused vars;
Claus Gittinger <cg@exept.de>
parents: 2470
diff changeset
   620
                      buttonLabels:(resources array:#('Cancel' 'Correct...' 'Generate' 'Continue'))
2338
4c67cec79a84 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2326
diff changeset
   621
                      values:#(#abort #correct #generate #continue)
2391
f8cd579704db optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents: 2388
diff changeset
   622
                      default:#continue
f8cd579704db optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents: 2388
diff changeset
   623
                      onCancel:#abort.
3744
c206f437042e turn on/off selector warnings
Claus Gittinger <cg@exept.de>
parents: 3742
diff changeset
   624
        ].
c206f437042e turn on/off selector warnings
Claus Gittinger <cg@exept.de>
parents: 3742
diff changeset
   625
        doNotShowAgainHolder value == true ifTrue:[
c206f437042e turn on/off selector warnings
Claus Gittinger <cg@exept.de>
parents: 3742
diff changeset
   626
            aCompiler class doNotShowCompilerWarningAgainActionQuery actionQuery value
c206f437042e turn on/off selector warnings
Claus Gittinger <cg@exept.de>
parents: 3742
diff changeset
   627
        ].
2104
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   628
    ].
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   629
2338
4c67cec79a84 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2326
diff changeset
   630
    action == #generate ifTrue:[
4c67cec79a84 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2326
diff changeset
   631
        ^ action
4c67cec79a84 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2326
diff changeset
   632
    ].
4c67cec79a84 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2326
diff changeset
   633
2391
f8cd579704db optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents: 2388
diff changeset
   634
    (action isNil or:[action == #abort]) ifTrue:[
2477
8a324269ee7a class based exceptions - abortSignal;
Claus Gittinger <cg@exept.de>
parents: 2471
diff changeset
   635
        AbortOperationRequest raise.
2104
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   636
        ^ false
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   637
    ].
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   638
    ^ action == #correct
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   639
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   640
    "Created: / 19.1.2000 / 16:27:28 / cg"
2477
8a324269ee7a class based exceptions - abortSignal;
Claus Gittinger <cg@exept.de>
parents: 2471
diff changeset
   641
    "Modified: / 16.11.2001 / 17:39:29 / cg"
2104
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   642
!
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   643
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   644
error:aString position:relPos to:relEndPos asWarning:asWarning
2277
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   645
    "obsolete - no longer invoked"
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   646
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   647
    ^ self error:aString position:relPos to:relEndPos from:nil asWarning:asWarning
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   648
!
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   649
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   650
error:aString position:relPos to:relEndPos from:aCompiler
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   651
    "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
   652
     and show a Box asking for continue/abort."
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   653
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   654
    ^ self error:aString position:relPos to:relEndPos from:aCompiler asWarning:false
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   655
!
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   656
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   657
error:aString position:relPos to:relEndPos from:aCompiler asWarning:asWarning
3397
cd20f51edc25 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3396
diff changeset
   658
    "compiler notifies us of an error; hilight the error (relPos to relEndPos)
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   659
     and show a Box asking for continue/abort."
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   660
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   661
    |answer fg bg|
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   662
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   663
    fg := asWarning ifTrue:[ self warningForegroundColor ] ifFalse:[ self errorForegroundColor ].
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   664
    bg := asWarning ifTrue:[ self warningBackgroundColor ] ifFalse:[ self errorBackgroundColor ].
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   665
3397
cd20f51edc25 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3396
diff changeset
   666
    self
3480
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   667
        highlightingErrorPosition:relPos to:relEndPos
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   668
        withForeground:fg andBackground:bg
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   669
        do:[
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   670
            |box lbl doNotShowAgainHolder l1 y1 y2 l2|
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   671
3480
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   672
            Warning isHandled ifTrue:[
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   673
                Warning raiseErrorString:aString.
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   674
                ^ false
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   675
            ].
213
6286d3f36c14 raise warningSignal if handled (allows warnBoxes from compiler to be suppressed in debugger)
Claus Gittinger <cg@exept.de>
parents: 208
diff changeset
   676
3480
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   677
            "
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   678
             ask if we should abort or continue
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   679
            "
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   680
            box := YesNoBox
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   681
                    title:aString
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   682
                    yesText:(resources string:'Continue')
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   683
                    noText:(resources string:'Abort').
2799
4d9967d1052e support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 2794
diff changeset
   684
3480
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   685
            lbl := aCompiler isNil ifTrue:['Compiler'] ifFalse:[aCompiler class name].
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   686
            asWarning ifTrue:[
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   687
                lbl := lbl , ' Warning'
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   688
            ] ifFalse:[
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   689
                lbl := lbl , ' Error'.
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   690
            ].
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   691
            box label:lbl.
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   692
            box image:(WarningBox iconBitmap).
2799
4d9967d1052e support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 2794
diff changeset
   693
3480
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   694
            (aCompiler notNil and:[aCompiler class doNotShowCompilerWarningAgainActionQuery isHandled]) ifTrue:[
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   695
                doNotShowAgainHolder := false asValue.
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   696
                box addCheckBox:'Do not show this dialog again (reenable via Launchers Settings Dialog)' on:doNotShowAgainHolder.
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   697
            ].
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   698
3480
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   699
            answer := box confirm.
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   700
3480
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   701
            doNotShowAgainHolder value == true ifTrue:[
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   702
                aCompiler class doNotShowCompilerWarningAgainActionQuery actionQuery value
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   703
            ].
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   704
3480
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   705
            box destroy.
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   706
        ].
2799
4d9967d1052e support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 2794
diff changeset
   707
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   708
    "
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   709
     do the abort if we have to
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   710
    "
3397
cd20f51edc25 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3396
diff changeset
   711
    answer ifFalse:[
3480
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   712
        AbortOperationRequest raise.
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   713
    ].
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   714
    ^ 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
   715
2471
fc8c179c4228 finished remove unused vars;
Claus Gittinger <cg@exept.de>
parents: 2470
diff changeset
   716
    "Created: / 24.11.1995 / 22:56:34 / cg"
2477
8a324269ee7a class based exceptions - abortSignal;
Claus Gittinger <cg@exept.de>
parents: 2471
diff changeset
   717
    "Modified: / 16.11.2001 / 17:39:31 / cg"
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   718
!
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   719
2663
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
   720
highlightingErrorLine:lineNr do:aBlock
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
   721
    "evaluate aBlock while some selection is shown highlighted with error colors."
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
   722
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
   723
    |linePosition|
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
   724
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
   725
    linePosition := self characterPositionOfLine:lineNr col:1.
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
   726
    self highlightingErrorPosition:linePosition to:nil do:aBlock
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
   727
!
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
   728
59
450ce95a72a4 *** empty log message ***
claus
parents: 58
diff changeset
   729
highlightingErrorPosition:relPos to:relEndPos do:aBlock
450ce95a72a4 *** empty log message ***
claus
parents: 58
diff changeset
   730
    "evaluate aBlock while some selection is shown highlighted with error colors."
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   731
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   732
    self 
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   733
        highlightingErrorPosition:relPos to:relEndPos 
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   734
        withForeground:(self errorForegroundColor) andBackground:(self errorBackgroundColor) 
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   735
        do:aBlock
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   736
!
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   737
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   738
highlightingErrorPosition:relPos to:relEndPos withForeground:hilightFg andBackground:hilightBg do:aBlock
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   739
    "evaluate aBlock while some selection is shown highlighted with colors passed as args."
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   740
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   741
    |absPosition oldFg oldBg|
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   742
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   743
    "
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   744
     change color of selection & hide cursor
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   745
    "
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   746
    oldFg := selectionFgColor.
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   747
    oldBg := selectionBgColor.
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   748
    selectionBgColor := hilightBg.
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   749
    selectionFgColor := hilightFg.
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   750
    self hideCursor.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   751
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   752
    "
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   753
     select the text - relEndPos may be nil in which case the whole line is selected
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   754
     we have to adjust the positions given by the compiler, since they
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   755
     are relative to the texts start (the compiler did stream-read the code).
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   756
    "
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   757
    codeStartPosition isNil ifTrue:[codeStartPosition := 1].
3427
9aa7216e0a5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3414
diff changeset
   758
    absPosition := codeStartPosition + (relPos ? 1) - 1.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   759
    relEndPos isNil ifTrue:[
2519
a088ad3bb1e5 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 2492
diff changeset
   760
        self selectLineWhereCharacterPosition:absPosition
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   761
    ] ifFalse:[
3427
9aa7216e0a5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3414
diff changeset
   762
        self selectFromCharacterPosition:absPosition to:(codeStartPosition + (relEndPos ? 1) - 1)
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   763
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   764
    self makeSelectionVisible.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   765
155
claus
parents: 146
diff changeset
   766
    device flush.
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   767
2519
a088ad3bb1e5 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 2492
diff changeset
   768
    aBlock ensure:[
a088ad3bb1e5 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 2492
diff changeset
   769
        "
a088ad3bb1e5 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 2492
diff changeset
   770
         undo selection color change and show cursor again
a088ad3bb1e5 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 2492
diff changeset
   771
        "
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   772
        selectionFgColor := oldFg.
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   773
        selectionBgColor := oldBg.
2519
a088ad3bb1e5 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 2492
diff changeset
   774
        self showCursor.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   775
    ].
3427
9aa7216e0a5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3414
diff changeset
   776
9aa7216e0a5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3414
diff changeset
   777
    "Modified: / 16-11-2006 / 16:37:34 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   778
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   779
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   780
highlightingWarningPosition:relPos to:relEndPos do:aBlock
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   781
    "evaluate aBlock while some selection is shown highlighted with warning colors."
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   782
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   783
    self 
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   784
        highlightingErrorPosition:relPos to:relEndPos 
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   785
        withForeground:(self warningForegroundColor) andBackground:(self warningBackgroundColor) 
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   786
        do:aBlock
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   787
!
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   788
2386
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   789
unusedVariableWarning:aString position:relPos to:relEndPos from:aCompiler
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   790
    "compiler notifies us of a (or some) unused variables;
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   791
     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
   792
     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
   793
     to be corrected; false otherwise"
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   794
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   795
    |action|
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   796
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   797
    self highlightingWarningPosition:relPos to:relEndPos do:[
2386
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   798
        action := OptionBox 
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   799
                      request:aString
3593
0de12c5b752a changed #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 3592
diff changeset
   800
                      label:(resources string:'Warning')
2990
1373f301a694 dont send obsolete message to OptionBox
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
   801
                      image:(WarningBox iconBitmap)
3593
0de12c5b752a changed #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 3592
diff changeset
   802
                      buttonLabels:(resources array:#('Cancel' 'Remove Variable(s)' 'Continue'))
2470
240b6d2d5511 finished remove unused vars;
Claus Gittinger <cg@exept.de>
parents: 2462
diff changeset
   803
                      values:#(#abort #correct #continue)
2386
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   804
                      default:#continue.
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   805
    ].
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   806
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   807
    action == #abort ifTrue:[
2477
8a324269ee7a class based exceptions - abortSignal;
Claus Gittinger <cg@exept.de>
parents: 2471
diff changeset
   808
        AbortOperationRequest raise.
2386
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   809
        ^ false
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   810
    ].
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   811
    ^ action == #correct
2470
240b6d2d5511 finished remove unused vars;
Claus Gittinger <cg@exept.de>
parents: 2462
diff changeset
   812
2477
8a324269ee7a class based exceptions - abortSignal;
Claus Gittinger <cg@exept.de>
parents: 2471
diff changeset
   813
    "Modified: / 16.11.2001 / 17:39:34 / cg"
2386
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   814
!
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
   815
116
claus
parents: 97
diff changeset
   816
warning:aString position:relPos to:relEndPos from:aCompiler 
32
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
   817
    "compiler notifies us of a warning - same behavior as error"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   818
2277
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   819
    self error:aString position:relPos to:relEndPos from:aCompiler asWarning:true 
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   820
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   821
3396
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
   822
!Workspace methodsFor:'drag & drop'!
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
   823
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
   824
canDrop:aDropContext
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
   825
    "Any object can be dropped into workspace..."
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
   826
3428
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
   827
    allowValueDrop ifFalse:[
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
   828
        self isReadOnly ifTrue:[^ false].
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
   829
        ^ aDropContext dropObjects 
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
   830
            contains:[:someObject| (someObject isTextObject or:[ someObject isFileObject ])].
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
   831
    ].
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
   832
3396
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
   833
    ^ true
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
   834
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
   835
    "Created: / 16-08-2005 / 22:01:13 / janfrog"
3428
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
   836
    "Modified: / 28-11-2006 / 16:18:51 / cg"
3396
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
   837
!
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
   838
3414
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
   839
doDrop:aDropContext
3739
51ff23b09d46 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
   840
    self halt:'should no longer be reached'.
3428
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
   841
    self drop:aDropContext
3414
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
   842
3428
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
   843
    "Modified: / 28-11-2006 / 16:14:51 / cg"
3414
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
   844
!
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
   845
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
   846
drop:aDropContext
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
   847
    "Any object can be dropped into workspace..."
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
   848
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
   849
    |textObjects|
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
   850
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
   851
    aDropContext dropObjects do:[:dropObject|
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
   852
        (dropObject isTextObject or:[ dropObject isFileObject ]) ifTrue:[
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
   853
            self dropObjects:(Array with:dropObject)
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
   854
            "/ self paste:dropObject theObject asStringWithoutFinalCR
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
   855
        ] ifFalse:[
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
   856
            name := Dialog 
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
   857
                    request:(resources 
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
   858
                                string:'Name of new Workspace Variable (refers to the dropped %1):'
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
   859
                                with:dropObject theObject class name allBold
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
   860
                             )
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
   861
                    initialAnswer:'droppedObject'
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
   862
                    okLabel:'Add'
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
   863
                    title:'Enter Variable Name'.
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
   864
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
   865
            name notEmptyOrNil ifTrue:[
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
   866
                Workspace addWorkspaceVariable:name.
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
   867
                (Workspace workspaceVariableAt:name) value:dropObject theObject.
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
   868
            ].
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
   869
        ].
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
   870
    ].
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
   871
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
   872
    "Created: / 13-10-2006 / 17:34:07 / cg"
3396
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
   873
! !
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
   874
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   875
!Workspace methodsFor:'editing'!
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   876
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   877
commentFrom:line1 to:line2
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   878
    "convenient function to comment out a block.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   879
     All lines from line1 to line2 get an end-of-line comment
1925
e73fe37177a0 comment
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
   880
     in the first col 
e73fe37177a0 comment
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
   881
     (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
   882
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   883
    |eolComment opening closing|
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   884
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   885
    eolComment := commentStrings at:1.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   886
    eolComment isNil ifTrue:[
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   887
        opening := (commentStrings at:2) at:1.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   888
        closing := (commentStrings at:2) at:2.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   889
        (opening isNil or:[closing isNil]) ifTrue:[^ self].
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   890
    ].
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   891
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   892
    line1 to:line2 do:[:lineNr |
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   893
        |l|
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   894
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   895
        l := self listAt:lineNr.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   896
        l isNil ifTrue:[l := ''].
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   897
        eolComment notNil ifTrue:[
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   898
            l := eolComment , l
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   899
        ] ifFalse:[
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   900
            l := opening , l , closing
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   901
        ].
3403
d8482346fd7d tuned comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3397
diff changeset
   902
        self replaceLine:lineNr with:l.
d8482346fd7d tuned comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3397
diff changeset
   903
        widthOfWidestLine notNil ifTrue:[
d8482346fd7d tuned comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3397
diff changeset
   904
            widthOfWidestLine := widthOfWidestLine max:(self widthOfLineString:l).
d8482346fd7d tuned comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3397
diff changeset
   905
        ].
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   906
    ].
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   907
    self textChanged.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   908
3403
d8482346fd7d tuned comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3397
diff changeset
   909
    "Created: / 09-11-1997 / 01:05:35 / cg"
d8482346fd7d tuned comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3397
diff changeset
   910
    "Modified: / 09-10-2006 / 10:46:44 / cg"
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   911
!
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   912
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   913
commentSelection
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   914
    "convenient function to comment out a block.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   915
     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
   916
     in the first col."
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   917
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   918
    |e commentPair opening closing|
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   919
1481
a5fb903ee745 moved readOnlyCheck.
Claus Gittinger <cg@exept.de>
parents: 1395
diff changeset
   920
    (self checkModificationsAllowed) ifFalse:[ ^ self].
3210
75d4c266d873 care for EOL-comments only
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
   921
    commentStrings isNil ifTrue:[ self beep. ^ self].
75d4c266d873 care for EOL-comments only
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
   922
3207
0088a1d4fb0e without selection, comment/uncomment operate on the single cursor-line
Claus Gittinger <cg@exept.de>
parents: 3157
diff changeset
   923
    selectionStartLine isNil ifTrue:[ 
0088a1d4fb0e without selection, comment/uncomment operate on the single cursor-line
Claus Gittinger <cg@exept.de>
parents: 3157
diff changeset
   924
        self 
0088a1d4fb0e without selection, comment/uncomment operate on the single cursor-line
Claus Gittinger <cg@exept.de>
parents: 3157
diff changeset
   925
            undoableDo:[
0088a1d4fb0e without selection, comment/uncomment operate on the single cursor-line
Claus Gittinger <cg@exept.de>
parents: 3157
diff changeset
   926
                self commentFrom:cursorLine to:cursorLine
3543
113409e8ab8b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
   927
            ]
113409e8ab8b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
   928
            info:'Comment'.
3207
0088a1d4fb0e without selection, comment/uncomment operate on the single cursor-line
Claus Gittinger <cg@exept.de>
parents: 3157
diff changeset
   929
        ^ self
0088a1d4fb0e without selection, comment/uncomment operate on the single cursor-line
Claus Gittinger <cg@exept.de>
parents: 3157
diff changeset
   930
    ].
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   931
3129
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
   932
    self 
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
   933
        undoableDo:
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
   934
            [
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
   935
                (selectionStartCol == 1 and:[selectionEndCol == 0]) ifTrue:[
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
   936
                    self commentFrom:selectionStartLine to:selectionEndLine-1
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
   937
                ] ifFalse:[
3210
75d4c266d873 care for EOL-comments only
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
   938
                    commentPair := commentStrings at:2 ifAbsent:nil.
75d4c266d873 care for EOL-comments only
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
   939
                    commentPair isNil ifTrue:[
75d4c266d873 care for EOL-comments only
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
   940
                        self beep.
75d4c266d873 care for EOL-comments only
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
   941
                    ] ifFalse:[
75d4c266d873 care for EOL-comments only
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
   942
                        opening := commentPair at:1.
75d4c266d873 care for EOL-comments only
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
   943
                        closing := commentPair at:2.
75d4c266d873 care for EOL-comments only
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
   944
                        (opening isNil or:[closing isNil]) ifTrue:[^ self].
3129
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
   945
3210
75d4c266d873 care for EOL-comments only
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
   946
                        e := selectionEndCol.
75d4c266d873 care for EOL-comments only
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
   947
75d4c266d873 care for EOL-comments only
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
   948
                        self insertString:closing atLine:selectionEndLine col:e+1.
75d4c266d873 care for EOL-comments only
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
   949
                        self insertString:opening atLine:selectionStartLine col:selectionStartCol.
3129
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
   950
3210
75d4c266d873 care for EOL-comments only
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
   951
                        selectionStartLine == selectionEndLine ifTrue:[e := e + opening size].
75d4c266d873 care for EOL-comments only
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
   952
                        self selectFromLine:selectionStartLine col:selectionStartCol
75d4c266d873 care for EOL-comments only
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
   953
                                     toLine:selectionEndLine col:e+closing size.
75d4c266d873 care for EOL-comments only
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
   954
                    ]
3129
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
   955
                ]
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
   956
            ]
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
   957
        info:'comment'
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   958
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   959
    "Created: / 9.11.1997 / 01:05:40 / cg"
1481
a5fb903ee745 moved readOnlyCheck.
Claus Gittinger <cg@exept.de>
parents: 1395
diff changeset
   960
    "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
   961
!
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   962
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   963
uncommentFrom:line1 to:line2
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   964
    "convenient function to comment out a block.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   965
     All lines from line1 to line2 get an end-of-line comment
1925
e73fe37177a0 comment
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
   966
     in the first col.
e73fe37177a0 comment
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
   967
     (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
   968
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   969
    |eolComment opening closing rest|
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   970
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   971
    eolComment := commentStrings at:1.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   972
    eolComment isNil ifTrue:[
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   973
        opening := (commentStrings at:2) at:1.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   974
        closing := (commentStrings at:2) at:2.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   975
        (opening isNil or:[closing isNil]) ifTrue:[^ self].
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   976
    ] ifFalse:[
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   977
        rest := eolComment size + 1.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   978
    ].
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   979
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   980
    line1 to:line2 do:[:lineNr |
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   981
        |l|
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   982
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   983
        l := self listAt:lineNr.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   984
        l notNil ifTrue:[
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   985
            eolComment notNil ifTrue:[
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   986
                (l startsWith:eolComment) ifTrue:[
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   987
                    l := l copyFrom:rest
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   988
                ]
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   989
            ] ifFalse:[
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   990
                ((l startsWith:opening)
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   991
                and:[l endsWith:closing]) ifTrue:[
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   992
                    l := l copyFrom:opening size + 1.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   993
                    l := l copyWithoutLast:closing size.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   994
                ]
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   995
            ].
3403
d8482346fd7d tuned comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3397
diff changeset
   996
            self replaceLine:lineNr with:l.
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   997
        ]
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   998
    ].
3403
d8482346fd7d tuned comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3397
diff changeset
   999
    widthOfWidestLine := nil.
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1000
    self textChanged.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1001
3403
d8482346fd7d tuned comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3397
diff changeset
  1002
    "Created: / 09-11-1997 / 01:05:43 / cg"
d8482346fd7d tuned comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3397
diff changeset
  1003
    "Modified: / 09-10-2006 / 10:46:59 / cg"
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1004
!
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1005
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1006
uncommentSelection
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1007
    "convenient function to comment out a block.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1008
     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
  1009
     in the first col."
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1010
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1011
    |e commentPair opening closing sz1 sz2|
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1012
3129
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1013
    (self checkModificationsAllowed) ifFalse:[ ^ self].
3207
0088a1d4fb0e without selection, comment/uncomment operate on the single cursor-line
Claus Gittinger <cg@exept.de>
parents: 3157
diff changeset
  1014
    selectionStartLine isNil ifTrue:[ 
0088a1d4fb0e without selection, comment/uncomment operate on the single cursor-line
Claus Gittinger <cg@exept.de>
parents: 3157
diff changeset
  1015
        self 
0088a1d4fb0e without selection, comment/uncomment operate on the single cursor-line
Claus Gittinger <cg@exept.de>
parents: 3157
diff changeset
  1016
            undoableDo:[
0088a1d4fb0e without selection, comment/uncomment operate on the single cursor-line
Claus Gittinger <cg@exept.de>
parents: 3157
diff changeset
  1017
                self uncommentFrom:cursorLine to:cursorLine
3543
113409e8ab8b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  1018
            ]
113409e8ab8b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  1019
            info:'Uncomment'.
3207
0088a1d4fb0e without selection, comment/uncomment operate on the single cursor-line
Claus Gittinger <cg@exept.de>
parents: 3157
diff changeset
  1020
        ^ self
0088a1d4fb0e without selection, comment/uncomment operate on the single cursor-line
Claus Gittinger <cg@exept.de>
parents: 3157
diff changeset
  1021
    ].
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1022
3129
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1023
    self 
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1024
        undoableDo:
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1025
            [
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1026
                (selectionStartCol == 1 and:[selectionEndCol == 0]) ifTrue:[
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1027
                    self uncommentFrom:selectionStartLine to:selectionEndLine-1
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1028
                ] ifFalse:[
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1029
                    commentPair := commentStrings at:2.
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1030
                    opening := commentPair at:1.
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1031
                    closing := commentPair at:2.
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1032
                    (opening isNil or:[closing isNil]) ifTrue:[^ self].
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1033
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1034
                    sz1 := opening size.
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1035
                    sz2 := closing size.
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1036
3129
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1037
                    ((self 
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1038
                        stringAtLine:selectionStartLine 
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1039
                        from:selectionStartCol
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1040
                        to:selectionStartCol+sz1 - 1) = opening
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1041
                    and:[(self 
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1042
                        stringAtLine:selectionEndLine 
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1043
                        from:selectionEndCol - sz2 + 1
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1044
                        to:selectionEndCol) = closing ]) ifTrue:[
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1045
3129
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1046
                        self deleteCharsAtLine:selectionEndLine fromCol:selectionEndCol-sz2+1 toCol:selectionEndCol.
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1047
                        self deleteCharsAtLine:selectionStartLine fromCol:selectionStartCol toCol:selectionStartCol+sz1-1.
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1048
3129
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1049
                        e := selectionEndCol - sz2.
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1050
                        selectionStartLine == selectionEndLine ifTrue:[e := e - sz1].
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1051
                        self selectFromLine:selectionStartLine col:selectionStartCol
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1052
                                     toLine:selectionEndLine col:e.
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1053
                    ]
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1054
                ]
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1055
            ]
3129
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1056
        info:'uncomment'
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1057
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1058
    "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
  1059
    "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
  1060
! !
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1061
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1062
!Workspace methodsFor:'events'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1063
3712
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
  1064
expandAbbreviation
3713
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1065
    |expandedString abortExpandAction oldSelectionStartLine oldSelectionStartCol oldSelectionEndLine oldSelectionEndCol oldCursorLine oldCursorCol
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1066
     newCursorPos replStartCol|
3712
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
  1067
3713
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1068
    oldCursorLine := self cursorLine.
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1069
    oldCursorCol := self cursorCol.
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1070
    oldSelectionStartLine := self selectionStartLine.
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1071
    oldSelectionStartCol := self selectionStartCol.
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1072
    oldSelectionEndLine := self selectionEndLine.
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1073
    oldSelectionEndCol := self selectionEndCol.
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1074
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1075
    abortExpandAction := [
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1076
        self selectFromLine:oldSelectionStartLine 
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1077
                              col:oldSelectionStartCol 
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1078
                           toLine:oldSelectionEndLine 
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1079
                              col:oldSelectionEndCol.
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1080
        self cursorLine: oldCursorLine col: oldCursorCol.
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1081
    ].                                  
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1082
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1083
    expandedString := self findAbbreviationKeyBeforeCursor.
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1084
    expandedString isNil ifTrue:[
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1085
        abortExpandAction value.
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1086
        ^ self
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1087
    ].
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1088
    newCursorPos := expandedString indexOf:$!!.
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1089
    newCursorPos ~~ 0 ifTrue:[
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1090
        expandedString := expandedString copyWithout:$!!.
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1091
    ].
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1092
    replStartCol := self selectionStartCol.
3714
5af60edccb0d expandAbbreviations fix
fm
parents: 3713
diff changeset
  1093
    self
5af60edccb0d expandAbbreviations fix
fm
parents: 3713
diff changeset
  1094
        undoableDo:[
5af60edccb0d expandAbbreviations fix
fm
parents: 3713
diff changeset
  1095
            self replaceSelectionWith: expandedString.
5af60edccb0d expandAbbreviations fix
fm
parents: 3713
diff changeset
  1096
    ] info:'Replace'.
3713
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1097
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1098
    newCursorPos == 0 ifTrue:[
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1099
        "/ cursor already fine (at the end)
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1100
    ] ifFalse:[
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1101
        self cursorCol:replStartCol+newCursorPos-1
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1102
    ]
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1103
!
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1104
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1105
findAbbreviationKeyBeforeCursor
3726
a95a68928876 abbrevs: start checking for longer sequences first.
Claus Gittinger <cg@exept.de>
parents: 3720
diff changeset
  1106
    |maxKeyLen minKeyLen line stringBeforeCursor|
3713
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1107
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1108
    maxKeyLen := (self class sniplets keys collect:[:k | k size]) max.
3726
a95a68928876 abbrevs: start checking for longer sequences first.
Claus Gittinger <cg@exept.de>
parents: 3720
diff changeset
  1109
    minKeyLen := (self class sniplets keys collect:[:k | k size]) min.
a95a68928876 abbrevs: start checking for longer sequences first.
Claus Gittinger <cg@exept.de>
parents: 3720
diff changeset
  1110
    line := (self at:cursorLine) ? ''.
a95a68928876 abbrevs: start checking for longer sequences first.
Claus Gittinger <cg@exept.de>
parents: 3720
diff changeset
  1111
    stringBeforeCursor := line string copyTo:((cursorCol-1) min:line size).
3713
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1112
3726
a95a68928876 abbrevs: start checking for longer sequences first.
Claus Gittinger <cg@exept.de>
parents: 3720
diff changeset
  1113
    maxKeyLen := maxKeyLen min:stringBeforeCursor size.
a95a68928876 abbrevs: start checking for longer sequences first.
Claus Gittinger <cg@exept.de>
parents: 3720
diff changeset
  1114
a95a68928876 abbrevs: start checking for longer sequences first.
Claus Gittinger <cg@exept.de>
parents: 3720
diff changeset
  1115
    (maxKeyLen to:minKeyLen by:-1) do:[:l |
a95a68928876 abbrevs: start checking for longer sequences first.
Claus Gittinger <cg@exept.de>
parents: 3720
diff changeset
  1116
        |lCharactersBeforeCursor expandedString|
3713
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1117
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1118
        lCharactersBeforeCursor := stringBeforeCursor last:l.
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1119
        expandedString := self class sniplets at:lCharactersBeforeCursor ifAbsent:nil.
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1120
        expandedString notNil ifTrue:[
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1121
            self selectFromLine:cursorLine col:cursorCol-l toLine:cursorLine col:cursorCol-1.
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1122
            ^ expandedString
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1123
        ].
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1124
    ].
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
  1125
    ^ nil.
3712
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
  1126
!
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
  1127
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1128
keyPress:key x:x y:y
3712
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
  1129
    <resource: #keyboard (#DoIt #InspectIt #PrintIt #ReplaceIt #BrowseIt #ExpandIt)>
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
  1130
32
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
  1131
    (key == #DoIt)      ifTrue:[^ self doIt].
23
69f1ba57f67a *** empty log message ***
claus
parents: 15
diff changeset
  1132
    (key == #InspectIt) ifTrue:[^ self inspectIt].
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1133
    (key == #PrintIt)   ifTrue:[^ self printIt].
3511
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1134
    (key == #ReplaceIt) ifTrue:[^ self replaceIt].
2307
dde2b8397b88 added #BrowseIt shortKey
Claus Gittinger <cg@exept.de>
parents: 2303
diff changeset
  1135
    (key == #BrowseIt)  ifTrue:[^ self browseIt].
3712
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
  1136
    (key == #ImplementorsOfIt)   ifTrue:[^ self browseImplementorsOfIt].
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
  1137
    (key == #ExpandAbbreviation) ifTrue:[^ self expandAbbreviation].
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
  1138
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1139
    super keyPress:key x:x y:y
3511
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1140
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1141
    "Modified: / 08-11-2007 / 11:29:45 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1142
! !
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1143
2143
ae0c3ae5de15 category rename
Claus Gittinger <cg@exept.de>
parents: 2104
diff changeset
  1144
!Workspace methodsFor:'executing'!
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1145
1501
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1146
do:code withValueDo:aBlock
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1147
    "helper for doIt, printIt and inspectIt. 
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1148
     Evaluate the selection and, if all went well, evaluate the argument, 
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1149
     aBlock with the value.
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1150
     Most work is in preparing for proper cleanup in case of abort
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1151
     or other exception while the evaluation is performed.
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1152
     (restore cursor, selectionColors etc.)"
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1153
1501
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1154
    |selLine selCol endLine endCol cLine cCol cleanUp|
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1155
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1156
    code notNil ifTrue:[
2409
489866f85d58 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2408
diff changeset
  1157
        code asString withoutSeparators isEmpty ifTrue:[ ^ self ].
2408
73edbd1475ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  1158
257
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1159
        codeStartPosition := self characterPositionOfSelection.
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1160
257
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1161
        "
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1162
         remember selection for later - if there is an error,
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1163
         the notification method will highlight it.
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1164
         thus destroying the current selection
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1165
        "
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1166
        selLine := selectionStartLine.
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1167
        selCol := selectionStartCol.
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1168
        endLine := selectionEndLine.
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1169
        endCol := selectionEndCol.
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1170
        cCol := cursorCol.
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1171
        cLine := cursorLine.
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1172
257
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1173
        "
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1174
         cleanup: restore previous selection and cursor positions
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1175
        "
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1176
        cleanUp := [
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1177
                self selectFromLine:selLine col:selCol toLine:endLine col:endCol.
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1178
                cLine notNil ifTrue:[
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1179
                    self cursorLine:cLine col:cCol
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1180
                ].
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1181
        ].
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1182
257
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1183
        "
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1184
         perform the action.
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1185
         Be careful to release the reference to the value;
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1186
         otherwise, we could keep lots of garbage from being freed
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1187
         until the view gets closed
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1188
        "
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1189
        self topView withExecuteCursorDo:[
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1190
            [
3008
3d94d492b032 use class based exceptions
Stefan Vogel <sv@exept.de>
parents: 3007
diff changeset
  1191
                AbortOperationRequest handle:[:ex |
257
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1192
                     ex return
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1193
                ] do:[
929
22265f1bb110 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1194
                    |value|
22265f1bb110 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1195
257
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1196
                    doItAction notNil ifTrue:[
929
22265f1bb110 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1197
                        value := doItAction value:(code asString).
257
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1198
                        cleanUp value. cleanUp := nil.
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1199
                        aBlock value:value.
2726
f258efeca730 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2717
diff changeset
  1200
                        value := nil.
2657
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
  1201
                        self class rememberDoIt:code.
257
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1202
                    ]
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1203
                ]
2519
a088ad3bb1e5 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 2492
diff changeset
  1204
            ] ensure:[
929
22265f1bb110 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1205
                cleanUp notNil ifTrue:[
22265f1bb110 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1206
                    cleanUp value. cleanUp := nil
22265f1bb110 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1207
                ].
257
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1208
            ]
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1209
        ].
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1210
    ]
257
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1211
1501
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1212
    "Modified: / 22.4.1998 / 21:56:13 / ca"
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1213
    "Created: / 22.4.1998 / 21:57:05 / ca"
2409
489866f85d58 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2408
diff changeset
  1214
    "Modified: / 26.9.2001 / 17:32:59 / cg"
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1215
! !
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1216
2751
dcba8a160aed method category rename
Claus Gittinger <cg@exept.de>
parents: 2733
diff changeset
  1217
!Workspace methodsFor:'initialization & release'!
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1218
2733
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1219
doItAction:aOneArgBlock
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1220
    "define the action to be performed when 'doIt' is selected.
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1221
     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
  1222
     A default doItAction is set for you in the initialize method."
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1223
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1224
    doItAction := aOneArgBlock
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1225
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1226
    "Modified: 27.2.1996 / 15:31:37 / cg"
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1227
!
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1228
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1229
executeDoIt:theCode
3537
1761370c0869 sharedPool access in doIts
Claus Gittinger <cg@exept.de>
parents: 3511
diff changeset
  1230
    ^ (self compilerClass new) moreSharedPools:poolsConsideredInDoIts;
2733
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1231
        evaluate:theCode 
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1232
        in:nil 
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1233
        receiver:simulatedSelf 
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1234
        notifying:self 
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1235
        logged:true 
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1236
        ifFail:nil 
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1237
!
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1238
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1239
initStyle
966
824e0ecc0e6f comments
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
  1240
    "setup viewStyle specifics"
824e0ecc0e6f comments
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
  1241
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1242
    super initStyle.
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1243
2492
740174c1be0f allow separate bg-color from styleSheet
Claus Gittinger <cg@exept.de>
parents: 2489
diff changeset
  1244
    DefaultViewBackground notNil ifTrue:[
740174c1be0f allow separate bg-color from styleSheet
Claus Gittinger <cg@exept.de>
parents: 2489
diff changeset
  1245
        viewBackground := DefaultViewBackground.
740174c1be0f allow separate bg-color from styleSheet
Claus Gittinger <cg@exept.de>
parents: 2489
diff changeset
  1246
        self backgroundColor:viewBackground.
740174c1be0f allow separate bg-color from styleSheet
Claus Gittinger <cg@exept.de>
parents: 2489
diff changeset
  1247
    ].
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1248
!
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1249
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1250
initialize
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1251
    super initialize.
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1252
2775
6adda7eef10a cursorMovement default
penk
parents: 2754
diff changeset
  1253
    scrollWhenUpdating := #beginOfText.
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1254
    showMatchingParenthesis := true.
3428
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
  1255
    allowValueDrop := true.
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
  1256
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1257
    commentStrings := #(
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1258
                        '"/'
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1259
                        ('"' '"')
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1260
                       ).
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1261
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1262
    self initializeDoITAction.
3396
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1263
    self initializeDragAndDrop.
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1264
3428
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
  1265
    "Modified: / 28-11-2006 / 16:11:55 / cg"
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1266
!
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1267
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1268
initializeDoITAction
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1269
    "set up the block to be evaluated for doIts.
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1270
     This is done here in a separate method to allow easier
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1271
     redefinition in subclasses"
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1272
2733
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1273
    doItAction := [:theCode | self executeDoIt:theCode].
3396
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1274
!
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1275
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1276
initializeDragAndDrop
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1277
    |target|
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1278
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1279
    target := DropTarget 
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1280
                    receiver:self
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1281
                    argument:nil
3411
693b4489cd84 drag & drop code cleanup
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  1282
                    dropSelector:#drop:
3396
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1283
                    canDropSelector:#canDrop:.
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1284
    self dropTarget:target
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1285
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1286
    "Created: / 16-08-2005 / 22:03:36 / janfrog"
3411
693b4489cd84 drag & drop code cleanup
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  1287
    "Modified: / 13-10-2006 / 12:37:18 / cg"
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1288
! !
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1289
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1290
!Workspace methodsFor:'menu & menu actions'!
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1291
2285
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1292
browseClass
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1293
    "user selected 'browseClass' from menu; evaluate the code
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1294
     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
  1295
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1296
    ^ self 
3272
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
  1297
        do:(self selectionAsString) 
2285
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1298
        withValueDo:[:result | result isBehavior ifTrue:[
2410
c7a829465c03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2409
diff changeset
  1299
                                  result browserClass openInClass:result selector:nil
2285
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1300
                               ] ifFalse:[
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1301
                                  self warn:'Selection does not evaluate to a class'
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1302
                               ]
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1303
                    ].
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1304
2410
c7a829465c03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2409
diff changeset
  1305
    "Modified: / 26.9.2001 / 17:37:35 / cg"
2285
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1306
!
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1307
2451
ae246b6c4df7 added browse implementors menu item
Claus Gittinger <cg@exept.de>
parents: 2440
diff changeset
  1308
browseImplementorsOfIt
ae246b6c4df7 added browse implementors menu item
Claus Gittinger <cg@exept.de>
parents: 2440
diff changeset
  1309
    "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
  1310
2714
7756ee36bb16 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1311
    |selectedText selector browserClass|
2457
0c1beddda9cb disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
  1312
2714
7756ee36bb16 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1313
    selectedText := self selectionAsString.
7756ee36bb16 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1314
    selectedText size > 0 ifTrue:[
2457
0c1beddda9cb disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
  1315
        self windowGroup withWaitCursorDo:[
3287
8b2f0dc64f3d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3286
diff changeset
  1316
            selector := SystemBrowser extractSelectorFrom:selectedText.
2714
7756ee36bb16 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1317
7756ee36bb16 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1318
            browserClass := UserPreferences current systemBrowserClass.
7756ee36bb16 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1319
3287
8b2f0dc64f3d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3286
diff changeset
  1320
            (selector notNil and:[selector ~= selectedText]) ifTrue:[
3579
3923810267b6 better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents: 3543
diff changeset
  1321
                (SystemBrowser 
3923810267b6 better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents: 3543
diff changeset
  1322
                        findImplementorsOfAny:(Array with:selectedText) 
3923810267b6 better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents: 3543
diff changeset
  1323
                        in:(Smalltalk allClasses) 
3923810267b6 better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents: 3543
diff changeset
  1324
                        ignoreCase:false) isEmpty ifTrue:[
3923810267b6 better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents: 3543
diff changeset
  1325
                    browserClass browseImplementorsOf:selector
3923810267b6 better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents: 3543
diff changeset
  1326
                ] ifFalse:[
3923810267b6 better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents: 3543
diff changeset
  1327
                    browserClass browseImplementorsOfAny:(Set with:selector with:selectedText)
3923810267b6 better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents: 3543
diff changeset
  1328
                ].
2534
55df9165ddd7 findImplementorsOfAny if in doubt
Claus Gittinger <cg@exept.de>
parents: 2519
diff changeset
  1329
            ] ifFalse:[
2714
7756ee36bb16 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1330
                browserClass browseImplementorsOf:(selector ? selectedText)
2534
55df9165ddd7 findImplementorsOfAny if in doubt
Claus Gittinger <cg@exept.de>
parents: 2519
diff changeset
  1331
            ]
2457
0c1beddda9cb disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
  1332
        ]
0c1beddda9cb disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
  1333
    ].
2451
ae246b6c4df7 added browse implementors menu item
Claus Gittinger <cg@exept.de>
parents: 2440
diff changeset
  1334
ae246b6c4df7 added browse implementors menu item
Claus Gittinger <cg@exept.de>
parents: 2440
diff changeset
  1335
    "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
  1336
    "Modified: / 19.11.2001 / 22:15:17 / cg"
2451
ae246b6c4df7 added browse implementors menu item
Claus Gittinger <cg@exept.de>
parents: 2440
diff changeset
  1337
!
ae246b6c4df7 added browse implementors menu item
Claus Gittinger <cg@exept.de>
parents: 2440
diff changeset
  1338
2307
dde2b8397b88 added #BrowseIt shortKey
Claus Gittinger <cg@exept.de>
parents: 2303
diff changeset
  1339
browseIt
dde2b8397b88 added #BrowseIt shortKey
Claus Gittinger <cg@exept.de>
parents: 2303
diff changeset
  1340
    "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
  1341
     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
  1342
07d3292d2965 in browseIt:
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  1343
     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
  1344
07d3292d2965 in browseIt:
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  1345
    |codeToEvaluate idx selector|
07d3292d2965 in browseIt:
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  1346
3596
80b7a1d95fe7 *** empty log message ***
sr
parents: 3593
diff changeset
  1347
    codeToEvaluate := (self selectionOrTextOfCursorLine ? '') withoutSeparators.
2713
07d3292d2965 in browseIt:
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  1348
    idx := codeToEvaluate indexOfSubCollection:'>>'.
07d3292d2965 in browseIt:
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  1349
    idx ~~ 0 ifTrue:[
2717
Claus Gittinger <cg@exept.de>
parents: 2715
diff changeset
  1350
        selector := (codeToEvaluate copyFrom:idx+2) withoutSeparators string.
3155
15d43d2ea850 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
  1351
        (selector startsWith:'#') ifTrue:[
15d43d2ea850 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
  1352
            selector := Symbol readFrom:selector.
15d43d2ea850 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
  1353
        ].
2713
07d3292d2965 in browseIt:
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  1354
        codeToEvaluate := codeToEvaluate copyTo:idx-1.   
07d3292d2965 in browseIt:
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  1355
    ].
2307
dde2b8397b88 added #BrowseIt shortKey
Claus Gittinger <cg@exept.de>
parents: 2303
diff changeset
  1356
dde2b8397b88 added #BrowseIt shortKey
Claus Gittinger <cg@exept.de>
parents: 2303
diff changeset
  1357
    ^ self 
2713
07d3292d2965 in browseIt:
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  1358
        do:codeToEvaluate 
3284
68f4e33b5c65 dont browse nil/unbound globals
Claus Gittinger <cg@exept.de>
parents: 3279
diff changeset
  1359
        withValueDo:[:result | 
68f4e33b5c65 dont browse nil/unbound globals
Claus Gittinger <cg@exept.de>
parents: 3279
diff changeset
  1360
                               result isNil ifTrue:[
68f4e33b5c65 dont browse nil/unbound globals
Claus Gittinger <cg@exept.de>
parents: 3279
diff changeset
  1361
                                  codeToEvaluate asCollectionOfWords size == 1 ifTrue:[
68f4e33b5c65 dont browse nil/unbound globals
Claus Gittinger <cg@exept.de>
parents: 3279
diff changeset
  1362
                                    codeToEvaluate isUppercaseFirst ifTrue:[
68f4e33b5c65 dont browse nil/unbound globals
Claus Gittinger <cg@exept.de>
parents: 3279
diff changeset
  1363
                                      Dialog information:(codeToEvaluate allBold , ' is unbound or nil').
68f4e33b5c65 dont browse nil/unbound globals
Claus Gittinger <cg@exept.de>
parents: 3279
diff changeset
  1364
                                      ^ self.
68f4e33b5c65 dont browse nil/unbound globals
Claus Gittinger <cg@exept.de>
parents: 3279
diff changeset
  1365
                                    ].
68f4e33b5c65 dont browse nil/unbound globals
Claus Gittinger <cg@exept.de>
parents: 3279
diff changeset
  1366
                                  ]
68f4e33b5c65 dont browse nil/unbound globals
Claus Gittinger <cg@exept.de>
parents: 3279
diff changeset
  1367
                               ].
68f4e33b5c65 dont browse nil/unbound globals
Claus Gittinger <cg@exept.de>
parents: 3279
diff changeset
  1368
                               result isBehavior ifTrue:[
2713
07d3292d2965 in browseIt:
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  1369
                                  result browserClass openInClass:result selector:selector
2307
dde2b8397b88 added #BrowseIt shortKey
Claus Gittinger <cg@exept.de>
parents: 2303
diff changeset
  1370
                               ] ifFalse:[
2410
c7a829465c03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2409
diff changeset
  1371
                                  result class browserClass openInClass:(result class) selector:nil
2307
dde2b8397b88 added #BrowseIt shortKey
Claus Gittinger <cg@exept.de>
parents: 2303
diff changeset
  1372
                               ]
dde2b8397b88 added #BrowseIt shortKey
Claus Gittinger <cg@exept.de>
parents: 2303
diff changeset
  1373
                    ].
2410
c7a829465c03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2409
diff changeset
  1374
c7a829465c03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2409
diff changeset
  1375
    "Modified: / 26.9.2001 / 17:37:50 / cg"
2307
dde2b8397b88 added #BrowseIt shortKey
Claus Gittinger <cg@exept.de>
parents: 2303
diff changeset
  1376
!
dde2b8397b88 added #BrowseIt shortKey
Claus Gittinger <cg@exept.de>
parents: 2303
diff changeset
  1377
2285
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1378
browseItsClass
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1379
    "user selected 'browseItsClass' from menu; evaluate the code
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1380
     and open a browser on the results class"
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1381
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1382
    ^ self 
3272
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
  1383
        do:(self selectionAsString) 
2410
c7a829465c03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2409
diff changeset
  1384
        withValueDo:[:result | 
c7a829465c03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2409
diff changeset
  1385
                        result class browserClass openInClass:result class selector:nil
c7a829465c03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2409
diff changeset
  1386
                    ]
2285
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1387
2410
c7a829465c03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2409
diff changeset
  1388
    "Modified: / 26.9.2001 / 17:38:06 / cg"
2285
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1389
!
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1390
2454
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
  1391
browseReferencesToIt
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
  1392
    "open a browser on all references to the selected global"
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
  1393
2457
0c1beddda9cb disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
  1394
    |sel|
0c1beddda9cb disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
  1395
0c1beddda9cb disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
  1396
    sel := self selectionAsString.
0c1beddda9cb disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
  1397
    sel size > 0 ifTrue:[
0c1beddda9cb disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
  1398
        self windowGroup withWaitCursorDo:[
0c1beddda9cb disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
  1399
            (UserPreferences current systemBrowserClass)
0c1beddda9cb disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
  1400
                browseReferendsOf:sel
0c1beddda9cb disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
  1401
        ].
2454
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
  1402
    ].
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
  1403
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
  1404
    "Created: / 5.11.2001 / 17:32:23 / cg"
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
  1405
    "Modified: / 5.11.2001 / 17:32:38 / cg"
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
  1406
!
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
  1407
2462
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  1408
browseSendersOfIt
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  1409
    "open a browser on the senders of the selected text"
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  1410
2715
b6802cd279d0 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
  1411
    |selectedText selector|
2462
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  1412
2715
b6802cd279d0 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
  1413
    selectedText := self selectionAsString.
b6802cd279d0 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
  1414
    selectedText size > 0 ifTrue:[
2462
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  1415
        self windowGroup withWaitCursorDo:[
3287
8b2f0dc64f3d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3286
diff changeset
  1416
            selector := SystemBrowser extractSelectorFrom:selectedText.
2462
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  1417
            (UserPreferences current systemBrowserClass)
2715
b6802cd279d0 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
  1418
                browseAllCallsOn:(selector ? selectedText)
2462
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  1419
        ]
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  1420
    ].
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  1421
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  1422
    "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
  1423
    "Modified: / 19.11.2001 / 22:15:27 / cg"
2462
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  1424
!
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  1425
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1426
doIt
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1427
    "user selected 'doIt' from menu; show a wait-cursor, evaluate the code
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1428
     and finally restore cursor; return result of evaluation"
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1429
1521
e2bb7811e4db removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
  1430
    ^ self 
3272
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
  1431
        do:(self selectionOrTextOfCursorLine) 
1521
e2bb7811e4db removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
  1432
        withValueDo:[:result | ]
e2bb7811e4db removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
  1433
e2bb7811e4db removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
  1434
    "Modified: / 16.5.1998 / 16:45:01 / cg"
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1435
!
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1436
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1437
editMenu
1107
25753e7f960f commentary
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1438
    "return my popUpMenu; thats the superclasses menu
25753e7f960f commentary
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1439
     PLUS st-evaluation items: doIt, printIt and inspectIt."
25753e7f960f commentary
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1440
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1441
    <resource: #keyboard (#DoIt #PrintIt #InspectIt 
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1442
                          #CommentSelection #UncommentSelection
2573
52c995a1ea78 accelerators for browseIt and implementorsOfIt
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  1443
                          #BrowseIt #ImplementorsOfIt
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1444
                         )>
1262
d69149b5be1f resource flag: #menu -> #programMenu
Claus Gittinger <cg@exept.de>
parents: 1251
diff changeset
  1445
    <resource: #programMenu>
489
5816aa12fec8 resources
Claus Gittinger <cg@exept.de>
parents: 444
diff changeset
  1446
2867
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1447
    |m sub subsub idx sensor s s2|
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1448
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1449
    m := super editMenu.
3252
b44361e6b97a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3210
diff changeset
  1450
    ((sensor := self sensor) notNil and:[sensor ctrlDown and:[sensor shiftDown not]]) ifTrue:[
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1451
        sub := m.
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1452
        m := nil.
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1453
    ] ifFalse:[
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1454
        sub := m subMenuAt:#others.
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1455
    ].
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1456
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1457
    sub notNil ifTrue:[
2867
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1458
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1459
        "
2867
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1460
         workspaces support #browse, implementors etc. add them after paste.
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1461
        "
2867
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1462
        sub 
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1463
            addItemList:#(
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1464
                ('-'                                                               )
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1465
                ('Browse'               browseIt                BrowseIt            )
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1466
                ('Senders of It'        browseSendersOfIt                           )
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1467
                ('Implementors of It'   browseImplementorsOfIt  ImplementorsOfIt    )
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1468
                ('References to It'     browseReferencesToIt                        )
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1469
                ('-'                                                                )
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1470
                ('TimeIt'               timeIt                                      )
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1471
                ('SpyOnIt'              spyOnIt                                     ))
2922
70e3f3ec7980 oops - doIt and friends were not translated
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
  1472
          resources:resources  
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1473
          after:#gotoLine.
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1474
2867
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1475
        subsub := sub subMenuAt:#tools.
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1476
        subsub notNil ifTrue:[
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1477
            subsub
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1478
                addItemList:#(
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1479
                    ('-'                                                                )
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1480
                    ('Comment'              commentSelection        CommentSelection    )
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1481
                    ('Uncomment'            uncommentSelection      UncommentSelection  ))
2922
70e3f3ec7980 oops - doIt and friends were not translated
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
  1482
              resources:resources  
2867
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1483
              after:#'indent'.
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1484
        ].
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1485
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1486
        self hasSelection ifFalse:[
3272
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
  1487
            sub disableAll:#(browseImplementorsOfIt browseSendersOfIt browseReferencesToIt timeIt spyOnIt
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
  1488
                             commentSelection uncommentSelection ) 
2454
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
  1489
        ] ifTrue:[
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
  1490
            s := self selectionAsString.
2485
1e4ab722cb11 browse senders/implementors: better selector check
Claus Gittinger <cg@exept.de>
parents: 2477
diff changeset
  1491
            s notNil ifTrue:[
3579
3923810267b6 better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents: 3543
diff changeset
  1492
                s asSymbolIfInterned isNil ifTrue:[
3923810267b6 better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents: 3543
diff changeset
  1493
                    s2 := SystemBrowser extractSelectorFrom:s.
3923810267b6 better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents: 3543
diff changeset
  1494
                    s2 notNil ifTrue:[
3923810267b6 better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents: 3543
diff changeset
  1495
                        s2 := s2 asSymbolIfInterned.
3923810267b6 better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents: 3543
diff changeset
  1496
                    ].
3923810267b6 better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents: 3543
diff changeset
  1497
                ].
2454
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
  1498
            ].
2487
47e0a1faf544 disabling of impl/senders menu
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
  1499
            (s2 isNil and:[s isNil]) ifTrue:[
2485
1e4ab722cb11 browse senders/implementors: better selector check
Claus Gittinger <cg@exept.de>
parents: 2477
diff changeset
  1500
                sub disableAll:#(browseImplementorsOfIt browseSendersOfIt).
1e4ab722cb11 browse senders/implementors: better selector check
Claus Gittinger <cg@exept.de>
parents: 2477
diff changeset
  1501
            ].
3606
9676ce5098cb Do not look up large strings in Smalltalk
Stefan Vogel <sv@exept.de>
parents: 3596
diff changeset
  1502
            (s isNil or:[s asSymbolIfInterned isNil
9676ce5098cb Do not look up large strings in Smalltalk
Stefan Vogel <sv@exept.de>
parents: 3596
diff changeset
  1503
            or:[(Smalltalk includesKey:s asSymbol) not]])
2485
1e4ab722cb11 browse senders/implementors: better selector check
Claus Gittinger <cg@exept.de>
parents: 2477
diff changeset
  1504
            ifTrue:[
1e4ab722cb11 browse senders/implementors: better selector check
Claus Gittinger <cg@exept.de>
parents: 2477
diff changeset
  1505
                sub disable:#browseReferencesToIt.
1e4ab722cb11 browse senders/implementors: better selector check
Claus Gittinger <cg@exept.de>
parents: 2477
diff changeset
  1506
            ].
2595
b09b515077b4 disable readOnly items
Claus Gittinger <cg@exept.de>
parents: 2573
diff changeset
  1507
            self isReadOnly ifTrue:[
2641
8a74823899f4 ctrl-menu
Claus Gittinger <cg@exept.de>
parents: 2601
diff changeset
  1508
                sub disableAll:#(commentSelection uncommentSelection) 
2595
b09b515077b4 disable readOnly items
Claus Gittinger <cg@exept.de>
parents: 2573
diff changeset
  1509
            ].
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1510
        ].
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1511
    ].
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1512
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1513
    m notNil ifTrue:[
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1514
        "
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1515
         workspaces support #doIt, #printIt and #inspectIt
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1516
         add them after paste.
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1517
        "
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1518
        idx := m indexOf:#paste.
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1519
        idx == 0 ifTrue:[idx := m indexOf:#pasteOrReplace].
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1520
        idx ~~ 0 ifTrue:[
2867
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1521
            m 
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1522
              addItemList:#(
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1523
                ('-'                                )
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1524
                ('DoIt'         doIt        DoIt     )
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1525
                ('PrintIt'      printIt     PrintIt  )
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1526
                ('InspectIt'    inspectIt   InspectIt))
2922
70e3f3ec7980 oops - doIt and friends were not translated
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
  1527
              resources:resources  
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1528
              after:idx.
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1529
            
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1530
        ].
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1531
3279
087a9e32c714 oops - autoselect for doIt was done too early
Claus Gittinger <cg@exept.de>
parents: 3272
diff changeset
  1532
        (self hasSelectionOrTextInCursorLine) ifFalse:[
3272
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
  1533
            |lNr line|
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
  1534
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
  1535
            lNr := self cursorLine.
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
  1536
            line := self listAt:lNr.
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
  1537
            line isEmptyOrNil ifTrue:[
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
  1538
                m disableAll:#(printIt doIt inspectIt browseIt) 
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
  1539
            ].
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1540
        ].
2595
b09b515077b4 disable readOnly items
Claus Gittinger <cg@exept.de>
parents: 2573
diff changeset
  1541
        self isReadOnly ifTrue:[
b09b515077b4 disable readOnly items
Claus Gittinger <cg@exept.de>
parents: 2573
diff changeset
  1542
            m disable:#printIt 
b09b515077b4 disable readOnly items
Claus Gittinger <cg@exept.de>
parents: 2573
diff changeset
  1543
        ].
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1544
    ].
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1545
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1546
    ^ m ? sub.
430
022b667e0d70 added accelerator display
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  1547
1501
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1548
    "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
  1549
    "Modified: / 19.11.2001 / 23:12:01 / cg"
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1550
!
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1551
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1552
inspectIt
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1553
    "user selected 'inspectIt' from menu; use doIt to evaluate the code
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1554
     and start an inspector on the result"
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1555
2981
75abc5efbf67 shift-inspect (= basicInspect)
Claus Gittinger <cg@exept.de>
parents: 2980
diff changeset
  1556
    |shifted|
75abc5efbf67 shift-inspect (= basicInspect)
Claus Gittinger <cg@exept.de>
parents: 2980
diff changeset
  1557
75abc5efbf67 shift-inspect (= basicInspect)
Claus Gittinger <cg@exept.de>
parents: 2980
diff changeset
  1558
    shifted := self sensor shiftDown.
75abc5efbf67 shift-inspect (= basicInspect)
Claus Gittinger <cg@exept.de>
parents: 2980
diff changeset
  1559
1521
e2bb7811e4db removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
  1560
    ^ self 
3272
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
  1561
        do:(self selectionOrTextOfCursorLine) 
2982
9a831ab53acc shift-inspect (= basicInspect)
Claus Gittinger <cg@exept.de>
parents: 2981
diff changeset
  1562
        withValueDo:[:result | shifted ifTrue:[result basicInspect] ifFalse:[result inspect] ]
1521
e2bb7811e4db removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
  1563
e2bb7811e4db removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
  1564
    "Modified: / 16.5.1998 / 16:44:56 / cg"
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1565
!
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1566
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1567
printIt
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1568
    "user selected 'printIt' from menu; use doIt to evaluate the code
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1569
     and insert result of evaluation into my text.
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1570
     If the text is readOnly, do nothing."
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1571
1734
e71982a6a4c5 use self isReadonly
Claus Gittinger <cg@exept.de>
parents: 1523
diff changeset
  1572
    self isReadOnly ifTrue:[
3511
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1573
        self beep.
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1574
        ^ self.
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1575
    ].
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1576
    self 
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1577
        undoableDo:[
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1578
            self 
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1579
                do:(self selectionOrTextOfCursorLine) 
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1580
                withValueDo:[:result | 
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1581
                    self cursorLine:selectionEndLine col:(selectionEndCol + 1).
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1582
                    self insertSelectedStringAtCursor:(result displayString "printString")
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1583
                ]
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1584
        ] 
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1585
        info:'PrintIt'
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1586
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1587
    "Modified: / 08-11-2007 / 11:35:31 / cg"
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1588
!
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1589
3511
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1590
replaceIt
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1591
    "like printIt, but replace the selection with the result, instead of
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1592
     pasting it after the selection."
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1593
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1594
    self isReadOnly ifTrue:[
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1595
        self beep.
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1596
        ^ self
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1597
    ].
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1598
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1599
    self 
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1600
        undoableDo:[
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1601
            self 
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1602
                do:(self selectionOrTextOfCursorLine) 
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1603
                withValueDo:[:result |
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1604
                    self replaceSelectionBy:(result displayString "printString")
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1605
                ].
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1606
                undoSupport actionInfo:'ReplaceIt'.
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1607
        ]
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1608
        info:'ReplaceIt'
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1609
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1610
    "Created: / 08-11-2007 / 11:31:54 / cg"
1501
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1611
!
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1612
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1613
spyOnIt
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1614
    "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
  1615
     and finally restore cursor; return result of evaluation"
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1616
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1617
    |code|
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1618
3511
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1619
    code := 'MessageTally spyDetailOn:[' , self selectionAsString, ']'.
1501
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1620
    self do:code withValueDo:[:result | ]
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1621
3511
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1622
    "Modified: / 22-04-1998 / 22:03:53 / ca"
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1623
    "Modified: / 08-11-2007 / 11:36:38 / cg"
1501
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1624
!
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1625
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1626
timeIt
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1627
    "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
  1628
     and finally restore cursor; return result of evaluation"
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1629
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1630
    |code|
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1631
3272
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
  1632
    code := '|t| t := Time millisecondsToRun:[' , self selectionAsString, '].
3141
2e8015ff554a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3129
diff changeset
  1633
2e8015ff554a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3129
diff changeset
  1634
    Transcript showCR:''execution time: '' , t printString , '' ms''.'.
1501
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1635
    self do:code withValueDo:[:result | ]
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1636
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1637
    "Modified: / 22.4.1998 / 22:03:51 / ca"
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1638
! !
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1639
2646
dcee45d1c5ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2641
diff changeset
  1640
!Workspace methodsFor:'queries'!
dcee45d1c5ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2641
diff changeset
  1641
dcee45d1c5ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2641
diff changeset
  1642
isWorkspace
dcee45d1c5ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2641
diff changeset
  1643
    ^ true
dcee45d1c5ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2641
diff changeset
  1644
! !
dcee45d1c5ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2641
diff changeset
  1645
206
2363a64a7c88 version at the end
Claus Gittinger <cg@exept.de>
parents: 201
diff changeset
  1646
!Workspace class methodsFor:'documentation'!
2363a64a7c88 version at the end
Claus Gittinger <cg@exept.de>
parents: 201
diff changeset
  1647
2363a64a7c88 version at the end
Claus Gittinger <cg@exept.de>
parents: 201
diff changeset
  1648
version
3744
c206f437042e turn on/off selector warnings
Claus Gittinger <cg@exept.de>
parents: 3742
diff changeset
  1649
    ^ '$Header: /cvs/stx/stx/libwidg/Workspace.st,v 1.196 2008-10-24 13:15:54 cg Exp $'
858
ef7ba327189b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  1650
! !