Workspace.st
author Claus Gittinger <cg@exept.de>
Fri, 24 Apr 2020 12:05:44 +0200
changeset 6847 22dc78cb5436
parent 6810 ddebfcfad415
permissions -rw-r--r--
#FEATURE by cg class: TextView changed: #editMenu
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6737
8e1ef494e29b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6736
diff changeset
     1
"{ Encoding: utf8 }"
8e1ef494e29b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6736
diff changeset
     2
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     3
"
5
claus
parents: 3
diff changeset
     4
 COPYRIGHT (c) 1989 by Claus Gittinger
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
     5
	      All Rights Reserved
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     6
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     7
 This software is furnished under a license and may be used
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     8
 only in accordance with the terms of that license and with the
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    10
 be provided or otherwise made available to, or used by, any
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    11
 other person.  No title to or ownership of the software is
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    12
 hereby transferred.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    13
"
2277
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
    14
"{ Package: 'stx:libwidg' }"
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
    15
5250
38534f27c2f7 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
    16
"{ NameSpace: Smalltalk }"
38534f27c2f7 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
    17
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    18
TextCollector subclass:#Workspace
5002
169305a9fdf2 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4998
diff changeset
    19
	instanceVariableNames:'doItAction codeStartPosition errorFgColor errorBgColor
169305a9fdf2 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4998
diff changeset
    20
		commentStrings autoDefineWorkspaceVariables simulatedSelf
169305a9fdf2 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4998
diff changeset
    21
		autoDefineVariables compilerClass allowValueDrop
169305a9fdf2 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4998
diff changeset
    22
		poolsConsideredInDoIts namespaceForDoits editedMethodOrClass
5595
925147560958 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5579
diff changeset
    23
		editedLanguage'
5982
79886cd5ae0e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5964
diff changeset
    24
	classVariableNames:'DefaultErrorBackgroundColor DefaultErrorForegroundColor
79886cd5ae0e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5964
diff changeset
    25
		DefaultViewBackground DefaultWarningBackgroundColor
79886cd5ae0e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5964
diff changeset
    26
		DefaultWarningForegroundColor DoItHistory Sniplets Snippets
79886cd5ae0e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5964
diff changeset
    27
		WorkspaceVariables'
5002
169305a9fdf2 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4998
diff changeset
    28
	poolDictionaries:''
169305a9fdf2 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4998
diff changeset
    29
	category:'Interface-Smalltalk'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    30
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    31
4726
fae60a152dab class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4725
diff changeset
    32
Workspace comment:''
3155
15d43d2ea850 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
    33
!
15d43d2ea850 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
    34
32
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
    35
!Workspace class methodsFor:'documentation'!
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
    36
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    37
copyright
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    38
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    39
 COPYRIGHT (c) 1989 by Claus Gittinger
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
    40
	      All Rights Reserved
38
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
 This software is furnished under a license and may be used
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    43
 only in accordance with the terms of that license and with the
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    44
 inclusion of the above copyright notice.   This software may not
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    45
 be provided or otherwise made available to, or used by, any
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    46
 other person.  No title to or ownership of the software is
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    47
 hereby transferred.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    48
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    49
!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    50
32
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
    51
documentation
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
    52
"
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
    53
    a view for editable text which can evaluate expressions.
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    54
    I.e. its basically a view for editable text, with added
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    55
    'doIt', 'printIt' and 'inspectIt' functions on the popup-menu.
125
claus
parents: 123
diff changeset
    56
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
    57
    The action to be performed on doIt is defined by a block,
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
    58
    which can be defined by the owner of this view.
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    59
    (thus you can put a workspace into more complex widgets, and
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    60
     control what should happen on 'doIt').
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
    61
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
    62
    A useful default action is automatically defined, which simply
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
    63
    evaluates the selection as a smalltalk expression.
578
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    64
    (but, a lisp or prolog workspace would define its own action,
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    65
     to call for another compiler/interpreter  ...)
32
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
    66
4922
f38a9a92a78a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4921
diff changeset
    67
    Special workspace- and doIt variables:
5915
d6c5de9d52bf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5906
diff changeset
    68
        workspaces can be configured to automatically define undefined variables
d6c5de9d52bf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5906
diff changeset
    69
        as either workspace- or doIt variables. When encountering undefined variables,
d6c5de9d52bf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5906
diff changeset
    70
        the parser asks for an action, which is responded with #workspace or doIt if a
d6c5de9d52bf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5906
diff changeset
    71
        workspace is the requestor of a doIt. Both are implemented as value holders, and
d6c5de9d52bf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5906
diff changeset
    72
        the parser will generate code sending value/value: instead of normal assignment.
d6c5de9d52bf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5906
diff changeset
    73
        Workspace variables are kept in the Workspace class and will both persist between doIts
d6c5de9d52bf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5906
diff changeset
    74
        and also be visible across workspaces. They are perfect for scripting (and therefore enabled
d6c5de9d52bf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5906
diff changeset
    75
        by default when stx is started with one of the scripting options).
d6c5de9d52bf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5906
diff changeset
    76
        DoIt variables are only valid during a single doIt.
d6c5de9d52bf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5906
diff changeset
    77
        Be aware that when you ask from the outside via workspaceVariableAt:, you'll get a valueHolder.
d6c5de9d52bf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5906
diff changeset
    78
        This is by purbose, as it allows for easy monitoring and tracing of changes.
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
    79
123
claus
parents: 121
diff changeset
    80
    Caveat:
5915
d6c5de9d52bf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5906
diff changeset
    81
        in this version, Workspace does not yet support doIt in MVC setups.
d6c5de9d52bf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5906
diff changeset
    82
        For now, simulate this by setting the doItAction, to notify the
d6c5de9d52bf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5906
diff changeset
    83
        model manually about the doIt.
123
claus
parents: 121
diff changeset
    84
claus
parents: 121
diff changeset
    85
578
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    86
    [instance variables:]
32
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
    87
121
claus
parents: 119
diff changeset
    88
      doItAction      <Block>         block to evaluate for doIt
123
claus
parents: 121
diff changeset
    89
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
    90
      errorFgColor    <Color>         fg-Color to be used when highlighting errors
121
claus
parents: 119
diff changeset
    91
claus
parents: 119
diff changeset
    92
      errorBgColor    <Color>         bg-Color to be used when highlighting errors
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
    93
578
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    94
      codeStartPosition               private temporary
121
claus
parents: 119
diff changeset
    95
578
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    96
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
    97
    [styleSheet values:]
121
claus
parents: 119
diff changeset
    98
claus
parents: 119
diff changeset
    99
      codeErrorSelectionForegroundColor     fg color to highlight errors
5915
d6c5de9d52bf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5906
diff changeset
   100
                                            (default: selection fg)
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   101
121
claus
parents: 119
diff changeset
   102
      codeErrorSelectionBackgroundColor     bg color to highlight errors
5915
d6c5de9d52bf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5906
diff changeset
   103
                                            (default: selection bg)
578
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
   104
1522
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   105
    [start with:]
5915
d6c5de9d52bf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5906
diff changeset
   106
        Workspace open
1522
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   107
578
5b82bc433c14 commentary
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
   108
    [see also:]
5915
d6c5de9d52bf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5906
diff changeset
   109
        Workspace EditTextView
d6c5de9d52bf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5906
diff changeset
   110
        Parser ByteCodeCompiler
583
2ec13b7ceba5 documentation
Claus Gittinger <cg@exept.de>
parents: 578
diff changeset
   111
2ec13b7ceba5 documentation
Claus Gittinger <cg@exept.de>
parents: 578
diff changeset
   112
    [author:]
5915
d6c5de9d52bf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5906
diff changeset
   113
        Claus Gittinger
32
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
   114
"
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   115
! !
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   116
3712
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
   117
!Workspace class methodsFor:'accessing'!
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
   118
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
   119
sniplets
5144
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   120
    <resource: #obsolete>
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   121
    self obsoleteMethodWarning.
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   122
    ^ self snippets
3713
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
   123
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
   124
    "
5144
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   125
     Snippets := nil
3713
a0946d019ad5 expand abbreviations
fm
parents: 3712
diff changeset
   126
    "
3712
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
   127
!
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
   128
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
   129
sniplets:something
5144
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   130
    <resource: #obsolete>
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   131
    self obsoleteMethodWarning.
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   132
    self snippets:something
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   133
!
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   134
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   135
snippets
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   136
    Snippets isNil ifTrue:[
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   137
        Snippets := Dictionary new.
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   138
        self initializeDefaultAbbreviations.
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   139
    ].
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   140
    ^ Snippets
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   141
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   142
    "
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   143
     Snippets := nil
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   144
    "
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   145
!
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   146
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   147
snippets:aDictionary
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   148
    Snippets := aDictionary.
3712
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
   149
! !
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
   150
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   151
!Workspace class methodsFor:'defaults'!
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   152
4799
4baf5f98c387 Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4784
diff changeset
   153
defaultCompletionSupportClass
4baf5f98c387 Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4784
diff changeset
   154
    ^ WorkspaceCompletionSupport
4baf5f98c387 Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4784
diff changeset
   155
4baf5f98c387 Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4784
diff changeset
   156
    "Created: / 26-09-2013 / 17:59:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
4695
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
   157
!
f133e5bd6e22 refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4691
diff changeset
   158
1522
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   159
defaultLabel
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   160
    "my default window label"
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   161
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   162
    ^ 'Workspace'
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   163
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   164
    "Created: / 16.5.1998 / 16:53:37 / cg"
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   165
!
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   166
3716
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   167
initializeDefaultAbbreviations
5144
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   168
    "default snippets/abbreviations. TODO: save/load snippets"
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   169
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   170
    "flush and reinitialize snippets with:
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   171
         Snippets := Dictionary new.
3741
d86e1e2dd088 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   172
    "
3807
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   173
    "after a code change below, update with:
5144
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   174
         self initializeDefaultAbbreviations.
3735
3b616f1c9f9b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3728
diff changeset
   175
    "
3807
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   176
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   177
    #(
5144
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   178
        't'     'true'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   179
        'f'     'false'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   180
        's'     'self'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   181
        'su'    'super'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   182
        'ss'    'super '
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   183
        'n'     'nil'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   184
        'y'     'yourself.'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   185
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   186
        'in'    'isNil '
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   187
        'nn'    'notNil '
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   188
        'ie'    'isEmpty '
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   189
        'ne'    'notEmpty '
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   190
        'ien'   'isEmptyOrNil '
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   191
        'nen'   'notEmptyOrNil '
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   192
5690
aa63cb90fa9f #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5686
diff changeset
   193
        '[it'    '[nil] ifTrue:[!!'
aa63cb90fa9f #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5686
diff changeset
   194
        '[if'    '[nil] ifFalse:[!!'
5144
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   195
        'it'    'ifTrue:[!!'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   196
        'if'    'ifFalse:[!!'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   197
        'itf'   'ifTrue:[!!] ifFalse:[].'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   198
        'int'   'isNil ifTrue:[!!].'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   199
        'inf'   'isNil ifFalse:[!!].'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   200
        'ints'  'isNil ifTrue:[^ self].'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   201
        'infs'  'isNil ifFalse:[^ self].'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   202
        'nnt'   'notNil ifTrue:[!!].'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   203
        'nnf'   'notNil ifFalse:[!!].'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   204
        'iet'   'isEmpty ifTrue:[!!].'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   205
        'net'   'notEmpty ifTrue:[!!].'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   206
        'ief'   'isEmpty ifFalse:[!!].'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   207
        'nef'   'notEmpty ifFalse:[!!].'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   208
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   209
        'wt'    'whileTrue:[!!]'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   210
        'wf'    'whileFalse:[!!]'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   211
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   212
        'do'    'do:[:each |!!]'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   213
        'd:'    'do:[:each |!!]'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   214
        'kdo'   'keysAndValuesDo:[:eachKey :eachValue |!!]'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   215
        'kvd'   'keysAndValuesDo:[:eachKey :eachValue |!!]'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   216
        'kv:'   'keysAndValuesDo:[:eachKey :eachValue |!!]'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   217
        'k:'    'keysDo:[:eachKey | !!]'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   218
        'dt'    'detect:[:each | !!]'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   219
        'de'    'detect:[:each | !!]'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   220
        'det'   'detect:[:each | !!]'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   221
        'dtn'   'detect:[:each | !!] ifNone:[]'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   222
        'cl'    'collect:[:each | !!]'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   223
        'co'    'collect:[:each | !!]'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   224
        'col'   'collect:[:each | !!]'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   225
        'sl'    'select:[:each | !!]'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   226
        'se'    'select:[:each | !!]'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   227
        'sel'   'select:[:each | !!]'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   228
        'rj'    'reject:[:each | !!]'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   229
        're'    'reject:[:each | !!]'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   230
        'rej'   'reject:[:each | !!]'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   231
        'inj'   'inject:!! into:[:accum :each | ]'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   232
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   233
        'ex'    'Error handle:[ex | !!] do:[].'
5686
261f94df209d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5685
diff changeset
   234
        '[ sh'  '[ self halt ].'
5685
ce39dfaa2120 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5682
diff changeset
   235
        '[sh'   '[self halt].'
5144
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   236
        'sh'    'self halt.'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   237
        'mt'    'MessageTally spyOn:[!!].'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   238
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   239
        'ih'    '!! ifTrue:[ self halt ].'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   240
        'ik'    'includesKey: #'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   241
        'is'    'includesString: #'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   242
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   243
        'af'    'asFilename '
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   244
        'as'    'asString '
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   245
        'aoc'   'asOrderedCollection '
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   246
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   247
        'np'    'nextPut: '
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   248
        'npa'   'nextPutAll: '
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   249
        'npl'   'nextPutLine: '
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   250
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   251
        'ps'    'printString'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   252
        'sr'    'self subclassResponsibility.'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   253
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   254
        'ati'   'at:!! ifAbsent: '
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   255
        'atip'  'at:!! ifAbsentPut:[ ] '
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   256
        'ap'    'at:!! '
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   257
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   258
        'st'    'Smalltalk'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   259
        'ts'    'Transcript showCR:''!!''.'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   260
        'trs'   'Transcript showCR:''!!''.'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   261
        'abb'   'Workspace snippets inspect.'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   262
        'ws'    'Delay waitForSeconds: 1.'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   263
        'wfs'   'Delay waitForSeconds: 1.'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   264
        'wfm'   'Delay waitForMilliseconds: 1000.'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   265
        'ini'   'initialize\    super initialize.\    '
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   266
        'newi'  'new\    ^ super new initialize.'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   267
        'upd'   'update:something with:aParameter from:changedObject\    !!\    ^ super update:something with:aParameter from:changedObject.'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   268
        'OC'    'OrderedCollection'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   269
        'oc'    'OrderedCollection'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   270
        'SC'    'SortedCollection'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   271
        'sc'    'SortedCollection'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   272
        'D'     'Dictionary'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   273
        'ID'    'IdentityDictionary'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   274
        'Id'    'IdentityDictionary'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   275
        'id'    'IdentityDictionary'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   276
        'iD'    'IdentityDictionary'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   277
        'OCn'   'OrderedCollection new.'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   278
        'ocn'   'OrderedCollection new.'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   279
        'SCn'   'SortedCollection new.'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   280
        'IDn'   'IdentityDictionary new'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   281
        'idn'   'IdentityDictionary new'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   282
        'Dn'    'Dictionary new'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   283
        'dn'    'Dictionary new'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   284
        'Sn'    'Set new'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   285
        'sn'    'Set new'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   286
        'A'     'Array'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   287
        'a'     'Array'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   288
        'An'    'Array new:'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   289
        'an'    'Array new:'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   290
        'Aw'    'Array with:'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   291
        'aw'    'Array with:'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   292
        'Aww'   'Array with:!! with:'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   293
        'sww'   'Array with:!! with:'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   294
        'Awww'  'Array with:!! with: with:'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   295
        'awww'  'Array with:!! with: with:'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   296
        'Awwww' 'Array with:!! with: with: with:'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   297
        'awwww' 'Array with:!! with: with: with:'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   298
        'aw2'   'Array with:!! with:'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   299
        'aw3'   'Array with:!! with: with:'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   300
        'aw4'   'Array with:!! with: with: with:'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   301
        '0'     '(0.0 @ 0.0)'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   302
        '1'     '(1.0 @ 1.0)'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   303
        '['     '[:!! ]'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   304
        '('     '(!! )'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   305
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   306
        "/ typos...
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   307
        'eslf'  'self'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   308
        'slef'  'self'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   309
        'sefl'  'self'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   310
        'elf'   'self'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   311
        'slf'   'self'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   312
        'sef'   'self'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   313
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   314
        'iftrue'   'ifTrue'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   315
        'iffalse'  'ifFalse'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   316
        'iftrue:'  'ifTrue:'
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   317
        'iffalse:' 'ifFalse:'
3807
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   318
    ) pairWiseDo:[:abbrev :text |
5144
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   319
        Snippets
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
   320
            at:abbrev put:text "/ ifPresent:[ self error:'duplicate abbreviation key' ]
3807
a70cb16fb224 sniplet defaults
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
   321
    ].
4148
2fe252a82d5b changed: #initializeDefaultAbbreviations
Claus Gittinger <cg@exept.de>
parents: 4141
diff changeset
   322
5690
aa63cb90fa9f #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5686
diff changeset
   323
    "Modified: / 30-04-2016 / 19:43:35 / cg"
3716
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   324
!
b4234b9a6673 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   325
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   326
updateStyleCache
444
ef26eba8c854 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 430
diff changeset
   327
    "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
   328
1354
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
   329
    <resource: #style (#'codeErrorSelection.foregroundColor'
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   330
		       #'codeErrorSelection.backgroundColor'
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   331
		       #'codeView.backgroundColor' )>
444
ef26eba8c854 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 430
diff changeset
   332
1354
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
   333
    DefaultErrorForegroundColor := StyleSheet colorAt:'codeErrorSelection.foregroundColor'.
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
   334
    DefaultErrorBackgroundColor := StyleSheet colorAt:'codeErrorSelection.backgroundColor'.
2492
740174c1be0f allow separate bg-color from styleSheet
Claus Gittinger <cg@exept.de>
parents: 2489
diff changeset
   335
    DefaultViewBackground := StyleSheet colorAt:'codeView.backgroundColor'.
32
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
   336
! !
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
   337
2776
17dca7ff1f82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2775
diff changeset
   338
!Workspace class methodsFor:'getting a new Workspace'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   339
32
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
   340
open
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   341
    "launch a new workspace"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   342
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   343
    |scr topView workspace f|
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   344
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   345
    topView := StandardSystemView
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   346
		label:(self classResources string:(self defaultLabel))
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   347
		" minExtent:(100 @ 100)".
23
69f1ba57f67a *** empty log message ***
claus
parents: 15
diff changeset
   348
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   349
    scr := HVScrollableView for:self in:topView.
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   350
    scr origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   351
    workspace := scr scrolledView.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   352
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   353
    "/ adjust topViews extent according to my font
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   354
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   355
    f := workspace font.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   356
    topView extent:((f widthOf:'x') * 40) @ (f height * 10).
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   357
    topView open.
131
claus
parents: 125
diff changeset
   358
    ^ workspace
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   359
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   360
    "
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   361
     Workspace open
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
   362
    "
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   363
1522
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   364
    "Modified: / 16.5.1998 / 16:53:53 / cg"
857
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
openForRemote:hostName
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   368
    "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
   369
     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
   370
     and the result is shown here.
857
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   371
     This requires the RemoteObjects package to be loaded."
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   372
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   373
    |server remoteCompiler workspace|
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   374
1522
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   375
    RemoteObjectServer isNil ifTrue:[
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   376
	self warn:'no remoteObjectServer available'.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   377
	^ nil
1522
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   378
    ].
857
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   379
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   380
    server := RemoteObjectServer on:hostName.
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   381
    remoteCompiler := server get:#Compiler.
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   382
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   383
    workspace := self open.
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   384
    workspace topView
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   385
	label:(self classResources string:'Remote Workspace {%1}' with:hostName).
