Workspace.st
author Claus Gittinger <cg@exept.de>
Tue, 03 Sep 2013 21:27:51 +0200
changeset 4733 d623925e0257
parent 4729 450cb0dcedd2
child 4735 415403266a32
permissions -rw-r--r--
class: Workspace care for cursor being out of sight
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
4619
bb6fc65fce18 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4618
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
4631
e1e810a69059 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 4619
diff changeset
    15
	instanceVariableNames:'doItAction codeStartPosition errorFgColor errorBgColor
e1e810a69059 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 4619
diff changeset
    16
		commentStrings autoDefineWorkspaceVariables simulatedSelf
e1e810a69059 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 4619
diff changeset
    17
		autoDefineVariables compilerClass allowValueDrop
4725
aff6517a3471 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4722
diff changeset
    18
		poolsConsideredInDoIts namespaceForDoits editedMethodOrClass
aff6517a3471 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4722
diff changeset
    19
		editedClass editedMethod'
4631
e1e810a69059 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 4619
diff changeset
    20
	classVariableNames:'DefaultViewBackground DefaultErrorForegroundColor
e1e810a69059 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 4619
diff changeset
    21
		DefaultErrorBackgroundColor DefaultWarningBackgroundColor
e1e810a69059 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 4619
diff changeset
    22
		DefaultWarningForegroundColor WorkspaceVariables DoItHistory
e1e810a69059 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 4619
diff changeset
    23
		Sniplets'
e1e810a69059 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 4619
diff changeset
    24
	poolDictionaries:''
e1e810a69059 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 4619
diff changeset
    25
	category:'Interface-Smalltalk'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    26
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    27
4695
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
    28
Object subclass:#CodeCompletionService
4703
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
    29
	instanceVariableNames:'completionView completionProcess editView state seqNr'
4695
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
    30
	classVariableNames:''
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
    31
	poolDictionaries:''
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
    32
	privateIn:Workspace
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
    33
!
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
    34
4726
fae60a152dab class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4725
diff changeset
    35
Workspace comment:''
3155
15d43d2ea850 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
    36
!
15d43d2ea850 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
    37
32
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
    38
!Workspace class methodsFor:'documentation'!
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
    39
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    40
copyright
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    41
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    42
 COPYRIGHT (c) 1989 by Claus Gittinger
4619
bb6fc65fce18 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4618
diff changeset
    43
              All Rights Reserved
38
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
 This software is furnished under a license and may be used
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    46
 only in accordance with the terms of that license and with the
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    47
 inclusion of the above copyright notice.   This software may not
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    48
 be provided or otherwise made available to, or used by, any
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    49
 other person.  No title to or ownership of the software is
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    50
 hereby transferred.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    51
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    52
!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    53
32
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
    54
documentation
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
    55
"
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
    56
    a view for editable text which can evaluate expressions.
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    57
    I.e. its basically a view for editable text, with added
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    58
    'doIt', 'printIt' and 'inspectIt' functions on the popup-menu.
125
claus
parents: 123
diff changeset
    59
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    60
    The action to be performed on doIt is defined by a block,
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
    61
    which can be defined by the owner of this view.
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    62
    (thus you can put a workspace into more complex widgets, and
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    63
     control what should happen on 'doIt').
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
    64
578
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    65
    A useful default action is automatically defined, which simply 
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    66
    evaluates the selection as a smalltalk expression. 
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    67
    (but, a lisp or prolog workspace would define its own action,
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    68
     to call for another compiler/interpreter  ...)
32
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
    69
123
claus
parents: 121
diff changeset
    70
claus
parents: 121
diff changeset
    71
    Caveat:
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
    72
        in this version, Workspace does not yet support doIt in MVC setups.
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
    73
        For now, simulate this by setting the doItAction, to notify the
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
    74
        model manually about the doIt.
123
claus
parents: 121
diff changeset
    75
claus
parents: 121
diff changeset
    76
578
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    77
    [instance variables:]
32
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
    78
121
claus
parents: 119
diff changeset
    79
      doItAction      <Block>         block to evaluate for doIt
123
claus
parents: 121
diff changeset
    80
121
claus
parents: 119
diff changeset
    81
      errorFgColor    <Color>         fg-Color to be used when highlighting errors 
claus
parents: 119
diff changeset
    82
claus
parents: 119
diff changeset
    83
      errorBgColor    <Color>         bg-Color to be used when highlighting errors
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
    84
578
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    85
      codeStartPosition               private temporary
121
claus
parents: 119
diff changeset
    86
578
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    87
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    88
    [styleSheet values:]
121
claus
parents: 119
diff changeset
    89
claus
parents: 119
diff changeset
    90
      codeErrorSelectionForegroundColor     fg color to highlight errors
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
    91
                                            (default: selection fg)
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
    92
121
claus
parents: 119
diff changeset
    93
      codeErrorSelectionBackgroundColor     bg color to highlight errors
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
    94
                                            (default: selection bg)
578
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    95
1522
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
    96
    [start with:]
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
    97
        Workspace open
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
    98
578
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    99
    [see also:]
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
   100
        Workspace EditTextView 
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
   101
        Parser ByteCodeCompiler
583
2ec13b7ceba5 documentation
Claus Gittinger <cg@exept.de>
parents: 578
diff changeset
   102
2ec13b7ceba5 documentation
Claus Gittinger <cg@exept.de>
parents: 578
diff changeset
   103
    [author:]
2ec13b7ceba5 documentation
Claus Gittinger <cg@exept.de>
parents: 578
diff changeset
   104
        Claus Gittinger
32
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
   105
"
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   106
! !
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   107
3712
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
   108
!Workspace class methodsFor:'accessing'!
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
   109
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
   110
sniplets
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
   111
    Sniplets isNil ifTrue:[
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
   112
        Sniplets := Dictionary new.
3713
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
   113
        self initializeDefaultAbbreviations.
3712
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
   114
    ].
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
   115
    ^ Sniplets
3713
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
   116
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
   117
    "
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
   118
     Sniplets := nil
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
   119
    "
3712
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
   120
!
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
   121
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
   122
sniplets:something
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
   123
    Sniplets := something.
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
   124
! !
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
   125
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   126
!Workspace class methodsFor:'defaults'!
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   127
4695
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
   128
codeCompletionServiceClass
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
   129
    ^ CodeCompletionService
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
   130
!
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
   131
1522
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   132
defaultLabel
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   133
    "my default window label"
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   134
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   135
    ^ 'Workspace'
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   136
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   137
    "Created: / 16.5.1998 / 16:53:37 / cg"
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   138
!
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   139
3716
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   140
initializeDefaultAbbreviations
3807
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   141
    "default sniplets/abbreviations. TODO: save/load sniplets"
3728
5bbf7c4a0231 more abbrevs
Claus Gittinger <cg@exept.de>
parents: 3726
diff changeset
   142
3735
3b616f1c9f9b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3728
diff changeset
   143
    "flush and reinitialize sniplets with:
3807
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   144
         Sniplets := Dictionary new.
3741
d86e1e2dd088 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   145
    "
3807
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   146
    "after a code change below, update with:
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   147
         self initializeDefaultAbbreviations.
3735
3b616f1c9f9b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3728
diff changeset
   148
    "
3807
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   149
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   150
    #(
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   151
        't'     'true'    
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   152
        'f'     'false'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   153
        's'     'self'
3876
38612526d6a2 sniplets: what was %p ? (noone knows)
Claus Gittinger <cg@exept.de>
parents: 3870
diff changeset
   154
        'su'    'super'                  
38612526d6a2 sniplets: what was %p ? (noone knows)
Claus Gittinger <cg@exept.de>
parents: 3870
diff changeset
   155
        'ss'    'super '            
3807
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   156
        'n'     'nil'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   157
        'y'     'yourself.'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   158
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   159
        'in'    'isNil '
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   160
        'nn'    'notNil '
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   161
        'ie'    'isEmpty '
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   162
        'ne'    'notEmpty '
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   163
        'ien'   'isEmptyOrNil '
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   164
        'nen'   'notEmptyOrNil '
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   165
4453
c0cee00a50f6 changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4438
diff changeset
   166
        'it'    'ifTrue:[!!'
c0cee00a50f6 changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4438
diff changeset
   167
        'if'    'ifFalse:[!!'
c0cee00a50f6 changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4438
diff changeset
   168
        'itf'   'ifTrue:[!!] ifFalse:[].'
c0cee00a50f6 changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4438
diff changeset
   169
        'int'   'isNil ifTrue:[!!].'
c0cee00a50f6 changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4438
diff changeset
   170
        'inf'   'isNil ifFalse:[!!].'
c0cee00a50f6 changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4438
diff changeset
   171
        'ints'  'isNil ifTrue:[^ self].'
c0cee00a50f6 changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4438
diff changeset
   172
        'infs'  'isNil ifFalse:[^ self].'
c0cee00a50f6 changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4438
diff changeset
   173
        'nnt'   'notNil ifTrue:[!!].'
c0cee00a50f6 changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4438
diff changeset
   174
        'nnf'   'notNil ifFalse:[!!].'
c0cee00a50f6 changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4438
diff changeset
   175
        'iet'   'isEmpty ifTrue:[!!].'
c0cee00a50f6 changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4438
diff changeset
   176
        'net'   'notEmpty ifTrue:[!!].'
c0cee00a50f6 changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4438
diff changeset
   177
        'ief'   'isEmpty ifFalse:[!!].'
c0cee00a50f6 changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4438
diff changeset
   178
        'nef'   'notEmpty ifFalse:[!!].'
3807
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   179
4185
44ac2c080798 changed:
Claus Gittinger <cg@exept.de>
parents: 4184
diff changeset
   180
        'wt'    'whileTrue:[!!]'
44ac2c080798 changed:
Claus Gittinger <cg@exept.de>
parents: 4184
diff changeset
   181
        'wf'    'whileFalse:[!!]'
3807
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   182
4185
44ac2c080798 changed:
Claus Gittinger <cg@exept.de>
parents: 4184
diff changeset
   183
        'do'    'do:[:each |!!]'
44ac2c080798 changed:
Claus Gittinger <cg@exept.de>
parents: 4184
diff changeset
   184
        'd:'    'do:[:each |!!]'
44ac2c080798 changed:
Claus Gittinger <cg@exept.de>
parents: 4184
diff changeset
   185
        'kdo'   'keysAndValuesDo:[:eachKey :eachValue |!!]'
44ac2c080798 changed:
Claus Gittinger <cg@exept.de>
parents: 4184
diff changeset
   186
        'kvd'   'keysAndValuesDo:[:eachKey :eachValue |!!]'
44ac2c080798 changed:
Claus Gittinger <cg@exept.de>
parents: 4184
diff changeset
   187
        'kv:'   'keysAndValuesDo:[:eachKey :eachValue |!!]'
4184
9879be399bcc changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4175
diff changeset
   188
        'k:'    'keysDo:[:eachKey | !!]'
4158
502e6898c82d changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4154
diff changeset
   189
        'dt'    'detect:[:each | !!]'   
502e6898c82d changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4154
diff changeset
   190
        'de'    'detect:[:each | !!]'
502e6898c82d changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4154
diff changeset
   191
        'det'   'detect:[:each | !!]'
502e6898c82d changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4154
diff changeset
   192
        'dtn'   'detect:[:each | !!] ifNone:[]'
502e6898c82d changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4154
diff changeset
   193
        'cl'    'collect:[:each | !!]'
502e6898c82d changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4154
diff changeset
   194
        'co'    'collect:[:each | !!]'
502e6898c82d changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4154
diff changeset
   195
        'col'   'collect:[:each | !!]'
502e6898c82d changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4154
diff changeset
   196
        'sl'    'select:[:each | !!]'
502e6898c82d changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4154
diff changeset
   197
        'se'    'select:[:each | !!]'
502e6898c82d changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4154
diff changeset
   198
        'sel'   'select:[:each | !!]'
502e6898c82d changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4154
diff changeset
   199
        'rj'    'reject:[:each | !!]'
502e6898c82d changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4154
diff changeset
   200
        're'    'reject:[:each | !!]'
502e6898c82d changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4154
diff changeset
   201
        'rej'   'reject:[:each | !!]'
502e6898c82d changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4154
diff changeset
   202
        'inj'   'inject:!! into:[:accum :each | ]'
3807
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   203
4453
c0cee00a50f6 changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4438
diff changeset
   204
        'ex'    'Error handle:[ex | !!] do:[].'
c0cee00a50f6 changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4438
diff changeset
   205
        'sh'    'self halt.'
c0cee00a50f6 changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4438
diff changeset
   206
        'mt'    'MessageTally spyOn:[!!].'
3807
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   207
4172
432d4d3f5717 changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4171
diff changeset
   208
        'ih'    '!! ifTrue:[ self halt ].'
3807
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   209
        'ik'    'includesKey: #'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   210
        'is'    'includesString: #'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   211
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   212
        'af'    'asFilename '
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   213
        'as'    'asString '
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   214
        'aoc'   'asOrderedCollection '
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   215
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   216
        'np'    'nextPut: '
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   217
        'npa'   'nextPutAll: '
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   218
        'npl'   'nextPutLine: '
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   219
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   220
        'ps'    'printString'
4453
c0cee00a50f6 changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4438
diff changeset
   221
        'sr'    'self subclassResponsibility.'
3807
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   222
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   223
        'ati'   'at:!! ifAbsent: '
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   224
        'atip'  'at:!! ifAbsentPut:[ ] '
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   225
        'ap'    'at:!! '
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   226
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   227
        'st'    'Smalltalk'
4453
c0cee00a50f6 changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4438
diff changeset
   228
        'ts'    'Transcript showCR:''!!''.'
c0cee00a50f6 changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4438
diff changeset
   229
        'trs'   'Transcript showCR:''!!''.'
c0cee00a50f6 changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4438
diff changeset
   230
        'abb'   'Workspace sniplets inspect.'
c0cee00a50f6 changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4438
diff changeset
   231
        'ws'    'Delay waitForSeconds: 1.' 
c0cee00a50f6 changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4438
diff changeset
   232
        'wfs'   'Delay waitForSeconds: 1.' 
c0cee00a50f6 changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4438
diff changeset
   233
        'wfm'   'Delay waitForMilliseconds: 1000.' 
3807
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   234
        'ini'   'initialize\    super initialize.\    '
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   235
        'newi'  'new\    ^ super new initialize.'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   236
        'upd'   'update:something with:aParameter from:changedObject\    !!\    ^ super update:something with:aParameter from:changedObject.'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   237
        'OC'    'OrderedCollection'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   238
        'oc'    'OrderedCollection'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   239
        'SC'    'SortedCollection'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   240
        'sc'    'SortedCollection'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   241
        'D'     'Dictionary'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   242
        'ID'    'IdentityDictionary'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   243
        'Id'    'IdentityDictionary'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   244
        'id'    'IdentityDictionary'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   245
        'iD'    'IdentityDictionary'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   246
        'OCn'   'OrderedCollection new.'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   247
        'ocn'   'OrderedCollection new.'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   248
        'SCn'   'SortedCollection new.'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   249
        'IDn'   'IdentityDictionary new'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   250
        'idn'   'IdentityDictionary new'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   251
        'Dn'    'Dictionary new'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   252
        'dn'    'Dictionary new'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   253
        'Sn'    'Set new'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   254
        'sn'    'Set new'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   255
        'A'     'Array'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   256
        'a'     'Array'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   257
        'An'    'Array new:'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   258
        'an'    'Array new:'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   259
        'Aw'    'Array with:'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   260
        'aw'    'Array with:'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   261
        'Aww'   'Array with:!! with:'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   262
        'sww'   'Array with:!! with:'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   263
        'Awww'  'Array with:!! with: with:'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   264
        'awww'  'Array with:!! with: with:'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   265
        'Awwww' 'Array with:!! with: with: with:'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   266
        'awwww' 'Array with:!! with: with: with:'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   267
        'aw2'   'Array with:!! with:'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   268
        'aw3'   'Array with:!! with: with:'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   269
        'aw4'   'Array with:!! with: with: with:'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   270
        '0'     '(0.0 @ 0.0)'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   271
        '1'     '(1.0 @ 1.0)'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   272
        '['     '[:!! ]'
3876
38612526d6a2 sniplets: what was %p ? (noone knows)
Claus Gittinger <cg@exept.de>
parents: 3870
diff changeset
   273
        '('     '(!! )'                                    
3807
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   274
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   275
        "/ typos...
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   276
        'eslf'  'self'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   277
        'slef'  'self'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   278
        'sefl'  'self'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   279
        'elf'   'self'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   280
        'slf'   'self'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   281
        'sef'   'self'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   282
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   283
        'iftrue'   'ifTrue'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   284
        'iffalse'  'ifFalse'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   285
        'iftrue:'  'ifTrue:'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   286
        'iffalse:' 'ifFalse:'
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   287
    ) pairWiseDo:[:abbrev :text |
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   288
        Sniplets
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   289
            at:abbrev put:text "/ ifPresent:[ self error:'duplicate abbreviation key' ]
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   290
    ].
4148
2fe252a82d5b changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4141
diff changeset
   291
4453
c0cee00a50f6 changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4438
diff changeset
   292
    "Modified: / 26-09-2012 / 14:48:42 / cg"
3716
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   293
!
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   294
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   295
updateStyleCache
444
ef26eba8c854 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 430
diff changeset
   296
    "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
   297
1354
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
   298
    <resource: #style (#'codeErrorSelection.foregroundColor'
2492
740174c1be0f allow separate bg-color from styleSheet
Claus Gittinger <cg@exept.de>
parents: 2489
diff changeset
   299
                       #'codeErrorSelection.backgroundColor'
740174c1be0f allow separate bg-color from styleSheet
Claus Gittinger <cg@exept.de>
parents: 2489
diff changeset
   300
                       #'codeView.backgroundColor' )>
444
ef26eba8c854 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 430
diff changeset
   301
1354
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
   302
    DefaultErrorForegroundColor := StyleSheet colorAt:'codeErrorSelection.foregroundColor'.
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
   303
    DefaultErrorBackgroundColor := StyleSheet colorAt:'codeErrorSelection.backgroundColor'.
2492
740174c1be0f allow separate bg-color from styleSheet
Claus Gittinger <cg@exept.de>
parents: 2489
diff changeset
   304
    DefaultViewBackground := StyleSheet colorAt:'codeView.backgroundColor'.
32
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
   305
! !
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
   306
2776
17dca7ff1f82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2775
diff changeset
   307
!Workspace class methodsFor:'getting a new Workspace'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   308
32
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
   309
open
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   310
    "launch a new workspace"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   311
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   312
    |scr topView workspace f|
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   313
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   314
    topView := StandardSystemView 
1522
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   315
                label:(self classResources string:(self defaultLabel)) 
1901
b3556ff49778 removed minExtent - let topView decide.
Claus Gittinger <cg@exept.de>
parents: 1738
diff changeset
   316
                " minExtent:(100 @ 100)".
23
69f1ba57f67a *** empty log message ***
claus
parents: 15
diff changeset
   317
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   318
    scr := HVScrollableView for:self in:topView.
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   319
    scr origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   320
    workspace := scr scrolledView.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   321
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   322
    "/ adjust topViews extent according to my font
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   323
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   324
    f := workspace font.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   325
    topView extent:((f widthOf:'x') * 40) @ (f height * 10).
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   326
    topView open.
131
claus
parents: 125
diff changeset
   327
    ^ workspace
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   328
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   329
    "
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   330
     Workspace open
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   331
    "
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   332
1522
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   333
    "Modified: / 16.5.1998 / 16:53:53 / cg"
857
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   334
!
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   335
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   336
openForRemote:hostName
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   337
    "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
   338
     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
   339
     and the result is shown here.
857
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   340
     This requires the RemoteObjects package to be loaded."
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   341
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   342
    |server remoteCompiler workspace|
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   343
1522
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   344
    RemoteObjectServer isNil ifTrue:[
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   345
        self warn:'no remoteObjectServer available'.
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   346
        ^ nil
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   347
    ].
857
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   348
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   349
    server := RemoteObjectServer on:hostName.
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   350
    remoteCompiler := server get:#Compiler.
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   351
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   352
    workspace := self open.