1522
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   386
857
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   387
    workspace doItAction:
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   388
		[:theCode |
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   389
		    remoteCompiler
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   390
			evaluate:theCode
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   391
			in:nil
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   392
			receiver:nil
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   393
			notifying:workspace
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   394
			logged:true
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   395
			ifFail:nil
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   396
		]
857
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   397
    "
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   398
     Workspace openForRemote:'andi'
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   399
    "
4990383442cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   400
1522
b9b131f6c959 made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
   401
    "Modified: / 16.5.1998 / 16:57:38 / cg"
2686
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   402
!
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   403
2794
90115a2de9d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   404
openWith:initialText selected:selectedBoolean
2686
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   405
    "launch a new workspace with some initial contents"
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   406
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   407
    |workspace|
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   408
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   409
    workspace := self open.
2794
90115a2de9d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   410
    workspace contents:initialText selected:selectedBoolean.
2686
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   411
    ^ workspace
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   412
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   413
    "
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   414
     Workspace openWith:'Transcript showCR:''hello world'''
ec869d3db366 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
   415
    "
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   416
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   417
2657
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   418
!Workspace class methodsFor:'history'!
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   419
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   420
clearDoItHistory
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   421
    DoItHistory := nil
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
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   424
doItHistory
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   425
    ^ DoItHistory
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   426
!
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   427
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   428
doItHistorySize
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   429
    "the number of remembered doIts"
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   430
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   431
    ^ 20
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   432
!
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   433
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   434
rememberDoIt:aString
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   435
    |string|
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   436
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   437
    string := aString asString string withoutSeparators.
2726
f258efeca730 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2717
diff changeset
   438
    (string asCollectionOfWords size <= 1) ifTrue:[
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   439
	Error handle:[:ex |
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   440
	    "/ unparsable
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   441
	    ^ self
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   442
	] do:[
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   443
	    ((Scanner new scanTokens:string) size <= 1) ifTrue:[
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   444
		"it's a variable only"
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   445
		^ self
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   446
	    ]
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   447
	]
2726
f258efeca730 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2717
diff changeset
   448
    ].
2657
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   449
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   450
    DoItHistory isNil ifTrue:[
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   451
	DoItHistory := OrderedCollection new.
2657
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   452
    ].
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   453
    DoItHistory remove:string ifAbsent:nil.
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   454
    DoItHistory addFirst:string.
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   455
    DoItHistory size > self doItHistorySize ifTrue:[
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   456
	DoItHistory removeLast
2657
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   457
    ].
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   458
! !
bbe77cbf006f doIt history
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   459
1523
6c0045d6a91f open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents: 1522
diff changeset
   460
!Workspace class methodsFor:'queries'!
6c0045d6a91f open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents: 1522
diff changeset
   461
6c0045d6a91f open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents: 1522
diff changeset
   462
isVisualStartable
6c0045d6a91f open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents: 1522
diff changeset
   463
    "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
   464
     (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
   465
6c0045d6a91f open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents: 1522
diff changeset
   466
    ^ self == Workspace
6c0045d6a91f open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents: 1522
diff changeset
   467
6c0045d6a91f open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents: 1522
diff changeset
   468
    "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
   469
    "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
   470
! !
6c0045d6a91f open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents: 1522
diff changeset
   471
1931
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   472
!Workspace class methodsFor:'workspace variables'!
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   473
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   474
addWorkspaceVariable:name
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   475
    "create a new workspace variable"
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   476
1933
a3d9c133279f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1932
diff changeset
   477
    |holder|
a3d9c133279f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1932
diff changeset
   478
3325
b7e01a88b167 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3319
diff changeset
   479
    holder := self workspaceVariables at:name ifAbsentPut:[ ValueHolder new ].
1933
a3d9c133279f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1932
diff changeset
   480
    ^ holder
1931
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   481
!
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   482
3157
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   483
anyWorkspaceVariableIsDefined
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   484
    ^ WorkspaceVariables notEmptyOrNil
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   485
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   486
    "Created: / 20-04-2005 / 11:57:53 / cg"
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   487
!
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   488
5945
de97bfa91a3a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5915
diff changeset
   489
rememberResultAsWorkspaceVariable:lastResult
de97bfa91a3a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5915
diff changeset
   490
    "remember some last result as _0,
de97bfa91a3a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5915
diff changeset
   491
     and shift the previous results (i.e. _0 -> _1 -> .. _9)"
de97bfa91a3a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5915
diff changeset
   492
de97bfa91a3a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5915
diff changeset
   493
    |workspaceVariables|
de97bfa91a3a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5915
diff changeset
   494
de97bfa91a3a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5915
diff changeset
   495
    workspaceVariables := self workspaceVariables.
de97bfa91a3a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5915
diff changeset
   496
    
de97bfa91a3a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5915
diff changeset
   497
    9 to:1 by:-1 do:[:h|
de97bfa91a3a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5915
diff changeset
   498
        (workspaceVariables includesKey:('_%1' bindWith:h-1)) ifTrue:[
5961
eaeba68ee65f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5945
diff changeset
   499
            self workspaceVariableAt:('_%1' bindWith:h)
eaeba68ee65f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5945
diff changeset
   500
                 put:(self workspaceVariableAt:('_%1' bindWith:h-1)).
5945
de97bfa91a3a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5915
diff changeset
   501
        ].
de97bfa91a3a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5915
diff changeset
   502
    ].
5961
eaeba68ee65f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5945
diff changeset
   503
    self workspaceVariableAt:'_0' put:lastResult.
eaeba68ee65f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5945
diff changeset
   504
eaeba68ee65f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5945
diff changeset
   505
    "Modified: / 08-11-2016 / 22:39:41 / cg"
5945
de97bfa91a3a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5915
diff changeset
   506
!
de97bfa91a3a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5915
diff changeset
   507
1931
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   508
removeAllWorkspaceVariables
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   509
    "delete all workspace variables"
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   510
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   511
    WorkspaceVariables := nil
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   512
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   513
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   514
!
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   515
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   516
removeWorkspaceVariable:name
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   517
    "delete a workspace variable"
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   518
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   519
    WorkspaceVariables notNil ifTrue:[
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   520
	WorkspaceVariables removeKey:name ifAbsent:nil.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   521
	WorkspaceVariables := WorkspaceVariables asNilIfEmpty.
1931
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   522
    ].
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   523
!
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   524
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   525
workspaceVariableAt:name
4924
c911b709e213 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4923
diff changeset
   526
    "retrieve a workspace variable's value"
c911b709e213 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4923
diff changeset
   527
c911b709e213 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4923
diff changeset
   528
    ^ (self workspaceVariableHolderAt:name) value
c911b709e213 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4923
diff changeset
   529
c911b709e213 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4923
diff changeset
   530
    "
c911b709e213 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4923
diff changeset
   531
     Workspace workspaceVariableAt:'foo' put:1234.
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   532
     Workspace workspaceVariableAt:'foo'
4924
c911b709e213 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4923
diff changeset
   533
    "
c911b709e213 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4923
diff changeset
   534
!
c911b709e213 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4923
diff changeset
   535
c911b709e213 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4923
diff changeset
   536
workspaceVariableAt:name put:aValue
c911b709e213 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4923
diff changeset
   537
    "set or define a workspace variable"
c911b709e213 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4923
diff changeset
   538
c911b709e213 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4923
diff changeset
   539
    (self workspaceVariables at:name ifAbsentPut:[ ValueHolder new]) value:aValue
c911b709e213 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4923
diff changeset
   540
!
c911b709e213 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4923
diff changeset
   541
c911b709e213 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4923
diff changeset
   542
workspaceVariableHolderAt:name
1931
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   543
    "retrieve a workspace variable (actually, a holder onto it)"
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   544
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   545
    WorkspaceVariables isNil ifTrue:[^ nil].
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   546
    ^ WorkspaceVariables at:name ifAbsent:nil.
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   547
4924
c911b709e213 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4923
diff changeset
   548
    "
c911b709e213 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4923
diff changeset
   549
     Workspace workspaceVariableAt:'foo' put:1234.
c911b709e213 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4923
diff changeset
   550
     Workspace workspaceVariableAt:'foo' put:1234.
c911b709e213 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4923
diff changeset
   551
    "
1932
a898c608fb9a support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   552
!
a898c608fb9a support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   553
3157
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   554
workspaceVariableNames
4923
d61e27d85c66 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4922
diff changeset
   555
    "retrieve the collection of workspace variable names only"
3157
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   556
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   557
    WorkspaceVariables isNil ifTrue:[^ #()].
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   558
    ^ WorkspaceVariables keys
1932
a898c608fb9a support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   559
3157
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   560
    "Created: / 20-04-2005 / 11:42:45 / cg"
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   561
!
1932
a898c608fb9a support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   562
3157
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   563
workspaceVariables
4924
c911b709e213 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4923
diff changeset
   564
    "retrieve the collection of workspace variable holders.
3157
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   565
     That is a dictionary associating names to values."
1932
a898c608fb9a support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   566
3325
b7e01a88b167 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3319
diff changeset
   567
    WorkspaceVariables isNil ifTrue:[
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   568
	WorkspaceVariables := Dictionary new.
3325
b7e01a88b167 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3319
diff changeset
   569
    ].
b7e01a88b167 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3319
diff changeset
   570
    ^ WorkspaceVariables
3157
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   571
12d85afaf320 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
   572
    "Modified: / 20-04-2005 / 11:43:14 / cg"
1931
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   573
! !
06cbb886dd10 support for workspace variables
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
   574
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   575
!Workspace methodsFor:'accessing'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   576
3428
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
   577
allowValueDrop:aBoolean
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
   578
    "if on (the default), any smalltalk value can be dropped and leads to a workspace variable
5595
925147560958 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5579
diff changeset
   579
     holding on to that being defined. Can be turned off, if you don't like this (for standAlone apps)"
3428
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
   580
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
   581
    allowValueDrop := aBoolean.
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
   582
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
   583
    "Created: / 28-11-2006 / 16:13:02 / cg"
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
   584
!
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
   585
2679
1e61847e26f4 autoDefine as doIt added
Claus Gittinger <cg@exept.de>
parents: 2663
diff changeset
   586
autoDefineVariables
4090
703569e25553 changed:
Claus Gittinger <cg@exept.de>
parents: 4057
diff changeset
   587
    "undefined variables handling:
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   588
	are automatically defined as workspace variable if autoDefineVariables is #workspace.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   589
	are automatically defined as doit variable if autoDefineVariables is #doit.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   590
	are left undefined if autoDefineVariables is nil."
4090
703569e25553 changed:
Claus Gittinger <cg@exept.de>
parents: 4057
diff changeset
   591
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   592
    ^ autoDefineVariables
2535
0884418b7c41 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2534
diff changeset
   593
!
0884418b7c41 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2534
diff changeset
   594
2679
1e61847e26f4 autoDefine as doIt added
Claus Gittinger <cg@exept.de>
parents: 2663
diff changeset
   595
autoDefineVariables:nilOrSymbol
3429
670414b849dd allow value drop to be disabled
Claus Gittinger <cg@exept.de>
parents: 3428
diff changeset
   596
    "undefined variables handling:
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   597
	are automatically defined as workspace variable if nilOrSymbol is #workspace.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   598
	are automatically defined as doit variable if nilOrSymbol is #doit.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   599
	are left undefined if nilOrSymbol is nil."
3429
670414b849dd allow value drop to be disabled
Claus Gittinger <cg@exept.de>
parents: 3428
diff changeset
   600
2679
1e61847e26f4 autoDefine as doIt added
Claus Gittinger <cg@exept.de>
parents: 2663
diff changeset
   601
    autoDefineVariables := nilOrSymbol.
3429
670414b849dd allow value drop to be disabled
Claus Gittinger <cg@exept.de>
parents: 3428
diff changeset
   602
670414b849dd allow value drop to be disabled
Claus Gittinger <cg@exept.de>
parents: 3428
diff changeset
   603
    "Modified: / 28-11-2006 / 16:21:01 / cg"
2679
1e61847e26f4 autoDefine as doIt added
Claus Gittinger <cg@exept.de>
parents: 2663
diff changeset
   604
!
2535
0884418b7c41 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2534
diff changeset
   605
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   606
commentStrings:anArrayOfCommentStrings
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   607
    "define the comment strings"
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   608
4876
bd61d63ca402 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4815
diff changeset
   609
    "/ The argument must be of the form:
bd61d63ca402 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4815
diff changeset
   610
    "/    #(
bd61d63ca402 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4815
diff changeset
   611
    "/        '"/'
bd61d63ca402 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4815
diff changeset
   612
    "/        ('"' '"')
bd61d63ca402 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4815
diff changeset
   613
    "/    )
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   614
    "/ where simple string elements define the EOL comment sequence,
6170
32595ba6f28a #OTHER by mawalch
mawalch
parents: 6148
diff changeset
   615
    "/ and pairs define regular comment opening/closing sequences.
4876
bd61d63ca402 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4815
diff changeset
   616
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   617
    commentStrings := anArrayOfCommentStrings
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   618
6170
32595ba6f28a #OTHER by mawalch
mawalch
parents: 6148
diff changeset
   619
    "Created: / 09-11-1997 / 01:05:25 / cg"
32595ba6f28a #OTHER by mawalch
mawalch
parents: 6148
diff changeset
   620
    "Modified (comment): / 15-06-2017 / 01:44:15 / mawalch"
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   621
!
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   622
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   623
doItAction
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   624
    "return the action to be performed when 'doIt' is selected"
32
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
   625
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   626
    ^ doItAction
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   627
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   628
4584
ba63ceaa4916 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4568
diff changeset
   629
doItAction:aOneArgBlock
ba63ceaa4916 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4568
diff changeset
   630
    "define the action to be performed when 'doIt' is selected.
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   631
     The block will be evaluated, passing the selection as a String argument.
4584
ba63ceaa4916 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4568
diff changeset
   632
     A default doItAction is set for you in the initialize method."
ba63ceaa4916 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4568
diff changeset
   633
ba63ceaa4916 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4568
diff changeset
   634
    doItAction := aOneArgBlock
ba63ceaa4916 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4568
diff changeset
   635
ba63ceaa4916 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4568
diff changeset
   636
    "Modified: 27.2.1996 / 15:31:37 / cg"
ba63ceaa4916 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4568
diff changeset
   637
!
ba63ceaa4916 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4568
diff changeset
   638
4675
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   639
editedClass
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   640
    "for the code completion"
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   641
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   642
    editedMethodOrClass isNil ifTrue:[^ nil].
5621
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
   643
    ^ editedMethodOrClass isBehavior 
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
   644
        ifTrue:[editedMethodOrClass] 
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
   645
        ifFalse:[editedMethodOrClass mclass]
4675
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   646
!
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   647
4776
fb82694b23d8 Pass programming language when asking DWIM to complete code
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4769
diff changeset
   648
editedLanguage
6148
66bf9fc0dfe4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6129
diff changeset
   649
    "get the programming language (for comments, indentation etc.)"
66bf9fc0dfe4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6129
diff changeset
   650
5595
925147560958 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5579
diff changeset
   651
    |mthd cls|
925147560958 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5579
diff changeset
   652
    
4776
fb82694b23d8 Pass programming language when asking DWIM to complete code
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4769
diff changeset
   653
    editedLanguage notNil ifTrue:[
5595
925147560958 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5579
diff changeset
   654
        ^ editedLanguage
4776
fb82694b23d8 Pass programming language when asking DWIM to complete code
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4769
diff changeset
   655
    ].
6687
0cccc4bffe67 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 6679
diff changeset
   656
    (mthd := self editedMethod) notNil ifTrue:[
5595
925147560958 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5579
diff changeset
   657
        ^ mthd programmingLanguage.
4776
fb82694b23d8 Pass programming language when asking DWIM to complete code
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4769
diff changeset
   658
    ].
5595
925147560958 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5579
diff changeset
   659
    (cls := self editedClass) notNil ifTrue:[
925147560958 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5579
diff changeset
   660
        ^ cls programmingLanguage.
4776
fb82694b23d8 Pass programming language when asking DWIM to complete code
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4769
diff changeset
   661
    ].
fb82694b23d8 Pass programming language when asking DWIM to complete code
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4769
diff changeset
   662
    ^ nil
fb82694b23d8 Pass programming language when asking DWIM to complete code
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4769
diff changeset
   663
fb82694b23d8 Pass programming language when asking DWIM to complete code
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4769
diff changeset
   664
    "Modified: / 18-09-2013 / 12:58:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6148
66bf9fc0dfe4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6129
diff changeset
   665
    "Modified (comment): / 25-04-2017 / 12:53:40 / cg"
4776
fb82694b23d8 Pass programming language when asking DWIM to complete code
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4769
diff changeset
   666
!
fb82694b23d8 Pass programming language when asking DWIM to complete code
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4769
diff changeset
   667
fb82694b23d8 Pass programming language when asking DWIM to complete code
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4769
diff changeset
   668
editedLanguage:aProgrammingLanguageOrNil
6148
66bf9fc0dfe4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6129
diff changeset
   669
    "set the programming language (for comments, indentation etc.)"
66bf9fc0dfe4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6129
diff changeset
   670
    
4776
fb82694b23d8 Pass programming language when asking DWIM to complete code
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4769
diff changeset
   671
    editedLanguage := aProgrammingLanguageOrNil.
5024
d000eac18ce2 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5009
diff changeset
   672
    aProgrammingLanguageOrNil notNil ifTrue:[
6148
66bf9fc0dfe4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6129
diff changeset
   673
        commentStrings := aProgrammingLanguageOrNil commentStrings.
5024
d000eac18ce2 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5009
diff changeset
   674
    ].
6148
66bf9fc0dfe4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6129
diff changeset
   675
66bf9fc0dfe4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6129
diff changeset
   676
    "Modified (comment): / 25-04-2017 / 12:53:33 / cg"
4776
fb82694b23d8 Pass programming language when asking DWIM to complete code
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4769
diff changeset
   677
!
fb82694b23d8 Pass programming language when asking DWIM to complete code
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4769
diff changeset
   678
4675
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   679
editedMethod
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   680
    "for the code completion"
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   681
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   682
    editedMethodOrClass isNil ifTrue:[^ nil].
5621
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
   683
    ^ editedMethodOrClass isBehavior 
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
   684
        ifTrue:[nil] 
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
   685
        ifFalse:[editedMethodOrClass]
4675
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   686
!
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   687
4606
86670e36b110 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4593
diff changeset
   688
editedMethodOrClass
86670e36b110 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4593
diff changeset
   689
    "for the code completion"
86670e36b110 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4593
diff changeset
   690
86670e36b110 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4593
diff changeset
   691
    ^ editedMethodOrClass.
86670e36b110 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4593
diff changeset
   692
!
86670e36b110 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4593
diff changeset
   693
86670e36b110 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4593
diff changeset
   694
editedMethodOrClass:aMethodOrClass
6129
159be1289d8b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6021
diff changeset
   695
    "Sets the edited method or class (for code completion)"
4606
86670e36b110 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4593
diff changeset
   696
86670e36b110 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4593
diff changeset
   697
    editedMethodOrClass := aMethodOrClass.
6129
159be1289d8b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6021
diff changeset
   698
159be1289d8b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6021
diff changeset
   699
    "Modified (comment): / 09-03-2017 / 10:41:05 / cg"
4606
86670e36b110 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4593
diff changeset
   700
!
86670e36b110 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4593
diff changeset
   701
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   702
errorBackgroundColor
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   703
    errorBgColor notNil ifTrue:[ ^ errorBgColor ].
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   704
    DefaultErrorBackgroundColor notNil ifTrue:[ ^ DefaultErrorBackgroundColor ].
5621
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
   705
    device hasColors ifTrue:[ ^ Color red ].
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   706
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   707
    ^ selectionBgColor
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   708
!
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   709
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   710
errorForegroundColor
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   711
    errorFgColor notNil ifTrue:[ ^ errorFgColor ].
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   712
    DefaultErrorForegroundColor notNil ifTrue:[ ^ DefaultErrorForegroundColor ].
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   713
    ^ selectionFgColor
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   714
!
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   715
4815
f75345885ad7 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
   716
nameSpaceForDoits
f75345885ad7 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
   717
    "can be used by the embedding application to control doIt execution
f75345885ad7 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
   718
     (especially: for tools like expecco, to provide better workspaces"
f75345885ad7 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
   719
f75345885ad7 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
   720
    ^ namespaceForDoits ? Smalltalk
f75345885ad7 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
   721
!
f75345885ad7 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
   722
4436
0834dc472b3f added: #nameSpaceForDoits:
Claus Gittinger <cg@exept.de>
parents: 4432
diff changeset
   723
nameSpaceForDoits:aNameSpaceOrNil
0834dc472b3f added: #nameSpaceForDoits:
Claus Gittinger <cg@exept.de>
parents: 4432
diff changeset
   724
    "can be used by the embedding application to control doIt execution
0834dc472b3f added: #nameSpaceForDoits:
Claus Gittinger <cg@exept.de>
parents: 4432
diff changeset
   725
     (especially: for tools like expecco, to provide better workspaces"
0834dc472b3f added: #nameSpaceForDoits:
Claus Gittinger <cg@exept.de>
parents: 4432
diff changeset
   726
0834dc472b3f added: #nameSpaceForDoits:
Claus Gittinger <cg@exept.de>
parents: 4432
diff changeset
   727
    namespaceForDoits := aNameSpaceOrNil.
0834dc472b3f added: #nameSpaceForDoits:
Claus Gittinger <cg@exept.de>
parents: 4432
diff changeset
   728
0834dc472b3f added: #nameSpaceForDoits:
Claus Gittinger <cg@exept.de>
parents: 4432
diff changeset
   729
    "Created: / 26-07-2012 / 23:06:04 / cg"
0834dc472b3f added: #nameSpaceForDoits:
Claus Gittinger <cg@exept.de>
parents: 4432
diff changeset
   730
!
0834dc472b3f added: #nameSpaceForDoits:
Claus Gittinger <cg@exept.de>
parents: 4432
diff changeset
   731
4391
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
   732
namespaceForDoits:aNameSpaceOrNil
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
   733
    "can be used by the embedding application to control doIt execution
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
   734
     (especially: for tools like expecco, to provide better workspaces"
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
   735
4436
0834dc472b3f added: #nameSpaceForDoits:
Claus Gittinger <cg@exept.de>
parents: 4432
diff changeset
   736
    <resource: #obsolete>
0834dc472b3f added: #nameSpaceForDoits:
Claus Gittinger <cg@exept.de>
parents: 4432
diff changeset
   737
4391
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
   738
    namespaceForDoits := aNameSpaceOrNil.
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
   739
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
   740
    "Created: / 04-03-2012 / 13:34:51 / cg"
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
   741
!
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
   742
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
   743
poolsConsideredInDoIts:aCollectionOfPools
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
   744
    "can be used by the embedding application to control doIt execution
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
   745
     (especially: for tools like expecco, to provide better workspaces"
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
   746
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
   747
    poolsConsideredInDoIts := aCollectionOfPools.
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
   748
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
   749
    "Modified (format): / 04-03-2012 / 13:35:00 / cg"
3537
1761370c0869 sharedPool access in doIts
Claus Gittinger <cg@exept.de>
parents: 3511
diff changeset
   750
!
1761370c0869 sharedPool access in doIts
Claus Gittinger <cg@exept.de>
parents: 3511
diff changeset
   751
6129
159be1289d8b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6021
diff changeset
   752
simulatedSelf
159be1289d8b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6021
diff changeset
   753
    "the 'self' instance used in an evaluation (also used in code completion of self messages)"
159be1289d8b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6021
diff changeset
   754
159be1289d8b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6021
diff changeset
   755
    ^ simulatedSelf
159be1289d8b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6021
diff changeset
   756
159be1289d8b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6021
diff changeset
   757
    "Created: / 09-03-2017 / 10:48:27 / cg"
159be1289d8b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6021
diff changeset
   758
!
159be1289d8b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6021
diff changeset
   759
2601
d52e69edc760 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2595
diff changeset
   760
simulatedSelf:anObject
6129
159be1289d8b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6021
diff changeset
   761
    "define what self is in an evaluation (also useful in code completion of self messages)"
2601
d52e69edc760 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2595
diff changeset
   762
d52e69edc760 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2595
diff changeset
   763
    simulatedSelf := anObject
6129
159be1289d8b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6021
diff changeset
   764
159be1289d8b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6021
diff changeset
   765
    "Modified (comment): / 09-03-2017 / 10:48:32 / cg"
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   766
!
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   767
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   768
warningBackgroundColor
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   769
    DefaultWarningBackgroundColor notNil ifTrue:[ ^ DefaultWarningBackgroundColor ].
5621
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
   770
    device hasColors ifTrue:[ ^ Color orange ].
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   771
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   772
    ^ selectionBgColor
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   773
!
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   774
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   775
warningForegroundColor
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   776
    DefaultWarningForegroundColor notNil ifTrue:[ ^ DefaultWarningForegroundColor ].
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   777
    ^ selectionFgColor
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   778
! !
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   779
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   780
!Workspace methodsFor:'compiler interface'!
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   781
2303
a0cce4808d1d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2285
diff changeset
   782
compilerClass
4432
2eaf85d92e62 corrected switching languages between tabs
Claus Gittinger <cg@exept.de>
parents: 4427
diff changeset
   783
    ^ compilerClass "? Compiler"
2eaf85d92e62 corrected switching languages between tabs
Claus Gittinger <cg@exept.de>
parents: 4427
diff changeset
   784
2eaf85d92e62 corrected switching languages between tabs
Claus Gittinger <cg@exept.de>
parents: 4427
diff changeset
   785
    "Modified: / 19-07-2012 / 17:04:35 / cg"
2980
37d217fbca80 syntax setting
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   786
!
37d217fbca80 syntax setting
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   787
37d217fbca80 syntax setting
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   788
compilerClass:aCompilerClass
37d217fbca80 syntax setting
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   789
    compilerClass := aCompilerClass
2303
a0cce4808d1d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2285
diff changeset
   790
!
a0cce4808d1d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2285
diff changeset
   791
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   792
currentSourceCode
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   793
    "special interface to compiler - called by parser
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   794
     to get the updated source code after a corrected error"
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   795
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   796
    ^ self contents
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   797
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   798
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   799
wantChangeLog
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   800
    "sent by the compiler to ask if a changeLog entry should
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   801
     be written. Return true here."
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   802
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   803
    ^ true
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   804
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   805
2754
4e479333efa3 method category rename
Claus Gittinger <cg@exept.de>
parents: 2751
diff changeset
   806
!Workspace methodsFor:'compiler interface-error handling'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   807
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   808
correctableError:aString position:relPos to:relEndPos from:aCompiler
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   809
    "compiler notifies us of a correctable error;
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   810
     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
   811
     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
   812
     to be corrected; false otherwise"
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   813
5680
4a392137c898 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5669
diff changeset
   814
    |action sameForAllHolder possibleFixes 
4a392137c898 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5669
diff changeset
   815
     doNotShowAgainHolder doNotShowAgainForThisMethodHolder doNotShowAgainForThisReceiverSelectorHolder|
4675
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   816
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   817
    "/ the declare/correct fixes are here for backward compatibility
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   818
    "/ (in previous versions, these two were always offered as fix,
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   819
    "/ and compilers which honor the old interface will not anwer the PossibleCorrectionsQuery)
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   820
    possibleFixes := Parser possibleCorrectionsQuery query.
4175
e7063a3e7ec5 changed: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4172
diff changeset
   821
e7063a3e7ec5 changed: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4172
diff changeset
   822
    sameForAllHolder := false asValue.
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   823
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   824
    self highlightingErrorPosition:relPos to:relEndPos do:[
5290
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   825
        doNotShowAgainHolder := false asValue.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   826
        doNotShowAgainForThisMethodHolder := false asValue.
5680
4a392137c898 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5669
diff changeset
   827
        doNotShowAgainForThisReceiverSelectorHolder := false asValue.
5290
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   828
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   829
        Dialog modifyingBoxWith:[:box |
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   830
            |declareButton makeSpaceOnlyOnce|
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   831
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   832
            (box isKindOf:OptionBox) ifTrue:[ 
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   833
                "/ a bad hack for subDialogs... needs fix
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   834
                makeSpaceOnlyOnce := [ box addVerticalSpace:10. makeSpaceOnlyOnce := nil ].
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   835
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   836
                DoNotShowCompilerWarningAgainActionQuery isHandled ifTrue:[
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   837
                    makeSpaceOnlyOnce value.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   838
                    box verticalPanel
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   839
                        add:(CheckBox
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   840
                                label: "addCheckBoxAtBottom:" 'Do not show this dialog again (reenable via Launcher''s settings dialog)'
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   841
                                model:doNotShowAgainHolder).
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   842
                ].
5680
4a392137c898 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5669
diff changeset
   843
                DoNotShowCompilerWarningAgainForThisReceiverSelectorActionQuery isHandled ifTrue:[  
4a392137c898 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5669
diff changeset
   844
                    makeSpaceOnlyOnce value.
4a392137c898 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5669
diff changeset
   845
                    box verticalPanel
4a392137c898 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5669
diff changeset
   846
                        add:(CheckBox
4a392137c898 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5669
diff changeset
   847
                                label:(resources string:'Do not warn for this receiver>>selector combination (reenable earlier via Launcher''s settings dialog)')
4a392137c898 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5669
diff changeset
   848
                                model:doNotShowAgainForThisReceiverSelectorHolder).
4a392137c898 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5669
diff changeset
   849
                ].    
5290
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   850
                DoNotShowCompilerWarningAgainForThisMethodActionQuery isHandled ifTrue:[
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   851
                    makeSpaceOnlyOnce value.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   852
                    box verticalPanel
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   853
                        add:(CheckBox
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   854
                                label:(resources string:'Do not warn in this method (for %1 - reenable earlier via Launcher''s settings dialog)' with:ParserFlags perMethodDisableWarningTimeDuration)
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   855
                                model:doNotShowAgainForThisMethodHolder).
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   856
                ].
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   857
                SameForAllNotification isHandled ifTrue:[
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   858
                    box addVerticalSpace:10.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   859
                    box addCheckBoxAtBottom:'Same action for all' on:sameForAllHolder
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   860
                ].
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   861
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   862
                declareButton := box buttons at:2.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   863
                declareButton pressAction:declareButton controller releaseAction.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   864
                declareButton controller beTriggerOnDown.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   865
            ]
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   866
        ] do:[
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   867
            |buttonLabels actions|
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   868
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   869
            buttonLabels := OrderedCollection new.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   870
            actions := OrderedCollection new.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   871
            buttonLabels add:'Cancel'. actions add:#abort.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   872
            possibleFixes do:[:each |
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   873
                buttonLabels add:(each buttonLabel). actions add:each.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   874
            ].
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   875
            buttonLabels add:'Continue'. actions add:#continue.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   876
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   877
            action := OptionBox
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   878
                          request:aString
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   879
                          label:(resources string:'Correctable Error')
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   880
                          image:(WarningBox iconBitmap)
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   881
                          buttonLabels:(resources array:buttonLabels)
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   882
                          values:actions
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   883
                          default:#continue
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   884
                          onCancel:#abort.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   885
        ].
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   886
    ].
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   887
4175
e7063a3e7ec5 changed: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4172
diff changeset
   888
    sameForAllHolder value ifTrue:[
5290
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   889
        SameForAllNotification notify
4175
e7063a3e7ec5 changed: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4172
diff changeset
   890
    ].
4691
398ab7693051 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
   891
    doNotShowAgainHolder value == true ifTrue:[
5290
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   892
        DoNotShowCompilerWarningAgainActionQuery actionQuery value
4691
398ab7693051 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
   893
    ].
398ab7693051 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
   894
    doNotShowAgainForThisMethodHolder value == true ifTrue:[
5290
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   895
        DoNotShowCompilerWarningAgainForThisMethodActionQuery actionQuery value
4691
398ab7693051 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
   896
    ].
5680
4a392137c898 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5669
diff changeset
   897
    doNotShowAgainForThisReceiverSelectorHolder value == true ifTrue:[
4a392137c898 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5669
diff changeset
   898
        DoNotShowCompilerWarningAgainForThisReceiverSelectorActionQuery actionQuery value
4a392137c898 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5669
diff changeset
   899
    ].
4691
398ab7693051 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
   900
4675
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   901
    action == #cancel ifTrue:[
5290
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   902
        ^ false
4675
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   903
    ].
4175
e7063a3e7ec5 changed: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4172
diff changeset
   904
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   905
    action == #abort ifTrue:[
5290
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   906
        AbortOperationRequest raise.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   907
        ^ false
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   908
    ].
4675
bd3425b7222f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   909
    ^ action
368
53476ee1fbee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
   910
4386
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
   911
    "Modified: / 28-02-2012 / 10:42:27 / cg"
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   912
!
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   913
2104
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   914
correctableSelectorWarning:aString position:relPos to:relEndPos from:aCompiler
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   915
    "compiler notifies us of a correctable selector warning;
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   916
     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
   917
     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
   918
     to be corrected; false otherwise"
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   919
3744
c206f437042e turn on/off selector warnings
Claus Gittinger <cg@exept.de>
parents: 3742
diff changeset
   920
    |action doNotShowAgainHolder|
2104
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   921
3261
62a2ab999d42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3252
diff changeset
   922
    self highlightingWarningPosition:relPos to:relEndPos do:[
6321
cf13accef85c #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6319
diff changeset
   923
        doNotShowAgainHolder := false asValue.
cf13accef85c #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6319
diff changeset
   924
        DialogBox modifyingBoxWith:[:box |
cf13accef85c #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6319
diff changeset
   925
            MessageNotUnderstood catch:[
cf13accef85c #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6319
diff changeset
   926
                (aCompiler notNil and:[DoNotShowCompilerWarningAgainActionQuery isHandled]) ifTrue:[
cf13accef85c #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6319
diff changeset
   927
                    box addCheckBoxAtBottom:'Do not show this dialog again (reenable via Launchers Settings Dialog)' on:doNotShowAgainHolder.
cf13accef85c #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6319
diff changeset
   928
                ].
cf13accef85c #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6319
diff changeset
   929
            ].
cf13accef85c #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6319
diff changeset
   930
        ] do:[
cf13accef85c #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6319
diff changeset
   931
            action := OptionBox
cf13accef85c #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6319
diff changeset
   932
                      request:aString
cf13accef85c #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6319
diff changeset
   933
                      label:(resources string:'Warning')
cf13accef85c #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6319
diff changeset
   934
                      image:(WarningBox iconBitmap)
cf13accef85c #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6319
diff changeset
   935
                      buttonLabels:(resources array:#('Cancel' 'Correct...' 'Generate' 'Continue'))
cf13accef85c #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6319
diff changeset
   936
                      values:#(#abort #correct #generate #continue)
cf13accef85c #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6319
diff changeset
   937
                      default:#continue
cf13accef85c #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6319
diff changeset
   938
                      onCancel:#abort.
cf13accef85c #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6319
diff changeset
   939
        ].
cf13accef85c #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6319
diff changeset
   940
        doNotShowAgainHolder value == true ifTrue:[
cf13accef85c #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6319
diff changeset
   941
            DoNotShowCompilerWarningAgainActionQuery actionQuery value
cf13accef85c #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6319
diff changeset
   942
        ].
2104
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   943
    ].
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   944
2338
4c67cec79a84 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2326
diff changeset
   945
    action == #generate ifTrue:[
6321
cf13accef85c #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6319
diff changeset
   946
        ^ action
2338
4c67cec79a84 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2326
diff changeset
   947
    ].
4c67cec79a84 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2326
diff changeset
   948
2391
f8cd579704db optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents: 2388
diff changeset
   949
    (action isNil or:[action == #abort]) ifTrue:[
6321
cf13accef85c #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6319
diff changeset
   950
        AbortOperationRequest raise.
cf13accef85c #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6319
diff changeset
   951
        ^ false
2104
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   952
    ].
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   953
    ^ action == #correct
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   954
4386
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
   955
    "Created: / 19-01-2000 / 16:27:28 / cg"
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
   956
    "Modified: / 28-02-2012 / 10:42:37 / cg"
6321
cf13accef85c #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6319
diff changeset
   957
    "Modified: / 15-05-2018 / 20:52:55 / stefan"
2104
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   958
!
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   959
4188
601acd1e72fe added: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4186
diff changeset
   960
correctableWarning:aString position:relPos to:relEndPos from:aCompiler
601acd1e72fe added: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4186
diff changeset
   961
    "compiler notifies us of a correctable warning;
601acd1e72fe added: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4186
diff changeset
   962
     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
   963
     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
   964
     to be corrected; false otherwise"
601acd1e72fe added: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4186
diff changeset
   965
601acd1e72fe added: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4186
diff changeset
   966
    ^ self correctableError:aString position:relPos to:relEndPos from:aCompiler
601acd1e72fe added: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4186
diff changeset
   967
601acd1e72fe added: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4186
diff changeset
   968
    "Created: / 02-11-2010 / 13:29:01 / cg"
601acd1e72fe added: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4186
diff changeset
   969
!
601acd1e72fe added: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4186
diff changeset
   970
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   971
error:aString position:relPos to:relEndPos asWarning:asWarning
6353
fb68da3ca28e #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 6332
diff changeset
   972
    <resource: #obsolete>
2277
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   973
    "obsolete - no longer invoked"
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   974
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   975
    ^ self error:aString position:relPos to:relEndPos from:nil asWarning:asWarning
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   976
!
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   977
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   978
error:aString position:relPos to:relEndPos from:aCompiler
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   979
    "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
   980
     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
   981
     Return true for correction, false of not (or not possible)"
2277
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   982
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   983
    ^ 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
   984
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   985
    "Modified (Comment): / 30-06-2011 / 19:47:36 / cg"
2277
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   986
!
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   987
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   988
error:aString position:relPos to:relEndPos from:aCompiler asWarning:asWarning
3397
cd20f51edc25 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3396
diff changeset
   989
    "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
   990
     and show a Box asking for continue/abort."
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   991
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   992
    |answer fg bg|
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   993
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   994
    fg := asWarning ifTrue:[ self warningForegroundColor ] ifFalse:[ self errorForegroundColor ].
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   995
    bg := asWarning ifTrue:[ self warningBackgroundColor ] ifFalse:[ self errorBackgroundColor ].
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   996
3397
cd20f51edc25 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3396
diff changeset
   997
    self
5290
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   998
        highlightingErrorPosition:relPos to:relEndPos
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   999
        withForeground:fg andBackground:bg
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1000
        do:[
6674
ac7f385346ee #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6616
diff changeset
  1001
            |box lbl doEnableOptionHolder doNotShowAgainHolder doNotShowAgainForThisMethodHolder l1 y1 y2 l2|
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1002
4170
6bf83a2af71f changed: #error:position:to:from:asWarning:
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
  1003
"/            Warning isHandled ifTrue:[
6bf83a2af71f changed: #error:position:to:from:asWarning:
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
  1004
"/                Warning raiseErrorString:aString.
6bf83a2af71f changed: #error:position:to:from:asWarning:
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
  1005
"/                ^ false
6bf83a2af71f changed: #error:position:to:from:asWarning:
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
  1006
"/            ].
213
6286d3f36c14 raise warningSignal if handled (allows warnBoxes from compiler to be suppressed in debugger)
Claus Gittinger <cg@exept.de>
parents: 208
diff changeset
  1007
5290
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1008
            lbl := aCompiler isNil ifTrue:['Compiler'] ifFalse:[aCompiler class name].
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1009
            asWarning ifTrue:[
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1010
                lbl := lbl , ' Warning'
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1011
            ] ifFalse:[
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1012
                lbl := lbl , ' Error'.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1013
            ].
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1014
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1015
            "
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1016
             ask if we should abort or continue
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1017
            "
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1018
            Dialog modifyingBoxWith:[:box |
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1019
                |makeSpace|
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1020
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1021
                doNotShowAgainHolder := false asValue.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1022
                doNotShowAgainForThisMethodHolder := false asValue.
6674
ac7f385346ee #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6616
diff changeset
  1023
                doEnableOptionHolder := false asValue.
5290
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1024
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1025
                box label:lbl.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1026
                box perform:#image: with:(WarningBox iconBitmap) ifNotUnderstood:[].
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1027
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1028
                aCompiler notNil ifTrue:[
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1029
                    makeSpace := [ box addVerticalSpace:10. makeSpace := nil ].
6674
ac7f385346ee #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6616
diff changeset
  1030
                    DoEnableCompilerOptionActionQuery isHandled ifTrue:[
ac7f385346ee #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6616
diff changeset
  1031
                        makeSpace value.
ac7f385346ee #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6616
diff changeset
  1032
                        box verticalPanel
6675
dbea00731942 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6674
diff changeset
  1033
                            add:(CheckBox label:'Enable this in the compiler options (disable via Launcher''s compilation settings dialog)'
6674
ac7f385346ee #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6616
diff changeset
  1034
                                          model:doEnableOptionHolder).
ac7f385346ee #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6616
diff changeset
  1035
                    ].
5290
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1036
                    DoNotShowCompilerWarningAgainActionQuery isHandled ifTrue:[
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1037
                        makeSpace value.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1038
                        box verticalPanel
6675
dbea00731942 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6674
diff changeset
  1039
                            add:(CheckBox label:'Do not show this dialog again (reenable via Launcher''scompilation  settings dialog)'
5290
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1040
                                          model:doNotShowAgainHolder).
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1041
                    ].
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1042
                    DoNotShowCompilerWarningAgainForThisMethodActionQuery isHandled ifTrue:[
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1043
                        makeSpace value.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1044
                        box verticalPanel
6675
dbea00731942 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6674
diff changeset
  1045
                            add:(CheckBox label:(resources string:'Do not warn in this method (for %1 - reenable earlier via Launcher''s compilation settings dialog)' with:ParserFlags perMethodDisableWarningTimeDuration)
5290
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1046
                                          model:doNotShowAgainForThisMethodHolder).
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1047
                    ].
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1048
                ].
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1049
            ] do:[
6745
ab14bc6731e8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6742
diff changeset
  1050
"/                |textBox|
ab14bc6731e8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6742
diff changeset
  1051
"/
ab14bc6731e8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6742
diff changeset
  1052
"/                textBox := TextBox new.
ab14bc6731e8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6742
diff changeset
  1053
"/                textBox initialText:aString.
ab14bc6731e8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6742
diff changeset
  1054
"/                textBox label:('Compilation Error').
ab14bc6731e8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6742
diff changeset
  1055
"/                textBox title:('Compilation Error').
ab14bc6731e8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6742
diff changeset
  1056
"/                textBox readOnly:true.
ab14bc6731e8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6742
diff changeset
  1057
"/                textBox open.    
ab14bc6731e8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6742
diff changeset
  1058
"/                answer := textBox accepted.   
ab14bc6731e8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6742
diff changeset
  1059
5290
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1060
                answer := OptionBox
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1061
                        request:aString
6679
5036ddf57f20 #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 6675
diff changeset
  1062
                        buttonLabels:(resources array:#('Cancel'  "'Keep Selected'" 'Continue'))
5290
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1063
                        values:#(false "#keepSelected" true)
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1064
                        default:(asWarning ifTrue:true ifFalse:false).
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1065
                answer := answer ? false.   "/ if escaped
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1066
            ].
4274
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
  1067
"/            box := YesNoBox
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
  1068
"/                    title:aString
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
  1069
"/                    yesText:(resources string:'Continue')
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
  1070
"/                    noText:(resources string:'Abort').
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
  1071
"/
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
  1072
"/            box label:lbl.
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
  1073
"/            box image:(WarningBox iconBitmap).
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
  1074
"/
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
  1075
"/            (aCompiler notNil and:[DoNotShowCompilerWarningAgainActionQuery isHandled]) ifTrue:[
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
  1076
"/                doNotShowAgainHolder := false asValue.
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
  1077
"/                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
  1078
"/            ].
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
  1079
"/
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
  1080
"/            "/ answer := box confirm.
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
  1081
"/            answer := box confirm.
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1082
6674
ac7f385346ee #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6616
diff changeset
  1083
            doEnableOptionHolder value == true ifTrue:[
ac7f385346ee #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6616
diff changeset
  1084
                DoEnableCompilerOptionActionQuery actionQuery value
ac7f385346ee #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6616
diff changeset
  1085
            ].
5290
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1086
            doNotShowAgainHolder value == true ifTrue:[
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1087
                DoNotShowCompilerWarningAgainActionQuery actionQuery value
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1088
            ].
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1089
            doNotShowAgainForThisMethodHolder value == true ifTrue:[
6674
ac7f385346ee #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6616
diff changeset
  1090
                DoNotShowCompilerWarningAgainForThisMethodActionQuery actionQuery value.
5290
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1091
            ].
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1092
4274
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
  1093
"/            box destroy.
5290
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1094
        ].
2799
4d9967d1052e support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 2794
diff changeset
  1095
4274
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
  1096
    answer == #keepSelected ifTrue:[
5290
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1097
        self hideCursor.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1098
        "redraw selection in normal color"
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1099
        self invalidate.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1100
        AbortOperationRequest raise.
4274
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
  1101
    ].
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
  1102
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1103
    "
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1104
     do the abort if we have to
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1105
    "
3397
cd20f51edc25 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3396
diff changeset
  1106
    answer ifFalse:[
5290
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1107
        "redraw selection in normal color"
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1108
        self invalidate.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1109
        AbortOperationRequest raise.
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1110
    ].
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1111
    ^ 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
  1112
4170
6bf83a2af71f changed: #error:position:to:from:asWarning:
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
  1113
    "Created: / 24-11-1995 / 22:56:34 / cg"
4398
fa39aafcc0f3 changed:
Claus Gittinger <cg@exept.de>
parents: 4395
diff changeset
  1114
    "Modified: / 08-03-2012 / 10:24:21 / cg"
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1115
!
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1116
2663
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
  1117
highlightingErrorLine:lineNr do:aBlock
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
  1118
    "evaluate aBlock while some selection is shown highlighted with error colors."
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
  1119
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
  1120
    |linePosition|
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
  1121
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
  1122
    linePosition := self characterPositionOfLine:lineNr col:1.
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
  1123
    self highlightingErrorPosition:linePosition to:nil do:aBlock
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
  1124
!
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
  1125
59
450ce95a72a4 *** empty log message ***
claus
parents: 58
diff changeset
  1126
highlightingErrorPosition:relPos to:relEndPos do:aBlock
450ce95a72a4 *** empty log message ***
claus
parents: 58
diff changeset
  1127
    "evaluate aBlock while some selection is shown highlighted with error colors."
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
  1128
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1129
    self
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1130
	highlightingErrorPosition:relPos to:relEndPos
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1131
	withForeground:(self errorForegroundColor) andBackground:(self errorBackgroundColor)
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1132
	do:aBlock
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1133
!
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1134
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1135
highlightingErrorPosition:relPos to:relEndPos withForeground:hilightFg andBackground:hilightBg do:aBlock
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1136
    "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
  1137
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1138
    |absPosition oldFg oldBg|
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1139
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
  1140
    "
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
  1141
     change color of selection & hide cursor
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
  1142
    "
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1143
    oldFg := selectionFgColor.
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1144
    oldBg := selectionBgColor.
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1145
    selectionBgColor := hilightBg.
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1146
    selectionFgColor := hilightFg.
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
  1147
    self hideCursor.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1148
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
  1149
    "
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
  1150
     select the text - relEndPos may be nil in which case the whole line is selected
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
  1151
     we have to adjust the positions given by the compiler, since they
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
  1152
     are relative to the texts start (the compiler did stream-read the code).
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
  1153
    "
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1154
    codeStartPosition isNil ifTrue:[codeStartPosition := 1].
3427
9aa7216e0a5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3414
diff changeset
  1155
    absPosition := codeStartPosition + (relPos ? 1) - 1.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1156
    relEndPos isNil ifTrue:[
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1157
	self selectFromCharacterPosition:absPosition.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1158
	"/ self selectLineWhereCharacterPosition:absPosition.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1159
    ] ifFalse:[
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1160
	self selectFromCharacterPosition:absPosition to:(codeStartPosition + (relEndPos ? 1) - 1)
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1161
    ].
4273
4e9e823f9e41 changed: #highlightingErrorPosition:to:withForeground:andBackground:do:
Claus Gittinger <cg@exept.de>
parents: 4252
diff changeset
  1162
    expandingTop := true.       "/ hack to make the top of the selection visible
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1163
    self makeSelectionVisible.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1164
4921
13491e18abf5 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 4883
diff changeset
  1165
    self flush.
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
  1166
2519
a088ad3bb1e5 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 2492
diff changeset
  1167
    aBlock ensure:[
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1168
	"
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1169
	 undo selection color change and show cursor again
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1170
	"
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1171
	selectionFgColor := oldFg.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1172
	selectionBgColor := oldBg.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1173
	self showCursor.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1174
    ].
3427
9aa7216e0a5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3414
diff changeset
  1175
4273
4e9e823f9e41 changed: #highlightingErrorPosition:to:withForeground:andBackground:do:
Claus Gittinger <cg@exept.de>
parents: 4252
diff changeset
  1176
    "Modified: / 30-06-2011 / 17:24:04 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1177
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1178
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1179
highlightingWarningPosition:relPos to:relEndPos do:aBlock
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1180
    "evaluate aBlock while some selection is shown highlighted with warning colors."
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1181
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1182
    self
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1183
	highlightingErrorPosition:relPos to:relEndPos
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1184
	withForeground:(self warningForegroundColor) andBackground:(self warningBackgroundColor)
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1185
	do:aBlock
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1186
!
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1187
2386
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1188
unusedVariableWarning:aString position:relPos to:relEndPos from:aCompiler
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1189
    "compiler notifies us of a (or some) unused variables;
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1190
     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
  1191
     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
  1192
     to be corrected; false otherwise"
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1193
4386
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1194
    |action doNotShowAgainHolder doNotShowAgainForThisMethodHolder|
2386
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1195
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1196
    self highlightingWarningPosition:relPos to:relEndPos do:[
5290
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1197
        doNotShowAgainHolder := false asValue.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1198
        doNotShowAgainForThisMethodHolder := false asValue.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1199
        Dialog modifyingBoxWith:[:box |
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1200
            |makeSpace|
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1201
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1202
            aCompiler notNil ifTrue:[
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1203
                makeSpace := [ box addVerticalSpace:10. makeSpace := nil ].
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1204
                DoNotShowCompilerWarningAgainActionQuery isHandled ifTrue:[
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1205
                    makeSpace value.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1206
                    box verticalPanel
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1207
                        add:(CheckBox
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1208
                                label: "addCheckBoxAtBottom:" 'Do not show this dialog again (reenable via Launcher''s settings dialog)'
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1209
                                model:doNotShowAgainHolder).
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1210
                ].
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1211
                DoNotShowCompilerWarningAgainForThisMethodActionQuery isHandled ifTrue:[
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1212
                    makeSpace value.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1213
                    box verticalPanel
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1214
                        add:(CheckBox
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1215
                                label:(resources string:'Do not warn in this method (for %1 - reenable earlier via Launcher''s settings dialog)' with:ParserFlags perMethodDisableWarningTimeDuration)
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1216
                                model:doNotShowAgainForThisMethodHolder).
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1217
                ].
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1218
            ].
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1219
        ] do:[
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1220
            action := OptionBox
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1221
                      request:aString
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1222
                      label:(resources string:'Warning')
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1223
                      image:(WarningBox iconBitmap)
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1224
                      buttonLabels:(resources array:#('Cancel' 'Remove Variable(s)' 'Continue'))
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1225
                      values:#(#abort #correct #continue)
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1226
                      default:#continue.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1227
            action isNil ifTrue:[ action := #abort].
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1228
        ].
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1229
        doNotShowAgainHolder value == true ifTrue:[
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1230
            DoNotShowCompilerWarningAgainActionQuery actionQuery value
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1231
        ].
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1232
        doNotShowAgainForThisMethodHolder value == true ifTrue:[
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1233
            DoNotShowCompilerWarningAgainForThisMethodActionQuery actionQuery value
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1234
        ].
2386
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1235
    ].
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1236
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1237
    action == #abort ifTrue:[
5290
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1238
        "/ self halt.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1239
        AbortOperationRequest raise.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1240
        ^ false
2386
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1241
    ].
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1242
    ^ action == #correct
2470
240b6d2d5511 finished remove unused vars;
Claus Gittinger <cg@exept.de>
parents: 2462
diff changeset
  1243
4398
fa39aafcc0f3 changed:
Claus Gittinger <cg@exept.de>
parents: 4395
diff changeset
  1244
    "Modified: / 08-03-2012 / 10:23:58 / cg"
2386
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1245
!
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1246
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1247
warning:aString position:relPos to:relEndPos from:aCompiler
32
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
  1248
    "compiler notifies us of a warning - same behavior as error"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1249
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1250
    self error:aString position:relPos to:relEndPos from:aCompiler asWarning:true
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1251
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1252
3396
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1253
!Workspace methodsFor:'drag & drop'!
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1254
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1255
canDrop:aDropContext
4090
703569e25553 changed:
Claus Gittinger <cg@exept.de>
parents: 4057
diff changeset
  1256
    "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
  1257
     (printString); otherwise, only ..."
703569e25553 changed:
Claus Gittinger <cg@exept.de>
parents: 4057
diff changeset
  1258
703569e25553 changed:
Claus Gittinger <cg@exept.de>
parents: 4057
diff changeset
  1259
    self isReadOnly ifTrue:[^ false].
3396
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1260
4090
703569e25553 changed:
Claus Gittinger <cg@exept.de>
parents: 4057
diff changeset
  1261
    allowValueDrop ifTrue:[^ true].
703569e25553 changed:
Claus Gittinger <cg@exept.de>
parents: 4057
diff changeset
  1262
    ^ super canDrop:aDropContext
3428
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
  1263
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1264
"/    ^ aDropContext dropObjects
4090
703569e25553 changed:
Claus Gittinger <cg@exept.de>
parents: 4057
diff changeset
  1265
"/        contains:[:someObject| (someObject isTextObject or:[ someObject isFileObject ])].
3396
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1266
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1267
    "Created: / 16-08-2005 / 22:01:13 / janfrog"
3428
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
  1268
    "Modified: / 28-11-2006 / 16:18:51 / cg"
3396
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1269
!
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1270
3414
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1271
doDrop:aDropContext
4631
e1e810a69059 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 4619
diff changeset
  1272
    <resource: #obsolete>
e1e810a69059 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 4619
diff changeset
  1273
    self obsoleteMethodWarning:'should no longer be reached'.
3428
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
  1274
    self drop:aDropContext
3414
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1275
3428
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
  1276
    "Modified: / 28-11-2006 / 16:14:51 / cg"
4386
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1277
    "Modified (format): / 28-02-2012 / 11:20:38 / cg"
3414
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1278
!
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1279
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1280
drop:aDropContext
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1281
    "Any object can be dropped into workspace..."
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1282
3870
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1283
    |textObjects nonTextObjects answer text|
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1284
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1285
    textObjects := aDropContext dropObjects
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1286
			    select:[:dropObject | dropObject isTextObject
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1287
						  or:[ dropObject isFileObject ]].
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1288
    nonTextObjects := aDropContext dropObjects
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1289
			    reject:[:dropObject | dropObject isTextObject
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1290
						  or:[ dropObject isFileObject ]].
3870
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1291
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1292
    self dropObjects:textObjects.
3414
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1293
3870
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1294
    nonTextObjects notEmpty ifTrue:[
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1295
	answer := Dialog
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1296
		confirmWithCancel:(resources
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1297
					string:'Drop as textual representation or as object reference ?')
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1298
		labels:(resources array:#('Cancel' 'Reference' 'Name' 'Text'))
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1299
		values:#(nil #ref #name #text)
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1300
		default:4.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1301
	answer isNil ifTrue:[^ self].
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1302
	(answer == #text or:[answer == #name]) ifTrue:[
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1303
	    text := String streamContents:[:s |
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1304
			nonTextObjects do:[:dropObject |
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1305
			    |obj|
3870
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1306
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1307
			    obj := dropObject theObject.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1308
			    obj isMethod ifTrue:[
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1309
				s nextPutAll:(answer == #name ifTrue:[obj selector] ifFalse:[obj source]).
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1310
			    ] ifFalse:[
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1311
				obj isClass ifTrue:[
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1312
				    s nextPutAll:(answer == #name ifTrue:[obj name] ifFalse:[obj source asString])
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1313
				] ifFalse:[
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1314
				    s nextPutAll:(answer == #name ifTrue:[obj className] ifFalse:[obj printString]) .
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1315
				].
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1316
			    ].
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1317
			].
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1318
		    ].
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1319
	    self paste:text.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1320
	] ifFalse:[
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1321
	    nonTextObjects do:[:dropObject |
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1322
		name := Dialog
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1323
			request:(resources
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1324
				    string:'Name of the new Workspace Variable (refers to the dropped %1):'
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1325
				    with:dropObject theObject class name allBold
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1326
				 )
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1327
			initialAnswer:'droppedObject'
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1328
			okLabel:'Add'
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1329
			title:'Enter Variable Name'.
3414
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1330
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1331
		name notEmptyOrNil ifTrue:[
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1332
		    Workspace addWorkspaceVariable:name.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1333
		    Workspace workspaceVariableAt:name put:dropObject theObject.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1334
		    self paste:name.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1335
		].
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1336
	    ].
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1337
	]
3414
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1338
    ].
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1339
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1340
    "Created: / 13-10-2006 / 17:34:07 / cg"
3396
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1341
! !
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1342
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1343
!Workspace methodsFor:'editing'!
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1344
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1345
commentFrom:line1 to:line2
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1346
    "convenient function to comment out a block.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1347
     All lines from line1 to line2 get an end-of-line comment
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1348
     in the first col
1925
e73fe37177a0 comment
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
  1349
     (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
  1350
6016
3362754911e4 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  1351
    self commentFrom:line1 to:line2 commentStrings:commentStrings.
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1352
3403
d8482346fd7d tuned comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3397
diff changeset
  1353
    "Created: / 09-11-1997 / 01:05:35 / cg"
d8482346fd7d tuned comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3397
diff changeset
  1354
    "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
  1355
!
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1356
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1357
commentSelection
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1358
    "convenient function to comment out a block.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1359
     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
  1360
     in the first col."
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1361
6016
3362754911e4 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  1362
    self commentSelection:commentStrings
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1363
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1364
    "Created: / 9.11.1997 / 01:05:40 / cg"
1481
a5fb903ee745 moved readOnlyCheck.
Claus Gittinger <cg@exept.de>
parents: 1395
diff changeset
  1365
    "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
  1366
!
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1367
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1368
uncommentFrom:line1 to:line2
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1369
    "convenient function to comment out a block.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1370
     All lines from line1 to line2 get an end-of-line comment
1925
e73fe37177a0 comment
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
  1371
     in the first col.
e73fe37177a0 comment
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
  1372
     (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
  1373
6016
3362754911e4 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  1374
    self uncommentFrom:line1 to:line2 commentStrings:commentStrings.
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1375
3403
d8482346fd7d tuned comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3397
diff changeset
  1376
    "Created: / 09-11-1997 / 01:05:43 / cg"
d8482346fd7d tuned comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3397
diff changeset
  1377
    "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
  1378
!
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1379
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1380
uncommentSelection
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1381
    "convenient function to comment out a block.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1382
     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
  1383
     in the first col."
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1384
6016
3362754911e4 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  1385
    self uncommentSelection:commentStrings
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1386
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1387
    "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
  1388
    "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
  1389
! !
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1390
3968
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  1391
!Workspace methodsFor:'event handling'!
3712
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
  1392
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1393
keyPress:key x:x y:y
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1394
    <resource: #keyboard (#DoIt #InspectIt #PrintIt #ReplaceIt
6555
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1395
                          #BrowseIt #ImplementorsOfIt #ExpandAbbreviation
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1396
                          #CommentSelection #UncommentSelection)>
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
  1397
3800
380b2ee3b02b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
  1398
    (key == #DoIt)      ifTrue:[self doIt. ^ self].
380b2ee3b02b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
  1399
    (key == #InspectIt) ifTrue:[self inspectIt. ^ self].
380b2ee3b02b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
  1400
    (key == #PrintIt)   ifTrue:[self printIt. ^ self].
380b2ee3b02b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
  1401
    (key == #ReplaceIt) ifTrue:[self replaceIt. ^ self].
380b2ee3b02b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
  1402
    (key == #BrowseIt)  ifTrue:[self browseIt. ^ self].
380b2ee3b02b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
  1403
    (key == #ImplementorsOfIt)   ifTrue:[self browseImplementorsOfIt. ^ self].
380b2ee3b02b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
  1404
    (key == #ExpandAbbreviation) ifTrue:[self expandAbbreviation. ^ self].
4587
aa0010521297 code move
Claus Gittinger <cg@exept.de>
parents: 4584
diff changeset
  1405
    (key == #CommentSelection)    ifTrue:[self commentSelection. ^ self].
aa0010521297 code move
Claus Gittinger <cg@exept.de>
parents: 4584
diff changeset
  1406
    (key == #UncommentSelection)  ifTrue:[self uncommentSelection. ^ self].
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
  1407
6555
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1408
    (key == #CtrlQ)  ifTrue:[self basicInspectIt. ^ self].
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1409
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1410
    super keyPress:key x:x y:y
3511
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1411
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1412
    "Modified: / 08-11-2007 / 11:29:45 / cg"
6555
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1413
    "Modified: / 12-03-2019 / 16:35:44 / Claus Gittinger"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1414
! !
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1415
2143
ae0c3ae5de15 category rename
Claus Gittinger <cg@exept.de>
parents: 2104
diff changeset
  1416
!Workspace methodsFor:'executing'!
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1417
1501
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1418
do:code withValueDo:aBlock
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1419
    "helper for doIt, printIt and inspectIt.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1420
     Evaluate the selection and, if all went well, evaluate the argument,
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1421
     aBlock with the value.
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1422
     Most work is in preparing for proper cleanup in case of abort
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1423
     or other exception while the evaluation is performed.
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1424
     (restore cursor, selectionColors etc.)"
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1425
6223
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1426
    |selLine selCol endLine endCol cLine cCol cleanUp executeBlock savedBackground|
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1427
6302
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1428
    code isNil ifTrue:[^ self].
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1429
    code asString withoutSeparators isEmpty ifTrue:[ ^ self ].
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1430
    doItAction isNil ifTrue:[^ self].
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1431
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1432
    codeStartPosition := self characterPositionOfSelection.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1433
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1434
    "
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1435
     remember selection for later - if there is an error,
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1436
     the notification method will highlight it.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1437
     thus destroying the current selection
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1438
    "
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1439
    selLine := selectionStartLine.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1440
    selCol := selectionStartCol.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1441
    endLine := selectionEndLine.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1442
    endCol := selectionEndCol.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1443
    cCol := cursorCol.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1444
    cLine := cursorLine.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1445
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1446
    "
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1447
     cleanup: restore previous selection and cursor positions
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1448
    "
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1449
    cleanUp :=  
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1450
        [
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1451
            self selectFromLine:selLine col:selCol toLine:endLine col:endCol.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1452
            cLine notNil ifTrue:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1453
                self cursorLine:cLine col:cCol
6223
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1454
            ].
6302
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1455
            savedBackground notNil ifTrue:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1456
                self backgroundColor:savedBackground.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1457
                self invalidate.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1458
            ].
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1459
        ].
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1460
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1461
    "
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1462
     perform the action.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1463
     Be careful to release the reference to the value;
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1464
     otherwise, we could keep lots of garbage from being freed
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1465
     until the view gets closed
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1466
    "
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1467
    executeBlock := 
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1468
        [
6223
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1469
            [
6302
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1470
                |busyColor|
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1471
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1472
                (busyColor := UserPreferences current busyBackgroundColorInDoits) notNil ifTrue:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1473
                    savedBackground := self backgroundColor.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1474
                    self backgroundColor:busyColor.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1475
                    self invalidateRepairNow:true.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1476
                ].
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1477
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1478
                AbortOperationRequest handle:[:ex |
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1479
                     "/ aBlock value:'** Abortsignal caught **'.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1480
                     ex return
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1481
                ] do:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1482
                    |value|
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1483
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1484
                    doItAction notNil ifTrue:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1485
                        value := doItAction value:(code asString).
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1486
                        cleanUp value. cleanUp := nil.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1487
                        aBlock notNil ifTrue:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1488
                            aBlock value:value.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1489
                        ].
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1490
                        value := nil.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1491
                        self class rememberDoIt:code.
6223
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1492
                    ]
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1493
                ]
6302
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1494
            ] ensure:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1495
                cleanUp notNil ifTrue:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1496
                    cleanUp value. cleanUp := nil
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1497
                ].
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1498
            ]
6223
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1499
        ].
6302
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1500
    aBlock isNil ifTrue:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1501
        "no action is performed with the result - give the user a visible
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1502
         feedback, that something has been done"
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1503
        self topView withVisibleCursor:Cursor execute do:executeBlock.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1504
    ] ifFalse:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1505
        self topView withCursor:Cursor execute do:executeBlock.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1506
    ].
257
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1507
6223
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1508
    "Created: / 22-04-1998 / 21:57:05 / ca"
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1509
    "Modified: / 01-11-2017 / 11:27:26 / cg"
4677
67285ce170f9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  1510
!
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1511
2733
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1512
executeDoIt:theCode
4391
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
  1513
    "the core of doIt, printIt, inspectIt, browseIt actions"
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
  1514
4618
d3554659540b Fix for RegressionTests::Compiler2Tests>>test_03
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4617
diff changeset
  1515
    | result compiler |
4404
56ea0037fd42 #executeDoIt: changed to reflect value of autoDefineVariables
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4402
diff changeset
  1516
56ea0037fd42 #executeDoIt: changed to reflect value of autoDefineVariables
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4402
diff changeset
  1517
    "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
  1518
    [
6223
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1519
        compiler := (self compilerClass ? Compiler) new.
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1520
        result := compiler
6687
0cccc4bffe67 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 6679
diff changeset
  1521
                    currentNameSpace:namespaceForDoits; moreSharedPools:poolsConsideredInDoIts;
0cccc4bffe67 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 6679
diff changeset
  1522
0cccc4bffe67 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 6679
diff changeset
  1523
                    evaluate:theCode in:nil receiver:simulatedSelf
6223
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1524
                    notifying:self logged:true
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1525
                    ifFail:nil
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1526
    ] on:(Parser undefinedVariableNotification) do:[:ex|
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1527
        (ex parser == compiler and:[autoDefineVariables notNil]) ifTrue:[
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1528
            ex proceedWith: #declare
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1529
        ] ifFalse:[
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1530
            ex proceedWith: nil
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1531
        ].
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1532
    ] on:(Parser askForVariableTypeOfUndeclaredQuery) do:[:ex|
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1533
        autoDefineVariables == #workspace ifTrue:[
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1534
            ex proceedWith:#WorkspaceVariable
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1535
        ].
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1536
        autoDefineVariables == #doIt ifTrue:[
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1537
            ex proceedWith:#DoItTemporary
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1538
        ].
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1539
        ex pass.
4404
56ea0037fd42 #executeDoIt: changed to reflect value of autoDefineVariables
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4402
diff changeset
  1540
    ].
56ea0037fd42 #executeDoIt: changed to reflect value of autoDefineVariables
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4402
diff changeset
  1541
    ^result
4391
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
  1542
4618
d3554659540b Fix for RegressionTests::Compiler2Tests>>test_03
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4617
diff changeset
  1543
    "Modified: / 24-06-2013 / 15:31:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6223
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1544
    "Modified (format): / 01-11-2017 / 11:18:31 / cg"
6555
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1545
!
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1546
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1547
withValueOfSelectionDo:aBlock
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1548
    "helper for doIt, printIt, inspectIt, etc.
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1549
     Evaluate the selection and, if all went well, evaluate the argument,
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1550
     aBlock with the value."
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1551
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1552
    self
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1553
        do:(self selectionOrTextOfCursorLine)
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1554
        withValueDo:aBlock
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1555
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1556
    "Created: / 12-03-2019 / 16:31:47 / Claus Gittinger"
4677
67285ce170f9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  1557
! !
67285ce170f9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  1558
67285ce170f9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  1559
!Workspace methodsFor:'initialization & release'!
2733
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1560
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1561
initStyle
966
824e0ecc0e6f comments
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
  1562
    "setup viewStyle specifics"
824e0ecc0e6f comments
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
  1563
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1564
    super initStyle.
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1565
2492
740174c1be0f allow separate bg-color from styleSheet
Claus Gittinger <cg@exept.de>
parents: 2489
diff changeset
  1566
    DefaultViewBackground notNil ifTrue:[
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1567
	viewBackground := DefaultViewBackground.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1568
	self backgroundColor:viewBackground.
2492
740174c1be0f allow separate bg-color from styleSheet
Claus Gittinger <cg@exept.de>
parents: 2489
diff changeset
  1569
    ].
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1570
!
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1571
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1572
initialize
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1573
    super initialize.
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1574
6616
c0a78fe7ba09 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6597
diff changeset
  1575
    autoIndent := (UserPreferences current autoIndentInCodeView) asValue.
2775
6adda7eef10a cursorMovement default
penk
parents: 2754
diff changeset
  1576
    scrollWhenUpdating := #beginOfText.
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1577
    showMatchingParenthesis := true.
3428
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
  1578
    allowValueDrop := true.
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
  1579
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1580
    commentStrings := #(
5103
7cbe0139d13a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5072
diff changeset
  1581
                        '"/'
7cbe0139d13a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5072
diff changeset
  1582
                        ('"' '"')
7cbe0139d13a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5072
diff changeset
  1583
                       ).
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1584
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1585
    self initializeDoITAction.
3396
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1586
    self initializeDragAndDrop.
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1587
3428
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
  1588
    "Modified: / 28-11-2006 / 16:11:55 / cg"
6616
c0a78fe7ba09 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6597
diff changeset
  1589
    "Modified: / 26-06-2019 / 23:18:49 / Claus Gittinger"
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1590
!
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1591
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1592
initializeDoITAction
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1593
    "set up the block to be evaluated for doIts.
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1594
     This is done here in a separate method to allow easier
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1595
     redefinition in subclasses"
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1596
2733
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1597
    doItAction := [:theCode | self executeDoIt:theCode].
3396
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1598
!
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1599
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1600
initializeDragAndDrop
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1601
    |target|
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1602
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1603
    target := DropTarget
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1604
		    receiver:self
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1605
		    argument:nil
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1606
		    dropSelector:#drop:
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1607
		    canDropSelector:#canDrop:.
3396
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1608
    self dropTarget:target
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1609
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1610
    "Created: / 16-08-2005 / 22:03:36 / janfrog"
3411
693b4489cd84 drag & drop code cleanup
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  1611
    "Modified: / 13-10-2006 / 12:37:18 / cg"
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1612
! !
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1613
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1614
!Workspace methodsFor:'menu & menu actions'!
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1615
6555
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1616
basicInspectIt
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1617
    "user selected 'basicInspectIt' from menu; use doIt to evaluate the code
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1618
     and start a basicInspector on the result"
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1619
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1620
    self withValueOfSelectionDo:#basicInspect
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1621
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1622
    "Created: / 12-03-2019 / 16:29:21 / Claus Gittinger"
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1623
!
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1624
2285
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1625
browseClass
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1626
    "user selected 'browseClass' from menu; evaluate the code
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1627
     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
  1628
6555
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1629
    self withValueOfSelectionDo:[:result |
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1630
        result isBehavior ifTrue:[
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1631
            result browserClass openInClass:result selector:nil
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1632
        ] ifFalse:[
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1633
            self warn:'Selection does not evaluate to a class'
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1634
        ]
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1635
    ].
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1636
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1637
    "Modified: / 26-09-2001 / 17:37:35 / cg"
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1638
    "Modified (format): / 12-03-2019 / 16:33:29 / Claus Gittinger"
2285
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1639
!
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1640
6317
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1641
browseClassesContainingInName
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1642
    "ask for a piece of text and 
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1643
     open a browser on all classes where that piece is contained in the name"
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1644
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1645
    |pieceOfText|
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1646
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1647
    pieceOfText := Dialog request:'Browse classes containing in name:'.
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1648
    pieceOfText isEmptyOrNil ifTrue:[^ self].
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1649
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1650
    self browseClassesContainingInName:pieceOfText
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1651
!
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1652
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1653
browseClassesContainingInName:pieceOfText
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1654
    "open a browser on all classes where that piece is contained in the name"
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1655
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1656
    |classes|
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1657
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1658
    classes := Smalltalk allClasses 
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1659
                select:[:cls | cls name includesString:pieceOfText caseSensitive:false].
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1660
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1661
    SystemBrowser default
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1662
        openOnClassesForWhich:[:cls | cls name includesString:pieceOfText caseSensitive:false]
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1663
        label:('Classes with "%1" in name' bindWith:pieceOfText)
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1664
!
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1665
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1666
browseClassesContainingItInName
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1667
    "open a browser on all classes where the selected text is contained in the name"
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1668
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1669
    |selectedText|
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1670
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1671
    selectedText := self selectedTextOrSyntaxElement.
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1672
    selectedText notEmptyOrNil ifTrue:[
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1673
        selectedText := selectedText withoutSeparators.
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1674
        selectedText notEmpty ifTrue:[
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1675
            self browseClassesContainingInName:selectedText.
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1676
        ]
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1677
    ].
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1678
!
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1679
6332
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1680
browseImplementorsOf
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1681
    "ask for a name and 
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1682
     open a browser on all implementors of the selector."
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1683
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1684
    |selector|
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1685
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1686
    selector := Dialog request:'Browse implementors of:'.
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1687
    selector isEmptyOrNil ifTrue:[^ self].
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1688
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1689
    self browseImplementorsOf:selector
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1690
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1691
    "Created: / 07-06-2018 / 15:15:57 / Stefan Vogel"
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1692
!
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1693
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1694
browseImplementorsOf:methodNameArg
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1695
    "open a browser on the implementors of the selected text,
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1696
     or - if I support syntax elements, on the syntax element at the cursor position"
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1697
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1698
    |methodName selector browserClass na browser 
6687
0cccc4bffe67 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 6679
diff changeset
  1699
     cls node dwim targetClass targetImplClass lang| 
6332
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1700
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1701
    methodName := methodNameArg.
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1702
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1703
    self windowGroup withWaitCursorDo:[
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1704
        "/ hack, for now and expecco; must ask the Parser eventually...
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1705
        ((compilerClass notNil and:[compilerClass includesBehavior:JavaScriptParser])
6687
0cccc4bffe67 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 6679
diff changeset
  1706
          or:[ (lang := self editedLanguage) notNil and:[ lang isSTXJavaScript]]
0cccc4bffe67 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 6679
diff changeset
  1707
        ) ifTrue:[
6332
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1708
            "/ selector is in one piece anyway
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1709
            (methodName includes:$_) ifFalse:[
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1710
                "/ zero or one args - sigh (need to parse more to figure this out)
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1711
                selector := JavaScriptParser basicNew translatedSmalltalkSelectorFor:methodName numArgs:1.
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1712
                methodName := JavaScriptParser basicNew translatedSmalltalkSelectorFor:methodName numArgs:0.
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1713
            ] ifTrue:[
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1714
                "/ count _#s plus one arg - sigh
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1715
                na := (methodName occurrencesOf:$_) + 1.
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1716
                selector := JavaScriptParser basicNew translatedSmalltalkSelectorFor:methodName numArgs:na
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1717
            ].
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1718
        ] ifFalse:[
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1719
            selector := SystemBrowser extractSelectorFrom:methodName.
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1720
        ].
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1721
        browserClass := SystemBrowser default.
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1722
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1723
        (selector notNil and:[selector ~= methodName]) ifTrue:[
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1724
            (SystemBrowser
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1725
                    findImplementorsOfAny:(Array with:methodName)
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1726
                    in:(Smalltalk allClasses)
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1727
                    ignoreCase:false) isEmpty ifTrue:[
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1728
                browser := browserClass browseImplementorsOf:selector
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1729
            ] ifFalse:[
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1730
                browser := browserClass browseImplementorsOfAny:(Set with:selector with:methodName)
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1731
            ].
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1732
        ] ifFalse:[
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1733
            browser := browserClass browseImplementorsOf:(selector ? methodName)
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1734
        ].
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1735
        browser notNil ifTrue:[
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1736
            "/ if the type of the receiver is known,
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1737
            "/ select the targeted method immediately
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1738
            (cls := self editedClass) notNil ifTrue:[
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1739
                node := DoWhatIMeanSupport
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1740
                            findNodeForInterval:(self selectionStartIndex to:self selectionStopIndex)
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1741
                            in:self contents string.
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1742
                (node notNil and:[node isMessage]) ifTrue:[
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1743
                    dwim := DoWhatIMeanSupport new.
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1744
                    dwim setClass:cls andContext:nil.
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1745
                    dwim setSelf: simulatedSelf.
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1746
                    targetClass := dwim classOfNode:node receiver.
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1747
                    
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1748
                    targetClass notNil ifTrue:[
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1749
                        targetImplClass := targetClass whichClassImplements:(node selector).
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1750
                        targetImplClass notNil ifTrue:[
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1751
                            browser selectMethod:(targetImplClass compiledMethodAt:(node selector))
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1752
                        ].
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1753
                    ].
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1754
                ].    
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1755
            ]
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1756
        ]
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1757
    ].
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1758
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1759
    "Created: / 07-06-2018 / 15:10:19 / Stefan Vogel"
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1760
!
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1761
2451
ae246b6c4df7 added browse implementors menu item
Claus Gittinger <cg@exept.de>
parents: 2440
diff changeset
  1762
browseImplementorsOfIt
4617
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1763
    "open a browser on the implementors of the selected text,
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1764
     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
  1765
6332
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1766
    |selectedText| 
2457
0c1beddda9cb disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
  1767
4617
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1768
    selectedText := self selectedTextOrSyntaxElement.
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1769
    selectedText notEmptyOrNil ifTrue:[
6332
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1770
        self browseImplementorsOf:selectedText.
2457
0c1beddda9cb disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
  1771
    ].
2451
ae246b6c4df7 added browse implementors menu item
Claus Gittinger <cg@exept.de>
parents: 2440
diff changeset
  1772
6201
5493871b7dd2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6170
diff changeset
  1773
    "Created: / 05-11-2001 / 17:32:23 / cg"
5493871b7dd2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6170
diff changeset
  1774
    "Modified: / 01-09-2017 / 14:24:04 / cg"
6332
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  1775
    "Modified: / 07-06-2018 / 15:11:24 / Stefan Vogel"
2451
ae246b6c4df7 added browse implementors menu item
Claus Gittinger <cg@exept.de>
parents: 2440
diff changeset
  1776
!
ae246b6c4df7 added browse implementors menu item
Claus Gittinger <cg@exept.de>
parents: 2440
diff changeset
  1777
2307
dde2b8397b88 added #BrowseIt shortKey
Claus Gittinger <cg@exept.de>
parents: 2303
diff changeset
  1778
browseIt
dde2b8397b88 added #BrowseIt shortKey
Claus Gittinger <cg@exept.de>
parents: 2303
diff changeset
  1779
    "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
  1780
     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
  1781
5731
00e37b96afea #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5690
diff changeset
  1782
     Added feature: 
00e37b96afea #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5690
diff changeset
  1783
        if selection is of the form class >> selector,  
6272
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1784
        immediately switch to that selector.
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1785
     And:
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1786
        if selection is of the form class >> selector [lineNr],  
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1787
        also navigate to that line."
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1788
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1789
    |codeToEvaluate el idx 
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1790
     possibleSelectorString selector lineNr
6302
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1791
     evaluatedValue classToBrowse getClassToBrowseWithoutDoIt gotResult browser|
2713
07d3292d2965 in browseIt:
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  1792
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1793
    (self selection isEmptyOrNil
5072
69124555bf22 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
  1794
        and:[ self supportsSyntaxElements
69124555bf22 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
  1795
        and:[ (el := self syntaxElementForVariableUnderCursor) notNil ]])
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1796
    ifTrue:[
5072
69124555bf22 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
  1797
        codeToEvaluate := el name
4617
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1798
    ] ifFalse:[
5072
69124555bf22 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
  1799
        codeToEvaluate := (self selectionOrTextOfCursorLine ? '') withoutSeparators.
4617
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1800
    ].
6272
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1801
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1802
    "/ check for expr >> selector...
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1803
    "/ i.e. given a whoString
6737
8e1ef494e29b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6736
diff changeset
  1804
    idx := codeToEvaluate indexOf:'»'.
2713
07d3292d2965 in browseIt:
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  1805
    idx ~~ 0 ifTrue:[
6272
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1806
        possibleSelectorString := codeToEvaluate copyFrom:idx+1.
5072
69124555bf22 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
  1807
        codeToEvaluate := codeToEvaluate copyTo:idx-1.
5731
00e37b96afea #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5690
diff changeset
  1808
    ] ifFalse:[
00e37b96afea #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5690
diff changeset
  1809
        idx := codeToEvaluate indexOfSubCollection:'>>'.
00e37b96afea #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5690
diff changeset
  1810
        idx ~~ 0 ifTrue:[
6272
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1811
            possibleSelectorString := (codeToEvaluate copyFrom:idx+2).
5731
00e37b96afea #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5690
diff changeset
  1812
            codeToEvaluate := codeToEvaluate copyTo:idx-1.
00e37b96afea #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5690
diff changeset
  1813
        ].
2713
07d3292d2965 in browseIt:
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  1814
    ].
6272
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1815
    possibleSelectorString notEmptyOrNil ifTrue:[
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1816
        "/ check for selector [lineNr]...
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1817
        "/ i.e. given a walkback line string (for example: copy-pasted from ALM)
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1818
        possibleSelectorString := possibleSelectorString withoutSeparators string.
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1819
        possibleSelectorString endsWith:$].
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1820
        idx := possibleSelectorString lastIndexOf:$[.
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1821
        lineNr := Integer readFrom:(possibleSelectorString copyFrom:idx+1 to:(possibleSelectorString size-1)) onError:nil.
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1822
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1823
        possibleSelectorString := possibleSelectorString copyTo:idx-1.
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1824
        selector := possibleSelectorString withoutSeparators.
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1825
        selector includesSeparator ifTrue:[
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1826
            selector := possibleSelectorString upToSeparator.
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1827
        ].
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1828
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1829
        (selector startsWith:'#') ifTrue:[
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1830
            selector := Symbol readFrom:selector.
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1831
        ] ifFalse:[
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1832
            selector := selector asSymbolIfInterned.
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1833
        ].
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1834
    ].
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1835
6302
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1836
    getClassToBrowseWithoutDoIt := 
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1837
        [
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1838
            |className words|
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1839
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1840
            (classToBrowse := Smalltalk classNamed:codeToEvaluate) isNil ifTrue:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1841
                "/ handle className selector (for example from messageTally list)
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1842
                codeToEvaluate includesSeparator ifTrue:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1843
                    words := codeToEvaluate asCollectionOfWords.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1844
                    classToBrowse := Smalltalk classNamed:words first.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1845
                    classToBrowse notNil ifTrue:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1846
                        selector := (words copyFrom:2) asStringWith:''.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1847
                        ((words size > 1) and:[words second = 'class']) ifTrue:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1848
                            classToBrowse := classToBrowse theMetaclass.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1849
                            selector := (words copyFrom:3) asStringWith:''.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1850
                        ].
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1851
                        browser := classToBrowse browserClass openInClass:classToBrowse selector:selector.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1852
                        (selector notNil and:[lineNr notNil]) ifTrue:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1853
                            browser codeView makeLineVisible:lineNr; selectLine:lineNr.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1854
                        ].
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1855
                        ^ self.
5072
69124555bf22 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
  1856
                    ].
69124555bf22 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
  1857
                ].
6302
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1858
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1859
                "/ fallback, if garbage is selected, look for matching classes.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1860
                className := SystemBrowser
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1861
                    askForClassNameMatching:codeToEvaluate
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1862
                    inEnvironment:nil
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1863
                    for:nil.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1864
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1865
                className isNil ifTrue:[^ self].
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1866
                classToBrowse := Smalltalk classNamed:className.
5072
69124555bf22 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
  1867
            ].
6302
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1868
        ].
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1869
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1870
    doItAction isNil ifTrue:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1871
        getClassToBrowseWithoutDoIt value
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1872
    ] ifFalse:[
6323
9d9d186b4bac #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6321
diff changeset
  1873
        (ParseError , MessageNotUnderstood) 
6302
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1874
            handle:getClassToBrowseWithoutDoIt
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1875
            do:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1876
                gotResult := false.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1877
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1878
                self
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1879
                    do:codeToEvaluate
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1880
                    withValueDo:[:result | evaluatedValue := result. gotResult := true.].
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1881
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1882
                gotResult ifFalse:[^ self].
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1883
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1884
                evaluatedValue isNil ifTrue:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1885
                    codeToEvaluate asCollectionOfWords size == 1 ifTrue:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1886
                        codeToEvaluate isUppercaseFirst ifTrue:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1887
                            Dialog information:(codeToEvaluate allBold , ' is unbound or nil').
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1888
                            ^ self.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1889
                        ].
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1890
                    ]
5072
69124555bf22 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
  1891
                ].
6302
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1892
                classToBrowse := evaluatedValue isBehavior
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1893
                                ifTrue:[ evaluatedValue ]
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1894
                                ifFalse:[ evaluatedValue class ].
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1895
            ].