1522
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   353
    workspace topView 
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   354
        label:(self classResources string:'Remote Workspace {%1}' with:hostName).
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   355
857
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   356
    workspace doItAction:
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   357
                [:theCode |
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   358
                    remoteCompiler 
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   359
                        evaluate:theCode 
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   360
                        in:nil 
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   361
                        receiver:nil 
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   362
                        notifying:workspace 
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   363
                        logged:true 
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   364
                        ifFail:nil 
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   365
                ]
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   366
    "
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   367
     Workspace openForRemote:'andi'
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   368
    "
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   369
1522
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   370
    "Modified: / 16.5.1998 / 16:57:38 / cg"
2686
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   371
!
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   372
2794
90115a2de9d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   373
openWith:initialText selected:selectedBoolean
2686
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   374
    "launch a new workspace with some initial contents"
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   375
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   376
    |workspace|
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   377
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   378
    workspace := self open.
2794
90115a2de9d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   379
    workspace contents:initialText selected:selectedBoolean.
2686
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   380
    ^ workspace
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   381
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   382
    "
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   383
     Workspace openWith:'Transcript showCR:''hello world'''
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   384
    "
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   385
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   386
2657
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   387
!Workspace class methodsFor:'history'!
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   388
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   389
clearDoItHistory
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   390
    DoItHistory := nil
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   391
!
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   392
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   393
doItHistory
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   394
    ^ DoItHistory
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   395
!
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   396
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   397
doItHistorySize
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   398
    "the number of remembered doIts"
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   399
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   400
    ^ 20
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   401
!
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   402
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   403
rememberDoIt:aString
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   404
    |string|
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   405
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   406
    string := aString asString string withoutSeparators.
2726
f258efeca730 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2717
diff changeset
   407
    (string asCollectionOfWords size <= 1) ifTrue:[
f258efeca730 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2717
diff changeset
   408
        ((Scanner new scanTokens:string) size <= 1) ifTrue:[
4542
ff3c118dcf43 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4504
diff changeset
   409
            "it's a variable only"
2726
f258efeca730 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2717
diff changeset
   410
            ^ self
f258efeca730 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2717
diff changeset
   411
        ]
f258efeca730 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2717
diff changeset
   412
    ].
2657
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   413
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   414
    DoItHistory isNil ifTrue:[
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   415
        DoItHistory := OrderedCollection new.
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   416
    ].
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   417
    DoItHistory remove:string ifAbsent:nil.
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   418
    DoItHistory addFirst:string.
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   419
    DoItHistory size > self doItHistorySize ifTrue:[
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   420
        DoItHistory removeLast
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   421
    ].
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   422
! !
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   423
1523
6c0045d6a91f open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents: 1522
diff changeset
   424
!Workspace class methodsFor:'queries'!
6c0045d6a91f open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents: 1522
diff changeset
   425
6c0045d6a91f open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents: 1522
diff changeset
   426