3910
a9536a430be0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3898
diff changeset
  1896
    ].
6316
9c60c63d8333 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6302
diff changeset
  1897
    classToBrowse browserClass isNil ifTrue:[
9c60c63d8333 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6302
diff changeset
  1898
        (Dialog confirm:'The object is class-less. Inspect the value instead?') ifFalse:[^ self].
9c60c63d8333 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6302
diff changeset
  1899
        evaluatedValue inspect.
9c60c63d8333 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6302
diff changeset
  1900
        ^ self.
9c60c63d8333 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6302
diff changeset
  1901
    ].
3910
a9536a430be0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3898
diff changeset
  1902
6272
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1903
    browser := classToBrowse browserClass openInClass:classToBrowse selector:selector.
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1904
    (selector notNil and:[lineNr notNil]) ifTrue:[
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1905
        browser codeView makeLineVisible:lineNr; selectLine:lineNr.
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1906
    ].
4386
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1907
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1908
    "Modified: / 28-02-2012 / 11:23:06 / cg"
2307
dde2b8397b88 added #BrowseIt shortKey
Claus Gittinger <cg@exept.de>
parents: 2303
diff changeset
  1909
!
dde2b8397b88 added #BrowseIt shortKey
Claus Gittinger <cg@exept.de>
parents: 2303
diff changeset
  1910
2285
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1911
browseItsClass
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1912
    "user selected 'browseItsClass' from menu; evaluate the code
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1913
     and open a browser on the results class"
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1914
6555
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1915
    self withValueOfSelectionDo:[:result |
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1916
        result class browserClass openInClass:result class selector:nil
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1917
    ]
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1918
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1919
    "Modified: / 26-09-2001 / 17:38:06 / cg"
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  1920
    "Modified (format): / 12-03-2019 / 16:33:22 / Claus Gittinger"
2285
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1921
!
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1922
6319
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1923
browseMethodsContainingInName
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1924
    "ask for a piece of text and 
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1925
     open a browser on all methods where that piece is contained in the selector"
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1926
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1927
    |pieceOfText|
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1928
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1929
    pieceOfText := Dialog request:'Browse methods containing in name:'.
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1930
    pieceOfText isEmptyOrNil ifTrue:[^ self].
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1931
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1932
    self browseMethodsContainingInName:pieceOfText
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1933
!
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1934
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1935
browseMethodsContainingInName:pieceOfText
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1936
    "open a browser on all methods where that piece is contained in the selector"
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1937
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1938
    (SystemBrowser default
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1939
        browseMethodsForWhich:[:m | 
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1940
            (m selector ? '') includesString:pieceOfText caseSensitive:false 
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1941
        ]
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1942
        title:('Methods with "%1" in name' bindWith:pieceOfText)
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1943
    ) autoSearch:pieceOfText ignoreCase:true 
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1944
!
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1945
6317
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1946
browseMethodsContainingInSource
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1947
    "ask for a piece of text and 
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1948
     open a browser on all methods where that piece is contained in the source"
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1949
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1950
    |pieceOfText|
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1951
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1952
    pieceOfText := Dialog request:'Browse methods containing in source:'.
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1953
    pieceOfText isEmptyOrNil ifTrue:[^ self].
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1954
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1955
    self browseMethodsContainingInSource:pieceOfText
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1956
!
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1957
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1958
browseMethodsContainingInSource:pieceOfText
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1959
    "open a browser on all methods where that piece is contained in the source"
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1960
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1961
    (SystemBrowser default
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1962
        browseMethodsForWhich:[:m | 
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1963
            (m source ? '') includesString:pieceOfText caseSensitive:false 
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1964
        ]
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1965
        title:('Methods containing "%1"' bindWith:pieceOfText)
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1966
    ) autoSearch:pieceOfText ignoreCase:true 
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1967
!
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1968
6319
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1969
browseMethodsContainingItInName
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1970
    "open a browser on all methods where the selected text is part of the selector"
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1971
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1972
    |selectedText|
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1973
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1974
    selectedText := self selectedTextOrSyntaxElement.
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1975
    selectedText notEmptyOrNil ifTrue:[
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1976
        selectedText := selectedText withoutSeparators.
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1977
        selectedText notEmpty ifTrue:[
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1978
            self browseMethodsContainingInName:selectedText.
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1979
        ]
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1980
    ].
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1981
!
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1982
6317
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1983
browseMethodsContainingItInSource
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1984
    "open a browser on all methods where the selected text is contained in the source"
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1985
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1986
    |selectedText|
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1987
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1988
    selectedText := self selectedTextOrSyntaxElement.
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1989
    selectedText notEmptyOrNil ifTrue:[
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1990
        selectedText := selectedText withoutSeparators.
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1991
        selectedText notEmpty ifTrue:[
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1992
            self browseMethodsContainingInSource:selectedText.
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1993
        ]
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1994
    ].
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1995
!
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1996
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1997
browseReferencesTo
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1998
    "ask for a name and 
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1999
     open a browser on all references to the selected global, poolvar or namespace class"
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2000
6736
f61a47790174 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 6735
diff changeset
  2001
    |nameOfVariable w|