isVisualStartable
6c0045d6a91f open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents: 1522
diff changeset
   427
    "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
   428
     (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
   429
6c0045d6a91f open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents: 1522
diff changeset
   430
    ^ self == Workspace
6c0045d6a91f open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents: 1522
diff changeset
   431
6c0045d6a91f open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents: 1522
diff changeset
   432
    "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
   433
    "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
   434
! !
6c0045d6a91f open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents: 1522
diff changeset
   435
1931
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   436
!Workspace class methodsFor:'workspace variables'!
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   437
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   438
addWorkspaceVariable:name
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   439
    "create a new workspace variable"
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   440
1933
a3d9c133279f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1932
diff changeset
   441
    |holder|
a3d9c133279f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1932
diff changeset
   442
3325
b7e01a88b167 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3319
diff changeset
   443
    holder := self workspaceVariables at:name ifAbsentPut:[ ValueHolder new ].
1933
a3d9c133279f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1932
diff changeset
   444
    ^ holder
1931
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   445
!
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   446
3157
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   447
anyWorkspaceVariableIsDefined
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   448
    ^ WorkspaceVariables notEmptyOrNil
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   449
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   450
    "Created: / 20-04-2005 / 11:57:53 / cg"
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   451
!
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   452
1931
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   453
removeAllWorkspaceVariables
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   454
    "delete all workspace variables"
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   455
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   456
    WorkspaceVariables := nil
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   457
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   458
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   459
!
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   460
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   461
removeWorkspaceVariable:name
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   462
    "delete a workspace variable"
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   463
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   464
    WorkspaceVariables notNil ifTrue:[
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   465
        WorkspaceVariables removeKey:name ifAbsent:nil.
4656
8e48e4c556b6 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4631
diff changeset
   466
        WorkspaceVariables := WorkspaceVariables asNilIfEmpty.
1931
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   467
    ].
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   468
!
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   469
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   470
workspaceVariableAt:name
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   471
    "retrieve a workspace variable (actually, a holder onto it)"
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   472
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   473
    WorkspaceVariables isNil ifTrue:[^ nil].
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   474
    ^ WorkspaceVariables at:name ifAbsent:nil.
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   475
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   476
1932
a898c608fb9a support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   477
!
a898c608fb9a support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   478
3157
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   479
workspaceVariableNames
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   480
    "retrieve the collection of workspace variable names"
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   481
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   482
    WorkspaceVariables isNil ifTrue:[^ #()].
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   483
    ^ WorkspaceVariables keys
1932
a898c608fb9a support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   484
3157
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   485
    "Created: / 20-04-2005 / 11:42:45 / cg"
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   486
!
1932
a898c608fb9a support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   487
3157
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   488
workspaceVariables
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   489
    "retrieve the collection of workspace variables.
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   490
     That is a dictionary associating names to values."
1932
a898c608fb9a support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   491
3325
b7e01a88b167 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3319
diff changeset
   492
    WorkspaceVariables isNil ifTrue:[
b7e01a88b167 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3319
diff changeset
   493
        WorkspaceVariables := Dictionary new.
b7e01a88b167 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3319
diff changeset
   494
    ].
b7e01a88b167 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3319
diff changeset
   495
    ^ WorkspaceVariables
3157
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   496
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   497
    "Modified: / 20-04-2005 / 11:43:14 / cg"
1931
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   498
! !
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   499
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   500
!Workspace methodsFor:'accessing'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   501
3428
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
   502
allowValueDrop:aBoolean
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
   503
    "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
   504
     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
   505
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
   506
    allowValueDrop := aBoolean.
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
   507
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
   508
    "Created: / 28-11-2006 / 16:13:02 / cg"
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
   509
!
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
   510
2679
1e61847e26f4 autoDefine as doIt added
Claus Gittinger <cg@exept.de>
parents: 2663
diff changeset
   511
autoDefineVariables
4090
703569e25553 changed:
Claus Gittinger <cg@exept.de>
parents: 4057
diff changeset
   512
    "undefined variables handling:
703569e25553 changed:
Claus Gittinger <cg@exept.de>
parents: 4057
diff changeset
   513
        are automatically defined as workspace variable if autoDefineVariables is #workspace.
703569e25553 changed:
Claus Gittinger <cg@exept.de>
parents: 4057
diff changeset
   514
        are automatically defined as doit variable if autoDefineVariables is #doit.
703569e25553 changed:
Claus Gittinger <cg@exept.de>
parents: 4057
diff changeset
   515
        are left undefined if autoDefineVariables is nil."
703569e25553 changed:
Claus Gittinger <cg@exept.de>
parents: 4057
diff changeset
   516
2679
1e61847e26f4 autoDefine as doIt added
Claus Gittinger <cg@exept.de>
parents: 2663
diff changeset
   517
    ^ autoDefineVariables 
2535
0884418b7c41 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2534
diff changeset
   518
!
0884418b7c41 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2534
diff changeset
   519
2679
1e61847e26f4 autoDefine as doIt added
Claus Gittinger <cg@exept.de>
parents: 2663
diff changeset
   520
autoDefineVariables:nilOrSymbol
3429
670414b849dd allow value drop to be disabled
Claus Gittinger <cg@exept.de>
parents: 3428
diff changeset
   521
    "undefined variables handling:
670414b849dd allow value drop to be disabled
Claus Gittinger <cg@exept.de>
parents: 3428
diff changeset
   522
        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
   523
        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
   524
        are left undefined if nilOrSymbol is nil."
670414b849dd allow value drop to be disabled
Claus Gittinger <cg@exept.de>
parents: 3428
diff changeset
   525
2679
1e61847e26f4 autoDefine as doIt added
Claus Gittinger <cg@exept.de>
parents: 2663
diff changeset
   526
    autoDefineVariables := nilOrSymbol.
3429
670414b849dd allow value drop to be disabled
Claus Gittinger <cg@exept.de>
parents: 3428
diff changeset
   527
670414b849dd allow value drop to be disabled
Claus Gittinger <cg@exept.de>
parents: 3428
diff changeset
   528
    "Modified: / 28-11-2006 / 16:21:01 / cg"
2679
1e61847e26f4 autoDefine as doIt added
Claus Gittinger <cg@exept.de>
parents: 2663
diff changeset
   529
!
2535
0884418b7c41 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2534
diff changeset
   530
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   531
commentStrings:anArrayOfCommentStrings
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   532
    "define the comment strings"
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   533
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   534
    commentStrings := anArrayOfCommentStrings
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   535
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   536
    "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
   537
!
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   538
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   539
doItAction
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   540
    "return the action to be performed when 'doIt' is selected"
32
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
   541
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   542
    ^ doItAction
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   543
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   544
4584
ba63ceaa4916 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4568
diff changeset
   545
doItAction:aOneArgBlock
ba63ceaa4916 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4568
diff changeset
   546
    "define the action to be performed when 'doIt' is selected.
ba63ceaa4916 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4568
diff changeset
   547
     The block will be evaluated, passing the selection as a String argument. 
ba63ceaa4916 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4568
diff changeset
   548
     A default doItAction is set for you in the initialize method."
ba63ceaa4916 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4568
diff changeset
   549
ba63ceaa4916 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4568
diff changeset
   550
    doItAction := aOneArgBlock
ba63ceaa4916 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4568
diff changeset
   551
ba63ceaa4916 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4568
diff changeset
   552
    "Modified: 27.2.1996 / 15:31:37 / cg"
ba63ceaa4916 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4568
diff changeset
   553
!
ba63ceaa4916 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4568
diff changeset
   554
4675
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   555
editedClass
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   556
    "for the code completion"
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   557
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   558
    editedMethodOrClass isNil ifTrue:[^ nil].
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   559
    ^ editedMethodOrClass isBehavior ifTrue:[editedMethodOrClass] ifFalse:[editedMethodOrClass mclass]
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   560
!
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   561
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   562
editedMethod
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   563
    "for the code completion"
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   564
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   565
    editedMethodOrClass isNil ifTrue:[^ nil].
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   566
    ^ editedMethodOrClass isBehavior ifTrue:[nil] ifFalse:[editedMethodOrClass]
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   567
!
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   568
4606
86670e36b110 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4593
diff changeset
   569
editedMethodOrClass
86670e36b110 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4593
diff changeset
   570
    "for the code completion"
86670e36b110 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4593
diff changeset
   571
86670e36b110 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4593
diff changeset
   572
    ^ editedMethodOrClass.
86670e36b110 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4593
diff changeset
   573
!
86670e36b110 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4593
diff changeset
   574
86670e36b110 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4593
diff changeset
   575
editedMethodOrClass:aMethodOrClass
86670e36b110 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4593
diff changeset
   576
    "for the code completion"
86670e36b110 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4593
diff changeset
   577
86670e36b110 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4593
diff changeset
   578
    editedMethodOrClass := aMethodOrClass.
86670e36b110 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4593
diff changeset
   579
!
86670e36b110 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4593
diff changeset
   580
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   581
errorBackgroundColor
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   582
    errorBgColor notNil ifTrue:[ ^ errorBgColor ].
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   583
    DefaultErrorBackgroundColor notNil ifTrue:[ ^ DefaultErrorBackgroundColor ].
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   584
    device hasColors ifTrue:[ ^ Color red ].
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   585
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   586
    ^ selectionBgColor
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   587
!
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   588
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   589
errorForegroundColor
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   590
    errorFgColor notNil ifTrue:[ ^ errorFgColor ].
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   591
    DefaultErrorForegroundColor notNil ifTrue:[ ^ DefaultErrorForegroundColor ].
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   592
    ^ selectionFgColor
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   593
!
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   594
4436
0834dc472b3f added: #nameSpaceForDoits:
Claus Gittinger <cg@exept.de>
parents: 4432
diff changeset
   595
nameSpaceForDoits:aNameSpaceOrNil
0834dc472b3f added: #nameSpaceForDoits:
Claus Gittinger <cg@exept.de>
parents: 4432
diff changeset
   596
    "can be used by the embedding application to control doIt execution
0834dc472b3f added: #nameSpaceForDoits:
Claus Gittinger <cg@exept.de>
parents: 4432
diff changeset
   597
     (especially: for tools like expecco, to provide better workspaces"
0834dc472b3f added: #nameSpaceForDoits:
Claus Gittinger <cg@exept.de>
parents: 4432
diff changeset
   598
0834dc472b3f added: #nameSpaceForDoits:
Claus Gittinger <cg@exept.de>
parents: 4432
diff changeset
   599
    namespaceForDoits := aNameSpaceOrNil.
0834dc472b3f added: #nameSpaceForDoits:
Claus Gittinger <cg@exept.de>
parents: 4432
diff changeset
   600
0834dc472b3f added: #nameSpaceForDoits:
Claus Gittinger <cg@exept.de>
parents: 4432
diff changeset
   601
    "Created: / 26-07-2012 / 23:06:04 / cg"
0834dc472b3f added: #nameSpaceForDoits:
Claus Gittinger <cg@exept.de>
parents: 4432
diff changeset
   602
!
0834dc472b3f added: #nameSpaceForDoits:
Claus Gittinger <cg@exept.de>
parents: 4432
diff changeset
   603
4391
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
   604
namespaceForDoits:aNameSpaceOrNil
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
   605
    "can be used by the embedding application to control doIt execution
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
   606
     (especially: for tools like expecco, to provide better workspaces"
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
   607
4436
0834dc472b3f added: #nameSpaceForDoits:
Claus Gittinger <cg@exept.de>
parents: 4432
diff changeset
   608
    <resource: #obsolete>
0834dc472b3f added: #nameSpaceForDoits:
Claus Gittinger <cg@exept.de>
parents: 4432
diff changeset
   609
4391
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
   610
    namespaceForDoits := aNameSpaceOrNil.
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
   611
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
   612
    "Created: / 04-03-2012 / 13:34:51 / cg"
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
   613
!
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
   614
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
   615
poolsConsideredInDoIts:aCollectionOfPools
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
   616
    "can be used by the embedding application to control doIt execution
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
   617
     (especially: for tools like expecco, to provide better workspaces"
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
   618
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
   619
    poolsConsideredInDoIts := aCollectionOfPools.
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
   620
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
   621
    "Modified (format): / 04-03-2012 / 13:35:00 / cg"
3537
1761370c0869 sharedPool access in doIts
Claus Gittinger <cg@exept.de>
parents: 3511
diff changeset
   622
!
1761370c0869 sharedPool access in doIts
Claus Gittinger <cg@exept.de>
parents: 3511
diff changeset
   623
2601
d52e69edc760 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2595
diff changeset
   624
simulatedSelf:anObject
d52e69edc760 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2595
diff changeset
   625
    "define what self is in an evaluation"
d52e69edc760 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2595
diff changeset
   626
d52e69edc760 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2595
diff changeset
   627
    simulatedSelf := anObject
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   628
!
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   629
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   630
warningBackgroundColor
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   631
    DefaultWarningBackgroundColor notNil ifTrue:[ ^ DefaultWarningBackgroundColor ].
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   632
    device hasColors ifTrue:[ ^ Color orange ].
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   633
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   634
    ^ selectionBgColor
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   635
!
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   636
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   637
warningForegroundColor
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   638
    DefaultWarningForegroundColor notNil ifTrue:[ ^ DefaultWarningForegroundColor ].
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   639
    ^ selectionFgColor
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   640
! !
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   641
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   642
!Workspace methodsFor:'compiler interface'!
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   643
2303
a0cce4808d1d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2285
diff changeset
   644
compilerClass
4432
2eaf85d92e62 corrected switching languages between tabs
Claus Gittinger <cg@exept.de>
parents: 4427
diff changeset
   645
    ^ compilerClass "? Compiler"
2eaf85d92e62 corrected switching languages between tabs
Claus Gittinger <cg@exept.de>
parents: 4427
diff changeset
   646
2eaf85d92e62 corrected switching languages between tabs
Claus Gittinger <cg@exept.de>
parents: 4427
diff changeset
   647
    "Modified: / 19-07-2012 / 17:04:35 / cg"
2980
37d217fbca80 syntax setting
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   648
!
37d217fbca80 syntax setting
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   649
37d217fbca80 syntax setting
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   650
compilerClass:aCompilerClass
37d217fbca80 syntax setting
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   651
    compilerClass := aCompilerClass
2303
a0cce4808d1d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2285
diff changeset
   652
!
a0cce4808d1d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2285
diff changeset
   653
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   654
currentSourceCode
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   655
    "special interface to compiler - called by parser
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   656
     to get the updated source code after a corrected error"
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   657
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   658
    ^ self contents
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   659
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   660
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   661
wantChangeLog
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   662
    "sent by the compiler to ask if a changeLog entry should
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   663
     be written. Return true here."
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   664
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   665
    ^ true
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   666
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   667
2754
4e479333efa3 method category rename
Claus Gittinger <cg@exept.de>
parents: 2751
diff changeset
   668
!Workspace methodsFor:'compiler interface-error handling'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   669
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   670
correctableError:aString position:relPos to:relEndPos from:aCompiler
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   671
    "compiler notifies us of a correctable error;
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   672
     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
   673
     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
   674
     to be corrected; false otherwise"
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   675
4675
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   676
    |action sameForAllHolder possibleFixes doNotShowAgainHolder doNotShowAgainForThisMethodHolder|
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   677
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   678
    "/ the declare/correct fixes are here for backward compatibility
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   679
    "/ (in previous versions, these two were always offered as fix,
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   680
    "/ and compilers which honor the old interface will not anwer the PossibleCorrectionsQuery)
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   681
    possibleFixes := Parser possibleCorrectionsQuery query.
4175
e7063a3e7ec5 changed: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4172
diff changeset
   682
e7063a3e7ec5 changed: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4172
diff changeset
   683
    sameForAllHolder := false asValue.
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   684
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   685
    self highlightingErrorPosition:relPos to:relEndPos do:[
4675
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   686
        doNotShowAgainHolder := false asValue.
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   687
        doNotShowAgainForThisMethodHolder := false asValue.
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   688
3383
41470ff2567d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   689
        Dialog aboutToOpenBoxNotificationSignal handle:[:ex |
4675
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   690
            |box declareButton makeSpaceOnlyOnce|
3383
41470ff2567d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   691
4669
e67632377ee5 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4656
diff changeset
   692
            box := ex box.
4675
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   693
            makeSpaceOnlyOnce := [ box addVerticalSpace:10. makeSpaceOnlyOnce := nil ].
4175
e7063a3e7ec5 changed: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4172
diff changeset
   694
4675
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   695
            DoNotShowCompilerWarningAgainActionQuery isHandled ifTrue:[
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   696
                makeSpaceOnlyOnce value.
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   697
                box verticalPanel 
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   698
                    add:(CheckBox 
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   699
                            label: "addCheckBoxAtBottom:" 'Do not show this dialog again (reenable via Launcher''s settings dialog)' 
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   700
                            model:doNotShowAgainHolder).
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   701
            ].
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   702
            DoNotShowCompilerWarningAgainForThisMethodActionQuery isHandled ifTrue:[
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   703
                makeSpaceOnlyOnce value.
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   704
                box verticalPanel
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   705
                    add:(CheckBox
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   706
                            label:(resources string:'Do not warn in this method (for %1 - reenable earlier via Launcher''s settings dialog)' with:ParserFlags perMethodDisableWarningTimeDuration)  
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   707
                            model:doNotShowAgainForThisMethodHolder).
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   708
            ].
4175
e7063a3e7ec5 changed: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4172
diff changeset
   709
            SameForAllNotification isHandled ifTrue:[
4675
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   710
                box addVerticalSpace:10.
4386
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
   711
                box addCheckBoxAtBottom:'Same action for all' on:sameForAllHolder
4175
e7063a3e7ec5 changed: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4172
diff changeset
   712
            ].
e7063a3e7ec5 changed: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4172
diff changeset
   713
3383
41470ff2567d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   714
            declareButton := box buttons at:2.
41470ff2567d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   715
            declareButton pressAction:declareButton controller releaseAction.
41470ff2567d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   716
            declareButton controller beTriggerOnDown.
41470ff2567d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   717
        ] do:[
4675
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   718
            |buttonLabels actions|
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   719
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   720
            buttonLabels := OrderedCollection new.
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   721
            actions := OrderedCollection new.
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   722
            buttonLabels add:'Cancel'. actions add:#abort.
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   723
            possibleFixes do:[:each |
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   724
                buttonLabels add:(each buttonLabel). actions add:each.
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   725
            ].
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   726
            buttonLabels add:'Continue'. actions add:#continue.
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   727
3383
41470ff2567d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   728
            action := OptionBox 
41470ff2567d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   729
                          request:aString
3592
cb6f9f060e62 changed #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 3579
diff changeset
   730
                          label:(resources string:'Correctable Error')
3383
41470ff2567d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   731
                          image:(WarningBox iconBitmap)
4675
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   732
                          buttonLabels:(resources array:buttonLabels)
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   733
                          values:actions
3383
41470ff2567d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   734
                          default:#continue
41470ff2567d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   735
                          onCancel:#abort.
41470ff2567d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   736
        ].
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   737
    ].
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   738
4175
e7063a3e7ec5 changed: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4172
diff changeset
   739
    sameForAllHolder value ifTrue:[
e7063a3e7ec5 changed: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4172
diff changeset
   740
        SameForAllNotification notify
e7063a3e7ec5 changed: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4172
diff changeset
   741
    ].
4691
398ab7693051 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
   742
    doNotShowAgainHolder value == true ifTrue:[
398ab7693051 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
   743
        DoNotShowCompilerWarningAgainActionQuery actionQuery value
398ab7693051 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
   744
    ].
398ab7693051 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
   745
    doNotShowAgainForThisMethodHolder value == true ifTrue:[
398ab7693051 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
   746
        DoNotShowCompilerWarningAgainForThisMethodActionQuery actionQuery value
398ab7693051 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
   747
    ].
398ab7693051 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
   748
4675
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   749
    action == #cancel ifTrue:[
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   750
        ^ false
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   751
    ].
4175
e7063a3e7ec5 changed: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4172
diff changeset
   752
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   753
    action == #abort ifTrue:[
2477
8a324269ee7a class based exceptions - abortSignal;
Claus Gittinger <cg@exept.de>
parents: 2471
diff changeset
   754
        AbortOperationRequest raise.
368
53476ee1fbee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
   755
        ^ false
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   756
    ].
4675
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   757
    ^ action
368
53476ee1fbee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
   758
4386
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
   759
    "Modified: / 28-02-2012 / 10:42:27 / cg"
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   760
!
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   761
2104
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   762
correctableSelectorWarning:aString position:relPos to:relEndPos from:aCompiler
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   763
    "compiler notifies us of a correctable selector warning;
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   764
     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
   765
     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
   766
     to be corrected; false otherwise"
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   767
3744
c206f437042e turn on/off selector warnings
Claus Gittinger <cg@exept.de>
parents: 3742
diff changeset
   768
    |action doNotShowAgainHolder|
2104
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   769
3261
62a2ab999d42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3252
diff changeset
   770
    self highlightingWarningPosition:relPos to:relEndPos do:[
3744
c206f437042e turn on/off selector warnings
Claus Gittinger <cg@exept.de>
parents: 3742
diff changeset
   771
        doNotShowAgainHolder := false asValue.
c206f437042e turn on/off selector warnings
Claus Gittinger <cg@exept.de>
parents: 3742
diff changeset
   772
        Dialog aboutToOpenBoxNotificationSignal handle:[:ex |
4617
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
   773
            MessageNotUnderstood catch:[
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
   774
                (aCompiler notNil and:[DoNotShowCompilerWarningAgainActionQuery isHandled]) ifTrue:[
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
   775
                    ex box addCheckBoxAtBottom:'Do not show this dialog again (reenable via Launchers Settings Dialog)' on:doNotShowAgainHolder.
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
   776
                ].
3744
c206f437042e turn on/off selector warnings
Claus Gittinger <cg@exept.de>
parents: 3742
diff changeset
   777
            ].
c206f437042e turn on/off selector warnings
Claus Gittinger <cg@exept.de>
parents: 3742
diff changeset
   778
        ] do:[
c206f437042e turn on/off selector warnings
Claus Gittinger <cg@exept.de>
parents: 3742
diff changeset
   779
            action := OptionBox 
2104
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   780
                      request:aString
3593
0de12c5b752a changed #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 3592
diff changeset
   781
                      label:(resources string:'Warning')
2983
910b4d5f7b1b dont send obsolete message (OptionBox request:..form:..)
Claus Gittinger <cg@exept.de>
parents: 2982
diff changeset
   782
                      image:(WarningBox iconBitmap)
2471
fc8c179c4228 finished remove unused vars;
Claus Gittinger <cg@exept.de>
parents: 2470
diff changeset
   783
                      buttonLabels:(resources array:#('Cancel' 'Correct...' 'Generate' 'Continue'))
2338
4c67cec79a84 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2326
diff changeset
   784
                      values:#(#abort #correct #generate #continue)
2391
f8cd579704db optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents: 2388
diff changeset
   785
                      default:#continue
f8cd579704db optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents: 2388
diff changeset
   786
                      onCancel:#abort.
3744
c206f437042e turn on/off selector warnings
Claus Gittinger <cg@exept.de>
parents: 3742
diff changeset
   787
        ].
c206f437042e turn on/off selector warnings
Claus Gittinger <cg@exept.de>
parents: 3742
diff changeset
   788
        doNotShowAgainHolder value == true ifTrue:[
4386
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
   789
            DoNotShowCompilerWarningAgainActionQuery actionQuery value
3744
c206f437042e turn on/off selector warnings
Claus Gittinger <cg@exept.de>
parents: 3742
diff changeset
   790
        ].
2104
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   791
    ].
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   792
2338
4c67cec79a84 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2326
diff changeset
   793
    action == #generate ifTrue:[
4c67cec79a84 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2326
diff changeset
   794
        ^ action
4c67cec79a84 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2326
diff changeset
   795
    ].
4c67cec79a84 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2326
diff changeset
   796
2391
f8cd579704db optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents: 2388
diff changeset
   797
    (action isNil or:[action == #abort]) ifTrue:[
2477
8a324269ee7a class based exceptions - abortSignal;
Claus Gittinger <cg@exept.de>
parents: 2471
diff changeset
   798
        AbortOperationRequest raise.
2104
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   799
        ^ false
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   800
    ].
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   801
    ^ action == #correct
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   802
4386
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
   803
    "Created: / 19-01-2000 / 16:27:28 / cg"
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
   804
    "Modified: / 28-02-2012 / 10:42:37 / cg"
2104
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   805
!
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   806
4188
601acd1e72fe added: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4186
diff changeset
   807
correctableWarning:aString position:relPos to:relEndPos from:aCompiler
601acd1e72fe added: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4186
diff changeset
   808
    "compiler notifies us of a correctable warning;
601acd1e72fe added: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4186
diff changeset
   809
     hilight the error (relPos to relEndPos) and show a Box asking for continue/correct/abort;
601acd1e72fe added: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4186
diff changeset
   810
     this method should return true to the compiler if user wants the error
601acd1e72fe added: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4186
diff changeset
   811
     to be corrected; false otherwise"
601acd1e72fe added: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4186
diff changeset
   812
601acd1e72fe added: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4186
diff changeset
   813
    ^ self correctableError:aString position:relPos to:relEndPos from:aCompiler
601acd1e72fe added: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4186
diff changeset
   814
601acd1e72fe added: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4186
diff changeset
   815
    "Created: / 02-11-2010 / 13:29:01 / cg"
601acd1e72fe added: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4186
diff changeset
   816
!
601acd1e72fe added: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4186
diff changeset
   817
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   818
error:aString position:relPos to:relEndPos asWarning:asWarning
2277
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   819
    "obsolete - no longer invoked"
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   820
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   821
    ^ self error:aString position:relPos to:relEndPos from:nil asWarning:asWarning
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   822
!
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   823
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   824
error:aString position:relPos to:relEndPos from:aCompiler
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   825
    "compiler notifies us of an error; hilight the error (relPos to relEndPos) 
4274
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   826
     and show a Box asking for continue/abort.
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   827
     Return true for correction, false of not (or not possible)"
2277
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   828
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   829
    ^ self error:aString position:relPos to:relEndPos from:aCompiler asWarning:false
4274
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   830
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   831
    "Modified (Comment): / 30-06-2011 / 19:47:36 / cg"
2277
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   832
!
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   833
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   834
error:aString position:relPos to:relEndPos from:aCompiler asWarning:asWarning
3397
cd20f51edc25 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3396
diff changeset
   835
    "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
   836
     and show a Box asking for continue/abort."
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   837
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   838
    |answer fg bg|
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   839
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   840
    fg := asWarning ifTrue:[ self warningForegroundColor ] ifFalse:[ self errorForegroundColor ].
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   841
    bg := asWarning ifTrue:[ self warningBackgroundColor ] ifFalse:[ self errorBackgroundColor ].
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   842
3397
cd20f51edc25 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3396
diff changeset
   843
    self
3480
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   844
        highlightingErrorPosition:relPos to:relEndPos
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   845
        withForeground:fg andBackground:bg
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   846
        do:[
4386
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
   847
            |box lbl doNotShowAgainHolder doNotShowAgainForThisMethodHolder l1 y1 y2 l2|
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   848
4170
6bf83a2af71f changed: #error:position:to:from:asWarning:
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   849
"/            Warning isHandled ifTrue:[
6bf83a2af71f changed: #error:position:to:from:asWarning:
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   850
"/                Warning raiseErrorString:aString.
6bf83a2af71f changed: #error:position:to:from:asWarning:
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   851
"/                ^ false
6bf83a2af71f changed: #error:position:to:from:asWarning:
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   852
"/            ].
213
6286d3f36c14 raise warningSignal if handled (allows warnBoxes from compiler to be suppressed in debugger)
Claus Gittinger <cg@exept.de>
parents: 208
diff changeset
   853
3480
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   854
            lbl := aCompiler isNil ifTrue:['Compiler'] ifFalse:[aCompiler class name].
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   855
            asWarning ifTrue:[
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   856
                lbl := lbl , ' Warning'
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   857
            ] ifFalse:[
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   858
                lbl := lbl , ' Error'.
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   859
            ].
4274
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   860
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   861
            "
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   862
             ask if we should abort or continue
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   863
            "
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   864
            Dialog aboutToOpenBoxNotificationSignal handle:[:ex |
4386
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
   865
                |box makeSpace|
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
   866
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
   867
                doNotShowAgainHolder := false asValue.
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
   868
                doNotShowAgainForThisMethodHolder := false asValue.
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
   869
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
   870
                box := ex box.
4504
24d47fd0174a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4472
diff changeset
   871
                box label:lbl.
24d47fd0174a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4472
diff changeset
   872
                box perform:#image: with:(WarningBox iconBitmap) ifNotUnderstood:[].
2799
4d9967d1052e support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 2794
diff changeset
   873
4386
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
   874
                aCompiler notNil ifTrue:[
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
   875
                    makeSpace := [ box addVerticalSpace:10. makeSpace := nil ].
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
   876
                    DoNotShowCompilerWarningAgainActionQuery isHandled ifTrue:[
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
   877
                        makeSpace value.
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
   878
                        box verticalPanel
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
   879
                            add:(CheckBox label:'Do not show this dialog again (reenable via Launcher''s settings dialog)' 
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
   880
                                          model:doNotShowAgainHolder).
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
   881
                    ].
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
   882
                    DoNotShowCompilerWarningAgainForThisMethodActionQuery isHandled ifTrue:[
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
   883
                        makeSpace value.
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
   884
                        box verticalPanel
4398
fa39aafcc0f3 changed:
Claus Gittinger <cg@exept.de>
parents: 4395
diff changeset
   885
                            add:(CheckBox label:(resources string:'Do not warn in this method (for %1 - reenable earlier via Launcher''s settings dialog)' with:ParserFlags perMethodDisableWarningTimeDuration) 
4386
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
   886
                                          model:doNotShowAgainForThisMethodHolder).
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
   887
                    ].
4274
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   888
                ].
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   889
            ] do:[
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   890
                answer := OptionBox
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   891
                        request:aString 
4279
f944300bc0be changed: #error:position:to:from:asWarning:
Claus Gittinger <cg@exept.de>
parents: 4278
diff changeset
   892
                        buttonLabels:(resources array:#('Abort'  "'Keep Selected'" 'Continue')) 
f944300bc0be changed: #error:position:to:from:asWarning:
Claus Gittinger <cg@exept.de>
parents: 4278
diff changeset
   893
                        values:#(false "#keepSelected" true)
4278
b13960d1a2cc changed: #error:position:to:from:asWarning:
Claus Gittinger <cg@exept.de>
parents: 4274
diff changeset
   894
                        default:(asWarning ifTrue:true ifFalse:false).
3480
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   895
            ].
4274
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   896
"/            box := YesNoBox
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   897
"/                    title:aString
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   898
"/                    yesText:(resources string:'Continue')
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   899
"/                    noText:(resources string:'Abort').
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   900
"/
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   901
"/            box label:lbl.
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   902
"/            box image:(WarningBox iconBitmap).
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   903
"/
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   904
"/            (aCompiler notNil and:[DoNotShowCompilerWarningAgainActionQuery isHandled]) ifTrue:[
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   905
"/                doNotShowAgainHolder := false asValue.
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   906
"/                box addCheckBox:'Do not show this dialog again (reenable via Launchers Settings Dialog)' on:doNotShowAgainHolder.
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   907
"/            ].
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   908
"/
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   909
"/            "/ answer := box confirm.
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   910
"/            answer := box confirm.
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   911
3480
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   912
            doNotShowAgainHolder value == true ifTrue:[
4125
eeed55ffc143 changed: #error:position:to:from:asWarning:
Claus Gittinger <cg@exept.de>
parents: 4103
diff changeset
   913
                DoNotShowCompilerWarningAgainActionQuery actionQuery value
3480
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   914
            ].
4386
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
   915
            doNotShowAgainForThisMethodHolder value == true ifTrue:[
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
   916
                DoNotShowCompilerWarningAgainForThisMethodActionQuery actionQuery value
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
   917
            ].
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   918
4274
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   919
"/            box destroy.
3480
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   920
        ].
2799
4d9967d1052e support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 2794
diff changeset
   921
4274
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   922
    answer == #keepSelected ifTrue:[
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   923
        self hideCursor.
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   924
        "redraw selection in normal color"
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   925
        self invalidate.
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   926
        AbortOperationRequest raise.
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   927
    ].
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   928
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   929
    "
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   930
     do the abort if we have to
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   931
    "
3397
cd20f51edc25 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3396
diff changeset
   932
    answer ifFalse:[
4274
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   933
        "redraw selection in normal color"
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   934
        self invalidate.
3480
9defe040ef4a AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3429
diff changeset
   935
        AbortOperationRequest raise.
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   936
    ].
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   937
    ^ 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
   938
4170
6bf83a2af71f changed: #error:position:to:from:asWarning:
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   939
    "Created: / 24-11-1995 / 22:56:34 / cg"
4398
fa39aafcc0f3 changed:
Claus Gittinger <cg@exept.de>
parents: 4395
diff changeset
   940
    "Modified: / 08-03-2012 / 10:24:21 / cg"
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   941
!
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   942
2663
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
   943
highlightingErrorLine:lineNr do:aBlock
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
   944
    "evaluate aBlock while some selection is shown highlighted with error colors."
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
   945
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
   946
    |linePosition|
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
   947
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
   948
    linePosition := self characterPositionOfLine:lineNr col:1.
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
   949
    self highlightingErrorPosition:linePosition to:nil do:aBlock
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
   950
!
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
   951
59
450ce95a72a4 *** empty log message ***
claus
parents: 58
diff changeset
   952
highlightingErrorPosition:relPos to:relEndPos do:aBlock
450ce95a72a4 *** empty log message ***
claus
parents: 58
diff changeset
   953
    "evaluate aBlock while some selection is shown highlighted with error colors."
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   954
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   955
    self 
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   956
        highlightingErrorPosition:relPos to:relEndPos 
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   957
        withForeground:(self errorForegroundColor) andBackground:(self errorBackgroundColor) 
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   958
        do:aBlock
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   959
!
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   960
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   961
highlightingErrorPosition:relPos to:relEndPos withForeground:hilightFg andBackground:hilightBg do:aBlock
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   962
    "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
   963
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   964
    |absPosition oldFg oldBg|
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   965
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   966
    "
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   967
     change color of selection & hide cursor
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   968
    "
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   969
    oldFg := selectionFgColor.
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   970
    oldBg := selectionBgColor.
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   971
    selectionBgColor := hilightBg.
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   972
    selectionFgColor := hilightFg.
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   973
    self hideCursor.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   974
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   975
    "
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   976
     select the text - relEndPos may be nil in which case the whole line is selected
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   977
     we have to adjust the positions given by the compiler, since they
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   978
     are relative to the texts start (the compiler did stream-read the code).
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   979
    "
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   980
    codeStartPosition isNil ifTrue:[codeStartPosition := 1].
3427
9aa7216e0a5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3414
diff changeset
   981
    absPosition := codeStartPosition + (relPos ? 1) - 1.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   982
    relEndPos isNil ifTrue:[
4141
06c97cc2bf6d changed: #highlightingErrorPosition:to:withForeground:andBackground:do:
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   983
        self selectFromCharacterPosition:absPosition.
06c97cc2bf6d changed: #highlightingErrorPosition:to:withForeground:andBackground:do:
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   984
        "/ self selectLineWhereCharacterPosition:absPosition.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   985
    ] ifFalse:[
3427
9aa7216e0a5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3414
diff changeset
   986
        self selectFromCharacterPosition:absPosition to:(codeStartPosition + (relEndPos ? 1) - 1)
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   987
    ].
4273
4e9e823f9e41 changed: #highlightingErrorPosition:to:withForeground:andBackground:do:
Claus Gittinger <cg@exept.de>
parents: 4252
diff changeset
   988
    expandingTop := true.       "/ hack to make the top of the selection visible
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   989
    self makeSelectionVisible.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   990
155
claus
parents: 146
diff changeset
   991
    device flush.
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   992
2519
a088ad3bb1e5 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 2492
diff changeset
   993
    aBlock ensure:[
a088ad3bb1e5 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 2492
diff changeset
   994
        "
a088ad3bb1e5 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 2492
diff changeset
   995
         undo selection color change and show cursor again
a088ad3bb1e5 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 2492
diff changeset
   996
        "
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   997
        selectionFgColor := oldFg.
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   998
        selectionBgColor := oldBg.
2519
a088ad3bb1e5 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 2492
diff changeset
   999
        self showCursor.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1000
    ].
3427
9aa7216e0a5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3414
diff changeset
  1001
4273
4e9e823f9e41 changed: #highlightingErrorPosition:to:withForeground:andBackground:do:
Claus Gittinger <cg@exept.de>
parents: 4252
diff changeset
  1002
    "Modified: / 30-06-2011 / 17:24:04 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1003
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1004
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1005
highlightingWarningPosition:relPos to:relEndPos do:aBlock
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1006
    "evaluate aBlock while some selection is shown highlighted with warning colors."
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1008
    self 
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1009
        highlightingErrorPosition:relPos to:relEndPos 
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1010
        withForeground:(self warningForegroundColor) andBackground:(self warningBackgroundColor) 
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1011
        do:aBlock
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1012
!
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1013
2386
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1014
unusedVariableWarning:aString position:relPos to:relEndPos from:aCompiler
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1015
    "compiler notifies us of a (or some) unused variables;
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1016
     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
  1017
     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
  1018
     to be corrected; false otherwise"
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1019
4386
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1020
    |action doNotShowAgainHolder doNotShowAgainForThisMethodHolder|
2386
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1021
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1022
    self highlightingWarningPosition:relPos to:relEndPos do:[
4154
05d107aebe74 changed: #unusedVariableWarning:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  1023
        doNotShowAgainHolder := false asValue.
4386
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1024
        doNotShowAgainForThisMethodHolder := false asValue.
4154
05d107aebe74 changed: #unusedVariableWarning:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  1025
        Dialog aboutToOpenBoxNotificationSignal handle:[:ex |
4386
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1026
            |box makeSpace|
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1027
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1028
            box := ex box.
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1029
            aCompiler notNil ifTrue:[
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1030
                makeSpace := [ box addVerticalSpace:10. makeSpace := nil ].
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1031
                DoNotShowCompilerWarningAgainActionQuery isHandled ifTrue:[
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1032
                    makeSpace value.
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1033
                    box verticalPanel 
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1034
                        add:(CheckBox 
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1035
                                label: "addCheckBoxAtBottom:" 'Do not show this dialog again (reenable via Launcher''s settings dialog)' 
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1036
                                model:doNotShowAgainHolder).
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1037
                ].
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1038
                DoNotShowCompilerWarningAgainForThisMethodActionQuery isHandled ifTrue:[
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1039
                    makeSpace value.
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1040
                    box verticalPanel
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1041
                        add:(CheckBox
4398
fa39aafcc0f3 changed:
Claus Gittinger <cg@exept.de>
parents: 4395
diff changeset
  1042
                                label:(resources string:'Do not warn in this method (for %1 - reenable earlier via Launcher''s settings dialog)' with:ParserFlags perMethodDisableWarningTimeDuration)  
4386
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1043
                                model:doNotShowAgainForThisMethodHolder).
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1044
                ].
4154
05d107aebe74 changed: #unusedVariableWarning:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  1045
            ].
05d107aebe74 changed: #unusedVariableWarning:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  1046
        ] do:[
05d107aebe74 changed: #unusedVariableWarning:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  1047
            action := OptionBox 
2386
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1048
                      request:aString
3593
0de12c5b752a changed #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 3592
diff changeset
  1049
                      label:(resources string:'Warning')
2990
1373f301a694 dont send obsolete message to OptionBox
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1050
                      image:(WarningBox iconBitmap)
3593
0de12c5b752a changed #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 3592
diff changeset
  1051
                      buttonLabels:(resources array:#('Cancel' 'Remove Variable(s)' 'Continue'))
2470
240b6d2d5511 finished remove unused vars;
Claus Gittinger <cg@exept.de>
parents: 2462
diff changeset
  1052
                      values:#(#abort #correct #continue)
2386
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1053
                      default:#continue.
4679
3ee68f0d9e4e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4677
diff changeset
  1054
            action isNil ifTrue:[ action := #abort].
4154
05d107aebe74 changed: #unusedVariableWarning:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  1055
        ].
05d107aebe74 changed: #unusedVariableWarning:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  1056
        doNotShowAgainHolder value == true ifTrue:[
4386
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1057
            DoNotShowCompilerWarningAgainActionQuery actionQuery value
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1058
        ].
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1059
        doNotShowAgainForThisMethodHolder value == true ifTrue:[
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1060
            DoNotShowCompilerWarningAgainForThisMethodActionQuery actionQuery value
4154
05d107aebe74 changed: #unusedVariableWarning:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  1061
        ].
2386
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1062
    ].
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1063
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1064
    action == #abort ifTrue:[
4703
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  1065
        "/ self halt.
2477
8a324269ee7a class based exceptions - abortSignal;
Claus Gittinger <cg@exept.de>
parents: 2471
diff changeset
  1066
        AbortOperationRequest raise.
2386
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1067
        ^ false
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1068
    ].
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1069
    ^ action == #correct
2470
240b6d2d5511 finished remove unused vars;
Claus Gittinger <cg@exept.de>
parents: 2462
diff changeset
  1070
4398
fa39aafcc0f3 changed:
Claus Gittinger <cg@exept.de>
parents: 4395
diff changeset
  1071
    "Modified: / 08-03-2012 / 10:23:58 / cg"
2386
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1072
!
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1073
116
claus
parents: 97
diff changeset
  1074
warning:aString position:relPos to:relEndPos from:aCompiler 
32
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
  1075
    "compiler notifies us of a warning - same behavior as error"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1076
2277
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
  1077
    self error:aString position:relPos to:relEndPos from:aCompiler asWarning:true 
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1078
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1079
3396
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1080
!Workspace methodsFor:'drag & drop'!
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1081
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1082
canDrop:aDropContext
4090
703569e25553 changed:
Claus Gittinger <cg@exept.de>
parents: 4057
diff changeset
  1083
    "if allowValueDrop is true, any text- or file-object can be dropped into workspace
703569e25553 changed:
Claus Gittinger <cg@exept.de>
parents: 4057
diff changeset
  1084
     (printString); otherwise, only ..."
703569e25553 changed:
Claus Gittinger <cg@exept.de>
parents: 4057
diff changeset
  1085
703569e25553 changed:
Claus Gittinger <cg@exept.de>
parents: 4057
diff changeset
  1086
    self isReadOnly ifTrue:[^ false].
3396
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1087
4090
703569e25553 changed:
Claus Gittinger <cg@exept.de>
parents: 4057
diff changeset
  1088
    allowValueDrop ifTrue:[^ true].
703569e25553 changed:
Claus Gittinger <cg@exept.de>
parents: 4057
diff changeset
  1089
    ^ super canDrop:aDropContext
3428
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
  1090
4090
703569e25553 changed:
Claus Gittinger <cg@exept.de>
parents: 4057
diff changeset
  1091
"/    ^ aDropContext dropObjects 
703569e25553 changed:
Claus Gittinger <cg@exept.de>
parents: 4057
diff changeset
  1092
"/        contains:[:someObject| (someObject isTextObject or:[ someObject isFileObject ])].
3396
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1093
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1094
    "Created: / 16-08-2005 / 22:01:13 / janfrog"
3428
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
  1095
    "Modified: / 28-11-2006 / 16:18:51 / cg"
3396
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1096
!
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1097
3414
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1098
doDrop:aDropContext
4631
e1e810a69059 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 4619
diff changeset
  1099
    <resource: #obsolete>
e1e810a69059 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 4619
diff changeset
  1100
    self obsoleteMethodWarning:'should no longer be reached'.
3428
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
  1101
    self drop:aDropContext
3414
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1102
3428
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
  1103
    "Modified: / 28-11-2006 / 16:14:51 / cg"
4386
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1104
    "Modified (format): / 28-02-2012 / 11:20:38 / cg"
3414
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1105
!
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1106
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1107
drop:aDropContext
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1108
    "Any object can be dropped into workspace..."
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1109
3870
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1110
    |textObjects nonTextObjects answer text|
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1111
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1112
    textObjects := aDropContext dropObjects 
3887
dea105b68acd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3876
diff changeset
  1113
                            select:[:dropObject | dropObject isTextObject 
dea105b68acd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3876
diff changeset
  1114
                                                  or:[ dropObject isFileObject ]].
3870
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1115
    nonTextObjects := aDropContext dropObjects 
3887
dea105b68acd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3876
diff changeset
  1116
                            reject:[:dropObject | dropObject isTextObject 
dea105b68acd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3876
diff changeset
  1117
                                                  or:[ dropObject isFileObject ]].
3870
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1118
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1119
    self dropObjects:textObjects.
3414
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1120
3870
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1121
    nonTextObjects notEmpty ifTrue:[
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1122
        answer := Dialog
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1123
                confirmWithCancel:(resources 
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1124
                                        string:'Drop as textual representation or as object reference ?')
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1125
                labels:(resources array:#('Cancel' 'Reference' 'Name' 'Text'))
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1126
                values:#(nil #ref #name #text)
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1127
                default:4.
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1128
        answer isNil ifTrue:[^ self].
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1129
        (answer == #text or:[answer == #name]) ifTrue:[
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1130
            text := String streamContents:[:s |
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1131
                        nonTextObjects do:[:dropObject |
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1132
                            |obj|
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1133
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1134
                            obj := dropObject theObject.
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1135
                            obj isMethod ifTrue:[
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1136
                                s nextPutAll:(answer == #name ifTrue:[obj selector] ifFalse:[obj source]).
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1137
                            ] ifFalse:[
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1138
                                obj isClass ifTrue:[
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1139
                                    s nextPutAll:(answer == #name ifTrue:[obj name] ifFalse:[obj source asString])
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1140
                                ] ifFalse:[
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1141
                                    s nextPutAll:(answer == #name ifTrue:[obj className] ifFalse:[obj printString]) .
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1142
                                ].
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1143
                            ].
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1144
                        ].
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1145
                    ].
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1146
            self paste:text.
3414
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1147
        ] ifFalse:[
3870
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1148
            nonTextObjects do:[:dropObject |
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1149
                name := Dialog 
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1150
                        request:(resources 
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1151
                                    string:'Name of the new Workspace Variable (refers to the dropped %1):'
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1152
                                    with:dropObject theObject class name allBold
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1153
                                 )
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1154
                        initialAnswer:'droppedObject'
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1155
                        okLabel:'Add'
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1156
                        title:'Enter Variable Name'.
3414
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1157
3870
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1158
                name notEmptyOrNil ifTrue:[
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1159
                    Workspace addWorkspaceVariable:name.
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1160
                    (Workspace workspaceVariableAt:name) value:dropObject theObject.
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1161
                    self paste:name.
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1162
                ].
3414
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1163
            ].
3870
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1164
        ]
3414
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1165
    ].
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1166
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1167
    "Created: / 13-10-2006 / 17:34:07 / cg"
3396
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1168
! !
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1169
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1170
!Workspace methodsFor:'editing'!
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1171
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1172
commentFrom:line1 to:line2
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1173
    "convenient function to comment out a block.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1174
     All lines from line1 to line2 get an end-of-line comment
1925
e73fe37177a0 comment
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
  1175
     in the first col 
e73fe37177a0 comment
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
  1176
     (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
  1177
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1178
    |eolComment opening closing|
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1179
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1180
    eolComment := commentStrings at:1.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1181
    eolComment isNil ifTrue:[
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1182
        opening := (commentStrings at:2) at:1.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1183
        closing := (commentStrings at:2) at:2.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1184
        (opening isNil or:[closing isNil]) ifTrue:[^ self].
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1185
    ].
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1186
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1187
    line1 to:line2 do:[:lineNr |
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1188
        |l|
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1189
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1190
        l := self listAt:lineNr.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1191
        l isNil ifTrue:[l := ''].
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1192
        eolComment notNil ifTrue:[
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1193
            l := eolComment , l
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1194
        ] ifFalse:[
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1195
            l := opening , l , closing
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1196
        ].
3403
d8482346fd7d tuned comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3397
diff changeset
  1197
        self replaceLine:lineNr with:l.
d8482346fd7d tuned comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3397
diff changeset
  1198
        widthOfWidestLine notNil ifTrue:[
d8482346fd7d tuned comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3397
diff changeset
  1199
            widthOfWidestLine := widthOfWidestLine max:(self widthOfLineString:l).
d8482346fd7d tuned comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3397
diff changeset
  1200
        ].
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1201
    ].
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1202
    self textChanged.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1203
3403
d8482346fd7d tuned comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3397
diff changeset
  1204
    "Created: / 09-11-1997 / 01:05:35 / cg"
d8482346fd7d tuned comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3397
diff changeset
  1205
    "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
  1206
!
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1207
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1208
commentSelection
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1209
    "convenient function to comment out a block.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1210
     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
  1211
     in the first col."
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1212
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1213
    |e commentPair opening closing|
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1214
1481
a5fb903ee745 moved readOnlyCheck.
Claus Gittinger <cg@exept.de>
parents: 1395
diff changeset
  1215
    (self checkModificationsAllowed) ifFalse:[ ^ self].
3210
75d4c266d873 care for EOL-comments only
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1216
    commentStrings isNil ifTrue:[ self beep. ^ self].
75d4c266d873 care for EOL-comments only
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1217
3207
0088a1d4fb0e without selection, comment/uncomment operate on the single cursor-line
Claus Gittinger <cg@exept.de>
parents: 3157
diff changeset
  1218
    selectionStartLine isNil ifTrue:[ 
0088a1d4fb0e without selection, comment/uncomment operate on the single cursor-line
Claus Gittinger <cg@exept.de>
parents: 3157
diff changeset
  1219
        self 
3785
8d8d84e1b72c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3744
diff changeset
  1220
            undoableDo:[ self commentFrom:cursorLine to:cursorLine ]
3543
113409e8ab8b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  1221
            info:'Comment'.
3207
0088a1d4fb0e without selection, comment/uncomment operate on the single cursor-line
Claus Gittinger <cg@exept.de>
parents: 3157
diff changeset
  1222
        ^ self
0088a1d4fb0e without selection, comment/uncomment operate on the single cursor-line
Claus Gittinger <cg@exept.de>
parents: 3157
diff changeset
  1223
    ].
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1224
3129
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1225
    self 
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1226
        undoableDo:
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1227
            [
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1228
                (selectionStartCol == 1 and:[selectionEndCol == 0]) ifTrue:[
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1229
                    self commentFrom:selectionStartLine to:selectionEndLine-1
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1230
                ] ifFalse:[
3210
75d4c266d873 care for EOL-comments only
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1231
                    commentPair := commentStrings at:2 ifAbsent:nil.
75d4c266d873 care for EOL-comments only
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1232
                    commentPair isNil ifTrue:[
75d4c266d873 care for EOL-comments only
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1233
                        self beep.
75d4c266d873 care for EOL-comments only
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1234
                    ] ifFalse:[
75d4c266d873 care for EOL-comments only
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1235
                        opening := commentPair at:1.
75d4c266d873 care for EOL-comments only
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1236
                        closing := commentPair at:2.
75d4c266d873 care for EOL-comments only
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1237
                        (opening isNil or:[closing isNil]) ifTrue:[^ self].
3129
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1238
3210
75d4c266d873 care for EOL-comments only
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1239
                        e := selectionEndCol.
75d4c266d873 care for EOL-comments only
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1240
75d4c266d873 care for EOL-comments only
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1241
                        self insertString:closing atLine:selectionEndLine col:e+1.
75d4c266d873 care for EOL-comments only
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1242
                        self insertString:opening atLine:selectionStartLine col:selectionStartCol.
3129
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1243
3210
75d4c266d873 care for EOL-comments only
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1244
                        selectionStartLine == selectionEndLine ifTrue:[e := e + opening size].
75d4c266d873 care for EOL-comments only
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1245
                        self selectFromLine:selectionStartLine col:selectionStartCol
75d4c266d873 care for EOL-comments only
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1246
                                     toLine:selectionEndLine col:e+closing size.
75d4c266d873 care for EOL-comments only
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  1247
                    ]
3129
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1248
                ]
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1249
            ]
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1250
        info:'comment'
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1251
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1252
    "Created: / 9.11.1997 / 01:05:40 / cg"
1481
a5fb903ee745 moved readOnlyCheck.
Claus Gittinger <cg@exept.de>
parents: 1395
diff changeset
  1253
    "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
  1254
!
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1255
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1256
uncommentFrom:line1 to:line2
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1257
    "convenient function to comment out a block.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1258
     All lines from line1 to line2 get an end-of-line comment
1925
e73fe37177a0 comment
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
  1259
     in the first col.
e73fe37177a0 comment
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
  1260
     (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
  1261
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1262
    |eolComment opening closing rest|
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1263
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1264
    eolComment := commentStrings at:1.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1265
    eolComment isNil ifTrue:[
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1266
        opening := (commentStrings at:2) at:1.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1267
        closing := (commentStrings at:2) at:2.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1268
        (opening isNil or:[closing isNil]) ifTrue:[^ self].
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1269
    ] ifFalse:[
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1270
        rest := eolComment size + 1.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1271
    ].
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1272
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1273
    line1 to:line2 do:[:lineNr |
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1274
        |l|
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1275
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1276
        l := self listAt:lineNr.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1277
        l notNil ifTrue:[
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1278
            eolComment notNil ifTrue:[
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1279
                (l startsWith:eolComment) ifTrue:[
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1280
                    l := l copyFrom:rest
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1281
                ]
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1282
            ] ifFalse:[
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1283
                ((l startsWith:opening)
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1284
                and:[l endsWith:closing]) ifTrue:[
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1285
                    l := l copyFrom:opening size + 1.
4568
cf9f6fd6d174 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4542
diff changeset
  1286
                    l := l copyButLast:closing size.
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1287
                ]
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1288
            ].
3403
d8482346fd7d tuned comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3397
diff changeset
  1289
            self replaceLine:lineNr with:l.
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1290
        ]
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1291
    ].
3403
d8482346fd7d tuned comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3397
diff changeset
  1292
    widthOfWidestLine := nil.
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1293
    self textChanged.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1294
3403
d8482346fd7d tuned comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3397
diff changeset
  1295
    "Created: / 09-11-1997 / 01:05:43 / cg"
d8482346fd7d tuned comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3397
diff changeset
  1296
    "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
  1297
!
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1298
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1299
uncommentSelection
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1300
    "convenient function to comment out a block.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1301
     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
  1302
     in the first col."
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1303
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1304
    |e commentPair opening closing sz1 sz2|
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1305
3129
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1306
    (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
  1307
    selectionStartLine isNil ifTrue:[ 
0088a1d4fb0e without selection, comment/uncomment operate on the single cursor-line
Claus Gittinger <cg@exept.de>
parents: 3157
diff changeset
  1308
        self 
0088a1d4fb0e without selection, comment/uncomment operate on the single cursor-line
Claus Gittinger <cg@exept.de>
parents: 3157
diff changeset
  1309
            undoableDo:[
0088a1d4fb0e without selection, comment/uncomment operate on the single cursor-line
Claus Gittinger <cg@exept.de>
parents: 3157
diff changeset
  1310
                self uncommentFrom:cursorLine to:cursorLine
3543
113409e8ab8b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  1311
            ]
113409e8ab8b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  1312
            info:'Uncomment'.
3207
0088a1d4fb0e without selection, comment/uncomment operate on the single cursor-line
Claus Gittinger <cg@exept.de>
parents: 3157
diff changeset
  1313
        ^ self
0088a1d4fb0e without selection, comment/uncomment operate on the single cursor-line
Claus Gittinger <cg@exept.de>
parents: 3157
diff changeset
  1314
    ].
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1315
3129
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1316
    self 
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1317
        undoableDo:
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1318
            [
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1319
                (selectionStartCol == 1 and:[selectionEndCol == 0]) ifTrue:[
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1320
                    self uncommentFrom:selectionStartLine to:selectionEndLine-1
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1321
                ] ifFalse:[
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1322
                    commentPair := commentStrings at:2.
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1323
                    opening := commentPair at:1.
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1324
                    closing := commentPair at:2.
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1325
                    (opening isNil or:[closing isNil]) ifTrue:[^ self].
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1326
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1327
                    sz1 := opening size.
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1328
                    sz2 := closing size.
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1329
3129
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1330
                    ((self 
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1331
                        stringAtLine:selectionStartLine 
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1332
                        from:selectionStartCol
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1333
                        to:selectionStartCol+sz1 - 1) = opening
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1334
                    and:[(self 
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1335
                        stringAtLine:selectionEndLine 
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1336
                        from:selectionEndCol - sz2 + 1
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1337
                        to:selectionEndCol) = closing ]) ifTrue:[
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1338
3129
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1339
                        self deleteCharsAtLine:selectionEndLine fromCol:selectionEndCol-sz2+1 toCol:selectionEndCol.
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1340
                        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
  1341
3129
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1342
                        e := selectionEndCol - sz2.
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1343
                        selectionStartLine == selectionEndLine ifTrue:[e := e - sz1].
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1344
                        self selectFromLine:selectionStartLine col:selectionStartCol
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1345
                                     toLine:selectionEndLine col:e.
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1346
                    ]
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1347
                ]
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1348
            ]
3129
c42ad1ea2e9c undoable comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1349
        info:'uncomment'
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1350
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1351
    "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
  1352
    "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
  1353
! !
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1354
3968
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  1355
!Workspace methodsFor:'event handling'!
3712
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
  1356
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1357
keyPress:key x:x y:y
4587
aa0010521297 code move
Claus Gittinger <cg@exept.de>
parents: 4584
diff changeset
  1358
    <resource: #keyboard (#DoIt #InspectIt #PrintIt #ReplaceIt 
aa0010521297 code move
Claus Gittinger <cg@exept.de>
parents: 4584
diff changeset
  1359
                          #BrowseIt #ImplementorsOfIt #ExpandAbbreviation
aa0010521297 code move
Claus Gittinger <cg@exept.de>
parents: 4584
diff changeset
  1360
                          #CommentSelection #UncommentSelection)>
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
  1361
3800
380b2ee3b02b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
  1362
    (key == #DoIt)      ifTrue:[self doIt. ^ self].
380b2ee3b02b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
  1363
    (key == #InspectIt) ifTrue:[self inspectIt. ^ self].
380b2ee3b02b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
  1364
    (key == #PrintIt)   ifTrue:[self printIt. ^ self].
380b2ee3b02b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
  1365
    (key == #ReplaceIt) ifTrue:[self replaceIt. ^ self].
380b2ee3b02b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
  1366
    (key == #BrowseIt)  ifTrue:[self browseIt. ^ self].
380b2ee3b02b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
  1367
    (key == #ImplementorsOfIt)   ifTrue:[self browseImplementorsOfIt. ^ self].
380b2ee3b02b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
  1368
    (key == #ExpandAbbreviation) ifTrue:[self expandAbbreviation. ^ self].
4587
aa0010521297 code move
Claus Gittinger <cg@exept.de>
parents: 4584
diff changeset
  1369
    (key == #CommentSelection)    ifTrue:[self commentSelection. ^ self].
aa0010521297 code move
Claus Gittinger <cg@exept.de>
parents: 4584
diff changeset
  1370
    (key == #UncommentSelection)  ifTrue:[self uncommentSelection. ^ self].
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
  1371
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1372
    super keyPress:key x:x y:y
3511
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1373
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1374
    "Modified: / 08-11-2007 / 11:29:45 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1375
! !
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1376
2143
ae0c3ae5de15 category rename
Claus Gittinger <cg@exept.de>
parents: 2104
diff changeset
  1377
!Workspace methodsFor:'executing'!
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1378
1501
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1379
do:code withValueDo:aBlock
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1380
    "helper for doIt, printIt and inspectIt. 
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1381
     Evaluate the selection and, if all went well, evaluate the argument, 
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1382
     aBlock with the value.
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1383
     Most work is in preparing for proper cleanup in case of abort
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1384
     or other exception while the evaluation is performed.
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1385
     (restore cursor, selectionColors etc.)"
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1386
4149
105b82a1365d changed:
Stefan Vogel <sv@exept.de>
parents: 4148
diff changeset
  1387
    |selLine selCol endLine endCol cLine cCol cleanUp executeBlock|
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1388
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1389
    code notNil ifTrue:[
2409
489866f85d58 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2408
diff changeset
  1390
        code asString withoutSeparators isEmpty ifTrue:[ ^ self ].
2408
73edbd1475ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  1391
257
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1392
        codeStartPosition := self characterPositionOfSelection.
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1393
257
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1394
        "
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1395
         remember selection for later - if there is an error,
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1396
         the notification method will highlight it.
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1397
         thus destroying the current selection
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1398
        "
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1399
        selLine := selectionStartLine.
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1400
        selCol := selectionStartCol.
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1401
        endLine := selectionEndLine.
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1402
        endCol := selectionEndCol.
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1403
        cCol := cursorCol.
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1404
        cLine := cursorLine.
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1405
257
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1406
        "
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1407
         cleanup: restore previous selection and cursor positions
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1408
        "
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1409
        cleanUp := [
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1410
                self selectFromLine:selLine col:selCol toLine:endLine col:endCol.
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1411
                cLine notNil ifTrue:[
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1412
                    self cursorLine:cLine col:cCol
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1413
                ].
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1414
        ].
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1415
257
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1416
        "
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1417
         perform the action.
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1418
         Be careful to release the reference to the value;
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1419
         otherwise, we could keep lots of garbage from being freed
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1420
         until the view gets closed
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1421
        "
4149
105b82a1365d changed:
Stefan Vogel <sv@exept.de>
parents: 4148
diff changeset
  1422
        executeBlock := [
105b82a1365d changed:
Stefan Vogel <sv@exept.de>
parents: 4148
diff changeset
  1423
                [
105b82a1365d changed:
Stefan Vogel <sv@exept.de>
parents: 4148
diff changeset
  1424
                    AbortOperationRequest handle:[:ex |
105b82a1365d changed:
Stefan Vogel <sv@exept.de>
parents: 4148
diff changeset
  1425
                         "/ aBlock value:'** Abortsignal cought **'.
105b82a1365d changed:
Stefan Vogel <sv@exept.de>
parents: 4148
diff changeset
  1426
                         ex return
105b82a1365d changed:
Stefan Vogel <sv@exept.de>
parents: 4148
diff changeset
  1427
                    ] do:[
105b82a1365d changed:
Stefan Vogel <sv@exept.de>
parents: 4148
diff changeset
  1428
                        |value|
929
22265f1bb110 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1429
4149
105b82a1365d changed:
Stefan Vogel <sv@exept.de>
parents: 4148
diff changeset
  1430
                        doItAction notNil ifTrue:[
105b82a1365d changed:
Stefan Vogel <sv@exept.de>
parents: 4148
diff changeset
  1431
                            value := doItAction value:(code asString).
105b82a1365d changed:
Stefan Vogel <sv@exept.de>
parents: 4148
diff changeset
  1432
                            cleanUp value. cleanUp := nil.
105b82a1365d changed:
Stefan Vogel <sv@exept.de>
parents: 4148
diff changeset
  1433
                            aBlock notNil ifTrue:[
105b82a1365d changed:
Stefan Vogel <sv@exept.de>
parents: 4148
diff changeset
  1434
                                aBlock value:value.
105b82a1365d changed:
Stefan Vogel <sv@exept.de>
parents: 4148
diff changeset
  1435
                            ].
105b82a1365d changed:
Stefan Vogel <sv@exept.de>
parents: 4148
diff changeset
  1436
                            value := nil.
105b82a1365d changed:
Stefan Vogel <sv@exept.de>
parents: 4148
diff changeset
  1437
                            self class rememberDoIt:code.
105b82a1365d changed:
Stefan Vogel <sv@exept.de>
parents: 4148
diff changeset
  1438
                        ]
257
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1439
                    ]
4149
105b82a1365d changed:
Stefan Vogel <sv@exept.de>
parents: 4148
diff changeset
  1440
                ] ensure:[
105b82a1365d changed:
Stefan Vogel <sv@exept.de>
parents: 4148
diff changeset
  1441
                    cleanUp notNil ifTrue:[
105b82a1365d changed:
Stefan Vogel <sv@exept.de>
parents: 4148
diff changeset
  1442
                        cleanUp value. cleanUp := nil
105b82a1365d changed:
Stefan Vogel <sv@exept.de>
parents: 4148
diff changeset
  1443
                    ].
257
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1444
                ]
4149
105b82a1365d changed:
Stefan Vogel <sv@exept.de>
parents: 4148
diff changeset
  1445
            ].
105b82a1365d changed:
Stefan Vogel <sv@exept.de>
parents: 4148
diff changeset
  1446
        aBlock isNil ifTrue:[
105b82a1365d changed:
Stefan Vogel <sv@exept.de>
parents: 4148
diff changeset
  1447
            "no action is performed with the result - give the user a visible
105b82a1365d changed:
Stefan Vogel <sv@exept.de>
parents: 4148
diff changeset
  1448
             feedback, that something has been done"
105b82a1365d changed:
Stefan Vogel <sv@exept.de>
parents: 4148
diff changeset
  1449
            self topView withVisibleCursor:Cursor execute do:executeBlock.
105b82a1365d changed:
Stefan Vogel <sv@exept.de>
parents: 4148
diff changeset
  1450
        ] ifFalse:[
105b82a1365d changed:
Stefan Vogel <sv@exept.de>
parents: 4148
diff changeset
  1451
            self topView withCursor:Cursor execute do:executeBlock.
257
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1452
        ].
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1453
    ]
257
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1454
1501
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1455
    "Modified: / 22.4.1998 / 21:56:13 / ca"
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1456
    "Created: / 22.4.1998 / 21:57:05 / ca"
2409
489866f85d58 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2408
diff changeset
  1457
    "Modified: / 26.9.2001 / 17:32:59 / cg"
4677
67285ce170f9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  1458
!
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1459
2733
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1460
executeDoIt:theCode
4391
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
  1461
    "the core of doIt, printIt, inspectIt, browseIt actions"
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
  1462
4618
d3554659540b Fix for RegressionTests::Compiler2Tests>>test_03
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4617
diff changeset
  1463
    | result compiler |
4404
56ea0037fd42 #executeDoIt: changed to reflect value of autoDefineVariables
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4402
diff changeset
  1464
56ea0037fd42 #executeDoIt: changed to reflect value of autoDefineVariables
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4402
diff changeset
  1465
    "JV@2012-03-19: Changed to reflect value of autoDefineVariables"
56ea0037fd42 #executeDoIt: changed to reflect value of autoDefineVariables
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4402
diff changeset
  1466
    [
4618
d3554659540b Fix for RegressionTests::Compiler2Tests>>test_03
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4617
diff changeset
  1467
        result := ( compiler := (self compilerClass ? Compiler) new ) 
4438
c1ccf198ce65 withWriteCursorDo
Claus Gittinger <cg@exept.de>
parents: 4436
diff changeset
  1468
                currentNameSpace:namespaceForDoits;
4404
56ea0037fd42 #executeDoIt: changed to reflect value of autoDefineVariables
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4402
diff changeset
  1469
                moreSharedPools:poolsConsideredInDoIts;
56ea0037fd42 #executeDoIt: changed to reflect value of autoDefineVariables
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4402
diff changeset
  1470
                evaluate:theCode 
56ea0037fd42 #executeDoIt: changed to reflect value of autoDefineVariables
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4402
diff changeset
  1471
                in:nil 
56ea0037fd42 #executeDoIt: changed to reflect value of autoDefineVariables
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4402
diff changeset
  1472
                receiver:simulatedSelf 
56ea0037fd42 #executeDoIt: changed to reflect value of autoDefineVariables
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4402
diff changeset
  1473
                notifying:self 
56ea0037fd42 #executeDoIt: changed to reflect value of autoDefineVariables
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4402
diff changeset
  1474
                logged:true 
56ea0037fd42 #executeDoIt: changed to reflect value of autoDefineVariables
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4402
diff changeset
  1475
                ifFail:nil
56ea0037fd42 #executeDoIt: changed to reflect value of autoDefineVariables
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4402
diff changeset
  1476
    ] on: Parser undefinedVariableNotification do:[:ex|
4618
d3554659540b Fix for RegressionTests::Compiler2Tests>>test_03
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4617
diff changeset
  1477
        (ex parser == compiler and:[autoDefineVariables notNil]) ifTrue:[
4404
56ea0037fd42 #executeDoIt: changed to reflect value of autoDefineVariables
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4402
diff changeset
  1478
            ex proceedWith: #declare
56ea0037fd42 #executeDoIt: changed to reflect value of autoDefineVariables
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4402
diff changeset
  1479
        ] ifFalse:[
56ea0037fd42 #executeDoIt: changed to reflect value of autoDefineVariables
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4402
diff changeset
  1480
            ex proceedWith: nil
56ea0037fd42 #executeDoIt: changed to reflect value of autoDefineVariables
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4402
diff changeset
  1481
        ].
56ea0037fd42 #executeDoIt: changed to reflect value of autoDefineVariables
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4402
diff changeset
  1482
    ] on: Parser askForVariableTypeOfUndeclaredQuery do:[:ex|
56ea0037fd42 #executeDoIt: changed to reflect value of autoDefineVariables
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4402
diff changeset
  1483
        autoDefineVariables == #workspace ifTrue:[
56ea0037fd42 #executeDoIt: changed to reflect value of autoDefineVariables
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4402
diff changeset
  1484
            ex proceedWith:#WorkspaceVariable
56ea0037fd42 #executeDoIt: changed to reflect value of autoDefineVariables
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4402
diff changeset
  1485
        ].
56ea0037fd42 #executeDoIt: changed to reflect value of autoDefineVariables
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4402
diff changeset
  1486
        autoDefineVariables == #doIt ifTrue:[
56ea0037fd42 #executeDoIt: changed to reflect value of autoDefineVariables
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4402
diff changeset
  1487
            ex proceedWith:#DoItTemporary
56ea0037fd42 #executeDoIt: changed to reflect value of autoDefineVariables
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4402
diff changeset
  1488
        ].
56ea0037fd42 #executeDoIt: changed to reflect value of autoDefineVariables
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4402
diff changeset
  1489
        ex pass.
56ea0037fd42 #executeDoIt: changed to reflect value of autoDefineVariables
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4402
diff changeset
  1490
    ].
56ea0037fd42 #executeDoIt: changed to reflect value of autoDefineVariables
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4402
diff changeset
  1491
    ^result
4391
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
  1492
4438
c1ccf198ce65 withWriteCursorDo
Claus Gittinger <cg@exept.de>
parents: 4436
diff changeset
  1493
    "Modified: / 27-07-2012 / 09:33:39 / cg"
4618
d3554659540b Fix for RegressionTests::Compiler2Tests>>test_03
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4617
diff changeset
  1494
    "Modified: / 24-06-2013 / 15:31:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
4677
67285ce170f9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  1495
! !
67285ce170f9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  1496
67285ce170f9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  1497
!Workspace methodsFor:'initialization & release'!
2733
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1498
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1499
initStyle
966
824e0ecc0e6f comments
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
  1500
    "setup viewStyle specifics"
824e0ecc0e6f comments
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
  1501
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1502
    super initStyle.
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1503
2492
740174c1be0f allow separate bg-color from styleSheet
Claus Gittinger <cg@exept.de>
parents: 2489
diff changeset
  1504
    DefaultViewBackground notNil ifTrue:[
740174c1be0f allow separate bg-color from styleSheet
Claus Gittinger <cg@exept.de>
parents: 2489
diff changeset
  1505
        viewBackground := DefaultViewBackground.
740174c1be0f allow separate bg-color from styleSheet
Claus Gittinger <cg@exept.de>
parents: 2489
diff changeset
  1506
        self backgroundColor:viewBackground.
740174c1be0f allow separate bg-color from styleSheet
Claus Gittinger <cg@exept.de>
parents: 2489
diff changeset
  1507
    ].
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1508
!
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1509
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1510
initialize
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1511
    super initialize.
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1512
4593
4877adcdf805 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4588
diff changeset
  1513
    autoIndent := UserPreferences current autoIndentInCodeView.
2775
6adda7eef10a cursorMovement default
penk
parents: 2754
diff changeset
  1514
    scrollWhenUpdating := #beginOfText.
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1515
    showMatchingParenthesis := true.
3428
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
  1516
    allowValueDrop := true.
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
  1517
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1518
    commentStrings := #(
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1519
                        '"/'
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1520
                        ('"' '"')
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1521
                       ).
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1522
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1523
    self initializeDoITAction.
3396
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1524
    self initializeDragAndDrop.
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1525
3428
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
  1526
    "Modified: / 28-11-2006 / 16:11:55 / cg"
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1527
!
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1528
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1529
initializeDoITAction
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1530
    "set up the block to be evaluated for doIts.
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1531
     This is done here in a separate method to allow easier
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1532
     redefinition in subclasses"
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1533
2733
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1534
    doItAction := [:theCode | self executeDoIt:theCode].
3396
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1535
!
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1536
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1537
initializeDragAndDrop
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1538
    |target|
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1539
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1540
    target := DropTarget 
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1541
                    receiver:self
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1542
                    argument:nil
3411
693b4489cd84 drag & drop code cleanup
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  1543
                    dropSelector:#drop:
3396
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1544
                    canDropSelector:#canDrop:.
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1545
    self dropTarget:target
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1546
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1547
    "Created: / 16-08-2005 / 22:03:36 / janfrog"
3411
693b4489cd84 drag & drop code cleanup
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  1548
    "Modified: / 13-10-2006 / 12:37:18 / cg"
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1549
! !
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1550
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1551
!Workspace methodsFor:'menu & menu actions'!
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1552
2285
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1553
browseClass
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1554
    "user selected 'browseClass' from menu; evaluate the code
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1555
     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
  1556
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1557
    ^ self 
3272
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
  1558
        do:(self selectionAsString) 
3910
a9536a430be0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3898
diff changeset
  1559
        withValueDo:[:result | 
a9536a430be0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3898
diff changeset
  1560
            result isBehavior ifTrue:[
a9536a430be0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3898
diff changeset
  1561
                result browserClass openInClass:result selector:nil
a9536a430be0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3898
diff changeset
  1562
            ] ifFalse:[
a9536a430be0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3898
diff changeset
  1563
                self warn:'Selection does not evaluate to a class'
a9536a430be0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3898
diff changeset
  1564
            ]
a9536a430be0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3898
diff changeset
  1565
        ].
2285
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1566
2410
c7a829465c03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2409
diff changeset
  1567
    "Modified: / 26.9.2001 / 17:37:35 / cg"
2285
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1568
!
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1569
2451
ae246b6c4df7 added browse implementors menu item
Claus Gittinger <cg@exept.de>
parents: 2440
diff changeset
  1570
browseImplementorsOfIt
4617
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1571
    "open a browser on the implementors of the selected text,
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1572
     or - if I support syntax elements, on the syntax element at the cursor position"
2451
ae246b6c4df7 added browse implementors menu item
Claus Gittinger <cg@exept.de>
parents: 2440
diff changeset
  1573
3895
77476b56175b browse-implementors also for javaScript
Claus Gittinger <cg@exept.de>
parents: 3887
diff changeset
  1574
    |selectedText selector browserClass na|
2457
0c1beddda9cb disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
  1575
4617
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1576
    selectedText := self selectedTextOrSyntaxElement.
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1577
    selectedText notEmptyOrNil ifTrue:[
2457
0c1beddda9cb disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
  1578
        self windowGroup withWaitCursorDo:[
3895
77476b56175b browse-implementors also for javaScript
Claus Gittinger <cg@exept.de>
parents: 3887
diff changeset
  1579
            "/ hack, for now and expecco; must ask the Parser eventually...
77476b56175b browse-implementors also for javaScript
Claus Gittinger <cg@exept.de>
parents: 3887
diff changeset
  1580
            (compilerClass notNil and:[compilerClass includesBehavior:JavaScriptParser]) ifTrue:[
77476b56175b browse-implementors also for javaScript
Claus Gittinger <cg@exept.de>
parents: 3887
diff changeset
  1581
                "/ selector is in one piece anyway
77476b56175b browse-implementors also for javaScript
Claus Gittinger <cg@exept.de>
parents: 3887
diff changeset
  1582
                (selectedText includes:$_) ifFalse:[
3896
ddab6266736f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3895
diff changeset
  1583
                    "/ zero or one args - sigh (need to parse more to figure this out)
3895
77476b56175b browse-implementors also for javaScript
Claus Gittinger <cg@exept.de>
parents: 3887
diff changeset
  1584
                    selector := JavaScriptParser basicNew translatedSmalltalkSelectorFor:selectedText numArgs:1.
77476b56175b browse-implementors also for javaScript
Claus Gittinger <cg@exept.de>
parents: 3887
diff changeset
  1585
                    selectedText := JavaScriptParser basicNew translatedSmalltalkSelectorFor:selectedText numArgs:0.
77476b56175b browse-implementors also for javaScript
Claus Gittinger <cg@exept.de>
parents: 3887
diff changeset
  1586
                ] ifTrue:[
77476b56175b browse-implementors also for javaScript
Claus Gittinger <cg@exept.de>
parents: 3887
diff changeset
  1587
                    "/ count _#s plus one arg - sigh
77476b56175b browse-implementors also for javaScript
Claus Gittinger <cg@exept.de>
parents: 3887
diff changeset
  1588
                    na := (selectedText occurrencesOf:$_) + 1. 
77476b56175b browse-implementors also for javaScript
Claus Gittinger <cg@exept.de>
parents: 3887
diff changeset
  1589
                    selector := JavaScriptParser basicNew translatedSmalltalkSelectorFor:selectedText numArgs:na
77476b56175b browse-implementors also for javaScript
Claus Gittinger <cg@exept.de>
parents: 3887
diff changeset
  1590
                ].
77476b56175b browse-implementors also for javaScript
Claus Gittinger <cg@exept.de>
parents: 3887
diff changeset
  1591
            ] ifFalse:[
77476b56175b browse-implementors also for javaScript
Claus Gittinger <cg@exept.de>
parents: 3887
diff changeset
  1592
                selector := SystemBrowser extractSelectorFrom:selectedText.
77476b56175b browse-implementors also for javaScript
Claus Gittinger <cg@exept.de>
parents: 3887
diff changeset
  1593
            ].
4619
bb6fc65fce18 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4618
diff changeset
  1594
            browserClass := UserPreferences systemBrowserClass.
2714
7756ee36bb16 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1595
3287
8b2f0dc64f3d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3286
diff changeset
  1596
            (selector notNil and:[selector ~= selectedText]) ifTrue:[
3579
3923810267b6 better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents: 3543
diff changeset
  1597
                (SystemBrowser 
3923810267b6 better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents: 3543
diff changeset
  1598
                        findImplementorsOfAny:(Array with:selectedText) 
3923810267b6 better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents: 3543
diff changeset
  1599
                        in:(Smalltalk allClasses) 
3923810267b6 better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents: 3543
diff changeset
  1600
                        ignoreCase:false) isEmpty ifTrue:[
3923810267b6 better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents: 3543
diff changeset
  1601
                    browserClass browseImplementorsOf:selector
3923810267b6 better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents: 3543
diff changeset
  1602
                ] ifFalse:[
3923810267b6 better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents: 3543
diff changeset
  1603
                    browserClass browseImplementorsOfAny:(Set with:selector with:selectedText)
3923810267b6 better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents: 3543
diff changeset
  1604
                ].
2534
55df9165ddd7 findImplementorsOfAny if in doubt
Claus Gittinger <cg@exept.de>
parents: 2519
diff changeset
  1605
            ] ifFalse:[
2714
7756ee36bb16 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1606
                browserClass browseImplementorsOf:(selector ? selectedText)
2534
55df9165ddd7 findImplementorsOfAny if in doubt
Claus Gittinger <cg@exept.de>
parents: 2519
diff changeset
  1607
            ]
2457
0c1beddda9cb disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
  1608
        ]
0c1beddda9cb disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
  1609
    ].
2451
ae246b6c4df7 added browse implementors menu item
Claus Gittinger <cg@exept.de>
parents: 2440
diff changeset
  1610
ae246b6c4df7 added browse implementors menu item
Claus Gittinger <cg@exept.de>
parents: 2440
diff changeset
  1611
    "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
  1612
    "Modified: / 19.11.2001 / 22:15:17 / cg"
2451
ae246b6c4df7 added browse implementors menu item
Claus Gittinger <cg@exept.de>
parents: 2440
diff changeset
  1613
!
ae246b6c4df7 added browse implementors menu item
Claus Gittinger <cg@exept.de>
parents: 2440
diff changeset
  1614
2307
dde2b8397b88 added #BrowseIt shortKey
Claus Gittinger <cg@exept.de>
parents: 2303
diff changeset
  1615
browseIt
dde2b8397b88 added #BrowseIt shortKey
Claus Gittinger <cg@exept.de>
parents: 2303
diff changeset
  1616
    "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
  1617
     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
  1618
07d3292d2965 in browseIt:
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  1619
     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
  1620
4617
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1621
    |codeToEvaluate el idx selector evaluatedValue classToBrowse gotResult|
2713
07d3292d2965 in browseIt:
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  1622
4617
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1623
    (self selection isEmptyOrNil 
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1624
        and:[ self supportsSyntaxElements 
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1625
        and:[ (el := self syntaxElementForVariableUnderCursor) notNil ]])
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1626
    ifTrue:[ 
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1627
        codeToEvaluate := el name
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1628
    ] ifFalse:[
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1629
        codeToEvaluate := (self selectionOrTextOfCursorLine ? '') withoutSeparators.
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1630
    ].
2713
07d3292d2965 in browseIt:
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  1631
    idx := codeToEvaluate indexOfSubCollection:'>>'.
07d3292d2965 in browseIt:
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  1632
    idx ~~ 0 ifTrue:[
2717
Claus Gittinger <cg@exept.de>
parents: 2715
diff changeset
  1633
        selector := (codeToEvaluate copyFrom:idx+2) withoutSeparators string.
3155
15d43d2ea850 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
  1634
        (selector startsWith:'#') ifTrue:[
15d43d2ea850 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
  1635
            selector := Symbol readFrom:selector.
15d43d2ea850 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
  1636
        ].
2713
07d3292d2965 in browseIt:
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  1637
        codeToEvaluate := codeToEvaluate copyTo:idx-1.   
07d3292d2965 in browseIt:
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  1638
    ].
2307
dde2b8397b88 added #BrowseIt shortKey
Claus Gittinger <cg@exept.de>
parents: 2303
diff changeset
  1639
3910
a9536a430be0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3898
diff changeset
  1640
    Parser parseErrorSignal handle:[:ex |
a9536a430be0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3898
diff changeset
  1641
        |className|
2410
c7a829465c03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2409
diff changeset
  1642
3910
a9536a430be0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3898
diff changeset
  1643
        "/ fallback, if garbage is selected, look for matching classes.
a9536a430be0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3898
diff changeset
  1644
        className := SystemBrowser
a9536a430be0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3898
diff changeset
  1645
            askForClassNameMatching:codeToEvaluate 
a9536a430be0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3898
diff changeset
  1646
            inEnvironment:nil 
a9536a430be0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3898
diff changeset
  1647
            for:nil.
4386
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1648
3910
a9536a430be0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3898
diff changeset
  1649
        className isNil ifTrue:[^ self].
4057
314415319f37 fixed: #browseIt when selected name was not a valid class name
Claus Gittinger <cg@exept.de>
parents: 3968
diff changeset
  1650
        classToBrowse := Smalltalk classNamed:className.
3910
a9536a430be0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3898
diff changeset
  1651
    ] do:[
4386
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1652
        gotResult := false.
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1653
3910
a9536a430be0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3898
diff changeset
  1654
        self 
a9536a430be0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3898
diff changeset
  1655
            do:codeToEvaluate 
4386
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1656
            withValueDo:[:result | evaluatedValue := result. gotResult := true.].
4057
314415319f37 fixed: #browseIt when selected name was not a valid class name
Claus Gittinger <cg@exept.de>
parents: 3968
diff changeset
  1657
4386
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1658
        gotResult ifFalse:[^ self].
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1659
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1660
        evaluatedValue isNil ifTrue:[                       
4057
314415319f37 fixed: #browseIt when selected name was not a valid class name
Claus Gittinger <cg@exept.de>
parents: 3968
diff changeset
  1661
            codeToEvaluate asCollectionOfWords size == 1 ifTrue:[
314415319f37 fixed: #browseIt when selected name was not a valid class name
Claus Gittinger <cg@exept.de>
parents: 3968
diff changeset
  1662
                codeToEvaluate isUppercaseFirst ifTrue:[
314415319f37 fixed: #browseIt when selected name was not a valid class name
Claus Gittinger <cg@exept.de>
parents: 3968
diff changeset
  1663
                    Dialog information:(codeToEvaluate allBold , ' is unbound or nil').
314415319f37 fixed: #browseIt when selected name was not a valid class name
Claus Gittinger <cg@exept.de>
parents: 3968
diff changeset
  1664
                    ^ self.
314415319f37 fixed: #browseIt when selected name was not a valid class name
Claus Gittinger <cg@exept.de>
parents: 3968
diff changeset
  1665
                ].
314415319f37 fixed: #browseIt when selected name was not a valid class name
Claus Gittinger <cg@exept.de>
parents: 3968
diff changeset
  1666
            ]
314415319f37 fixed: #browseIt when selected name was not a valid class name
Claus Gittinger <cg@exept.de>
parents: 3968
diff changeset
  1667
        ].
314415319f37 fixed: #browseIt when selected name was not a valid class name
Claus Gittinger <cg@exept.de>
parents: 3968
diff changeset
  1668
        classToBrowse := evaluatedValue isBehavior 
314415319f37 fixed: #browseIt when selected name was not a valid class name
Claus Gittinger <cg@exept.de>
parents: 3968
diff changeset
  1669
                        ifTrue:[ evaluatedValue ] 
314415319f37 fixed: #browseIt when selected name was not a valid class name
Claus Gittinger <cg@exept.de>
parents: 3968
diff changeset
  1670
                        ifFalse:[ evaluatedValue class ].
3910
a9536a430be0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3898
diff changeset
  1671
    ].
a9536a430be0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3898
diff changeset
  1672
a9536a430be0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3898
diff changeset
  1673
    classToBrowse browserClass openInClass:classToBrowse selector:selector
4386
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1674
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1675
    "Modified: / 28-02-2012 / 11:23:06 / cg"
2307
dde2b8397b88 added #BrowseIt shortKey
Claus Gittinger <cg@exept.de>
parents: 2303
diff changeset
  1676
!
dde2b8397b88 added #BrowseIt shortKey
Claus Gittinger <cg@exept.de>
parents: 2303
diff changeset
  1677
2285
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1678
browseItsClass
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1679
    "user selected 'browseItsClass' from menu; evaluate the code
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1680
     and open a browser on the results class"
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1681
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1682
    ^ self 
3272
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
  1683
        do:(self selectionAsString) 
2410
c7a829465c03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2409
diff changeset
  1684
        withValueDo:[:result | 
c7a829465c03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2409
diff changeset
  1685
                        result class browserClass openInClass:result class selector:nil
c7a829465c03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2409
diff changeset
  1686
                    ]
2285
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1687
2410
c7a829465c03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2409
diff changeset
  1688
    "Modified: / 26.9.2001 / 17:38:06 / cg"
2285
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1689
!
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1690
2454
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
  1691
browseReferencesToIt
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
  1692
    "open a browser on all references to the selected global"
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
  1693
4675
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
  1694
    |nameOfGlobal|
2457
0c1beddda9cb disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
  1695
4675
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
  1696
    nameOfGlobal := self selectedTextOrSyntaxElement.
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
  1697
    nameOfGlobal notEmptyOrNil ifTrue:[
2457
0c1beddda9cb disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
  1698
        self windowGroup withWaitCursorDo:[
4675
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
  1699
            |cls privateClass|
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
  1700
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
  1701
            ((cls := self editedClass) notNil
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
  1702
            and:[ (cls theNonMetaclass allClassVarNames includes:nameOfGlobal) ]) ifTrue:[
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
  1703
                (UserPreferences systemBrowserClass)
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
  1704
                    browseRefsTo:nameOfGlobal 
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
  1705
                    classVars:true 
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
  1706
                    in:(cls whichClassDefinesClassVar:nameOfGlobal) withAllSubclasses 
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
  1707
                    modificationsOnly:false.
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
  1708
            ] ifFalse:[
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
  1709
                (cls notNil
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
  1710
                and:[ (privateClass := cls theNonMetaclass privateClassNamed:nameOfGlobal) notNil ]) ifTrue:[
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
  1711
                    (UserPreferences systemBrowserClass)
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
  1712
                        browseReferendsOf:(privateClass name)
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
  1713
                ] ifFalse:[
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
  1714
                    (UserPreferences systemBrowserClass) browseReferendsOf:nameOfGlobal
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
  1715
                ]
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
  1716
            ]
2457
0c1beddda9cb disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
  1717
        ].
2454
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
  1718
    ].
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
  1719
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
  1720
    "Created: / 5.11.2001 / 17:32:23 / cg"
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
  1721
    "Modified: / 5.11.2001 / 17:32:38 / cg"
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
  1722
!
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
  1723
2462
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  1724
browseSendersOfIt
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  1725
    "open a browser on the senders of the selected text"
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  1726
2715
b6802cd279d0 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
  1727
    |selectedText selector|
2462
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  1728
4617
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1729
    selectedText := self selectedTextOrSyntaxElement.
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1730
    selectedText notEmptyOrNil ifTrue:[
2462
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  1731
        self windowGroup withWaitCursorDo:[
3287
8b2f0dc64f3d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3286
diff changeset
  1732
            selector := SystemBrowser extractSelectorFrom:selectedText.
4619
bb6fc65fce18 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4618
diff changeset
  1733
            (UserPreferences systemBrowserClass)
2715
b6802cd279d0 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
  1734
                browseAllCallsOn:(selector ? selectedText)
2462
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  1735
        ]
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  1736
    ].
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  1737
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  1738
    "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
  1739
    "Modified: / 19.11.2001 / 22:15:27 / cg"
2462
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  1740
!
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  1741
4209
c8e3967e8623 added: #browseSharedPoolOfIt
Claus Gittinger <cg@exept.de>
parents: 4188
diff changeset
  1742
browseSharedPoolOfIt
c8e3967e8623 added: #browseSharedPoolOfIt
Claus Gittinger <cg@exept.de>
parents: 4188
diff changeset
  1743
    "open a browser on the shared pool in which the selected variable is"
c8e3967e8623 added: #browseSharedPoolOfIt
Claus Gittinger <cg@exept.de>
parents: 4188
diff changeset
  1744
c8e3967e8623 added: #browseSharedPoolOfIt
Claus Gittinger <cg@exept.de>
parents: 4188
diff changeset
  1745
    |sel|
c8e3967e8623 added: #browseSharedPoolOfIt
Claus Gittinger <cg@exept.de>
parents: 4188
diff changeset
  1746
4617
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1747
    sel := self selectedTextOrSyntaxElement.
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1748
    sel notEmptyOrNil ifTrue:[
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1749
        sel := sel asSymbol.
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1750
        self windowGroup withWaitCursorDo:[
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1751
            SharedPool allSubclassesDo:[:eachPool |
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1752
                (eachPool includesKey:sel) ifTrue:[
4619
bb6fc65fce18 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4618
diff changeset
  1753
                    (UserPreferences systemBrowserClass) 
4617
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1754
                        openInClass:eachPool class selector:#initialize
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1755
                ].
4209
c8e3967e8623 added: #browseSharedPoolOfIt
Claus Gittinger <cg@exept.de>
parents: 4188
diff changeset
  1756
            ].
c8e3967e8623 added: #browseSharedPoolOfIt
Claus Gittinger <cg@exept.de>
parents: 4188
diff changeset
  1757
        ].
c8e3967e8623 added: #browseSharedPoolOfIt
Claus Gittinger <cg@exept.de>
parents: 4188
diff changeset
  1758
    ].
c8e3967e8623 added: #browseSharedPoolOfIt
Claus Gittinger <cg@exept.de>
parents: 4188
diff changeset
  1759
c8e3967e8623 added: #browseSharedPoolOfIt
Claus Gittinger <cg@exept.de>
parents: 4188
diff changeset
  1760
    "Created: / 15-01-2011 / 14:01:39 / cg"
c8e3967e8623 added: #browseSharedPoolOfIt
Claus Gittinger <cg@exept.de>
parents: 4188
diff changeset
  1761
!
c8e3967e8623 added: #browseSharedPoolOfIt
Claus Gittinger <cg@exept.de>
parents: 4188
diff changeset
  1762
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1763
doIt
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1764
    "user selected 'doIt' from menu; show a wait-cursor, evaluate the code
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1765
     and finally restore cursor; return result of evaluation"
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1766
1521
e2bb7811e4db removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
  1767
    ^ self 
3272
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
  1768
        do:(self selectionOrTextOfCursorLine) 
4149
105b82a1365d changed:
Stefan Vogel <sv@exept.de>
parents: 4148
diff changeset
  1769
        withValueDo:nil
1521
e2bb7811e4db removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
  1770
e2bb7811e4db removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
  1771
    "Modified: / 16.5.1998 / 16:45:01 / cg"
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1772
!
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1773
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1774
editMenu
1107
25753e7f960f commentary
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1775
    "return my popUpMenu; thats the superclasses menu
25753e7f960f commentary
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1776
     PLUS st-evaluation items: doIt, printIt and inspectIt."
25753e7f960f commentary
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1777
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1778
    <resource: #keyboard (#DoIt #PrintIt #InspectIt 
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1779
                          #CommentSelection #UncommentSelection
2573
52c995a1ea78 accelerators for browseIt and implementorsOfIt
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  1780
                          #BrowseIt #ImplementorsOfIt
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1781
                         )>
1262
d69149b5be1f resource flag: #menu -> #programMenu
Claus Gittinger <cg@exept.de>
parents: 1251
diff changeset
  1782
    <resource: #programMenu>
489
5816aa12fec8 resources
Claus Gittinger <cg@exept.de>
parents: 444
diff changeset
  1783
2867
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1784
    |m sub subsub idx sensor s s2|
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1785
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1786
    m := super editMenu.
3252
b44361e6b97a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3210
diff changeset
  1787
    ((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
  1788
        sub := m.
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1789
        m := nil.
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1790
    ] ifFalse:[
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1791
        sub := m subMenuAt:#others.
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1792
    ].
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1793
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1794
    sub notNil ifTrue:[
2867
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1795
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1796
        "
2867
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1797
         workspaces support #browse, implementors etc. add them after paste.
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1798
        "
2867
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1799
        sub 
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1800
            addItemList:#(
4209
c8e3967e8623 added: #browseSharedPoolOfIt
Claus Gittinger <cg@exept.de>
parents: 4188
diff changeset
  1801
                ('-'                                                                        )
3910
a9536a430be0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3898
diff changeset
  1802
                ('Browse'                       browseIt                BrowseIt            )
4617
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1803
                ('Browse Pool'                  browseSharedPoolOfIt                        )
3910
a9536a430be0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3898
diff changeset
  1804
                ('Senders of It'                browseSendersOfIt                           )
a9536a430be0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3898
diff changeset
  1805
                ('Implementors of It'           browseImplementorsOfIt  ImplementorsOfIt    )
a9536a430be0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3898
diff changeset
  1806
                ('References to It'             browseReferencesToIt                        )
a9536a430be0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3898
diff changeset
  1807
"/                ('Classes Containing It in Name'    browseClassesContainingItInName           )
a9536a430be0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3898
diff changeset
  1808
"/                ('Methods Contaníning It in Name'   browseMethodsContainingItInName           )
a9536a430be0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3898
diff changeset
  1809
"/                ('Methods Contaníning It in Source' browseMethodsContainingItInSource         )
2867
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1810
                ('-'                                                                )
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1811
                ('TimeIt'               timeIt                                      )
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1812
                ('SpyOnIt'              spyOnIt                                     ))
2922
70e3f3ec7980 oops - doIt and friends were not translated
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
  1813
          resources:resources  
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1814
          after:#gotoLine.
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1815
2867
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1816
        subsub := sub subMenuAt:#tools.
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1817
        subsub notNil ifTrue:[
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1818
            subsub
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1819
                addItemList:#(
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1820
                    ('-'                                                                )
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1821
                    ('Comment'              commentSelection        CommentSelection    )
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1822
                    ('Uncomment'            uncommentSelection      UncommentSelection  ))
2922
70e3f3ec7980 oops - doIt and friends were not translated
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
  1823
              resources:resources  
2867
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1824
              after:#'indent'.
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1825
        ].
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1826
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1827
        self hasSelection ifFalse:[
4209
c8e3967e8623 added: #browseSharedPoolOfIt
Claus Gittinger <cg@exept.de>
parents: 4188
diff changeset
  1828
            sub disableAll:#(browseImplementorsOfIt browseSendersOfIt 
c8e3967e8623 added: #browseSharedPoolOfIt
Claus Gittinger <cg@exept.de>
parents: 4188
diff changeset
  1829
                             browseReferencesToIt timeIt spyOnIt
4617
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1830
                             browseSharedPoolOfIt browseIt). 
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1831
            self supportsSyntaxElements ifTrue:[
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1832
                self syntaxElementForSelectorUnderCursor notNil ifTrue:[
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1833
                    sub enableAll:#(browseImplementorsOfIt browseSendersOfIt ) 
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1834
                ] ifFalse:[
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1835
                    |el|
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1836
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1837
                    (el := self syntaxElementForVariableUnderCursor) notNil ifTrue:[
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1838
                        el isGlobal ifTrue:[
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1839
                            sub enable: #browseReferencesToIt
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1840
                        ].
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1841
                        el isClass ifTrue:[
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1842
                            sub enable:#browseIt
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1843
                        ]
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1844
                    ]
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1845
                ]
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1846
            ].
2454
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
  1847
        ] ifTrue:[
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
  1848
            s := self selectionAsString.
2485
1e4ab722cb11 browse senders/implementors: better selector check
Claus Gittinger <cg@exept.de>
parents: 2477
diff changeset
  1849
            s notNil ifTrue:[
3579
3923810267b6 better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents: 3543
diff changeset
  1850
                s asSymbolIfInterned isNil ifTrue:[
3923810267b6 better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents: 3543
diff changeset
  1851
                    s2 := SystemBrowser extractSelectorFrom:s.
3923810267b6 better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents: 3543
diff changeset
  1852
                    s2 notNil ifTrue:[
3923810267b6 better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents: 3543
diff changeset
  1853
                        s2 := s2 asSymbolIfInterned.
3923810267b6 better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents: 3543
diff changeset
  1854
                    ].
3923810267b6 better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents: 3543
diff changeset
  1855
                ].
2454
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
  1856
            ].
2487
47e0a1faf544 disabling of impl/senders menu
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
  1857
            (s2 isNil and:[s isNil]) ifTrue:[
2485
1e4ab722cb11 browse senders/implementors: better selector check
Claus Gittinger <cg@exept.de>
parents: 2477
diff changeset
  1858
                sub disableAll:#(browseImplementorsOfIt browseSendersOfIt).
1e4ab722cb11 browse senders/implementors: better selector check
Claus Gittinger <cg@exept.de>
parents: 2477
diff changeset
  1859
            ].
3959
2d90b5eaada7 changed:
Claus Gittinger <cg@exept.de>
parents: 3910
diff changeset
  1860
            "/ a global or namespace-var selected ?
4459
2b9b54d95778 changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 4453
diff changeset
  1861
            s isNil ifTrue:[
2485
1e4ab722cb11 browse senders/implementors: better selector check
Claus Gittinger <cg@exept.de>
parents: 2477
diff changeset
  1862
                sub disable:#browseReferencesToIt.
4459
2b9b54d95778 changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 4453
diff changeset
  1863
            ] ifFalse:[
2b9b54d95778 changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 4453
diff changeset
  1864
                (s asSymbolIfInterned notNil
2b9b54d95778 changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 4453
diff changeset
  1865
                and:[ (Smalltalk includesKey:s asSymbol)
4617
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1866
                      or:[ (NameSpace allNameSpaces contains:[:ns | ns includesKey:s asSymbol]) ]]
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1867
                ) ifTrue:[
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1868
                    "/ a global or namespace var selected
4459
2b9b54d95778 changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 4453
diff changeset
  1869
                ] ifFalse:[
4675
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
  1870
                    |cls|
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
  1871
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
  1872
                    ((cls := self editedClass) notNil
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
  1873
                    and:[ (cls theNonMetaclass allClassVarNames includes:s)
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
  1874
                          or:[ (cls theNonMetaclass privateClassNamed:s) notNil ]]) ifTrue:[
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
  1875
                        "/ a classvar or private class
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
  1876
                    ] ifFalse:[
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
  1877
                        "/ todo: an instvar selected?
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
  1878
                        sub disable:#browseReferencesToIt.
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
  1879
                    ].
4459
2b9b54d95778 changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 4453
diff changeset
  1880
                ].
2485
1e4ab722cb11 browse senders/implementors: better selector check
Claus Gittinger <cg@exept.de>
parents: 2477
diff changeset
  1881
            ].
4342
2845509d2b8a changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 4317
diff changeset
  1882
            (s notNil 
2845509d2b8a changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 4317
diff changeset
  1883
            and:[ s asSymbolIfInterned notNil
2845509d2b8a changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 4317
diff changeset
  1884
            and:[ (SharedPool allSubclasses contains:[:pool | pool includesKey:s asSymbol]) ]]) ifFalse:[
4209
c8e3967e8623 added: #browseSharedPoolOfIt
Claus Gittinger <cg@exept.de>
parents: 4188
diff changeset
  1885
                sub disable:#browseSharedPoolOfIt.
c8e3967e8623 added: #browseSharedPoolOfIt
Claus Gittinger <cg@exept.de>
parents: 4188
diff changeset
  1886
            ].
4584
ba63ceaa4916 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4568
diff changeset
  1887
        ].
ba63ceaa4916 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4568
diff changeset
  1888
        self isReadOnly ifTrue:[
ba63ceaa4916 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4568
diff changeset
  1889
            sub disableAll:#(commentSelection uncommentSelection) 
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1890
        ].
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1891
    ].
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1892
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1893
    m notNil ifTrue:[
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1894
        "
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1895
         workspaces support #doIt, #printIt and #inspectIt
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1896
         add them after paste.
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1897
        "
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1898
        idx := m indexOf:#paste.
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1899
        idx == 0 ifTrue:[idx := m indexOf:#pasteOrReplace].
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1900
        idx ~~ 0 ifTrue:[
2867
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1901
            m 
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1902
              addItemList:#(
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1903
                ('-'                                )
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1904
                ('DoIt'         doIt        DoIt     )
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1905
                ('PrintIt'      printIt     PrintIt  )
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  1906
                ('InspectIt'    inspectIt   InspectIt))
2922
70e3f3ec7980 oops - doIt and friends were not translated
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
  1907
              resources:resources  
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1908
              after:idx.
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1909
            
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1910
        ].
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1911
3279
087a9e32c714 oops - autoselect for doIt was done too early
Claus Gittinger <cg@exept.de>
parents: 3272
diff changeset
  1912
        (self hasSelectionOrTextInCursorLine) ifFalse:[
3272
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
  1913
            |lNr line|
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
  1914
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
  1915
            lNr := self cursorLine.
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
  1916
            line := self listAt:lNr.
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
  1917
            line isEmptyOrNil ifTrue:[
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
  1918
                m disableAll:#(printIt doIt inspectIt browseIt) 
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
  1919
            ].
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1920
        ].
2595
b09b515077b4 disable readOnly items
Claus Gittinger <cg@exept.de>
parents: 2573
diff changeset
  1921
        self isReadOnly ifTrue:[
b09b515077b4 disable readOnly items
Claus Gittinger <cg@exept.de>
parents: 2573
diff changeset
  1922
            m disable:#printIt 
b09b515077b4 disable readOnly items
Claus Gittinger <cg@exept.de>
parents: 2573
diff changeset
  1923
        ].
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1924
    ].
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1925
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  1926
    ^ m ? sub.
430
022b667e0d70 added accelerator display
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  1927
4209
c8e3967e8623 added: #browseSharedPoolOfIt
Claus Gittinger <cg@exept.de>
parents: 4188
diff changeset
  1928
    "Modified: / 22-04-1998 / 21:49:06 / ca"
4342
2845509d2b8a changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 4317
diff changeset
  1929
    "Modified: / 20-12-2011 / 11:22:20 / cg"
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1930
!
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1931
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1932
inspectIt
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1933
    "user selected 'inspectIt' from menu; use doIt to evaluate the code
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1934
     and start an inspector on the result"
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1935
2981
75abc5efbf67 shift-inspect (= basicInspect)
Claus Gittinger <cg@exept.de>
parents: 2980
diff changeset
  1936
    |shifted|
75abc5efbf67 shift-inspect (= basicInspect)
Claus Gittinger <cg@exept.de>
parents: 2980
diff changeset
  1937
75abc5efbf67 shift-inspect (= basicInspect)
Claus Gittinger <cg@exept.de>
parents: 2980
diff changeset
  1938
    shifted := self sensor shiftDown.
75abc5efbf67 shift-inspect (= basicInspect)
Claus Gittinger <cg@exept.de>
parents: 2980
diff changeset
  1939
1521
e2bb7811e4db removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
  1940
    ^ self 
3272
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
  1941
        do:(self selectionOrTextOfCursorLine) 
2982
9a831ab53acc shift-inspect (= basicInspect)
Claus Gittinger <cg@exept.de>
parents: 2981
diff changeset
  1942
        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
  1943
e2bb7811e4db removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
  1944
    "Modified: / 16.5.1998 / 16:44:56 / cg"
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1945
!
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1946
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1947
printIt
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1948
    "user selected 'printIt' from menu; use doIt to evaluate the code
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1949
     and insert result of evaluation into my text.
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1950
     If the text is readOnly, do nothing."
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1951
1734
e71982a6a4c5 use self isReadonly
Claus Gittinger <cg@exept.de>
parents: 1523
diff changeset
  1952
    self isReadOnly ifTrue:[
3511
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1953
        self beep.
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1954
        ^ self.
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1955
    ].
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1956
    self 
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1957
        undoableDo:[
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1958
            self 
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1959
                do:(self selectionOrTextOfCursorLine) 
4367
2658c5bf5ec3 changed: #printIt
Claus Gittinger <cg@exept.de>
parents: 4342
diff changeset
  1960
                withValueDo:[:result |
2658c5bf5ec3 changed: #printIt
Claus Gittinger <cg@exept.de>
parents: 4342
diff changeset
  1961
                    |s|
2658c5bf5ec3 changed: #printIt
Claus Gittinger <cg@exept.de>
parents: 4342
diff changeset
  1962
3511
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1963
                    self cursorLine:selectionEndLine col:(selectionEndCol + 1).
4367
2658c5bf5ec3 changed: #printIt
Claus Gittinger <cg@exept.de>
parents: 4342
diff changeset
  1964
                    (result isInteger 
2658c5bf5ec3 changed: #printIt
Claus Gittinger <cg@exept.de>
parents: 4342
diff changeset
  1965
                    and:[ result > 10 
4401
Claus Gittinger <cg@exept.de>
parents: 4398
diff changeset
  1966
                    and:[ InspectorView defaultIntegerDisplayRadix ~= 10 ]]) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 4398
diff changeset
  1967
                        s := result displayString , ' "',(result radixPrintStringRadix: InspectorView defaultIntegerDisplayRadix),'"'.
4367
2658c5bf5ec3 changed: #printIt
Claus Gittinger <cg@exept.de>
parents: 4342
diff changeset
  1968
                    ] ifFalse:[
2658c5bf5ec3 changed: #printIt
Claus Gittinger <cg@exept.de>
parents: 4342
diff changeset
  1969
                        s := result displayString "printString"
2658c5bf5ec3 changed: #printIt
Claus Gittinger <cg@exept.de>
parents: 4342
diff changeset
  1970
                    ].
2658c5bf5ec3 changed: #printIt
Claus Gittinger <cg@exept.de>
parents: 4342
diff changeset
  1971
                    self insertSelectedStringAtCursor:s
3511
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1972
                ]
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1973
        ] 
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1974
        info:'PrintIt'
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1975
4401
Claus Gittinger <cg@exept.de>
parents: 4398
diff changeset
  1976
    "Modified: / 08-03-2012 / 16:14:34 / cg"
3511
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1977
!
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1978
4471
6b403ca6c388 added profileIt menu item
Claus Gittinger <cg@exept.de>
parents: 4459
diff changeset
  1979
profileIt
6b403ca6c388 added profileIt menu item
Claus Gittinger <cg@exept.de>
parents: 4459
diff changeset
  1980
    "user selected 'profileIt' from menu; show a wait-cursor, profile the code
4472
1eef89af0ef0 added: #spyOnItUsing:
Claus Gittinger <cg@exept.de>
parents: 4471
diff changeset
  1981
     and finally restore the cursor. Open a visual profiler on the sample data."
4471
6b403ca6c388 added profileIt menu item
Claus Gittinger <cg@exept.de>
parents: 4459
diff changeset
  1982
4472
1eef89af0ef0 added: #spyOnItUsing:
Claus Gittinger <cg@exept.de>
parents: 4471
diff changeset
  1983
    self spyOnItUsing:Tools::Profiler
4471
6b403ca6c388 added profileIt menu item
Claus Gittinger <cg@exept.de>
parents: 4459
diff changeset
  1984
!
6b403ca6c388 added profileIt menu item
Claus Gittinger <cg@exept.de>
parents: 4459
diff changeset
  1985
3511
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1986
replaceIt
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1987
    "like printIt, but replace the selection with the result, instead of
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1988
     pasting it after the selection."
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1989
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1990
    self isReadOnly ifTrue:[
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1991
        self beep.
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1992
        ^ self
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1993
    ].
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1994
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1995
    self 
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1996
        undoableDo:[
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1997
            self 
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1998
                do:(self selectionOrTextOfCursorLine) 
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1999
                withValueDo:[:result |
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2000
                    self replaceSelectionBy:(result displayString "printString")
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2001
                ].
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2002
                undoSupport actionInfo:'ReplaceIt'.
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2003
        ]
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2004
        info:'ReplaceIt'
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2005
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2006
    "Created: / 08-11-2007 / 11:31:54 / cg"
1501
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  2007
!
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  2008
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  2009
spyOnIt
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  2010
    "user selected 'spyOnIt' from menu; show a wait-cursor, evaluate the code
4472
1eef89af0ef0 added: #spyOnItUsing:
Claus Gittinger <cg@exept.de>
parents: 4471
diff changeset
  2011
     and finally restore the cursor. Show profile data on the Transcript"
1eef89af0ef0 added: #spyOnItUsing:
Claus Gittinger <cg@exept.de>
parents: 4471
diff changeset
  2012
1eef89af0ef0 added: #spyOnItUsing:
Claus Gittinger <cg@exept.de>
parents: 4471
diff changeset
  2013
    self spyOnItUsing:MessageTally
1eef89af0ef0 added: #spyOnItUsing:
Claus Gittinger <cg@exept.de>
parents: 4471
diff changeset
  2014
!
1eef89af0ef0 added: #spyOnItUsing:
Claus Gittinger <cg@exept.de>
parents: 4471
diff changeset
  2015
1eef89af0ef0 added: #spyOnItUsing:
Claus Gittinger <cg@exept.de>
parents: 4471
diff changeset
  2016
spyOnItUsing:aProfiler
1eef89af0ef0 added: #spyOnItUsing:
Claus Gittinger <cg@exept.de>
parents: 4471
diff changeset
  2017
    "common code for spyOnIt / profileIt.
1eef89af0ef0 added: #spyOnItUsing:
Claus Gittinger <cg@exept.de>
parents: 4471
diff changeset
  2018
     Show a wait-cursor, evaluate the code with profier on it,
1eef89af0ef0 added: #spyOnItUsing:
Claus Gittinger <cg@exept.de>
parents: 4471
diff changeset
  2019
     and finally restore the cursor. Show profile data as per profiler"
1501
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  2020
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  2021
    |code|
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  2022
4427
9eb0f20e7ed8 changed:
Claus Gittinger <cg@exept.de>
parents: 4416
diff changeset
  2023
    compilerClass == Smalltalk::Compiler ifFalse:[
9eb0f20e7ed8 changed:
Claus Gittinger <cg@exept.de>
parents: 4416
diff changeset
  2024
        "sigh - this measurement will include the time to compile - sigh"
4472
1eef89af0ef0 added: #spyOnItUsing:
Claus Gittinger <cg@exept.de>
parents: 4471
diff changeset
  2025
        aProfiler spyDetailedOn:[ self doIt ].
4427
9eb0f20e7ed8 changed:
Claus Gittinger <cg@exept.de>
parents: 4416
diff changeset
  2026
        ^ self.
9eb0f20e7ed8 changed:
Claus Gittinger <cg@exept.de>
parents: 4416
diff changeset
  2027
    ].
9eb0f20e7ed8 changed:
Claus Gittinger <cg@exept.de>
parents: 4416
diff changeset
  2028
4472
1eef89af0ef0 added: #spyOnItUsing:
Claus Gittinger <cg@exept.de>
parents: 4471
diff changeset
  2029
    code := aProfiler name,' spyDetailedOn:[' , self selectionAsString, ']'.
4149
105b82a1365d changed:
Stefan Vogel <sv@exept.de>
parents: 4148
diff changeset
  2030
    self do:code withValueDo:[:value| ].
1501
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  2031
!
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  2032
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  2033
timeIt
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  2034
    "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
  2035
     and finally restore cursor; return result of evaluation"
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  2036
4427
9eb0f20e7ed8 changed:
Claus Gittinger <cg@exept.de>
parents: 4416
diff changeset
  2037
    |code t|
9eb0f20e7ed8 changed:
Claus Gittinger <cg@exept.de>
parents: 4416
diff changeset
  2038
9eb0f20e7ed8 changed:
Claus Gittinger <cg@exept.de>
parents: 4416
diff changeset
  2039
    compilerClass == Smalltalk::Compiler ifFalse:[
9eb0f20e7ed8 changed:
Claus Gittinger <cg@exept.de>
parents: 4416
diff changeset
  2040
        "sigh - this measurement will include the time to compile - sigh"
9eb0f20e7ed8 changed:
Claus Gittinger <cg@exept.de>
parents: 4416
diff changeset
  2041
        t := Time millisecondsToRun:[ self doIt ].
9eb0f20e7ed8 changed:
Claus Gittinger <cg@exept.de>
parents: 4416
diff changeset
  2042
        Transcript showCR:'execution time: ' , t printString , ' ms'.
9eb0f20e7ed8 changed:
Claus Gittinger <cg@exept.de>
parents: 4416
diff changeset
  2043
        ^ self.
9eb0f20e7ed8 changed:
Claus Gittinger <cg@exept.de>
parents: 4416
diff changeset
  2044
    ].
1501
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  2045
3272
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
  2046
    code := '|t| t := Time millisecondsToRun:[' , self selectionAsString, '].
4149
105b82a1365d changed:
Stefan Vogel <sv@exept.de>
parents: 4148
diff changeset
  2047
             Transcript showCR:''execution time: '' , t printString , '' ms''.'.
105b82a1365d changed:
Stefan Vogel <sv@exept.de>
parents: 4148
diff changeset
  2048
    self do:code withValueDo:[:value | ].
1501
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  2049
4427
9eb0f20e7ed8 changed:
Claus Gittinger <cg@exept.de>
parents: 4416
diff changeset
  2050
    "Modified: / 22-04-1998 / 22:03:51 / ca"
9eb0f20e7ed8 changed:
Claus Gittinger <cg@exept.de>
parents: 4416
diff changeset
  2051
    "Modified (format): / 02-06-2012 / 00:38:51 / cg"
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2052
! !
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2053
3968
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2054
!Workspace methodsFor:'misc'!
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2055
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2056
expandAbbreviation
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2057
    "after receiving an Alt-shift key-event, look for the string before the
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2058
     cursor, find an abbrev for it and expand."
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2059
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2060
    |expandedString abortExpandAction oldSelectionStartLine oldSelectionStartCol oldSelectionEndLine oldSelectionEndCol oldCursorLine oldCursorCol
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2061
     newCursorPos replStartCol|
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2062
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2063
    oldCursorLine := self cursorLine.
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2064
    oldCursorCol := self cursorCol.
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2065
    oldSelectionStartLine := self selectionStartLine.
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2066
    oldSelectionStartCol := self selectionStartCol.
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2067
    oldSelectionEndLine := self selectionEndLine.
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2068
    oldSelectionEndCol := self selectionEndCol.
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2069
4706
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2070
    abortExpandAction := 
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2071
        [
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2072
            self 
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2073
                selectFromLine:oldSelectionStartLine col:oldSelectionStartCol 
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2074
                toLine:oldSelectionEndLine col:oldSelectionEndCol.
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2075
            self cursorLine:oldCursorLine col:oldCursorCol.
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2076
        ].                                  
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2077
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2078
    expandedString := self selectAbbreviationKeyBeforeCursor. "/ returns the new string AND selects the key
3968
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2079
    expandedString isNil ifTrue:[
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2080
        abortExpandAction value.
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2081
        ^ self
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2082
    ].
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2083
    newCursorPos := expandedString indexOf:$!!.
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2084
    newCursorPos ~~ 0 ifTrue:[
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2085
        expandedString := expandedString copyWithout:$!!.
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2086
    ].
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2087
    replStartCol := self selectionStartCol.
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2088
    self
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2089
        undoableDo:[
4706
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2090
            self replaceSelectionWith: expandedString
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2091
        ]
3968
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2092
        info:'Replace'.
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2093
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2094
    newCursorPos == 0 ifTrue:[
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2095
        "/ cursor already fine (at the end)
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2096
    ] ifFalse:[
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2097
        self cursorCol:replStartCol+newCursorPos-1
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2098
    ]
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2099
!
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2100
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2101
findAbbreviationKeyBeforeCursor
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2102
    "after receiving an Alt-shift key-event, look for the string before the
4706
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2103
     cursor, find an abbrev for it, return the key and the abbreviation for it.   
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2104
     If none is found, return nil"
3968
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2105
4714
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2106
    |sniplets keys minMax maxKeyLen minKeyLen stringBeforeCursor|
3968
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2107
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2108
    sniplets := self class sniplets.
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2109
    keys := sniplets keys.
4714
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2110
3968
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2111
    minMax := (keys collect:[:k | k size]) minMax.
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2112
    minKeyLen := minMax first.
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2113
    maxKeyLen := minMax second.
4714
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2114
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2115
    stringBeforeCursor := self lineStringBeforeCursor.
3968
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2116
    maxKeyLen := maxKeyLen min:stringBeforeCursor size.
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2117
4706
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2118
    maxKeyLen to:minKeyLen by:-1 do:[:keyLen |
3968
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2119
        |lCharactersBeforeCursor expandedString|
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2120
4706
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2121
        lCharactersBeforeCursor := stringBeforeCursor last:keyLen.
3968
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2122
        expandedString := sniplets at:lCharactersBeforeCursor ifAbsent:nil.
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2123
        expandedString notNil ifTrue:[
4706
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2124
            ^ { lCharactersBeforeCursor . expandedString withCRs }
3968
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2125
        ].
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2126
    ].
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2127
    ^ nil.
4185
44ac2c080798 changed:
Claus Gittinger <cg@exept.de>
parents: 4184
diff changeset
  2128
44ac2c080798 changed:
Claus Gittinger <cg@exept.de>
parents: 4184
diff changeset
  2129
    "Modified: / 29-10-2010 / 10:22:38 / cg"
4617
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  2130
!
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  2131
4706
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2132
selectAbbreviationKeyBeforeCursor
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2133
    "after receiving an Alt-shift key-event, look for the string before the
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2134
     cursor, find an abbrev for it, select it and return the abbreviation for it.   
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2135
     If none is found, do not select and return nil"
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2136
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2137
    |keyAndSniplet sniplet key|
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2138
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2139
    (keyAndSniplet := self findAbbreviationKeyBeforeCursor) notNil ifTrue:[
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2140
        key := keyAndSniplet first.
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2141
        sniplet := keyAndSniplet second.
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2142
        self selectFromLine:cursorLine col:cursorCol-key size toLine:cursorLine col:cursorCol-1.
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2143
        ^ sniplet
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2144
    ].
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2145
    ^ nil.
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2146
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2147
    "Modified: / 29-10-2010 / 10:22:38 / cg"
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2148
!
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2149
4617
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  2150
selectedTextOrSyntaxElement
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  2151
    |selectedText el|
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  2152
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  2153
    selectedText := self selectionAsString.
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  2154
    selectedText isEmptyOrNil ifTrue:[
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  2155
        self supportsSyntaxElements ifTrue:[
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  2156
            el := self syntaxElementForSelectorUnderCursor.
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  2157
            el notNil ifTrue:[ selectedText := el value ].
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  2158
        ]
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  2159
    ].
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  2160
    ^ selectedText 
3968
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2161
! !
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2162
2646
dcee45d1c5ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2641
diff changeset
  2163
!Workspace methodsFor:'queries'!
dcee45d1c5ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2641
diff changeset
  2164
dcee45d1c5ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2641
diff changeset
  2165
isWorkspace
4395
a862858a2165 comment: #isWorkspace
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2166
    "back-query from the compiler to ask if this is an interactive view
a862858a2165 comment: #isWorkspace
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2167
     (for error feedback)"
a862858a2165 comment: #isWorkspace
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2168
2646
dcee45d1c5ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2641
diff changeset
  2169
    ^ true
4395
a862858a2165 comment: #isWorkspace
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2170
a862858a2165 comment: #isWorkspace
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2171
    "Modified (comment): / 07-03-2012 / 17:52:59 / cg"
2646
dcee45d1c5ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2641
diff changeset
  2172
! !
dcee45d1c5ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2641
diff changeset
  2173
4695
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2174
!Workspace::CodeCompletionService class methodsFor:'instance creation'!
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2175
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2176
for:anEditView
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2177
    ^ self new editView:anEditView
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2178
! !
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2179
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2180
!Workspace::CodeCompletionService methodsFor:'accessing'!
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2181
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2182
editView:something
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2183
    editView := something.
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2184
! !
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2185
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2186
!Workspace::CodeCompletionService methodsFor:'events'!
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2187
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2188
buttonPress:button x:x y:y
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2189
    self closeCompletionView.
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2190
!
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2191
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2192
editViewLostFocus
4714
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2193
    completionView notNil ifTrue:[
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2194
        self closeCompletionView
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2195
    ]
4695
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2196
!
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2197
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2198
handleKeyPress:key x:x y:y
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2199
    "return true, if I have eaten this keypress"
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2200
4716
a9c9e68cd628 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2201
    (completionView isNil or:[completionView realized not]) ifTrue:[
4725
aff6517a3471 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4722
diff changeset
  2202
        (key == #Control_L or:[ key == #Control_R or:[ key == #Control]]) ifTrue:[
4726
fae60a152dab class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4725
diff changeset
  2203
            editView hasSelection ifFalse:[
fae60a152dab class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4725
diff changeset
  2204
                UserPreferences current codeCompletionOnControlKey ifTrue:[
fae60a152dab class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4725
diff changeset
  2205
                    self updateCompletionList
fae60a152dab class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4725
diff changeset
  2206
                ]
fae60a152dab class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4725
diff changeset
  2207
            ].
4725
aff6517a3471 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4722
diff changeset
  2208
        ].
4716
a9c9e68cd628 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2209
        ^ false.
a9c9e68cd628 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2210
    ].
a9c9e68cd628 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2211
4695
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2212
    key isCharacter ifFalse:[
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2213
        "/ forward to menu
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2214
        completionView notNil ifTrue:[
4726
fae60a152dab class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4725
diff changeset
  2215
            (key == #CursorDown 
fae60a152dab class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4725
diff changeset
  2216
                or:[ (key == #CursorUp)
fae60a152dab class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4725
diff changeset
  2217
                or:[ ((key == #Return) and:[ completionView hasSelection ])
fae60a152dab class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4725
diff changeset
  2218
            ]]) ifTrue:[
4695
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2219
                "/ forward to completion view
4703
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2220
                completionView sensor pushUserEvent:#value for:[ completionView keyPress:key x:0 y:0 ].
4695
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2221
                ^ true.
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2222
            ].
4717
cabfcd0e5737 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4716
diff changeset
  2223
            (key == #Control_L or:[ key == #Control_R or:[ key == #Control]]) ifTrue:[
4729
450cb0dcedd2 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4727
diff changeset
  2224
                "/ CTRL is a toggle
450cb0dcedd2 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4727
diff changeset
  2225
                self closeCompletionView.
450cb0dcedd2 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4727
diff changeset
  2226
                ^ true.
450cb0dcedd2 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4727
diff changeset
  2227
                "/ ^ false
4717
cabfcd0e5737 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4716
diff changeset
  2228
            ].
cabfcd0e5737 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4716
diff changeset
  2229
            (key == #Escape) ifTrue:[
4714
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2230
                self closeCompletionView.
4717
cabfcd0e5737 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4716
diff changeset
  2231
                ^ true  "/ EAT
4714
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2232
            ].
4717
cabfcd0e5737 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4716
diff changeset
  2233
            self closeCompletionView.
cabfcd0e5737 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4716
diff changeset
  2234
            ^ false "/ don' eat
4695
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2235
        ].
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2236
    ].
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2237
4703
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2238
    (key == #Escape) ifTrue:[
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2239
        completionView notNil ifTrue:[ 
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2240
            self closeCompletionView.
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2241
            ^ true
4714
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2242
        ].
4729
450cb0dcedd2 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4727
diff changeset
  2243
        "/ self halt.
4703
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2244
    ].
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2245
4695
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2246
    (key == #CursorRight
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2247
    or:[key == #CursorDown
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2248
    or:[key == #CursorLeft
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2249
    or:[key == #CursorUp]]]) ifTrue:[
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2250
        completionView notNil ifTrue:[
4703
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2251
            completionView sensor pushUserEvent:#value for:[ completionView keyPress:key x:x y:y ].
4695
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2252
            ^ true
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2253
        ].
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2254
    ].
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2255
    ^ false.
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2256
!
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2257
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2258
postKeyPress:key
4729
450cb0dcedd2 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4727
diff changeset
  2259
    UserPreferences current immediateCodeCompletion ifFalse:[
450cb0dcedd2 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4727
diff changeset
  2260
        "/ only update, if already open
450cb0dcedd2 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4727
diff changeset
  2261
        completionView isNil ifTrue:[^ self].
450cb0dcedd2 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4727
diff changeset
  2262
    ].
450cb0dcedd2 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4727
diff changeset
  2263
4695
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2264
    (key == #BackSpace or:[key == #BasicBackspace]) ifTrue:[
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2265
        self updateCompletionList.
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2266
        ^ self
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2267
    ].
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2268
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2269
    key isCharacter ifTrue:[
4714
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2270
        key isSeparator ifTrue:[
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2271
            self closeCompletionView
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2272
        ] ifFalse:[
4703
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2273
            self updateCompletionList.
4714
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2274
        ].
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2275
        ^ self
4695
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2276
    ].
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2277
! !
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2278
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2279
!Workspace::CodeCompletionService methodsFor:'private'!
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2280
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2281
closeCompletionView
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2282
    |v|
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2283
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2284
    (v := completionView) notNil ifTrue:[
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2285
        completionView := nil.
4703
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2286
        "/ let it close itself - avoids synchronization problems
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2287
        v sensor
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2288
            pushUserEvent:#value
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2289
            for:[ v topView destroy ]
4695
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2290
    ].
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2291
!
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2292
4714
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2293
release
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2294
    self stopCompletionProcess.
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2295
    self closeCompletionView.
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2296
    super release
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2297
!
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2298
4703
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2299
startCompletionProcess
4729
450cb0dcedd2 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4727
diff changeset
  2300
    "start the code completion process in the background"
4703
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2301
4733
d623925e0257 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4729
diff changeset
  2302
    |movePos topView initialList cursorX cursorY|
4703
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2303
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2304
    "/ terminate any previous process
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2305
    self stopCompletionProcess.
4698
2d49410e369c class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4695
diff changeset
  2306
2d49410e369c class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4695
diff changeset
  2307
    (editView sensor hasKeyPressEventFor:nil) ifTrue:[ 
2d49410e369c class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4695
diff changeset
  2308
        self closeCompletionView. 
2d49410e369c class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4695
diff changeset
  2309
        ^ self
2d49410e369c class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4695
diff changeset
  2310
    ].
4733
d623925e0257 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4729
diff changeset
  2311
    ((cursorX := editView xOfCursor) isNil
d623925e0257 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4729
diff changeset
  2312
    or:[ (cursorY := editView yOfCursor) isNil ]) ifTrue:[
d623925e0257 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4729
diff changeset
  2313
        "/ no cursor - user is selecting, or cursor has been scrolled out of sight.
d623925e0257 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4729
diff changeset
  2314
        self closeCompletionView. 
d623925e0257 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4729
diff changeset
  2315
        ^ self
d623925e0257 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4729
diff changeset
  2316
    ].
4698
2d49410e369c class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4695
diff changeset
  2317
4709
1170fc797722 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4706
diff changeset
  2318
    initialList := #( 'busy...' ).
4706
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2319
4703
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2320
    "/ move the window
4733
d623925e0257 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4729
diff changeset
  2321
    movePos := editView device translatePoint:(cursorX @ cursorY) fromView:editView toView:nil.
4714
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2322
    "/ currently, we have to stay away a bit, to avoid getting the focus
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2323
    movePos := movePos + (60 @ (editView font height)).
4695
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2324
4698
2d49410e369c class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4695
diff changeset
  2325
    completionView isNil ifTrue:[
4727
07c917f409b1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4726
diff changeset
  2326
        completionView := CodeCompletionHelpMenuView new.
07c917f409b1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4726
diff changeset
  2327
        completionView name:'completion'.
4703
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2328
        completionView level:0.
4706
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2329
        completionView list:initialList.
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2330
        completionView enable:false.
4703
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2331
        completionView extent:completionView preferredExtentForContents.
4698
2d49410e369c class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4695
diff changeset
  2332
        topView := CodeCompletionHelpView with:completionView.
4703
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2333
        topView origin:movePos.
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2334
        topView resizeToFit.
4709
1170fc797722 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4706
diff changeset
  2335
        "/ topView open.
4703
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2336
    ] ifFalse:[
4706
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2337
        completionView list:initialList.
4703
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2338
        topView := completionView topView.
4714
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2339
        topView ~~ completionView ifTrue:[
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2340
            topView origin:movePos.
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2341
            topView resizeToFit.
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2342
        ]
4698
2d49410e369c class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4695
diff changeset
  2343
    ].
2d49410e369c class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4695
diff changeset
  2344
4703
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2345
    completionProcess := 
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2346
        [
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2347
            |suggestions actions anyFound|
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2348
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2349
            UserInformation ignoreIn:[
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2350
                anyFound := false.
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2351
                DoWhatIMeanSupport 
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2352
                    codeCompletionForMethod:editView editedMethod
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2353
                    orClass:editView editedClass 
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2354
                    context:nil 
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2355
                    codeView:editView 
4705
af96f6a12b41 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4704
diff changeset
  2356
                    into:[:listOfSuggestions :listOfActions :titleWhenAsking |
4703
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2357
                            suggestions := listOfSuggestions. 
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2358
                            actions := listOfActions.
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2359
                            anyFound := true.
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2360
                            nil "/ must return nil to avoid DWIM to do it itself (for now)
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2361
                    ]
4698
2d49410e369c class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4695
diff changeset
  2362
            ].
4703
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2363
            "/ anyFound ifFalse:[self halt].
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2364
            "/ Transcript show:'suggestions: '; showCR:suggestions.
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2365
            "/ Transcript show:'actions: '; showCR:actions.  
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2366
            editView sensor
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2367
                pushUserEvent:#'suggestionsArrived:actions:'
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2368
                for:self
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2369
                withArguments:{suggestions . actions }
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2370
        ] forkAt:(Processor activePriority - 1).
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2371
!
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2372
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2373
stopCompletionProcess
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2374
    "kill any background completion process"
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2375
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2376
    |p|
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2377
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2378
    (p := completionProcess) notNil ifTrue:[
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2379
        completionProcess := nil.
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2380
        p terminate.
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2381
    ].
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2382
!
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2383
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2384
suggestionsArrived:suggestions actions:actions
4722
ff80b5a0b8b6 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4717
diff changeset
  2385
    |v list suggestionOffset keyAndSniplet lastEntryIsSniplet|
4703
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2386
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2387
    (editView sensor hasKeyPressEventFor:nil) ifTrue:[ 
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2388
        self closeCompletionView. 
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2389
        ^ self
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2390
    ].
4706
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2391
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2392
    list := suggestions ? #().
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2393
    list size > 20 ifTrue:[ list := list copyTo:20 ].
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2394
4714
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2395
    "/ append snipplets, if any (can be easily reached via CRSR-up)
4706
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2396
    suggestionOffset := 0.
4722
ff80b5a0b8b6 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4717
diff changeset
  2397
    lastEntryIsSniplet := false.
4706
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2398
    (keyAndSniplet := editView findAbbreviationKeyBeforeCursor) notNil ifTrue:[
4714
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2399
        |abbrev sniplet i line|
4706
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2400
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2401
        abbrev := keyAndSniplet first.
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2402
        sniplet := keyAndSniplet second.
4714
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2403
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2404
        "/ if the abbreviation is simply at the end of a longer word, ignore the abbrev.
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2405
        line := editView lineStringBeforeCursor.
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2406
        i := line findLast:[:ch | ch isLetterOrDigit not].
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2407
        (i < (line size - abbrev size - 1)) ifFalse:[
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2408
            sniplet := sniplet copyWithout:$!!.
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2409
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2410
            "/ true, false and self are often found in both lists
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2411
            (list includes:sniplet) ifFalse:[   
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2412
                list isEmpty ifFalse:[ list := list copyWith: '-' ]. 
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2413
                list := list copyWith: ( '%1 %2'
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2414
                                        bindWith:(sniplet asStringCollection first "contractTo:25")
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2415
                                        with: ( ('("',abbrev,'" sniplet)') colorizeAllWith:Color grey)).
4722
ff80b5a0b8b6 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4717
diff changeset
  2416
                lastEntryIsSniplet := true.
4714
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2417
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2418
                "/ change below, when reversing the order in above code
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2419
                "/ suggestionOffset := 2.
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2420
            ]
4706
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2421
        ]
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2422
    ].
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2423
    list isEmptyOrNil ifTrue:[
4703
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2424
        self closeCompletionView.
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2425
        ^ self
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2426
    ].
4706
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2427
4703
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2428
    (v := completionView) isNil ifTrue: [
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2429
        ^ self
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2430
    ].
4709
1170fc797722 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4706
diff changeset
  2431
    v topView open.
1170fc797722 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4706
diff changeset
  2432
4703
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2433
    "/ v waitUntilVisible.
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2434
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2435
    v sensor
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2436
        pushUserEvent:#value
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2437
        for:[
4706
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2438
            |top|
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2439
4704
ea070cb320e5 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4703
diff changeset
  2440
            (v == completionView) ifTrue: [
4706
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2441
                top := v topView.
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2442
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2443
                v list:list. 
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2444
                v enable:true.
4704
ea070cb320e5 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4703
diff changeset
  2445
                v extent:completionView preferredExtentForContents.
ea070cb320e5 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4703
diff changeset
  2446
ea070cb320e5 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4703
diff changeset
  2447
                v action:
4706
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2448
                    [:selectedListIndex | 
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2449
                        |indexInSuggestions|
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2450
4714
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2451
                        self closeCompletionView.
4706
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2452
                        indexInSuggestions := selectedListIndex - suggestionOffset.
4722
ff80b5a0b8b6 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4717
diff changeset
  2453
                        (lastEntryIsSniplet and:[ selectedListIndex == list size]) ifTrue:[
4706
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2454
                            "/ replace the sniplet
4714
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2455
                            editView sensor
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2456
                                pushUserEvent:#value
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2457
                                for:[
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2458
                                    editView expandAbbreviation
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2459
                                ]
4706
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2460
                        ] ifFalse:[
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2461
                            actions notNil ifTrue:[
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2462
                                actions isBlock ifTrue:[
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2463
                                    actions value:indexInSuggestions
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2464
                                ] ifFalse:[
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2465
                                    (actions at:indexInSuggestions) value
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2466
                                ].
4704
ea070cb320e5 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4703
diff changeset
  2467
                            ].
ea070cb320e5 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4703
diff changeset
  2468
                        ].
4717
cabfcd0e5737 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4716
diff changeset
  2469
                        "/ no, user has chosen; so don't show more suggestions
cabfcd0e5737 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4716
diff changeset
  2470
"/                        editView sensor
cabfcd0e5737 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4716
diff changeset
  2471
"/                            pushUserEvent:#value
cabfcd0e5737 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4716
diff changeset
  2472
"/                            for:[
cabfcd0e5737 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4716
diff changeset
  2473
"/                                self updateCompletionList
cabfcd0e5737 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4716
diff changeset
  2474
"/                            ]
4703
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2475
                    ].
4704
ea070cb320e5 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4703
diff changeset
  2476
4706
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2477
                (top ~~ v) ifTrue:[
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2478
                    top resizeToFit.
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2479
                    top bottom > v device usableHeight ifTrue:[
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2480
                        top origin:((top origin x) @ (v device usableHeight - v height)).
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2481
                    ].
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2482
                    top raise.
4704
ea070cb320e5 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4703
diff changeset
  2483
                ]
ea070cb320e5 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4703
diff changeset
  2484
            ]
4703
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2485
        ]
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2486
!
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2487
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2488
updateCompletionList
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2489
    "called for keypress events"
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2490
2bbd9e98802d class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4698
diff changeset
  2491
    self startCompletionProcess.
4695
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2492
! !
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
  2493
206
2363a64a7c88 version at the end
Claus Gittinger <cg@exept.de>
parents: 201
diff changeset
  2494
!Workspace class methodsFor:'documentation'!
2363a64a7c88 version at the end
Claus Gittinger <cg@exept.de>
parents: 201
diff changeset
  2495
4402
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  2496
version
4733
d623925e0257 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4729
diff changeset
  2497
    ^ '$Header: /cvs/stx/stx/libwidg/Workspace.st,v 1.290 2013-09-03 19:27:51 cg Exp $'
4402
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  2498
!
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  2499
3959
2d90b5eaada7 changed:
Claus Gittinger <cg@exept.de>
parents: 3910
diff changeset
  2500
version_CVS
4733
d623925e0257 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4729
diff changeset
  2501
    ^ '$Header: /cvs/stx/stx/libwidg/Workspace.st,v 1.290 2013-09-03 19:27:51 cg Exp $'
858
ef7ba327189b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  2502
! !
4504
24d47fd0174a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4472
diff changeset
  2503