f61a47790174 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 6735
diff changeset
  2002
f61a47790174 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 6735
diff changeset
  2003
    (cursorLine notNil and:[cursorCol notNil]) ifTrue:[
f61a47790174 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 6735
diff changeset
  2004
        self wordAtLine:cursorLine col:cursorCol do:[
f61a47790174 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 6735
diff changeset
  2005
            :beginLine :beginCol :endLine :endCol :style |
f61a47790174 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 6735
diff changeset
  2006
f61a47790174 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 6735
diff changeset
  2007
            w := self textFromLine:beginLine col:beginCol toLine:endLine col:endCol.
f61a47790174 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 6735
diff changeset
  2008
            w := w asString string withoutSeparators.
f61a47790174 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 6735
diff changeset
  2009
        ].
f61a47790174 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 6735
diff changeset
  2010
    ].
f61a47790174 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 6735
diff changeset
  2011
f61a47790174 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 6735
diff changeset
  2012
    nameOfVariable := Dialog request:'Browse references to:' initialAnswer:w.
6317
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2013
    nameOfVariable isEmptyOrNil ifTrue:[^ self].
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2014
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2015
    self browseReferencesTo:nameOfVariable
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2016
!
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2017
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2018
browseReferencesTo:nameOfVariable
5003
8d2610b84c45 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5002
diff changeset
  2019
    "open a browser on all references to the selected global, poolvar or namespace class"
2454
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
  2020
6317
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2021
    |browserClass sym cls|
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2022
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2023
    browserClass := SystemBrowser default.
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2024
    self windowGroup withWaitCursorDo:[
6443
7a9f4df684d6 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6431
diff changeset
  2025
        |nonMeta privateClass rest|
6317
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2026
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2027
        (nameOfVariable startsWith:'#') ifTrue:[
6443
7a9f4df684d6 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6431
diff changeset
  2028
            rest := nameOfVariable copyFrom:2.
7a9f4df684d6 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6431
diff changeset
  2029
            (rest startsWith:$') ifTrue:[
7a9f4df684d6 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6431
diff changeset
  2030
                sym := Parser evaluate:nameOfVariable ifFail:nil.
7a9f4df684d6 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6431
diff changeset
  2031
            ] ifFalse:[    
7a9f4df684d6 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6431
diff changeset
  2032
                sym := rest asSymbolIfInterned.
7a9f4df684d6 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6431
diff changeset
  2033
            ].
7a9f4df684d6 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6431
diff changeset
  2034
            sym isNil ifTrue:[
7a9f4df684d6 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6431
diff changeset
  2035
                Dialog information:'No such symbol is known'.
7a9f4df684d6 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6431
diff changeset
  2036
                ^ self.
7a9f4df684d6 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6431
diff changeset
  2037
            ].    
6317
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2038
            browserClass browseForSymbol:sym.
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2039
        ] ifFalse:[
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2040
            "/ is it a class variable?
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2041
            ((cls := self editedClass) notNil
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2042
            and:[ ((nonMeta := cls theNonMetaclass) allClassVarNames includes:nameOfVariable) ]) ifTrue:[
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2043
                nonMeta isSharedPool ifTrue:[
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2044
                    "/ class is a pool - browse all references to it.
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2045
                    browserClass browseReferendsOf:(nonMeta name,':',nameOfVariable)
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2046
                ] ifFalse:[
6317
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2047
                    browserClass
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2048
                        browseRefsTo:nameOfVariable
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2049
                        classVars:true
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2050
                        in:(nonMeta whichClassDefinesClassVar:nameOfVariable) withAllSubclasses
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2051
                        modificationsOnly:false.
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2052
                ].
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2053
            ] ifFalse:[
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2054
                "/ is it a private class?
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2055
                (cls notNil
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2056
                and:[ (privateClass := cls theNonMetaclass privateClassNamed:nameOfVariable) notNil ]) ifTrue:[
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2057
                    browserClass browseReferendsOf:(privateClass name)
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2058
                ] ifFalse:[
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2059
                    |pool nsClass|
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2060
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2061
                    "/ is it a pool variable?
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2062
                    cls notNil ifTrue:[
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2063
                        pool := cls theNonMetaclass sharedPools
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2064
                                detect:[:pool | pool classVarNames includes:nameOfVariable]
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2065
                                ifNone:nil.
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2066
                    ].
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2067
                    pool notNil ifTrue:[
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2068
                        browserClass browseReferendsOf:(pool name,':',nameOfVariable)
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2069
                    ] ifFalse:[
6317
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2070
                        (cls notNil
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2071
                          and:[ cls nameSpace notNil
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2072
                          and:[ cls nameSpace isNameSpace            
6742
5e0000410bcc #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6737
diff changeset
  2073
                          and:[ (cls nameSpace name,'::',nameOfVariable) "nameOfVariable" knownAsSymbol
5e0000410bcc #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6737
diff changeset
  2074
                          and:[ nameOfVariable knownAsSymbol
5e0000410bcc #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6737
diff changeset
  2075
                          and:[ (nsClass := cls nameSpace at:nameOfVariable asSymbol) notNil
6317
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2076
                          and:[ nsClass isBehavior
6742
5e0000410bcc #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6737
diff changeset
  2077
                        ]]]]]]) ifTrue:[
6317
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2078
                            "/ a namespace class?
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2079
                            browserClass browseReferendsOf:nsClass name
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2080
                        ] ifFalse:[
6317
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2081
                            "/ an instvar?
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2082
                            (cls notNil and:[cls allInstVarNames includes:nameOfVariable]) ifTrue:[
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2083
                                browserClass 
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2084
                                    browseInstRefsTo:nameOfVariable 
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2085
                                    under:(cls whichClassDefinesInstVar:nameOfVariable) 
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2086
                                    modificationsOnly:false
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2087
                            ] ifFalse:[
6317
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2088
                                "/ no, assume global
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2089
                                browserClass browseReferendsOf:nameOfVariable
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2090
                            ]
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2091
                        ]
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2092
                    ]
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2093
                ]
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2094
            ]
6317
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2095
        ]
2454
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
  2096
    ].
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
  2097
5618
6caed94c3cef #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5595
diff changeset
  2098
    "Created: / 05-11-2001 / 17:32:23 / cg"
6201
5493871b7dd2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6170
diff changeset
  2099
    "Modified: / 01-09-2017 / 14:24:09 / cg"
6443
7a9f4df684d6 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6431
diff changeset
  2100
    "Modified: / 25-09-2018 / 12:09:29 / Claus Gittinger"
2454
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
  2101
!
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
  2102
6317
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2103
browseReferencesToIt
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2104
    "open a browser on all references to the selected global, poolvar or namespace class"
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2105
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2106
    |nameOfVariable|
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2107
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2108
    nameOfVariable := self selectedTextOrSyntaxElement.
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2109
    nameOfVariable isEmptyOrNil ifTrue:[^ self].
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2110
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2111
    nameOfVariable := nameOfVariable string asString.
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2112
    nameOfVariable := nameOfVariable asSingleByteStringIfPossible.
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2113
    self browseReferencesTo:nameOfVariable
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2114
!
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2115
6332
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  2116
browseSendersOf
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  2117
    "ask for a name and 
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  2118
     open a browser on all senders of the selector."
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  2119
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  2120
    |selector|
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  2121
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  2122
    selector := Dialog request:'Browse senders of:'.
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  2123
    selector isEmptyOrNil ifTrue:[^ self].
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  2124
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  2125
    self browseSendersOf:selector
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  2126
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  2127
    "Created: / 07-06-2018 / 15:15:06 / Stefan Vogel"
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  2128
!
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  2129
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  2130
browseSendersOf:methodName
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  2131
    "open a browser on the senders of the selected text"
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  2132
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  2133
    |selector|
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  2134
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  2135
    self windowGroup withWaitCursorDo:[
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  2136
        selector := SystemBrowser extractSelectorFrom:methodName.
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  2137
        SystemBrowser default
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  2138
            browseAllCallsOn:(selector ? methodName)
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  2139
    ].
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  2140
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  2141
    "Created: / 07-06-2018 / 15:12:31 / Stefan Vogel"
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  2142
!
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  2143
2462
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  2144
browseSendersOfIt
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  2145
    "open a browser on the senders of the selected text"
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  2146
6332
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  2147
    |selectedText|
2462
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  2148
4617
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  2149
    selectedText := self selectedTextOrSyntaxElement.
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  2150
    selectedText notEmptyOrNil ifTrue:[
6332
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  2151
        self browseSendersOf:selectedText.
2462
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  2152
    ].
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  2153
6201
5493871b7dd2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6170
diff changeset
  2154
    "Created: / 05-11-2001 / 17:32:23 / cg"
5493871b7dd2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6170
diff changeset
  2155
    "Modified: / 01-09-2017 / 14:24:13 / cg"
6332
b9ffa7bb1c29 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6323
diff changeset
  2156
    "Modified: / 07-06-2018 / 15:13:20 / Stefan Vogel"
2462
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  2157
!
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  2158
4209
c8e3967e8623 added: #browseSharedPoolOfIt
Claus Gittinger <cg@exept.de>
parents: 4188
diff changeset
  2159
browseSharedPoolOfIt
c8e3967e8623 added: #browseSharedPoolOfIt
Claus Gittinger <cg@exept.de>
parents: 4188
diff changeset
  2160
    "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
  2161
c8e3967e8623 added: #browseSharedPoolOfIt
Claus Gittinger <cg@exept.de>
parents: 4188
diff changeset
  2162
    |sel|
c8e3967e8623 added: #browseSharedPoolOfIt
Claus Gittinger <cg@exept.de>
parents: 4188
diff changeset
  2163
4617
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  2164
    sel := self selectedTextOrSyntaxElement.
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  2165
    sel notEmptyOrNil ifTrue:[
5506
a604a1bb195d #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5504
diff changeset
  2166
        sel := sel asSymbol.
a604a1bb195d #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5504
diff changeset
  2167
        self windowGroup withWaitCursorDo:[
a604a1bb195d #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5504
diff changeset
  2168
            SharedPool allSubclassesDo:[:eachPool |
a604a1bb195d #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5504
diff changeset
  2169
                (eachPool includesKey:sel) ifTrue:[
a604a1bb195d #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5504
diff changeset
  2170
                    eachPool class browse:#initialize
a604a1bb195d #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5504
diff changeset
  2171
                ].
a604a1bb195d #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5504
diff changeset
  2172
            ].
a604a1bb195d #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5504
diff changeset
  2173
        ].
4209
c8e3967e8623 added: #browseSharedPoolOfIt
Claus Gittinger <cg@exept.de>
parents: 4188
diff changeset
  2174
    ].
c8e3967e8623 added: #browseSharedPoolOfIt
Claus Gittinger <cg@exept.de>
parents: 4188
diff changeset
  2175
c8e3967e8623 added: #browseSharedPoolOfIt
Claus Gittinger <cg@exept.de>
parents: 4188
diff changeset
  2176
    "Created: / 15-01-2011 / 14:01:39 / cg"
c8e3967e8623 added: #browseSharedPoolOfIt
Claus Gittinger <cg@exept.de>
parents: 4188
diff changeset
  2177
!
c8e3967e8623 added: #browseSharedPoolOfIt
Claus Gittinger <cg@exept.de>
parents: 4188
diff changeset
  2178
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2179
doIt
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2180
    "user selected 'doIt' from menu; show a wait-cursor, evaluate the code
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2181
     and finally restore cursor; return result of evaluation"
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2182
6556
2b8c8e4fbfcb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6555
diff changeset
  2183
    self withValueOfSelectionDo:nil "/ do nothing with it
6555
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  2184
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  2185
    "Modified: / 16-05-1998 / 16:45:01 / cg"
6556
2b8c8e4fbfcb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6555
diff changeset
  2186
    "Modified: / 12-03-2019 / 16:40:23 / Claus Gittinger"
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2187
!
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2188
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2189
editMenu
5878
bf8ff30c58d5 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5865
diff changeset
  2190
    "return my popUpMenu; that's the superclasses menu
1107
25753e7f960f commentary
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  2191
     PLUS st-evaluation items: doIt, printIt and inspectIt."
25753e7f960f commentary
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  2192
6555
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  2193
    <resource: #keyboard (#DoIt #PrintIt #InspectIt 
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2194
                          #CommentSelection #UncommentSelection
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2195
                          #BrowseIt #ImplementorsOfIt
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2196
                         )>
1262
d69149b5be1f resource flag: #menu -> #programMenu
Claus Gittinger <cg@exept.de>
parents: 1251
diff changeset
  2197
    <resource: #programMenu>
489
5816aa12fec8 resources
Claus Gittinger <cg@exept.de>
parents: 444
diff changeset
  2198
4998
000a0752dd25 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 4997
diff changeset
  2199
    |m sub subsub idx sensor sel2 sel selectedSymbol|
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2200
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2201
    m := super editMenu.
6583
af87db4a9809 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6556
diff changeset
  2202
    
3252
b44361e6b97a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3210
diff changeset
  2203
    ((sensor := self sensor) notNil and:[sensor ctrlDown and:[sensor shiftDown not]]) ifTrue:[
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2204
        sub := m.
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2205
        m := nil.
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  2206
    ] ifFalse:[
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2207
        sub := m subMenuAt:#others.
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  2208
    ].
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2209
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  2210
    sub notNil ifTrue:[
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2211
        "
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2212
         workspaces support #browse, implementors etc. add them after paste.
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2213
        "
6317
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2214
        self hasSelection ifTrue:[
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2215
            sub
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2216
                addItemList:#(
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2217
                    ('-'                                                                        )
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2218
                    ('Browse It'                        browseIt                BrowseIt            )
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2219
                    ('Browse Pool'                      browseSharedPoolOfIt                        )
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2220
                    ('Senders of It'                    browseSendersOfIt                           )
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2221
                    ('Implementors of It'               browseImplementorsOfIt  ImplementorsOfIt    )
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2222
                    ('References to It'                 browseReferencesToIt                        )
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2223
                    ('Classes Containing It in Name'    browseClassesContainingItInName           )
6319
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  2224
                    ('Methods Containing It in Name'    browseMethodsContainingItInName         )
6317
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2225
                    ('Methods Containing It in Source'  browseMethodsContainingItInSource         )
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2226
                    ('-'                                                                )
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2227
                    ('TimeIt'               timeIt                                      )
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2228
                    ('SpyOnIt'              spyOnIt                                     ))
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2229
              resources:resources
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2230
              after:#gotoLine.
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2231
        ] ifFalse:[
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2232
            sub
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2233
                addItemList:#(
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2234
                    ('-'                                                                        )
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2235
                    ('Browse It'                        browseIt                BrowseIt            )
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2236
                    ('Browse Pool'                      browseSharedPoolOfIt                        )
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2237
                    ('Senders of...'                    browseSendersOf                           )
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2238
                    ('Implementors of...'               browseImplementorsOf   ImplementorsOf       )
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2239
                    ('References to...'                 browseReferencesTo                          )
6319
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  2240
                    ('Classes Containing in Name...'    browseClassesContainingInName   )
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  2241
                    ('Methods Containing in Name...'    browseMethodsContainingInName   )
6317
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2242
                    ('Methods Containing in Source...'  browseMethodsWithString         )
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2243
                    ('-'                                                                )
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2244
                    ('TimeIt'               timeIt                                      )
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2245
                    ('SpyOnIt'              spyOnIt                                     ))
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2246
              resources:resources
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2247
              after:#gotoLine.
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2248
        ].
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  2249
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2250
        subsub := sub subMenuAt:#tools.
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2251
        subsub notNil ifTrue:[
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2252
            subsub
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2253
                addItemList:#(
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2254
                    ('-'                                                                )
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2255
                    ('CommentIt'            commentSelection        CommentSelection    )
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2256
                    ('UncommentIt'          uncommentSelection      UncommentSelection  ))
5579
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2257
                resources:resources
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2258
                after:#'indent'.
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2259
            subsub
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2260
                addItemList:#(
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2261
                    ('Inspect Instances'       inspectInstances          nil)       
6555
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  2262
                    ('Basic Inspect'           basicInspectIt            CtrlQ)       
5579
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2263
                )
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2264
                resources:resources  
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2265
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2266
                after:#inspectString.
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2267
                
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2268
            (self hasSelection not
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2269
            or:[ (sel := self selectionAsString asSymbolIfInterned) isNil
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2270
            or:[ (Smalltalk at:sel) isBehavior not ]]) ifTrue:[
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2271
                sub disable:#inspectInstances
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2272
            ].    
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2273
        ].
2867
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  2274
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2275
        self hasSelection ifFalse:[
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2276
            sub disableAll:#(browseImplementorsOfIt browseSendersOfIt
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2277
                             browseReferencesToIt timeIt spyOnIt
5579
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2278
                             browseSharedPoolOfIt browseIt inspectInstances).
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2279
            self supportsSyntaxElements ifTrue:[
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2280
                self syntaxElementForSelectorUnderCursor notNil ifTrue:[
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2281
                    sub enableAll:#(browseImplementorsOfIt browseSendersOfIt )
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2282
                ] ifFalse:[
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2283
                    |el|
4617
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  2284
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2285
                    (el := self syntaxElementForVariableUnderCursor) notNil ifTrue:[
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2286
                        (el isGlobal or:[el isInstanceVariable]) ifTrue:[
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2287
                            sub enable: #browseReferencesToIt
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2288
                        ].
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2289
                        el isClass ifTrue:[
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2290
                            sub enable:#browseIt
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2291
                        ]
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2292
                    ]
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2293
                ]
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2294
            ].
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2295
        ] ifTrue:[
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2296
            sel := self selectionAsString.
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2297
            sel notNil ifTrue:[
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2298
                sel asSymbolIfInterned isNil ifTrue:[
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2299
                    sel2 := SystemBrowser extractSelectorFrom:sel.
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2300
                    sel2 notNil ifTrue:[
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2301
                        sel2 := sel2 asSymbolIfInterned.
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2302
                    ].
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2303
                ].
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2304
            ].
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2305
            (sel2 isNil and:[sel isNil]) ifTrue:[
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2306
                sub disableAll:#(browseImplementorsOfIt browseSendersOfIt).
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2307
            ].
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2308
            "/ a global or namespace-var selected ?
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2309
            sel isNil ifTrue:[
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2310
                sub disable:#browseReferencesToIt.
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2311
            ] ifFalse:[
5066
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2312
                (sel startsWith:'#') ifTrue:[
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2313
                    "/ a symbol selected - can search references
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2314
                ] ifFalse:[
6735
2d496aeaf2e1 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 6732
diff changeset
  2315
                    |cls|
2d496aeaf2e1 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 6732
diff changeset
  2316
2d496aeaf2e1 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 6732
diff changeset
  2317
                    cls := self editedClass.
2d496aeaf2e1 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 6732
diff changeset
  2318
5066
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2319
                    selectedSymbol := sel asSymbolIfInterned.
6735
2d496aeaf2e1 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 6732
diff changeset
  2320
                    ((selectedSymbol notNil and:[Smalltalk includesKey:selectedSymbol])
6737
8e1ef494e29b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6736
diff changeset
  2321
                      or:[ cls notNil and:[cls topNameSpace includesKey:sel]]
5066
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2322
                    ) ifTrue:[
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2323
                        "/ a global or namespace var selected
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2324
                    ] ifFalse:[
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2325
                        cls notNil ifTrue:[
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2326
                            cls := cls theNonMetaclass.
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2327
                            ((cls allClassVarNames includes:sel)
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2328
                              or:[ (cls theNonMetaclass privateClassNamed:sel) notNil]) ifTrue:[
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2329
                                "/ a classvar or private class
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2330
                            ] ifFalse:[
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2331
                                |pool|
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2332
                                "/ is it a pool variable?
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2333
                                pool := cls sharedPools
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2334
                                        detect:[:pool | pool classVarNames includes:sel]
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2335
                                        ifNone:nil.
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2336
                                pool isNil ifTrue:[
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2337
                                    "/ todo: an instvar selected?
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2338
                                    (cls allInstVarNames includes:sel) ifFalse:[
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2339
                                        sub disable:#browseReferencesToIt.
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2340
                                    ].
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2341
                                ].
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2342
                            ].
5066
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2343
                        ] ifFalse:[
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2344
                            sub disable:#browseReferencesToIt.
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2345
                        ].
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2346
                    ].
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2347
                ].
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2348
            ].
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2349
            (selectedSymbol notNil
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2350
             and:[SharedPool allSubclasses contains:[:pool | pool includesKey:selectedSymbol]]) ifFalse:[
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2351
                sub disable:#browseSharedPoolOfIt.
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2352
            ].
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2353
        ].
6302
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  2354
        (self isReadOnly or:[commentStrings isEmptyOrNil]) ifTrue:[
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2355
            sub disableAll:#(commentSelection uncommentSelection)
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2356
        ].
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  2357
    ].
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  2358
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  2359
    m notNil ifTrue:[
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2360
        "
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2361
         workspaces support #doIt, #printIt and #inspectIt
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2362
         add them after paste.
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2363
        "
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2364
        idx := m indexOf:#paste.
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2365
        idx == 0 ifTrue:[idx := m indexOf:#pasteOrReplace].
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2366
        idx ~~ 0 ifTrue:[
6583
af87db4a9809 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6556
diff changeset
  2367
            (cursorLine notNil and:[cursorCol notNil]) ifTrue:[
af87db4a9809 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6556
diff changeset
  2368
                |t|
af87db4a9809 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6556
diff changeset
  2369
                t := (self textFromLine:cursorLine col:cursorCol toLine:cursorLine col:cursorCol) asString.
af87db4a9809 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6556
diff changeset
  2370
                t isText ifTrue:[
af87db4a9809 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6556
diff changeset
  2371
                    (t hasEmphasis:#actionBlock) ifTrue:[
af87db4a9809 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6556
diff changeset
  2372
                        m
af87db4a9809 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6556
diff changeset
  2373
                          addItemList:#(
af87db4a9809 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6556
diff changeset
  2374
                            ('See Detail'         seeDetail     )
af87db4a9809 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6556
diff changeset
  2375
                            ('-'                                ))
af87db4a9809 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6556
diff changeset
  2376
                          resources:resources
af87db4a9809 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6556
diff changeset
  2377
                          before:1.
af87db4a9809 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6556
diff changeset
  2378
                    ].    
af87db4a9809 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6556
diff changeset
  2379
                ].    
af87db4a9809 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6556
diff changeset
  2380
            ].    
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2381
            m
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2382
              addItemList:#(
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2383
                ('-'                                )
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2384
                ('DoIt'         doIt        DoIt     )
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2385
                ('PrintIt'      printIt     PrintIt  )
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2386
                ('InspectIt'    inspectIt   InspectIt))
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2387
              resources:resources
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2388
              after:idx.
4998
000a0752dd25 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 4997
diff changeset
  2389
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2390
        ].
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  2391
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2392
        (self hasSelectionOrTextInCursorLine) ifFalse:[
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2393
            |lNr line|
3272
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
  2394
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2395
            lNr := self cursorLine.
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2396
            line := self listAt:lNr.
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2397
            line isEmptyOrNil ifTrue:[
6555
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  2398
                m disableAll:#(printIt doIt inspectIt browseIt basicInspectIt inspectInstances)
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2399
            ].
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2400
        ].
6302
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  2401
        doItAction isNil ifTrue:[
6555
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  2402
            m disableAll:#(printIt doIt inspectIt timeIt spyOnIt basicInspectIt inspectInstances)
6302
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  2403
        ].
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2404
        self isReadOnly ifTrue:[
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2405
            m disable:#printIt
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2406
        ].
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2407
    ].
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2408
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  2409
    ^ m ? sub.
430
022b667e0d70 added accelerator display
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  2410
4209
c8e3967e8623 added: #browseSharedPoolOfIt
Claus Gittinger <cg@exept.de>
parents: 4188
diff changeset
  2411
    "Modified: / 22-04-1998 / 21:49:06 / ca"
4342
2845509d2b8a changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 4317
diff changeset
  2412
    "Modified: / 20-12-2011 / 11:22:20 / cg"
6583
af87db4a9809 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6556
diff changeset
  2413
    "Modified: / 28-05-2019 / 11:05:55 / Claus Gittinger"
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2414
!
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2415
5579
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2416
inspectInstances
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2417
    |nameOfVariable cls insts|
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2418
    
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2419
    nameOfVariable := self selectedTextOrSyntaxElement.
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2420
    nameOfVariable isEmptyOrNil ifTrue:[^ self].
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2421
    nameOfVariable := nameOfVariable asSymbolIfInterned.
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2422
    nameOfVariable isNil ifTrue:[^ self].
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2423
    cls := Smalltalk at:nameOfVariable.
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2424
    cls isNil ifTrue:[^ self].
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2425
    cls isBehavior ifFalse:[^ self].
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2426
    insts := cls allInstances.
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2427
    insts isEmpty ifTrue:[
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2428
        Dialog information:(resources string:'No instances of %1' with:nameOfVariable).
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2429
        ^ self.
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2430
    ].    
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2431
    insts inspect.
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2432
!
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2433
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2434
inspectIt
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2435
    "user selected 'inspectIt' from menu; use doIt to evaluate the code
6555
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  2436
     and start an inspector (or basicInspector if Shift pressed) on the result"
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2437
2981
75abc5efbf67 shift-inspect (= basicInspect)
Claus Gittinger <cg@exept.de>
parents: 2980
diff changeset
  2438
    |shifted|
75abc5efbf67 shift-inspect (= basicInspect)
Claus Gittinger <cg@exept.de>
parents: 2980
diff changeset
  2439
75abc5efbf67 shift-inspect (= basicInspect)
Claus Gittinger <cg@exept.de>
parents: 2980
diff changeset
  2440
    shifted := self sensor shiftDown.
75abc5efbf67 shift-inspect (= basicInspect)
Claus Gittinger <cg@exept.de>
parents: 2980
diff changeset
  2441
6555
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  2442
    self withValueOfSelectionDo:[:result | 
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  2443
        shifted 
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  2444
            ifTrue:[result basicInspect] 
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  2445
            ifFalse:[result inspect] 
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  2446
    ]
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  2447
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  2448
    "Modified: / 16-05-1998 / 16:44:56 / cg"
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  2449
    "Modified: / 12-03-2019 / 16:34:06 / Claus Gittinger"
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2450
!
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2451
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2452
printIt
6687
0cccc4bffe67 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 6679
diff changeset
  2453
    "user selected 'printIt' from menu; 
0cccc4bffe67 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 6679
diff changeset
  2454
     use doIt to evaluate the code
0cccc4bffe67 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 6679
diff changeset
  2455
     and insert the result of evaluation into my text.
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2456
     If the text is readOnly, do nothing."
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2457
1734
e71982a6a4c5 use self isReadonly
Claus Gittinger <cg@exept.de>
parents: 1523
diff changeset
  2458
    self isReadOnly ifTrue:[
6263
8d70af79d06f #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6223
diff changeset
  2459
        self beepInEditor.
5148
006f1e2256cd class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  2460
        ^ self.
3511
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2461
    ].
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2462
    self
5148
006f1e2256cd class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  2463
        undoableDo:[
006f1e2256cd class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  2464
            self
6555
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  2465
                withValueOfSelectionDo:[:result |
5396
c699ff474608 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5290
diff changeset
  2466
                    |s printer lang|
5148
006f1e2256cd class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  2467
006f1e2256cd class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  2468
                    self cursorLine:selectionEndLine col:(selectionEndCol + 1).
5396
c699ff474608 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5290
diff changeset
  2469
                    "/ give the language a chance to generate a printString for that value
c699ff474608 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5290
diff changeset
  2470
                    lang := self editedLanguage.
c699ff474608 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5290
diff changeset
  2471
                    (lang notNil and:[(printer := lang valuePrinterClass) notNil]) ifTrue:[
5148
006f1e2256cd class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  2472
                        s := printer printStringForPrintItOf:result
006f1e2256cd class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  2473
                    ] ifFalse:[
6020
79c1a6bb497a #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6016
diff changeset
  2474
                        result isProtoObject ifTrue:[
79c1a6bb497a #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6016
diff changeset
  2475
                            s := result displayString.
5148
006f1e2256cd class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  2476
                        ] ifFalse:[
6020
79c1a6bb497a #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6016
diff changeset
  2477
                            (result isInteger
79c1a6bb497a #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6016
diff changeset
  2478
                             and:[ result > 10
79c1a6bb497a #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6016
diff changeset
  2479
                             and:[ InspectorView defaultIntegerDisplayRadix ~= 10]]) ifTrue:[
79c1a6bb497a #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6016
diff changeset
  2480
                                s := result displayString , ' "',(result radixPrintStringRadix: InspectorView defaultIntegerDisplayRadix),'"'.
79c1a6bb497a #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6016
diff changeset
  2481
                            ] ifFalse:[
79c1a6bb497a #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6016
diff changeset
  2482
                                s := result printStringForPrintIt "old: displayString" "very old: printString"
79c1a6bb497a #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6016
diff changeset
  2483
                            ].
79c1a6bb497a #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6016
diff changeset
  2484
                        ]
5148
006f1e2256cd class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  2485
                    ].
5565
e26cfc2a8ae8 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5512
diff changeset
  2486
                    
e26cfc2a8ae8 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5512
diff changeset
  2487
                    self withAutoIndent:false do:[ 
e26cfc2a8ae8 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5512
diff changeset
  2488
                        "/ if the returned string starts with a newLine,
e26cfc2a8ae8 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5512
diff changeset
  2489
                        "/ insert as a bunch of lines after the cursor line.
e26cfc2a8ae8 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5512
diff changeset
  2490
                        (s size > 0 and:[s startsWith:(Character cr)]) ifTrue:[
5566
c25bc1fbc26a #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5565
diff changeset
  2491
                            |cursorLine cursorCol lines|
5565
e26cfc2a8ae8 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5512
diff changeset
  2492
                            
e26cfc2a8ae8 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5512
diff changeset
  2493
                            cursorLine := self cursorLine.
5566
c25bc1fbc26a #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5565
diff changeset
  2494
                            cursorCol := self cursorCol.
5565
e26cfc2a8ae8 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5512
diff changeset
  2495
                            lines := s asStringCollection copyFrom:2.
5566
c25bc1fbc26a #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5565
diff changeset
  2496
                            self insertLines:lines before:cursorLine+((cursorCol == 1) ifTrue:0 ifFalse:1).
5565
e26cfc2a8ae8 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5512
diff changeset
  2497
                            self selectFromLine:cursorLine+1 toLine:cursorLine+lines size.
e26cfc2a8ae8 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5512
diff changeset
  2498
                        ] ifFalse:[    
e26cfc2a8ae8 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5512
diff changeset
  2499
                            self insertSelectedStringAtCursor:s 
e26cfc2a8ae8 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5512
diff changeset
  2500
                        ]
e26cfc2a8ae8 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5512
diff changeset
  2501
                    ]
5148
006f1e2256cd class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  2502
                ]
006f1e2256cd class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  2503
        ]
006f1e2256cd class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  2504
        info:'PrintIt'
3511
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2505
4401
Claus Gittinger <cg@exept.de>
parents: 4398
diff changeset
  2506
    "Modified: / 08-03-2012 / 16:14:34 / cg"
6555
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  2507
    "Modified: / 12-03-2019 / 16:34:16 / Claus Gittinger"
3511
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2508
!
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2509
4471
6b403ca6c388 added profileIt menu item
Claus Gittinger <cg@exept.de>
parents: 4459
diff changeset
  2510
profileIt
6b403ca6c388 added profileIt menu item
Claus Gittinger <cg@exept.de>
parents: 4459
diff changeset
  2511
    "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
  2512
     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
  2513
4472
1eef89af0ef0 added: #spyOnItUsing:
Claus Gittinger <cg@exept.de>
parents: 4471
diff changeset
  2514
    self spyOnItUsing:Tools::Profiler
4471
6b403ca6c388 added profileIt menu item
Claus Gittinger <cg@exept.de>
parents: 4459
diff changeset
  2515
!
6b403ca6c388 added profileIt menu item
Claus Gittinger <cg@exept.de>
parents: 4459
diff changeset
  2516
3511
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2517
replaceIt
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2518
    "like printIt, but replace the selection with the result, instead of
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2519
     pasting it after the selection."
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2520
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2521
    self isReadOnly ifTrue:[
6263
8d70af79d06f #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6223
diff changeset
  2522
        self beepInEditor.
8d70af79d06f #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6223
diff changeset
  2523
        ^ self
3511
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2524
    ].
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2525
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2526
    self
6263
8d70af79d06f #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6223
diff changeset
  2527
        undoableDo:[
8d70af79d06f #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6223
diff changeset
  2528
            self
6555
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  2529
                withValueOfSelectionDo:[:result |
6263
8d70af79d06f #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6223
diff changeset
  2530
                    self replaceSelectionBy:(result displayString "printString")
8d70af79d06f #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6223
diff changeset
  2531
                ].
8d70af79d06f #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6223
diff changeset
  2532
                undoSupport actionInfo:'ReplaceIt'.
8d70af79d06f #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6223
diff changeset
  2533
        ]
8d70af79d06f #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6223
diff changeset
  2534
        info:'ReplaceIt'
3511
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2535
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2536
    "Created: / 08-11-2007 / 11:31:54 / cg"
6555
3af24552a8e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6443
diff changeset
  2537
    "Modified: / 12-03-2019 / 16:34:23 / Claus Gittinger"
1501
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  2538
!
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  2539
6583
af87db4a9809 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6556
diff changeset
  2540
seeDetail
af87db4a9809 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6556
diff changeset
  2541
    "user selected 'seeDetails' from menu while the cursor was at a text-element with
af87db4a9809 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6556
diff changeset
  2542
     an actionBlock. Evaluate it.
af87db4a9809 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6556
diff changeset
  2543
     Used by the inspector to provide detail about errors"
af87db4a9809 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6556
diff changeset
  2544
6810
ddebfcfad415 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 6801
diff changeset
  2545
    |t emphasis emphasisAction|
6583
af87db4a9809 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6556
diff changeset
  2546
af87db4a9809 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6556
diff changeset
  2547
    t := (self textFromLine:cursorLine col:cursorCol toLine:cursorLine col:cursorCol) asString.
af87db4a9809 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6556
diff changeset
  2548
    t isText ifTrue:[
6810
ddebfcfad415 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 6801
diff changeset
  2549
        (emphasis := t emphasisAt:1) notNil ifTrue:[
ddebfcfad415 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 6801
diff changeset
  2550
            (emphasisAction := Text actionBlockFromEmphasis:emphasis) notNil ifTrue:[
ddebfcfad415 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 6801
diff changeset
  2551
                emphasisAction value.
ddebfcfad415 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 6801
diff changeset
  2552
            ].    
6583
af87db4a9809 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6556
diff changeset
  2553
        ].    
af87db4a9809 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6556
diff changeset
  2554
    ].
af87db4a9809 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6556
diff changeset
  2555
af87db4a9809 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6556
diff changeset
  2556
    "Created: / 28-05-2019 / 11:05:45 / Claus Gittinger"
af87db4a9809 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6556
diff changeset
  2557
!
af87db4a9809 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6556
diff changeset
  2558
6597
b63c0114077e #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6583
diff changeset
  2559
showLineLimitInMenu
b63c0114077e #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6583
diff changeset
  2560
    ^ true "/ false.
b63c0114077e #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6583
diff changeset
  2561
b63c0114077e #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6583
diff changeset
  2562
    "Modified: / 06-06-2019 / 11:19:11 / Claus Gittinger"
b63c0114077e #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6583
diff changeset
  2563
!
b63c0114077e #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6583
diff changeset
  2564
1501
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  2565
spyOnIt
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  2566
    "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
  2567
     and finally restore the cursor. Show profile data on the Transcript"
1eef89af0ef0 added: #spyOnItUsing:
Claus Gittinger <cg@exept.de>
parents: 4471
diff changeset
  2568
1eef89af0ef0 added: #spyOnItUsing:
Claus Gittinger <cg@exept.de>
parents: 4471
diff changeset
  2569
    self spyOnItUsing:MessageTally
1eef89af0ef0 added: #spyOnItUsing:
Claus Gittinger <cg@exept.de>
parents: 4471
diff changeset
  2570
!
1eef89af0ef0 added: #spyOnItUsing:
Claus Gittinger <cg@exept.de>
parents: 4471
diff changeset
  2571
1eef89af0ef0 added: #spyOnItUsing:
Claus Gittinger <cg@exept.de>
parents: 4471
diff changeset
  2572
spyOnItUsing:aProfiler
1eef89af0ef0 added: #spyOnItUsing:
Claus Gittinger <cg@exept.de>
parents: 4471
diff changeset
  2573
    "common code for spyOnIt / profileIt.
1eef89af0ef0 added: #spyOnItUsing:
Claus Gittinger <cg@exept.de>
parents: 4471
diff changeset
  2574
     Show a wait-cursor, evaluate the code with profier on it,
1eef89af0ef0 added: #spyOnItUsing:
Claus Gittinger <cg@exept.de>
parents: 4471
diff changeset
  2575
     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
  2576
5865
e3e40eabdebc #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 5731
diff changeset
  2577
    |code codeToRun|
e3e40eabdebc #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 5731
diff changeset
  2578
        
e3e40eabdebc #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 5731
diff changeset
  2579
    codeToRun := self selectionOrTextOfCursorLine.
6431
cd5e96cf7b4d #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 6353
diff changeset
  2580
    (codeToRun isNil or:[codeToRun isBlank]) ifTrue:[^ self].
5865
e3e40eabdebc #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 5731
diff changeset
  2581
    
5504
0dda43e18c90 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5396
diff changeset
  2582
    compilerClass == (Smalltalk at:#Compiler) ifFalse:[
5865
e3e40eabdebc #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 5731
diff changeset
  2583
        "sigh - this measurement will include the time to compile - sigh"
e3e40eabdebc #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 5731
diff changeset
  2584
        aProfiler spyDetailedOn:[ self doIt ].
e3e40eabdebc #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 5731
diff changeset
  2585
        ^ self.
4427
9eb0f20e7ed8 changed:
Claus Gittinger <cg@exept.de>
parents: 4416
diff changeset
  2586
    ].
9eb0f20e7ed8 changed:
Claus Gittinger <cg@exept.de>
parents: 4416
diff changeset
  2587
5865
e3e40eabdebc #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 5731
diff changeset
  2588
    code := aProfiler name,' spyDetailedOn:[' , codeToRun, ']'.
4149
105b82a1365d changed:
Stefan Vogel <sv@exept.de>
parents: 4148
diff changeset
  2589
    self do:code withValueDo:[:value| ].
6431
cd5e96cf7b4d #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 6353
diff changeset
  2590
cd5e96cf7b4d #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 6353
diff changeset
  2591
    "Modified: / 14-09-2018 / 10:09:25 / Stefan Vogel"
1501
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  2592
!
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  2593
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  2594
timeIt
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  2595
    "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
  2596
     and finally restore cursor; return result of evaluation"
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  2597
5135
4024c8249107 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 5116
diff changeset
  2598
    |code|
4427
9eb0f20e7ed8 changed:
Claus Gittinger <cg@exept.de>
parents: 4416
diff changeset
  2599
5504
0dda43e18c90 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5396
diff changeset
  2600
    compilerClass == (Smalltalk at:#Compiler) ifFalse:[
5135
4024c8249107 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 5116
diff changeset
  2601
        "sigh - this measurement will include the time to compile - sigh"
4024c8249107 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 5116
diff changeset
  2602
        [ self doIt ] benchmark:'execution time: '.
4024c8249107 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 5116
diff changeset
  2603
        ^ self.
4427
9eb0f20e7ed8 changed:
Claus Gittinger <cg@exept.de>
parents: 4416
diff changeset
  2604
    ].
1501
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  2605
5135
4024c8249107 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 5116
diff changeset
  2606
    code := '[' , self selectionAsString, '] benchmark:''execution time: '''.
4149
105b82a1365d changed:
Stefan Vogel <sv@exept.de>
parents: 4148
diff changeset
  2607
    self do:code withValueDo:[:value | ].
1501
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  2608
4427
9eb0f20e7ed8 changed:
Claus Gittinger <cg@exept.de>
parents: 4416
diff changeset
  2609
    "Modified: / 22-04-1998 / 22:03:51 / ca"
9eb0f20e7ed8 changed:
Claus Gittinger <cg@exept.de>
parents: 4416
diff changeset
  2610
    "Modified (format): / 02-06-2012 / 00:38:51 / cg"
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2611
! !
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2612
3968
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2613
!Workspace methodsFor:'misc'!
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2614
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2615
expandAbbreviation
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2616
    "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
  2617
     cursor, find an abbrev for it and expand."
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2618
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2619
    |expandedString abortExpandAction oldSelectionStartLine oldSelectionStartCol oldSelectionEndLine oldSelectionEndCol oldCursorLine oldCursorCol
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2620
     newCursorPos replStartCol|
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2621
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2622
    oldCursorLine := self cursorLine.
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2623
    oldCursorCol := self cursorCol.
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2624
    oldSelectionStartLine := self selectionStartLine.
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2625
    oldSelectionStartCol := self selectionStartCol.
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2626
    oldSelectionEndLine := self selectionEndLine.
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2627
    oldSelectionEndCol := self selectionEndCol.
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2628
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2629
    abortExpandAction :=
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2630
	[
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2631
	    self
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2632
		selectFromLine:oldSelectionStartLine col:oldSelectionStartCol
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2633
		toLine:oldSelectionEndLine col:oldSelectionEndCol.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2634
	    self cursorLine:oldCursorLine col:oldCursorCol.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2635
	].
4706
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2636
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2637
    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
  2638
    expandedString isNil ifTrue:[
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2639
	abortExpandAction value.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2640
	^ self
3968
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2641
    ].
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2642
    newCursorPos := expandedString indexOf:$!!.
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2643
    newCursorPos ~~ 0 ifTrue:[
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2644
	expandedString := expandedString copyWithout:$!!.
3968
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2645
    ].
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2646
    replStartCol := self selectionStartCol.
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2647
    self
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2648
	undoableDo:[
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2649
	    self replaceSelectionBy: expandedString
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2650
	]
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2651
	info:'Replace'.
3968
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2652
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2653
    newCursorPos == 0 ifTrue:[
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2654
	"/ cursor already fine (at the end)
3968
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2655
    ] ifFalse:[
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2656
	self cursorCol:replStartCol+newCursorPos-1
3968
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2657
    ]
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2658
!
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2659
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2660
findAbbreviationKeyBeforeCursor
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2661
    "after receiving an Alt-shift key-event, look for the string before the
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2662
     cursor, find an abbrev for it, return the key and the abbreviation for it.
4706
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2663
     If none is found, return nil"
3968
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2664
4745
ba8ca65cd308 ouch - sniplet is a type;
Claus Gittinger <cg@exept.de>
parents: 4744
diff changeset
  2665
    |snippets keys minMax maxKeyLen minKeyLen stringBeforeCursor|
ba8ca65cd308 ouch - sniplet is a type;
Claus Gittinger <cg@exept.de>
parents: 4744
diff changeset
  2666
5144
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
  2667
    snippets := self class snippets.
4745
ba8ca65cd308 ouch - sniplet is a type;
Claus Gittinger <cg@exept.de>
parents: 4744
diff changeset
  2668
    keys := snippets keys.
4714
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2669
3968
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2670
    minMax := (keys collect:[:k | k size]) minMax.
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2671
    minKeyLen := minMax first.
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2672
    maxKeyLen := minMax second.
4714
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2673
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2674
    stringBeforeCursor := self lineStringBeforeCursor.
3968
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2675
    maxKeyLen := maxKeyLen min:stringBeforeCursor size.
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2676
4706
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2677
    maxKeyLen to:minKeyLen by:-1 do:[:keyLen |
5144
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
  2678
        |lCharactersBeforeCursor expandedString|
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
  2679
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
  2680
        lCharactersBeforeCursor := stringBeforeCursor last:keyLen.
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
  2681
        expandedString := snippets at:lCharactersBeforeCursor ifAbsent:nil.
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
  2682
        expandedString notNil ifTrue:[
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
  2683
            ^ { lCharactersBeforeCursor . expandedString withCRs }
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
  2684
        ].
3968
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2685
    ].
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2686
    ^ nil.
4185
44ac2c080798 changed:
Claus Gittinger <cg@exept.de>
parents: 4184
diff changeset
  2687
44ac2c080798 changed:
Claus Gittinger <cg@exept.de>
parents: 4184
diff changeset
  2688
    "Modified: / 29-10-2010 / 10:22:38 / cg"
4617
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  2689
!
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  2690
4706
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2691
selectAbbreviationKeyBeforeCursor
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2692
    "after receiving an Alt-shift key-event, look for the string before the
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2693
     cursor, find an abbrev for it, select it and return the abbreviation for it.
4706
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2694
     If none is found, do not select and return nil"
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2695
4745
ba8ca65cd308 ouch - sniplet is a type;
Claus Gittinger <cg@exept.de>
parents: 4744
diff changeset
  2696
    |keyAndSnippet snippet key|
ba8ca65cd308 ouch - sniplet is a type;
Claus Gittinger <cg@exept.de>
parents: 4744
diff changeset
  2697
ba8ca65cd308 ouch - sniplet is a type;
Claus Gittinger <cg@exept.de>
parents: 4744
diff changeset
  2698
    (keyAndSnippet := self findAbbreviationKeyBeforeCursor) notNil ifTrue:[
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2699
	key := keyAndSnippet first.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2700
	snippet := keyAndSnippet second.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2701
	self selectFromLine:cursorLine col:cursorCol-key size toLine:cursorLine col:cursorCol-1.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2702
	^ snippet
4706
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2703
    ].
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2704
    ^ nil.
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2705
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2706
    "Modified: / 29-10-2010 / 10:22:38 / cg"
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2707
!
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2708
4617
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  2709
selectedTextOrSyntaxElement
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  2710
    |selectedText el|
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  2711
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  2712
    selectedText := self selectionAsString.
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  2713
    selectedText isEmptyOrNil ifTrue:[
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2714
        el := self syntaxElementUnderCursor.
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2715
        el notNil ifTrue:[ selectedText := el value ].
4617
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  2716
    ].
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2717
    ^ selectedText
4998
000a0752dd25 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 4997
diff changeset
  2718
!
000a0752dd25 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 4997
diff changeset
  2719
000a0752dd25 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 4997
diff changeset
  2720
syntaxElementForSelectorUnderCursor
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2721
    "we do not support syntax elements, but subclasses may do"
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2722
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2723
    ^ nil
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2724
!
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2725
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2726
syntaxElementUnderCursor
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2727
    "we do not support syntax elements, but subclasses may do"
4998
000a0752dd25 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 4997
diff changeset
  2728
000a0752dd25 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 4997
diff changeset
  2729
    ^ nil
3968
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2730
! !
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2731
2646
dcee45d1c5ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2641
diff changeset
  2732
!Workspace methodsFor:'queries'!
dcee45d1c5ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2641
diff changeset
  2733
6801
15d100b9b7ed #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 6745
diff changeset
  2734
canDivertOutput
15d100b9b7ed #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 6745
diff changeset
  2735
    ^ false
15d100b9b7ed #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 6745
diff changeset
  2736
!
15d100b9b7ed #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 6745
diff changeset
  2737
2646
dcee45d1c5ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2641
diff changeset
  2738
isWorkspace
4395
a862858a2165 comment: #isWorkspace
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2739
    "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
  2740
     (for error feedback)"
a862858a2165 comment: #isWorkspace
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2741
2646
dcee45d1c5ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2641
diff changeset
  2742
    ^ true
4395
a862858a2165 comment: #isWorkspace
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2743
a862858a2165 comment: #isWorkspace
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2744
    "Modified (comment): / 07-03-2012 / 17:52:59 / cg"
2646
dcee45d1c5ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2641
diff changeset
  2745
! !
dcee45d1c5ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2641
diff changeset
  2746
206
2363a64a7c88 version at the end
Claus Gittinger <cg@exept.de>
parents: 201
diff changeset
  2747
!Workspace class methodsFor:'documentation'!
2363a64a7c88 version at the end
Claus Gittinger <cg@exept.de>
parents: 201
diff changeset
  2748
4402
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  2749
version
5396
c699ff474608 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5290
diff changeset
  2750
    ^ '$Header$'
4402
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  2751
!
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  2752
3959
2d90b5eaada7 changed:
Claus Gittinger <cg@exept.de>
parents: 3910
diff changeset
  2753
version_CVS
5396
c699ff474608 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5290
diff changeset
  2754
    ^ '$Header$'
858
ef7ba327189b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  2755
! !
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2756