Workspace.st
author Claus Gittinger <cg@exept.de>
Fri, 11 May 2018 13:09:27 +0200
changeset 6319 beb48f66edf1
parent 6317 162eab34215c
child 6321 cf13accef85c
permissions -rw-r--r--
#FEATURE by cg class: Workspace added: #browseMethodsContainingInName #browseMethodsContainingInName: #browseMethodsContainingItInName changed: #editMenu
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6272
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
     1
"{ Encoding: utf8 }"
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
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
    ].
5595
925147560958 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5579
diff changeset
   656
    (mthd := self editedMethod )notNil ifTrue:[
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:[
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   923
	doNotShowAgainHolder := false asValue.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   924
	Dialog aboutToOpenBoxNotificationSignal handle:[:ex |
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   925
	    MessageNotUnderstood catch:[
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   926
		(aCompiler notNil and:[DoNotShowCompilerWarningAgainActionQuery isHandled]) ifTrue:[
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   927
		    ex box addCheckBoxAtBottom:'Do not show this dialog again (reenable via Launchers Settings Dialog)' on:doNotShowAgainHolder.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   928
		].
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   929
	    ].
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   930
	] do:[
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   931
	    action := OptionBox
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   932
		      request:aString
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   933
		      label:(resources string:'Warning')
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   934
		      image:(WarningBox iconBitmap)
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   935
		      buttonLabels:(resources array:#('Cancel' 'Correct...' 'Generate' 'Continue'))
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   936
		      values:#(#abort #correct #generate #continue)
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   937
		      default:#continue
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   938
		      onCancel:#abort.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   939
	].
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   940
	doNotShowAgainHolder value == true ifTrue:[
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   941
	    DoNotShowCompilerWarningAgainActionQuery actionQuery value
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
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:[
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
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:[
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   950
	AbortOperationRequest raise.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
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"
2104
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   957
!
6ca8e039298f correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   958
4188
601acd1e72fe added: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4186
diff changeset
   959
correctableWarning:aString position:relPos to:relEndPos from:aCompiler
601acd1e72fe added: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4186
diff changeset
   960
    "compiler notifies us of a correctable warning;
601acd1e72fe added: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4186
diff changeset
   961
     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
   962
     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
   963
     to be corrected; false otherwise"
601acd1e72fe added: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4186
diff changeset
   964
601acd1e72fe added: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4186
diff changeset
   965
    ^ self correctableError:aString position:relPos to:relEndPos from:aCompiler
601acd1e72fe added: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4186
diff changeset
   966
601acd1e72fe added: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4186
diff changeset
   967
    "Created: / 02-11-2010 / 13:29:01 / cg"
601acd1e72fe added: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4186
diff changeset
   968
!
601acd1e72fe added: #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4186
diff changeset
   969
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   970
error:aString position:relPos to:relEndPos asWarning:asWarning
2277
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   971
    "obsolete - no longer invoked"
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   972
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   973
    ^ self error:aString position:relPos to:relEndPos from:nil asWarning:asWarning
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
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   976
error:aString position:relPos to:relEndPos from:aCompiler
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
   977
    "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
   978
     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
   979
     Return true for correction, false of not (or not possible)"
2277
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   980
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   981
    ^ 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
   982
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
   983
    "Modified (Comment): / 30-06-2011 / 19:47:36 / cg"
2277
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   984
!
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   985
00695225653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2143
diff changeset
   986
error:aString position:relPos to:relEndPos from:aCompiler asWarning:asWarning
3397
cd20f51edc25 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3396
diff changeset
   987
    "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
   988
     and show a Box asking for continue/abort."
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   989
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   990
    |answer fg bg|
201
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
    fg := asWarning ifTrue:[ self warningForegroundColor ] ifFalse:[ self errorForegroundColor ].
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   993
    bg := asWarning ifTrue:[ self warningBackgroundColor ] ifFalse:[ self errorBackgroundColor ].
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   994
3397
cd20f51edc25 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3396
diff changeset
   995
    self
5290
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   996
        highlightingErrorPosition:relPos to:relEndPos
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   997
        withForeground:fg andBackground:bg
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   998
        do:[
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
   999
            |box lbl doNotShowAgainHolder doNotShowAgainForThisMethodHolder l1 y1 y2 l2|
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1000
4170
6bf83a2af71f changed: #error:position:to:from:asWarning:
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
  1001
"/            Warning isHandled ifTrue:[
6bf83a2af71f changed: #error:position:to:from:asWarning:
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
  1002
"/                Warning raiseErrorString:aString.
6bf83a2af71f changed: #error:position:to:from:asWarning:
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
  1003
"/                ^ false
6bf83a2af71f changed: #error:position:to:from:asWarning:
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
  1004
"/            ].
213
6286d3f36c14 raise warningSignal if handled (allows warnBoxes from compiler to be suppressed in debugger)
Claus Gittinger <cg@exept.de>
parents: 208
diff changeset
  1005
5290
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1006
            lbl := aCompiler isNil ifTrue:['Compiler'] ifFalse:[aCompiler class name].
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1007
            asWarning ifTrue:[
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1008
                lbl := lbl , ' Warning'
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1009
            ] ifFalse:[
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1010
                lbl := lbl , ' Error'.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1011
            ].
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1012
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
             ask if we should abort or continue
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
            Dialog modifyingBoxWith:[:box |
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1017
                |makeSpace|
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1018
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1019
                doNotShowAgainHolder := false asValue.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1020
                doNotShowAgainForThisMethodHolder := false asValue.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1021
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1022
                box label:lbl.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1023
                box perform:#image: with:(WarningBox iconBitmap) ifNotUnderstood:[].
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
                aCompiler notNil ifTrue:[
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1026
                    makeSpace := [ box addVerticalSpace:10. makeSpace := nil ].
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1027
                    DoNotShowCompilerWarningAgainActionQuery isHandled ifTrue:[
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1028
                        makeSpace value.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1029
                        box verticalPanel
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1030
                            add:(CheckBox label:'Do not show this dialog again (reenable via Launcher''s settings dialog)'
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1031
                                          model:doNotShowAgainHolder).
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1032
                    ].
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1033
                    DoNotShowCompilerWarningAgainForThisMethodActionQuery isHandled ifTrue:[
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1034
                        makeSpace value.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1035
                        box verticalPanel
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1036
                            add:(CheckBox 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
  1037
                                          model:doNotShowAgainForThisMethodHolder).
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1038
                    ].
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1039
                ].
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1040
            ] do:[
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1041
                answer := OptionBox
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1042
                        request:aString
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1043
                        buttonLabels:(resources array:#('Abort'  "'Keep Selected'" 'Continue'))
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1044
                        values:#(false "#keepSelected" true)
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1045
                        default:(asWarning ifTrue:true ifFalse:false).
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1046
                answer := answer ? false.   "/ if escaped
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1047
            ].
4274
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
  1048
"/            box := YesNoBox
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
  1049
"/                    title:aString
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
  1050
"/                    yesText:(resources string:'Continue')
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
  1051
"/                    noText:(resources string:'Abort').
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
  1052
"/
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
  1053
"/            box label:lbl.
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
  1054
"/            box image:(WarningBox iconBitmap).
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
  1055
"/
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
  1056
"/            (aCompiler notNil and:[DoNotShowCompilerWarningAgainActionQuery isHandled]) ifTrue:[
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
  1057
"/                doNotShowAgainHolder := false asValue.
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
  1058
"/                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
  1059
"/            ].
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
  1060
"/
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
  1061
"/            "/ answer := box confirm.
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
  1062
"/            answer := box confirm.
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1063
5290
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1064
            doNotShowAgainHolder value == true ifTrue:[
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1065
                DoNotShowCompilerWarningAgainActionQuery actionQuery value
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1066
            ].
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1067
            doNotShowAgainForThisMethodHolder value == true ifTrue:[
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1068
                DoNotShowCompilerWarningAgainForThisMethodActionQuery actionQuery value
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1069
            ].
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1070
4274
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
  1071
"/            box destroy.
5290
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1072
        ].
2799
4d9967d1052e support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 2794
diff changeset
  1073
4274
2114434f990d comment/format in: #error:position:to:from:
Claus Gittinger <cg@exept.de>
parents: 4273
diff changeset
  1074
    answer == #keepSelected ifTrue:[
5290
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1075
        self hideCursor.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1076
        "redraw selection in normal color"
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1077
        self invalidate.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1078
        AbortOperationRequest raise.
4274
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
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1081
    "
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1082
     do the abort if we have to
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1083
    "
3397
cd20f51edc25 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3396
diff changeset
  1084
    answer ifFalse:[
5290
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1085
        "redraw selection in normal color"
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1086
        self invalidate.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1087
        AbortOperationRequest raise.
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1088
    ].
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1089
    ^ 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
  1090
4170
6bf83a2af71f changed: #error:position:to:from:asWarning:
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
  1091
    "Created: / 24-11-1995 / 22:56:34 / cg"
4398
fa39aafcc0f3 changed:
Claus Gittinger <cg@exept.de>
parents: 4395
diff changeset
  1092
    "Modified: / 08-03-2012 / 10:24:21 / cg"
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1093
!
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1094
2663
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
  1095
highlightingErrorLine:lineNr do:aBlock
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
  1096
    "evaluate aBlock while some selection is shown highlighted with error colors."
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
  1097
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
  1098
    |linePosition|
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
  1099
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
  1100
    linePosition := self characterPositionOfLine:lineNr col:1.
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
  1101
    self highlightingErrorPosition:linePosition to:nil do:aBlock
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
  1102
!
187a0776caf1 highlightLine added
Claus Gittinger <cg@exept.de>
parents: 2657
diff changeset
  1103
59
450ce95a72a4 *** empty log message ***
claus
parents: 58
diff changeset
  1104
highlightingErrorPosition:relPos to:relEndPos do:aBlock
450ce95a72a4 *** empty log message ***
claus
parents: 58
diff changeset
  1105
    "evaluate aBlock while some selection is shown highlighted with error colors."
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
  1106
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1107
    self
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1108
	highlightingErrorPosition:relPos to:relEndPos
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1109
	withForeground:(self errorForegroundColor) andBackground:(self errorBackgroundColor)
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1110
	do:aBlock
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1111
!
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1112
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1113
highlightingErrorPosition:relPos to:relEndPos withForeground:hilightFg andBackground:hilightBg do:aBlock
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1114
    "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
  1115
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1116
    |absPosition oldFg oldBg|
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1117
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
  1118
    "
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
  1119
     change color of selection & hide cursor
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
  1120
    "
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1121
    oldFg := selectionFgColor.
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1122
    oldBg := selectionBgColor.
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1123
    selectionBgColor := hilightBg.
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1124
    selectionFgColor := hilightFg.
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
  1125
    self hideCursor.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1126
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
  1127
    "
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
  1128
     select the text - relEndPos may be nil in which case the whole line is selected
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
  1129
     we have to adjust the positions given by the compiler, since they
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
  1130
     are relative to the texts start (the compiler did stream-read the code).
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
  1131
    "
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1132
    codeStartPosition isNil ifTrue:[codeStartPosition := 1].
3427
9aa7216e0a5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3414
diff changeset
  1133
    absPosition := codeStartPosition + (relPos ? 1) - 1.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1134
    relEndPos isNil ifTrue:[
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1135
	self selectFromCharacterPosition:absPosition.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1136
	"/ self selectLineWhereCharacterPosition:absPosition.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1137
    ] ifFalse:[
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1138
	self selectFromCharacterPosition:absPosition to:(codeStartPosition + (relEndPos ? 1) - 1)
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1139
    ].
4273
4e9e823f9e41 changed: #highlightingErrorPosition:to:withForeground:andBackground:do:
Claus Gittinger <cg@exept.de>
parents: 4252
diff changeset
  1140
    expandingTop := true.       "/ hack to make the top of the selection visible
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1141
    self makeSelectionVisible.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1142
4921
13491e18abf5 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 4883
diff changeset
  1143
    self flush.
58
28815246bbc1 *** empty log message ***
claus
parents: 54
diff changeset
  1144
2519
a088ad3bb1e5 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 2492
diff changeset
  1145
    aBlock ensure:[
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1146
	"
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1147
	 undo selection color change and show cursor again
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1148
	"
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1149
	selectionFgColor := oldFg.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1150
	selectionBgColor := oldBg.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1151
	self showCursor.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1152
    ].
3427
9aa7216e0a5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3414
diff changeset
  1153
4273
4e9e823f9e41 changed: #highlightingErrorPosition:to:withForeground:andBackground:do:
Claus Gittinger <cg@exept.de>
parents: 4252
diff changeset
  1154
    "Modified: / 30-06-2011 / 17:24:04 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1155
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1156
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1157
highlightingWarningPosition:relPos to:relEndPos do:aBlock
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1158
    "evaluate aBlock while some selection is shown highlighted with warning colors."
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1159
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1160
    self
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1161
	highlightingErrorPosition:relPos to:relEndPos
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1162
	withForeground:(self warningForegroundColor) andBackground:(self warningBackgroundColor)
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1163
	do:aBlock
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1164
!
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1165
2386
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1166
unusedVariableWarning:aString position:relPos to:relEndPos from:aCompiler
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1167
    "compiler notifies us of a (or some) unused variables;
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1168
     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
  1169
     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
  1170
     to be corrected; false otherwise"
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1171
4386
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1172
    |action doNotShowAgainHolder doNotShowAgainForThisMethodHolder|
2386
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1173
3007
ee450c9f41b7 warning color
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  1174
    self highlightingWarningPosition:relPos to:relEndPos do:[
5290
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1175
        doNotShowAgainHolder := false asValue.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1176
        doNotShowAgainForThisMethodHolder := false asValue.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1177
        Dialog modifyingBoxWith:[:box |
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1178
            |makeSpace|
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1179
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1180
            aCompiler notNil ifTrue:[
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1181
                makeSpace := [ box addVerticalSpace:10. makeSpace := nil ].
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1182
                DoNotShowCompilerWarningAgainActionQuery isHandled ifTrue:[
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1183
                    makeSpace value.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1184
                    box verticalPanel
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1185
                        add:(CheckBox
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1186
                                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
  1187
                                model:doNotShowAgainHolder).
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1188
                ].
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1189
                DoNotShowCompilerWarningAgainForThisMethodActionQuery isHandled ifTrue:[
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1190
                    makeSpace value.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1191
                    box verticalPanel
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1192
                        add:(CheckBox
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1193
                                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
  1194
                                model:doNotShowAgainForThisMethodHolder).
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1195
                ].
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1196
            ].
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1197
        ] do:[
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1198
            action := OptionBox
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1199
                      request:aString
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1200
                      label:(resources string:'Warning')
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1201
                      image:(WarningBox iconBitmap)
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1202
                      buttonLabels:(resources array:#('Cancel' 'Remove Variable(s)' 'Continue'))
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1203
                      values:#(#abort #correct #continue)
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1204
                      default:#continue.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1205
            action isNil ifTrue:[ action := #abort].
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1206
        ].
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1207
        doNotShowAgainHolder value == true ifTrue:[
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1208
            DoNotShowCompilerWarningAgainActionQuery actionQuery value
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1209
        ].
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1210
        doNotShowAgainForThisMethodHolder value == true ifTrue:[
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1211
            DoNotShowCompilerWarningAgainForThisMethodActionQuery actionQuery value
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1212
        ].
2386
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1213
    ].
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1214
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1215
    action == #abort ifTrue:[
5290
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1216
        "/ self halt.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1217
        AbortOperationRequest raise.
6e5158a5c59b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5250
diff changeset
  1218
        ^ false
2386
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1219
    ].
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1220
    ^ action == #correct
2470
240b6d2d5511 finished remove unused vars;
Claus Gittinger <cg@exept.de>
parents: 2462
diff changeset
  1221
4398
fa39aafcc0f3 changed:
Claus Gittinger <cg@exept.de>
parents: 4395
diff changeset
  1222
    "Modified: / 08-03-2012 / 10:23:58 / cg"
2386
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1223
!
ace953bac401 unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  1224
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1225
warning:aString position:relPos to:relEndPos from:aCompiler
32
b6c23dfd5663 *** empty log message ***
claus
parents: 23
diff changeset
  1226
    "compiler notifies us of a warning - same behavior as error"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1227
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1228
    self error:aString position:relPos to:relEndPos from:aCompiler asWarning:true
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1229
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1230
3396
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1231
!Workspace methodsFor:'drag & drop'!
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1232
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1233
canDrop:aDropContext
4090
703569e25553 changed:
Claus Gittinger <cg@exept.de>
parents: 4057
diff changeset
  1234
    "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
  1235
     (printString); otherwise, only ..."
703569e25553 changed:
Claus Gittinger <cg@exept.de>
parents: 4057
diff changeset
  1236
703569e25553 changed:
Claus Gittinger <cg@exept.de>
parents: 4057
diff changeset
  1237
    self isReadOnly ifTrue:[^ false].
3396
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1238
4090
703569e25553 changed:
Claus Gittinger <cg@exept.de>
parents: 4057
diff changeset
  1239
    allowValueDrop ifTrue:[^ true].
703569e25553 changed:
Claus Gittinger <cg@exept.de>
parents: 4057
diff changeset
  1240
    ^ super canDrop:aDropContext
3428
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
  1241
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1242
"/    ^ aDropContext dropObjects
4090
703569e25553 changed:
Claus Gittinger <cg@exept.de>
parents: 4057
diff changeset
  1243
"/        contains:[:someObject| (someObject isTextObject or:[ someObject isFileObject ])].
3396
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1244
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1245
    "Created: / 16-08-2005 / 22:01:13 / janfrog"
3428
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
  1246
    "Modified: / 28-11-2006 / 16:18:51 / cg"
3396
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1247
!
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1248
3414
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1249
doDrop:aDropContext
4631
e1e810a69059 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 4619
diff changeset
  1250
    <resource: #obsolete>
e1e810a69059 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 4619
diff changeset
  1251
    self obsoleteMethodWarning:'should no longer be reached'.
3428
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
  1252
    self drop:aDropContext
3414
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1253
3428
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
  1254
    "Modified: / 28-11-2006 / 16:14:51 / cg"
4386
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1255
    "Modified (format): / 28-02-2012 / 11:20:38 / cg"
3414
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1256
!
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1257
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1258
drop:aDropContext
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1259
    "Any object can be dropped into workspace..."
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1260
3870
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1261
    |textObjects nonTextObjects answer text|
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1262
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1263
    textObjects := aDropContext dropObjects
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1264
			    select:[:dropObject | dropObject isTextObject
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1265
						  or:[ dropObject isFileObject ]].
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1266
    nonTextObjects := aDropContext dropObjects
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1267
			    reject:[:dropObject | dropObject isTextObject
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1268
						  or:[ dropObject isFileObject ]].
3870
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1269
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1270
    self dropObjects:textObjects.
3414
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1271
3870
e08a82f2e73f better drop (class/methods)
Claus Gittinger <cg@exept.de>
parents: 3807
diff changeset
  1272
    nonTextObjects notEmpty ifTrue:[
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1273
	answer := Dialog
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1274
		confirmWithCancel:(resources
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1275
					string:'Drop as textual representation or as object reference ?')
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1276
		labels:(resources array:#('Cancel' 'Reference' 'Name' 'Text'))
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1277
		values:#(nil #ref #name #text)
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1278
		default:4.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1279
	answer isNil ifTrue:[^ self].
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1280
	(answer == #text or:[answer == #name]) ifTrue:[
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1281
	    text := String streamContents:[:s |
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1282
			nonTextObjects do:[:dropObject |
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1283
			    |obj|
3870
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
			    obj := dropObject theObject.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1286
			    obj isMethod ifTrue:[
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1287
				s nextPutAll:(answer == #name ifTrue:[obj selector] ifFalse:[obj source]).
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1288
			    ] ifFalse:[
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1289
				obj isClass ifTrue:[
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1290
				    s nextPutAll:(answer == #name ifTrue:[obj name] ifFalse:[obj source asString])
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1291
				] ifFalse:[
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1292
				    s nextPutAll:(answer == #name ifTrue:[obj className] ifFalse:[obj printString]) .
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1293
				].
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1294
			    ].
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1295
			].
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1296
		    ].
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1297
	    self paste:text.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1298
	] ifFalse:[
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1299
	    nonTextObjects do:[:dropObject |
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1300
		name := Dialog
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1301
			request:(resources
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1302
				    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
  1303
				    with:dropObject theObject class name allBold
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1304
				 )
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1305
			initialAnswer:'droppedObject'
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1306
			okLabel:'Add'
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1307
			title:'Enter Variable Name'.
3414
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1308
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1309
		name notEmptyOrNil ifTrue:[
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1310
		    Workspace addWorkspaceVariable:name.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1311
		    Workspace workspaceVariableAt:name put:dropObject theObject.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1312
		    self paste:name.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1313
		].
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1314
	    ].
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1315
	]
3414
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1316
    ].
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1317
74efb68372e1 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1318
    "Created: / 13-10-2006 / 17:34:07 / cg"
3396
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1319
! !
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1320
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1321
!Workspace methodsFor:'editing'!
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1322
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1323
commentFrom:line1 to:line2
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1324
    "convenient function to comment out a block.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1325
     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
  1326
     in the first col
1925
e73fe37177a0 comment
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
  1327
     (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
  1328
6016
3362754911e4 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  1329
    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
  1330
3403
d8482346fd7d tuned comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3397
diff changeset
  1331
    "Created: / 09-11-1997 / 01:05:35 / cg"
d8482346fd7d tuned comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3397
diff changeset
  1332
    "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
  1333
!
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1334
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1335
commentSelection
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1336
    "convenient function to comment out a block.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1337
     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
  1338
     in the first col."
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1339
6016
3362754911e4 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  1340
    self commentSelection:commentStrings
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1341
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1342
    "Created: / 9.11.1997 / 01:05:40 / cg"
1481
a5fb903ee745 moved readOnlyCheck.
Claus Gittinger <cg@exept.de>
parents: 1395
diff changeset
  1343
    "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
  1344
!
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1345
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1346
uncommentFrom:line1 to:line2
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1347
    "convenient function to comment out a block.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1348
     All lines from line1 to line2 get an end-of-line comment
1925
e73fe37177a0 comment
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
  1349
     in the first col.
e73fe37177a0 comment
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
  1350
     (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
  1351
6016
3362754911e4 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  1352
    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
  1353
3403
d8482346fd7d tuned comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3397
diff changeset
  1354
    "Created: / 09-11-1997 / 01:05:43 / cg"
d8482346fd7d tuned comment/uncomment
Claus Gittinger <cg@exept.de>
parents: 3397
diff changeset
  1355
    "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
  1356
!
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1357
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1358
uncommentSelection
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1359
    "convenient function to comment out a block.
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1360
     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
  1361
     in the first col."
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1362
6016
3362754911e4 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  1363
    self uncommentSelection:commentStrings
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1364
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1365
    "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
  1366
    "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
  1367
! !
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1368
3968
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  1369
!Workspace methodsFor:'event handling'!
3712
20989c5be134 made sniplets globally accessable
fm
parents: 3606
diff changeset
  1370
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1371
keyPress:key x:x y:y
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1372
    <resource: #keyboard (#DoIt #InspectIt #PrintIt #ReplaceIt
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1373
			  #BrowseIt #ImplementorsOfIt #ExpandAbbreviation
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1374
			  #CommentSelection #UncommentSelection)>
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
  1375
3800
380b2ee3b02b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
  1376
    (key == #DoIt)      ifTrue:[self doIt. ^ self].
380b2ee3b02b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
  1377
    (key == #InspectIt) ifTrue:[self inspectIt. ^ self].
380b2ee3b02b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
  1378
    (key == #PrintIt)   ifTrue:[self printIt. ^ self].
380b2ee3b02b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
  1379
    (key == #ReplaceIt) ifTrue:[self replaceIt. ^ self].
380b2ee3b02b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
  1380
    (key == #BrowseIt)  ifTrue:[self browseIt. ^ self].
380b2ee3b02b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
  1381
    (key == #ImplementorsOfIt)   ifTrue:[self browseImplementorsOfIt. ^ self].
380b2ee3b02b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
  1382
    (key == #ExpandAbbreviation) ifTrue:[self expandAbbreviation. ^ self].
4587
aa0010521297 code move
Claus Gittinger <cg@exept.de>
parents: 4584
diff changeset
  1383
    (key == #CommentSelection)    ifTrue:[self commentSelection. ^ self].
aa0010521297 code move
Claus Gittinger <cg@exept.de>
parents: 4584
diff changeset
  1384
    (key == #UncommentSelection)  ifTrue:[self uncommentSelection. ^ self].
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 32
diff changeset
  1385
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1386
    super keyPress:key x:x y:y
3511
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1387
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  1388
    "Modified: / 08-11-2007 / 11:29:45 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1389
! !
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1390
2143
ae0c3ae5de15 category rename
Claus Gittinger <cg@exept.de>
parents: 2104
diff changeset
  1391
!Workspace methodsFor:'executing'!
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1392
1501
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1393
do:code withValueDo:aBlock
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1394
    "helper for doIt, printIt and inspectIt.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1395
     Evaluate the selection and, if all went well, evaluate the argument,
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1396
     aBlock with the value.
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1397
     Most work is in preparing for proper cleanup in case of abort
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1398
     or other exception while the evaluation is performed.
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1399
     (restore cursor, selectionColors etc.)"
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1400
6223
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1401
    |selLine selCol endLine endCol cLine cCol cleanUp executeBlock savedBackground|
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1402
6302
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1403
    code isNil ifTrue:[^ self].
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1404
    code asString withoutSeparators isEmpty ifTrue:[ ^ self ].
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1405
    doItAction isNil ifTrue:[^ self].
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1406
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1407
    codeStartPosition := self characterPositionOfSelection.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1408
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1409
    "
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1410
     remember selection for later - if there is an error,
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1411
     the notification method will highlight it.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1412
     thus destroying the current selection
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1413
    "
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1414
    selLine := selectionStartLine.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1415
    selCol := selectionStartCol.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1416
    endLine := selectionEndLine.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1417
    endCol := selectionEndCol.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1418
    cCol := cursorCol.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1419
    cLine := cursorLine.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1420
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1421
    "
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1422
     cleanup: restore previous selection and cursor positions
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1423
    "
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1424
    cleanUp :=  
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1425
        [
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1426
            self selectFromLine:selLine col:selCol toLine:endLine col:endCol.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1427
            cLine notNil ifTrue:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1428
                self cursorLine:cLine col:cCol
6223
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1429
            ].
6302
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1430
            savedBackground notNil ifTrue:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1431
                self backgroundColor:savedBackground.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1432
                self invalidate.
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
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1436
    "
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1437
     perform the action.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1438
     Be careful to release the reference to the value;
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1439
     otherwise, we could keep lots of garbage from being freed
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1440
     until the view gets closed
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1441
    "
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1442
    executeBlock := 
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1443
        [
6223
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1444
            [
6302
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1445
                |busyColor|
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
                (busyColor := UserPreferences current busyBackgroundColorInDoits) notNil ifTrue:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1448
                    savedBackground := self backgroundColor.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1449
                    self backgroundColor:busyColor.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1450
                    self invalidateRepairNow:true.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1451
                ].
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1452
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1453
                AbortOperationRequest handle:[:ex |
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1454
                     "/ aBlock value:'** Abortsignal caught **'.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1455
                     ex return
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1456
                ] do:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1457
                    |value|
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
                    doItAction notNil ifTrue:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1460
                        value := doItAction value:(code asString).
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1461
                        cleanUp value. cleanUp := nil.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1462
                        aBlock notNil ifTrue:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1463
                            aBlock value:value.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1464
                        ].
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1465
                        value := nil.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1466
                        self class rememberDoIt:code.
6223
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1467
                    ]
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1468
                ]
6302
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1469
            ] ensure:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1470
                cleanUp notNil ifTrue:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1471
                    cleanUp value. cleanUp := nil
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1472
                ].
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1473
            ]
6223
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1474
        ].
6302
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1475
    aBlock isNil ifTrue:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1476
        "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
  1477
         feedback, that something has been done"
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1478
        self topView withVisibleCursor:Cursor execute do:executeBlock.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1479
    ] ifFalse:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1480
        self topView withCursor:Cursor execute do:executeBlock.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1481
    ].
257
605e68c1223f use new withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1482
6223
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1483
    "Created: / 22-04-1998 / 21:57:05 / ca"
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1484
    "Modified: / 01-11-2017 / 11:27:26 / cg"
4677
67285ce170f9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  1485
!
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1486
2733
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1487
executeDoIt:theCode
4391
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
  1488
    "the core of doIt, printIt, inspectIt, browseIt actions"
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
  1489
4618
d3554659540b Fix for RegressionTests::Compiler2Tests>>test_03
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4617
diff changeset
  1490
    | result compiler |
4404
56ea0037fd42 #executeDoIt: changed to reflect value of autoDefineVariables
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4402
diff changeset
  1491
56ea0037fd42 #executeDoIt: changed to reflect value of autoDefineVariables
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4402
diff changeset
  1492
    "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
  1493
    [
6223
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1494
        compiler := (self compilerClass ? Compiler) new.
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1495
        result := compiler
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1496
                    currentNameSpace:namespaceForDoits;
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1497
                    moreSharedPools:poolsConsideredInDoIts;
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1498
                    evaluate:theCode in:nil
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1499
                    receiver:simulatedSelf
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1500
                    notifying:self logged:true
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1501
                    ifFail:nil
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1502
    ] on:(Parser undefinedVariableNotification) do:[:ex|
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1503
        (ex parser == compiler and:[autoDefineVariables notNil]) ifTrue:[
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1504
            ex proceedWith: #declare
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1505
        ] ifFalse:[
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1506
            ex proceedWith: nil
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1507
        ].
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1508
    ] on:(Parser askForVariableTypeOfUndeclaredQuery) do:[:ex|
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1509
        autoDefineVariables == #workspace ifTrue:[
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1510
            ex proceedWith:#WorkspaceVariable
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1511
        ].
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1512
        autoDefineVariables == #doIt ifTrue:[
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1513
            ex proceedWith:#DoItTemporary
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1514
        ].
5c12b231db19 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6201
diff changeset
  1515
        ex pass.
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
    ^result
4391
c2344fec7ea4 class definition
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
  1518
4618
d3554659540b Fix for RegressionTests::Compiler2Tests>>test_03
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4617
diff changeset
  1519
    "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
  1520
    "Modified (format): / 01-11-2017 / 11:18:31 / cg"
4677
67285ce170f9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  1521
! !
67285ce170f9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  1522
67285ce170f9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  1523
!Workspace methodsFor:'initialization & release'!
2733
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1524
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1525
initStyle
966
824e0ecc0e6f comments
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
  1526
    "setup viewStyle specifics"
824e0ecc0e6f comments
Claus Gittinger <cg@exept.de>
parents: 929
diff changeset
  1527
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1528
    super initStyle.
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1529
2492
740174c1be0f allow separate bg-color from styleSheet
Claus Gittinger <cg@exept.de>
parents: 2489
diff changeset
  1530
    DefaultViewBackground notNil ifTrue:[
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1531
	viewBackground := DefaultViewBackground.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1532
	self backgroundColor:viewBackground.
2492
740174c1be0f allow separate bg-color from styleSheet
Claus Gittinger <cg@exept.de>
parents: 2489
diff changeset
  1533
    ].
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1534
!
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1535
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1536
initialize
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1537
    super initialize.
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1538
5105
0b7feb94c60f class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5103
diff changeset
  1539
    autoIndent := UserPreferences current autoIndentInCodeView.
2775
6adda7eef10a cursorMovement default
penk
parents: 2754
diff changeset
  1540
    scrollWhenUpdating := #beginOfText.
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1541
    showMatchingParenthesis := true.
3428
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
  1542
    allowValueDrop := true.
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
  1543
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1544
    commentStrings := #(
5103
7cbe0139d13a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5072
diff changeset
  1545
                        '"/'
7cbe0139d13a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5072
diff changeset
  1546
                        ('"' '"')
7cbe0139d13a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5072
diff changeset
  1547
                       ).
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1548
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1549
    self initializeDoITAction.
3396
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1550
    self initializeDragAndDrop.
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1551
3428
611eb1811c37 +allowValueDrop:
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
  1552
    "Modified: / 28-11-2006 / 16:11:55 / cg"
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1553
!
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1554
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1555
initializeDoITAction
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1556
    "set up the block to be evaluated for doIts.
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1557
     This is done here in a separate method to allow easier
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1558
     redefinition in subclasses"
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1559
2733
8c040c62c783 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1560
    doItAction := [:theCode | self executeDoIt:theCode].
3396
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1561
!
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1562
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1563
initializeDragAndDrop
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1564
    |target|
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1565
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1566
    target := DropTarget
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1567
		    receiver:self
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1568
		    argument:nil
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1569
		    dropSelector:#drop:
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1570
		    canDropSelector:#canDrop:.
3396
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1571
    self dropTarget:target
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1572
20933d591d6c drag and drop
Claus Gittinger <cg@exept.de>
parents: 3383
diff changeset
  1573
    "Created: / 16-08-2005 / 22:03:36 / janfrog"
3411
693b4489cd84 drag & drop code cleanup
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  1574
    "Modified: / 13-10-2006 / 12:37:18 / cg"
201
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1575
! !
d2888811c664 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1576
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1577
!Workspace methodsFor:'menu & menu actions'!
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  1578
2285
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1579
browseClass
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1580
    "user selected 'browseClass' from menu; evaluate the code
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1581
     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
  1582
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1583
    ^ self
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1584
	do:(self selectionAsString)
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1585
	withValueDo:[:result |
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1586
	    result isBehavior ifTrue:[
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1587
		result browserClass openInClass:result selector:nil
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1588
	    ] ifFalse:[
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1589
		self warn:'Selection does not evaluate to a class'
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1590
	    ]
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1591
	].
2285
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1592
2410
c7a829465c03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2409
diff changeset
  1593
    "Modified: / 26.9.2001 / 17:37:35 / cg"
2285
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1594
!
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1595
6317
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1596
browseClassesContainingInName
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1597
    "ask for a piece of text and 
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1598
     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
  1599
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1600
    |pieceOfText|
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1601
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1602
    pieceOfText := Dialog request:'Browse classes containing in name:'.
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1603
    pieceOfText isEmptyOrNil ifTrue:[^ self].
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1604
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1605
    self browseClassesContainingInName:pieceOfText
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1606
!
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1607
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1608
browseClassesContainingInName:pieceOfText
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1609
    "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
  1610
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1611
    |classes|
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1612
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1613
    classes := Smalltalk allClasses 
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1614
                select:[:cls | cls name includesString:pieceOfText caseSensitive:false].
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1615
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1616
    SystemBrowser default
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1617
        openOnClassesForWhich:[:cls | cls name includesString:pieceOfText caseSensitive:false]
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1618
        label:('Classes with "%1" in name' bindWith:pieceOfText)
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1619
!
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1620
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1621
browseClassesContainingItInName
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1622
    "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
  1623
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1624
    |selectedText|
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1625
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1626
    selectedText := self selectedTextOrSyntaxElement.
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1627
    selectedText notEmptyOrNil ifTrue:[
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1628
        selectedText := selectedText withoutSeparators.
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1629
        selectedText notEmpty ifTrue:[
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1630
            self browseClassesContainingInName:selectedText.
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1631
        ]
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1632
    ].
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1633
!
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1634
2451
ae246b6c4df7 added browse implementors menu item
Claus Gittinger <cg@exept.de>
parents: 2440
diff changeset
  1635
browseImplementorsOfIt
4617
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1636
    "open a browser on the implementors of the selected text,
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1637
     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
  1638
5621
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
  1639
    |selectedText selector browserClass na browser 
5906
5073749b9708 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5878
diff changeset
  1640
     cls node dwim targetClass targetImplClass| 
2457
0c1beddda9cb disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
  1641
4617
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1642
    selectedText := self selectedTextOrSyntaxElement.
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1643
    selectedText notEmptyOrNil ifTrue:[
5621
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
  1644
        self windowGroup withWaitCursorDo:[
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
  1645
            "/ hack, for now and expecco; must ask the Parser eventually...
6021
6bc4a2c5506d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6020
diff changeset
  1646
            ((compilerClass notNil and:[compilerClass includesBehavior:JavaScriptParser])
6bc4a2c5506d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6020
diff changeset
  1647
            or:[ self editedLanguage notNil 
6bc4a2c5506d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6020
diff changeset
  1648
                 and:[ self editedLanguage isSTXJavaScript]]) ifTrue:[
5621
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
  1649
                "/ selector is in one piece anyway
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
  1650
                (selectedText includes:$_) ifFalse:[
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
  1651
                    "/ zero or one args - sigh (need to parse more to figure this out)
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
  1652
                    selector := JavaScriptParser basicNew translatedSmalltalkSelectorFor:selectedText numArgs:1.
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
  1653
                    selectedText := JavaScriptParser basicNew translatedSmalltalkSelectorFor:selectedText numArgs:0.
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
  1654
                ] ifTrue:[
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
  1655
                    "/ count _#s plus one arg - sigh
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
  1656
                    na := (selectedText occurrencesOf:$_) + 1.
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
  1657
                    selector := JavaScriptParser basicNew translatedSmalltalkSelectorFor:selectedText numArgs:na
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
  1658
                ].
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
  1659
            ] ifFalse:[
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
  1660
                selector := SystemBrowser extractSelectorFrom:selectedText.
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
  1661
            ].
6201
5493871b7dd2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6170
diff changeset
  1662
            browserClass := SystemBrowser default.
5621
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
  1663
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
  1664
            (selector notNil and:[selector ~= selectedText]) ifTrue:[
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
  1665
                (SystemBrowser
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
  1666
                        findImplementorsOfAny:(Array with:selectedText)
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
  1667
                        in:(Smalltalk allClasses)
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
  1668
                        ignoreCase:false) isEmpty ifTrue:[
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
  1669
                    browser := browserClass browseImplementorsOf:selector
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
  1670
                ] ifFalse:[
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
  1671
                    browser := browserClass browseImplementorsOfAny:(Set with:selector with:selectedText)
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
  1672
                ].
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
  1673
            ] ifFalse:[
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
  1674
                browser := browserClass browseImplementorsOf:(selector ? selectedText)
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
  1675
            ].
5646
b52061d58dab #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5621
diff changeset
  1676
            browser notNil ifTrue:[
b52061d58dab #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5621
diff changeset
  1677
                "/ if the type of the receiver is known,
b52061d58dab #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5621
diff changeset
  1678
                "/ select the targeted method immediately
b52061d58dab #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5621
diff changeset
  1679
                (cls := self editedClass) notNil ifTrue:[
5906
5073749b9708 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5878
diff changeset
  1680
                    node := DoWhatIMeanSupport
5646
b52061d58dab #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5621
diff changeset
  1681
                                findNodeForInterval:(self selectionStartIndex to:self selectionStopIndex)
b52061d58dab #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5621
diff changeset
  1682
                                in:self contents string.
b52061d58dab #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5621
diff changeset
  1683
                    (node notNil and:[node isMessage]) ifTrue:[
5906
5073749b9708 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5878
diff changeset
  1684
                        dwim := DoWhatIMeanSupport new.
5073749b9708 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5878
diff changeset
  1685
                        dwim setClass:cls andContext:nil.
5073749b9708 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5878
diff changeset
  1686
                        dwim setSelf: simulatedSelf.
5646
b52061d58dab #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5621
diff changeset
  1687
                        targetClass := dwim classOfNode:node receiver.
5906
5073749b9708 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5878
diff changeset
  1688
                        
5646
b52061d58dab #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5621
diff changeset
  1689
                        targetClass notNil ifTrue:[
b52061d58dab #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5621
diff changeset
  1690
                            targetImplClass := targetClass whichClassImplements:(node selector).
b52061d58dab #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5621
diff changeset
  1691
                            targetImplClass notNil ifTrue:[
b52061d58dab #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5621
diff changeset
  1692
                                browser selectMethod:(targetImplClass compiledMethodAt:(node selector))
b52061d58dab #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5621
diff changeset
  1693
                            ].
5621
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
  1694
                        ].
5646
b52061d58dab #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5621
diff changeset
  1695
                    ].    
b52061d58dab #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5621
diff changeset
  1696
                ]
5621
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
  1697
            ]
75050c1ed7b4 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5618
diff changeset
  1698
        ]
2457
0c1beddda9cb disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
  1699
    ].
2451
ae246b6c4df7 added browse implementors menu item
Claus Gittinger <cg@exept.de>
parents: 2440
diff changeset
  1700
6201
5493871b7dd2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6170
diff changeset
  1701
    "Created: / 05-11-2001 / 17:32:23 / cg"
5493871b7dd2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6170
diff changeset
  1702
    "Modified: / 01-09-2017 / 14:24:04 / cg"
2451
ae246b6c4df7 added browse implementors menu item
Claus Gittinger <cg@exept.de>
parents: 2440
diff changeset
  1703
!
ae246b6c4df7 added browse implementors menu item
Claus Gittinger <cg@exept.de>
parents: 2440
diff changeset
  1704
2307
dde2b8397b88 added #BrowseIt shortKey
Claus Gittinger <cg@exept.de>
parents: 2303
diff changeset
  1705
browseIt
dde2b8397b88 added #BrowseIt shortKey
Claus Gittinger <cg@exept.de>
parents: 2303
diff changeset
  1706
    "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
  1707
     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
  1708
5731
00e37b96afea #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5690
diff changeset
  1709
     Added feature: 
00e37b96afea #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5690
diff changeset
  1710
        if selection is of the form class >> selector,  
6272
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1711
        immediately switch to that selector.
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1712
     And:
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1713
        if selection is of the form class >> selector [lineNr],  
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1714
        also navigate to that line."
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1715
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1716
    |codeToEvaluate el idx 
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1717
     possibleSelectorString selector lineNr
6302
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1718
     evaluatedValue classToBrowse getClassToBrowseWithoutDoIt gotResult browser|
2713
07d3292d2965 in browseIt:
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  1719
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1720
    (self selection isEmptyOrNil
5072
69124555bf22 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
  1721
        and:[ self supportsSyntaxElements
69124555bf22 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
  1722
        and:[ (el := self syntaxElementForVariableUnderCursor) notNil ]])
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1723
    ifTrue:[
5072
69124555bf22 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
  1724
        codeToEvaluate := el name
4617
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1725
    ] ifFalse:[
5072
69124555bf22 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
  1726
        codeToEvaluate := (self selectionOrTextOfCursorLine ? '') withoutSeparators.
4617
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1727
    ].
6272
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1728
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1729
    "/ check for expr >> selector...
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1730
    "/ i.e. given a whoString
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1731
    idx := codeToEvaluate indexOf:'»'.
2713
07d3292d2965 in browseIt:
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  1732
    idx ~~ 0 ifTrue:[
6272
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1733
        possibleSelectorString := codeToEvaluate copyFrom:idx+1.
5072
69124555bf22 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
  1734
        codeToEvaluate := codeToEvaluate copyTo:idx-1.
5731
00e37b96afea #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5690
diff changeset
  1735
    ] ifFalse:[
00e37b96afea #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5690
diff changeset
  1736
        idx := codeToEvaluate indexOfSubCollection:'>>'.
00e37b96afea #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5690
diff changeset
  1737
        idx ~~ 0 ifTrue:[
6272
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1738
            possibleSelectorString := (codeToEvaluate copyFrom:idx+2).
5731
00e37b96afea #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5690
diff changeset
  1739
            codeToEvaluate := codeToEvaluate copyTo:idx-1.
00e37b96afea #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5690
diff changeset
  1740
        ].
2713
07d3292d2965 in browseIt:
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  1741
    ].
6272
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1742
    possibleSelectorString notEmptyOrNil ifTrue:[
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1743
        "/ check for selector [lineNr]...
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1744
        "/ 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
  1745
        possibleSelectorString := possibleSelectorString withoutSeparators string.
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1746
        possibleSelectorString endsWith:$].
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1747
        idx := possibleSelectorString lastIndexOf:$[.
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1748
        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
  1749
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1750
        possibleSelectorString := possibleSelectorString copyTo:idx-1.
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1751
        selector := possibleSelectorString withoutSeparators.
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1752
        selector includesSeparator ifTrue:[
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1753
            selector := possibleSelectorString upToSeparator.
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1754
        ].
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1755
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1756
        (selector startsWith:'#') ifTrue:[
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1757
            selector := Symbol readFrom:selector.
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1758
        ] ifFalse:[
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1759
            selector := selector asSymbolIfInterned.
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1760
        ].
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1761
    ].
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1762
6302
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1763
    getClassToBrowseWithoutDoIt := 
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1764
        [
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1765
            |className words|
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1766
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1767
            (classToBrowse := Smalltalk classNamed:codeToEvaluate) isNil ifTrue:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1768
                "/ handle className selector (for example from messageTally list)
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1769
                codeToEvaluate includesSeparator ifTrue:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1770
                    words := codeToEvaluate asCollectionOfWords.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1771
                    classToBrowse := Smalltalk classNamed:words first.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1772
                    classToBrowse notNil ifTrue:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1773
                        selector := (words copyFrom:2) asStringWith:''.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1774
                        ((words size > 1) and:[words second = 'class']) ifTrue:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1775
                            classToBrowse := classToBrowse theMetaclass.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1776
                            selector := (words copyFrom:3) asStringWith:''.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1777
                        ].
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1778
                        browser := classToBrowse browserClass openInClass:classToBrowse selector:selector.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1779
                        (selector notNil and:[lineNr notNil]) ifTrue:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1780
                            browser codeView makeLineVisible:lineNr; selectLine:lineNr.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1781
                        ].
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1782
                        ^ self.
5072
69124555bf22 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
  1783
                    ].
69124555bf22 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
  1784
                ].
6302
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1785
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1786
                "/ fallback, if garbage is selected, look for matching classes.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1787
                className := SystemBrowser
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1788
                    askForClassNameMatching:codeToEvaluate
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1789
                    inEnvironment:nil
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1790
                    for:nil.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1791
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1792
                className isNil ifTrue:[^ self].
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1793
                classToBrowse := Smalltalk classNamed:className.
5072
69124555bf22 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
  1794
            ].
6302
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1795
        ].
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1796
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1797
    doItAction isNil ifTrue:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1798
        getClassToBrowseWithoutDoIt value
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1799
    ] ifFalse:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1800
        (Parser parseErrorSignal , MessageNotUnderstood) 
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1801
            handle:getClassToBrowseWithoutDoIt
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1802
            do:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1803
                gotResult := false.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1804
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1805
                self
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1806
                    do:codeToEvaluate
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1807
                    withValueDo:[:result | evaluatedValue := result. gotResult := true.].
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1808
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1809
                gotResult ifFalse:[^ self].
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1810
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1811
                evaluatedValue isNil ifTrue:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1812
                    codeToEvaluate asCollectionOfWords size == 1 ifTrue:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1813
                        codeToEvaluate isUppercaseFirst ifTrue:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1814
                            Dialog information:(codeToEvaluate allBold , ' is unbound or nil').
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1815
                            ^ self.
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1816
                        ].
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1817
                    ]
5072
69124555bf22 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5066
diff changeset
  1818
                ].
6302
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1819
                classToBrowse := evaluatedValue isBehavior
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1820
                                ifTrue:[ evaluatedValue ]
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1821
                                ifFalse:[ evaluatedValue class ].
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  1822
            ].
3910
a9536a430be0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3898
diff changeset
  1823
    ].
6316
9c60c63d8333 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6302
diff changeset
  1824
    classToBrowse browserClass isNil ifTrue:[
9c60c63d8333 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6302
diff changeset
  1825
        (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
  1826
        evaluatedValue inspect.
9c60c63d8333 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6302
diff changeset
  1827
        ^ self.
9c60c63d8333 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6302
diff changeset
  1828
    ].
3910
a9536a430be0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3898
diff changeset
  1829
6272
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1830
    browser := classToBrowse browserClass openInClass:classToBrowse selector:selector.
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1831
    (selector notNil and:[lineNr notNil]) ifTrue:[
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1832
        browser codeView makeLineVisible:lineNr; selectLine:lineNr.
e51b50b5e11c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  1833
    ].
4386
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1834
01c4f6e37603 per method warnings
Claus Gittinger <cg@exept.de>
parents: 4367
diff changeset
  1835
    "Modified: / 28-02-2012 / 11:23:06 / cg"
2307
dde2b8397b88 added #BrowseIt shortKey
Claus Gittinger <cg@exept.de>
parents: 2303
diff changeset
  1836
!
dde2b8397b88 added #BrowseIt shortKey
Claus Gittinger <cg@exept.de>
parents: 2303
diff changeset
  1837
2285
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1838
browseItsClass
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1839
    "user selected 'browseItsClass' from menu; evaluate the code
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1840
     and open a browser on the results class"
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1841
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1842
    ^ self
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1843
	do:(self selectionAsString)
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1844
	withValueDo:[:result |
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1845
			result class browserClass openInClass:result class selector:nil
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  1846
		    ]
2285
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1847
2410
c7a829465c03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2409
diff changeset
  1848
    "Modified: / 26.9.2001 / 17:38:06 / cg"
2285
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1849
!
6621bbf72a38 browse added to menu
Claus Gittinger <cg@exept.de>
parents: 2277
diff changeset
  1850
6319
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1851
browseMethodsContainingInName
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1852
    "ask for a piece of text and 
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1853
     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
  1854
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1855
    |pieceOfText|
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1856
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1857
    pieceOfText := Dialog request:'Browse methods containing in name:'.
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1858
    pieceOfText isEmptyOrNil ifTrue:[^ self].
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1859
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1860
    self browseMethodsContainingInName:pieceOfText
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1861
!
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1862
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1863
browseMethodsContainingInName:pieceOfText
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1864
    "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
  1865
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1866
    (SystemBrowser default
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1867
        browseMethodsForWhich:[:m | 
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1868
            (m selector ? '') includesString:pieceOfText caseSensitive:false 
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1869
        ]
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1870
        title:('Methods with "%1" in name' bindWith:pieceOfText)
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1871
    ) autoSearch:pieceOfText ignoreCase:true 
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1872
!
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1873
6317
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1874
browseMethodsContainingInSource
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1875
    "ask for a piece of text and 
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1876
     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
  1877
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1878
    |pieceOfText|
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1879
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1880
    pieceOfText := Dialog request:'Browse methods containing in source:'.
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1881
    pieceOfText isEmptyOrNil ifTrue:[^ self].
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1882
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1883
    self browseMethodsContainingInSource:pieceOfText
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1884
!
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1885
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1886
browseMethodsContainingInSource:pieceOfText
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1887
    "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
  1888
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1889
    (SystemBrowser default
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1890
        browseMethodsForWhich:[:m | 
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1891
            (m source ? '') includesString:pieceOfText caseSensitive:false 
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1892
        ]
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1893
        title:('Methods containing "%1"' bindWith:pieceOfText)
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1894
    ) autoSearch:pieceOfText ignoreCase:true 
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1895
!
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1896
6319
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1897
browseMethodsContainingItInName
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1898
    "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
  1899
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1900
    |selectedText|
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1901
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1902
    selectedText := self selectedTextOrSyntaxElement.
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1903
    selectedText notEmptyOrNil ifTrue:[
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1904
        selectedText := selectedText withoutSeparators.
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1905
        selectedText notEmpty ifTrue:[
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1906
            self browseMethodsContainingInName:selectedText.
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1907
        ]
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1908
    ].
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1909
!
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  1910
6317
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1911
browseMethodsContainingItInSource
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1912
    "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
  1913
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1914
    |selectedText|
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1915
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1916
    selectedText := self selectedTextOrSyntaxElement.
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1917
    selectedText notEmptyOrNil ifTrue:[
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1918
        selectedText := selectedText withoutSeparators.
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1919
        selectedText notEmpty ifTrue:[
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1920
            self browseMethodsContainingInSource:selectedText.
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1921
        ]
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1922
    ].
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1923
!
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1924
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1925
browseReferencesTo
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1926
    "ask for a name and 
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1927
     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
  1928
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1929
    |nameOfVariable|
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1930
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1931
    nameOfVariable := Dialog request:'Browse references to:'.
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1932
    nameOfVariable isEmptyOrNil ifTrue:[^ self].
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1933
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1934
    self browseReferencesTo:nameOfVariable
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1935
!
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1936
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1937
browseReferencesTo:nameOfVariable
5003
8d2610b84c45 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5002
diff changeset
  1938
    "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
  1939
6317
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1940
    |browserClass sym cls|
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1941
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1942
    browserClass := SystemBrowser default.
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1943
    self windowGroup withWaitCursorDo:[
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1944
        |nonMeta privateClass|
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1945
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1946
        (nameOfVariable startsWith:'#') ifTrue:[
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1947
            sym := (nameOfVariable copyFrom:2) asSymbolIfInterned.
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1948
            browserClass browseForSymbol:sym.
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1949
        ] ifFalse:[
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1950
            "/ is it a class variable?
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1951
            ((cls := self editedClass) notNil
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1952
            and:[ ((nonMeta := cls theNonMetaclass) allClassVarNames includes:nameOfVariable) ]) ifTrue:[
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1953
                nonMeta isSharedPool ifTrue:[
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1954
                    "/ class is a pool - browse all references to it.
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1955
                    browserClass browseReferendsOf:(nonMeta name,':',nameOfVariable)
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  1956
                ] ifFalse:[
6317
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1957
                    browserClass
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1958
                        browseRefsTo:nameOfVariable
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1959
                        classVars:true
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1960
                        in:(nonMeta whichClassDefinesClassVar:nameOfVariable) withAllSubclasses
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1961
                        modificationsOnly:false.
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1962
                ].
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1963
            ] ifFalse:[
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1964
                "/ is it a private class?
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1965
                (cls notNil
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1966
                and:[ (privateClass := cls theNonMetaclass privateClassNamed:nameOfVariable) notNil ]) ifTrue:[
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1967
                    browserClass browseReferendsOf:(privateClass name)
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1968
                ] ifFalse:[
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1969
                    |pool nsClass|
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1970
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1971
                    "/ is it a pool variable?
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1972
                    cls notNil ifTrue:[
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1973
                        pool := cls theNonMetaclass sharedPools
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1974
                                detect:[:pool | pool classVarNames includes:nameOfVariable]
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1975
                                ifNone:nil.
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1976
                    ].
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1977
                    pool notNil ifTrue:[
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1978
                        browserClass browseReferendsOf:(pool name,':',nameOfVariable)
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  1979
                    ] ifFalse:[
6317
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1980
                        (cls notNil
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1981
                          and:[ cls nameSpace notNil
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1982
                          and:[ cls nameSpace isNameSpace            
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1983
                          and:[ nameOfVariable knownAsSymbol  
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1984
                          and:[ (cls nameSpace name,'::',nameOfVariable) "nameOfVariable" knownAsSymbol  
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1985
                          and:[ (nsClass := cls nameSpace at:nameOfVariable asSymbol) notNil
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1986
                          and:[ nsClass isBehavior
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1987
                        ]]]]]]) ifTrue:[
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1988
                            "/ a namespace class?
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1989
                            browserClass browseReferendsOf:nsClass name
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  1990
                        ] ifFalse:[
6317
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1991
                            "/ an instvar?
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1992
                            (cls notNil and:[cls allInstVarNames includes:nameOfVariable]) ifTrue:[
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1993
                                browserClass 
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1994
                                    browseInstRefsTo:nameOfVariable 
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1995
                                    under:(cls whichClassDefinesInstVar:nameOfVariable) 
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1996
                                    modificationsOnly:false
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  1997
                            ] ifFalse:[
6317
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1998
                                "/ no, assume global
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1999
                                browserClass browseReferendsOf:nameOfVariable
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2000
                            ]
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2001
                        ]
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2002
                    ]
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2003
                ]
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2004
            ]
6317
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2005
        ]
2454
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
  2006
    ].
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
  2007
5618
6caed94c3cef #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5595
diff changeset
  2008
    "Created: / 05-11-2001 / 17:32:23 / cg"
6201
5493871b7dd2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6170
diff changeset
  2009
    "Modified: / 01-09-2017 / 14:24:09 / cg"
2454
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
  2010
!
49f806b17d33 + browseReferencesToIt
Claus Gittinger <cg@exept.de>
parents: 2451
diff changeset
  2011
6317
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2012
browseReferencesToIt
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2013
    "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
  2014
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2015
    |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
    nameOfVariable := self selectedTextOrSyntaxElement.
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2018
    nameOfVariable isEmptyOrNil ifTrue:[^ self].
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2019
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2020
    nameOfVariable := nameOfVariable string asString.
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2021
    nameOfVariable := nameOfVariable asSingleByteStringIfPossible.
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2022
    self browseReferencesTo:nameOfVariable
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2023
!
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2024
2462
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  2025
browseSendersOfIt
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  2026
    "open a browser on the senders of the selected text"
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  2027
2715
b6802cd279d0 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
  2028
    |selectedText selector|
2462
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  2029
4617
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  2030
    selectedText := self selectedTextOrSyntaxElement.
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  2031
    selectedText notEmptyOrNil ifTrue:[
6201
5493871b7dd2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6170
diff changeset
  2032
        self windowGroup withWaitCursorDo:[
5493871b7dd2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6170
diff changeset
  2033
            selector := SystemBrowser extractSelectorFrom:selectedText.
5493871b7dd2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6170
diff changeset
  2034
            SystemBrowser default
5493871b7dd2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6170
diff changeset
  2035
                browseAllCallsOn:(selector ? selectedText)
5493871b7dd2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6170
diff changeset
  2036
        ]
2462
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  2037
    ].
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  2038
6201
5493871b7dd2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6170
diff changeset
  2039
    "Created: / 05-11-2001 / 17:32:23 / cg"
5493871b7dd2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6170
diff changeset
  2040
    "Modified: / 01-09-2017 / 14:24:13 / cg"
2462
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  2041
!
49030ddcf83f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  2042
4209
c8e3967e8623 added: #browseSharedPoolOfIt
Claus Gittinger <cg@exept.de>
parents: 4188
diff changeset
  2043
browseSharedPoolOfIt
c8e3967e8623 added: #browseSharedPoolOfIt
Claus Gittinger <cg@exept.de>
parents: 4188
diff changeset
  2044
    "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
  2045
c8e3967e8623 added: #browseSharedPoolOfIt
Claus Gittinger <cg@exept.de>
parents: 4188
diff changeset
  2046
    |sel|
c8e3967e8623 added: #browseSharedPoolOfIt
Claus Gittinger <cg@exept.de>
parents: 4188
diff changeset
  2047
4617
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  2048
    sel := self selectedTextOrSyntaxElement.
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  2049
    sel notEmptyOrNil ifTrue:[
5506
a604a1bb195d #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5504
diff changeset
  2050
        sel := sel asSymbol.
a604a1bb195d #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5504
diff changeset
  2051
        self windowGroup withWaitCursorDo:[
a604a1bb195d #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5504
diff changeset
  2052
            SharedPool allSubclassesDo:[:eachPool |
a604a1bb195d #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5504
diff changeset
  2053
                (eachPool includesKey:sel) ifTrue:[
a604a1bb195d #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5504
diff changeset
  2054
                    eachPool class browse:#initialize
a604a1bb195d #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5504
diff changeset
  2055
                ].
a604a1bb195d #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5504
diff changeset
  2056
            ].
a604a1bb195d #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5504
diff changeset
  2057
        ].
4209
c8e3967e8623 added: #browseSharedPoolOfIt
Claus Gittinger <cg@exept.de>
parents: 4188
diff changeset
  2058
    ].
c8e3967e8623 added: #browseSharedPoolOfIt
Claus Gittinger <cg@exept.de>
parents: 4188
diff changeset
  2059
c8e3967e8623 added: #browseSharedPoolOfIt
Claus Gittinger <cg@exept.de>
parents: 4188
diff changeset
  2060
    "Created: / 15-01-2011 / 14:01:39 / cg"
c8e3967e8623 added: #browseSharedPoolOfIt
Claus Gittinger <cg@exept.de>
parents: 4188
diff changeset
  2061
!
c8e3967e8623 added: #browseSharedPoolOfIt
Claus Gittinger <cg@exept.de>
parents: 4188
diff changeset
  2062
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2063
doIt
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2064
    "user selected 'doIt' from menu; show a wait-cursor, evaluate the code
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2065
     and finally restore cursor; return result of evaluation"
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2066
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2067
    ^ self
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2068
	do:(self selectionOrTextOfCursorLine)
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2069
	withValueDo:nil
1521
e2bb7811e4db removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
  2070
e2bb7811e4db removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
  2071
    "Modified: / 16.5.1998 / 16:45:01 / cg"
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2072
!
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2073
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2074
editMenu
5878
bf8ff30c58d5 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5865
diff changeset
  2075
    "return my popUpMenu; that's the superclasses menu
1107
25753e7f960f commentary
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  2076
     PLUS st-evaluation items: doIt, printIt and inspectIt."
25753e7f960f commentary
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  2077
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2078
    <resource: #keyboard (#DoIt #PrintIt #InspectIt
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2079
                          #CommentSelection #UncommentSelection
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2080
                          #BrowseIt #ImplementorsOfIt
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2081
                         )>
1262
d69149b5be1f resource flag: #menu -> #programMenu
Claus Gittinger <cg@exept.de>
parents: 1251
diff changeset
  2082
    <resource: #programMenu>
489
5816aa12fec8 resources
Claus Gittinger <cg@exept.de>
parents: 444
diff changeset
  2083
4998
000a0752dd25 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 4997
diff changeset
  2084
    |m sub subsub idx sensor sel2 sel selectedSymbol|
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2085
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2086
    m := super editMenu.
3252
b44361e6b97a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3210
diff changeset
  2087
    ((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
  2088
        sub := m.
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2089
        m := nil.
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  2090
    ] ifFalse:[
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2091
        sub := m subMenuAt:#others.
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  2092
    ].
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2093
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  2094
    sub notNil ifTrue:[
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2095
        "
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2096
         workspaces support #browse, implementors etc. add them after paste.
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2097
        "
6317
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2098
        self hasSelection ifTrue:[
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2099
            sub
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2100
                addItemList:#(
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2101
                    ('-'                                                                        )
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2102
                    ('Browse It'                        browseIt                BrowseIt            )
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2103
                    ('Browse Pool'                      browseSharedPoolOfIt                        )
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2104
                    ('Senders of It'                    browseSendersOfIt                           )
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2105
                    ('Implementors of It'               browseImplementorsOfIt  ImplementorsOfIt    )
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2106
                    ('References to It'                 browseReferencesToIt                        )
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2107
                    ('Classes Containing It in Name'    browseClassesContainingItInName           )
6319
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  2108
                    ('Methods Containing It in Name'    browseMethodsContainingItInName         )
6317
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2109
                    ('Methods Containing It in Source'  browseMethodsContainingItInSource         )
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
                    ('TimeIt'               timeIt                                      )
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2112
                    ('SpyOnIt'              spyOnIt                                     ))
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2113
              resources:resources
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2114
              after:#gotoLine.
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2115
        ] ifFalse:[
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2116
            sub
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2117
                addItemList:#(
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2118
                    ('-'                                                                        )
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2119
                    ('Browse It'                        browseIt                BrowseIt            )
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2120
                    ('Browse Pool'                      browseSharedPoolOfIt                        )
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2121
                    ('Senders of...'                    browseSendersOf                           )
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2122
                    ('Implementors of...'               browseImplementorsOf   ImplementorsOf       )
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2123
                    ('References to...'                 browseReferencesTo                          )
6319
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  2124
                    ('Classes Containing in Name...'    browseClassesContainingInName   )
beb48f66edf1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6317
diff changeset
  2125
                    ('Methods Containing in Name...'    browseMethodsContainingInName   )
6317
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2126
                    ('Methods Containing in Source...'  browseMethodsWithString         )
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2127
                    ('-'                                                                )
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2128
                    ('TimeIt'               timeIt                                      )
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2129
                    ('SpyOnIt'              spyOnIt                                     ))
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2130
              resources:resources
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2131
              after:#gotoLine.
162eab34215c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  2132
        ].
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  2133
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2134
        subsub := sub subMenuAt:#tools.
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2135
        subsub notNil ifTrue:[
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2136
            subsub
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2137
                addItemList:#(
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2138
                    ('-'                                                                )
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2139
                    ('CommentIt'            commentSelection        CommentSelection    )
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2140
                    ('UncommentIt'          uncommentSelection      UncommentSelection  ))
5579
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2141
                resources:resources
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2142
                after:#'indent'.
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2143
            subsub
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2144
                addItemList:#(
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2145
                    ('Inspect Instances'       inspectInstances          nil)       
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2146
                )
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2147
                resources:resources  
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2148
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2149
                after:#inspectString.
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2150
                
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2151
            (self hasSelection not
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2152
            or:[ (sel := self selectionAsString asSymbolIfInterned) isNil
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2153
            or:[ (Smalltalk at:sel) isBehavior not ]]) ifTrue:[
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2154
                sub disable:#inspectInstances
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2155
            ].    
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2156
        ].
2867
4d21f141d0c9 menu reorganized
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  2157
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2158
        self hasSelection ifFalse:[
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2159
            sub disableAll:#(browseImplementorsOfIt browseSendersOfIt
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2160
                             browseReferencesToIt timeIt spyOnIt
5579
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2161
                             browseSharedPoolOfIt browseIt inspectInstances).
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2162
            self supportsSyntaxElements ifTrue:[
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2163
                self syntaxElementForSelectorUnderCursor notNil ifTrue:[
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2164
                    sub enableAll:#(browseImplementorsOfIt browseSendersOfIt )
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2165
                ] ifFalse:[
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2166
                    |el|
4617
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  2167
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2168
                    (el := self syntaxElementForVariableUnderCursor) notNil ifTrue:[
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2169
                        (el isGlobal or:[el isInstanceVariable]) ifTrue:[
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2170
                            sub enable: #browseReferencesToIt
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2171
                        ].
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2172
                        el isClass ifTrue:[
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2173
                            sub enable:#browseIt
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2174
                        ]
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2175
                    ]
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2176
                ]
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2177
            ].
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2178
        ] ifTrue:[
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2179
            sel := self selectionAsString.
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2180
            sel notNil ifTrue:[
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2181
                sel asSymbolIfInterned isNil ifTrue:[
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2182
                    sel2 := SystemBrowser extractSelectorFrom:sel.
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2183
                    sel2 notNil ifTrue:[
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2184
                        sel2 := sel2 asSymbolIfInterned.
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2185
                    ].
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2186
                ].
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2187
            ].
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2188
            (sel2 isNil and:[sel isNil]) ifTrue:[
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2189
                sub disableAll:#(browseImplementorsOfIt browseSendersOfIt).
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2190
            ].
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2191
            "/ a global or namespace-var selected ?
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2192
            sel isNil ifTrue:[
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2193
                sub disable:#browseReferencesToIt.
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2194
            ] ifFalse:[
5066
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2195
                (sel startsWith:'#') ifTrue:[
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2196
                    "/ a symbol selected - can search references
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2197
                ] ifFalse:[
5066
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2198
                    selectedSymbol := sel asSymbolIfInterned.
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2199
                    (selectedSymbol notNil
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2200
                     and:[(Smalltalk includesKey:selectedSymbol)
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2201
                          or:[(NameSpace allNameSpaces contains:[:ns | ns includesKey:selectedSymbol]) ]]
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2202
                    ) ifTrue:[
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2203
                        "/ a global or namespace var selected
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2204
                    ] ifFalse:[
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2205
                        |cls|
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2206
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2207
                        cls := self editedClass.
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2208
                        cls notNil ifTrue:[
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2209
                            cls := cls theNonMetaclass.
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2210
                            ((cls allClassVarNames includes:sel)
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2211
                              or:[ (cls theNonMetaclass privateClassNamed:sel) notNil]) ifTrue:[
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2212
                                "/ a classvar or private class
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2213
                            ] ifFalse:[
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2214
                                |pool|
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2215
                                "/ is it a pool variable?
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2216
                                pool := cls sharedPools
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2217
                                        detect:[:pool | pool classVarNames includes:sel]
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2218
                                        ifNone:nil.
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2219
                                pool isNil ifTrue:[
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2220
                                    "/ todo: an instvar selected?
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2221
                                    (cls allInstVarNames includes:sel) ifFalse:[
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2222
                                        sub disable:#browseReferencesToIt.
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2223
                                    ].
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2224
                                ].
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2225
                            ].
5066
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2226
                        ] ifFalse:[
8ed2ee897fbe class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
  2227
                            sub disable:#browseReferencesToIt.
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2228
                        ].
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2229
                    ].
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2230
                ].
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2231
            ].
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2232
            (selectedSymbol notNil
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2233
             and:[SharedPool allSubclasses contains:[:pool | pool includesKey:selectedSymbol]]) ifFalse:[
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2234
                sub disable:#browseSharedPoolOfIt.
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2235
            ].
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2236
        ].
6302
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  2237
        (self isReadOnly or:[commentStrings isEmptyOrNil]) ifTrue:[
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2238
            sub disableAll:#(commentSelection uncommentSelection)
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2239
        ].
1395
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  2240
    ].
cbadcf93c173 moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  2241
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  2242
    m notNil ifTrue:[
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2243
        "
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2244
         workspaces support #doIt, #printIt and #inspectIt
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2245
         add them after paste.
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2246
        "
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2247
        idx := m indexOf:#paste.
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2248
        idx == 0 ifTrue:[idx := m indexOf:#pasteOrReplace].
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2249
        idx ~~ 0 ifTrue:[
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2250
            m
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2251
              addItemList:#(
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2252
                ('-'                                )
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2253
                ('DoIt'         doIt        DoIt     )
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2254
                ('PrintIt'      printIt     PrintIt  )
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2255
                ('InspectIt'    inspectIt   InspectIt))
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2256
              resources:resources
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2257
              after:idx.
4998
000a0752dd25 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 4997
diff changeset
  2258
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2259
        ].
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  2260
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2261
        (self hasSelectionOrTextInCursorLine) ifFalse:[
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2262
            |lNr line|
3272
0e5fdbce3724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3261
diff changeset
  2263
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2264
            lNr := self cursorLine.
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2265
            line := self listAt:lNr.
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2266
            line isEmptyOrNil ifTrue:[
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2267
                m disableAll:#(printIt doIt inspectIt browseIt)
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2268
            ].
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2269
        ].
6302
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  2270
        doItAction isNil ifTrue:[
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  2271
            m disableAll:#(printIt doIt inspectIt timeIt spyOnIt)
9a1eaefba171 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6283
diff changeset
  2272
        ].
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2273
        self isReadOnly ifTrue:[
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2274
            m disable:#printIt
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2275
        ].
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2276
    ].
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2277
2459
050dfa4aa0c9 menus changed
Claus Gittinger <cg@exept.de>
parents: 2457
diff changeset
  2278
    ^ m ? sub.
430
022b667e0d70 added accelerator display
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  2279
4209
c8e3967e8623 added: #browseSharedPoolOfIt
Claus Gittinger <cg@exept.de>
parents: 4188
diff changeset
  2280
    "Modified: / 22-04-1998 / 21:49:06 / ca"
4342
2845509d2b8a changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 4317
diff changeset
  2281
    "Modified: / 20-12-2011 / 11:22:20 / cg"
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2282
!
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2283
5579
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2284
inspectInstances
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2285
    |nameOfVariable cls insts|
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2286
    
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2287
    nameOfVariable := self selectedTextOrSyntaxElement.
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2288
    nameOfVariable isEmptyOrNil ifTrue:[^ self].
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2289
    nameOfVariable := nameOfVariable asSymbolIfInterned.
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2290
    nameOfVariable isNil ifTrue:[^ self].
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2291
    cls := Smalltalk at:nameOfVariable.
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2292
    cls isNil ifTrue:[^ self].
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2293
    cls isBehavior ifFalse:[^ self].
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2294
    insts := cls allInstances.
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2295
    insts isEmpty ifTrue:[
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2296
        Dialog information:(resources string:'No instances of %1' with:nameOfVariable).
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2297
        ^ self.
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2298
    ].    
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2299
    insts inspect.
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2300
!
028c351dfc0d #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5566
diff changeset
  2301
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2302
inspectIt
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2303
    "user selected 'inspectIt' from menu; use doIt to evaluate the code
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2304
     and start an inspector on the result"
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2305
2981
75abc5efbf67 shift-inspect (= basicInspect)
Claus Gittinger <cg@exept.de>
parents: 2980
diff changeset
  2306
    |shifted|
75abc5efbf67 shift-inspect (= basicInspect)
Claus Gittinger <cg@exept.de>
parents: 2980
diff changeset
  2307
75abc5efbf67 shift-inspect (= basicInspect)
Claus Gittinger <cg@exept.de>
parents: 2980
diff changeset
  2308
    shifted := self sensor shiftDown.
75abc5efbf67 shift-inspect (= basicInspect)
Claus Gittinger <cg@exept.de>
parents: 2980
diff changeset
  2309
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2310
    ^ self
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2311
	do:(self selectionOrTextOfCursorLine)
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2312
	withValueDo:[:result | shifted ifTrue:[result basicInspect] ifFalse:[result inspect] ]
1521
e2bb7811e4db removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
  2313
e2bb7811e4db removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
  2314
    "Modified: / 16.5.1998 / 16:44:56 / cg"
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2315
!
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2316
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2317
printIt
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2318
    "user selected 'printIt' from menu; use doIt to evaluate the code
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2319
     and insert result of evaluation into my text.
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2320
     If the text is readOnly, do nothing."
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2321
1734
e71982a6a4c5 use self isReadonly
Claus Gittinger <cg@exept.de>
parents: 1523
diff changeset
  2322
    self isReadOnly ifTrue:[
6263
8d70af79d06f #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6223
diff changeset
  2323
        self beepInEditor.
5148
006f1e2256cd class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  2324
        ^ self.
3511
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2325
    ].
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2326
    self
5148
006f1e2256cd class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  2327
        undoableDo:[
006f1e2256cd class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  2328
            self
006f1e2256cd class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  2329
                do:(self selectionOrTextOfCursorLine)
006f1e2256cd class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  2330
                withValueDo:[:result |
5396
c699ff474608 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5290
diff changeset
  2331
                    |s printer lang|
5148
006f1e2256cd class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  2332
006f1e2256cd class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  2333
                    self cursorLine:selectionEndLine col:(selectionEndCol + 1).
5396
c699ff474608 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5290
diff changeset
  2334
                    "/ give the language a chance to generate a printString for that value
c699ff474608 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5290
diff changeset
  2335
                    lang := self editedLanguage.
c699ff474608 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5290
diff changeset
  2336
                    (lang notNil and:[(printer := lang valuePrinterClass) notNil]) ifTrue:[
5148
006f1e2256cd class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  2337
                        s := printer printStringForPrintItOf:result
006f1e2256cd class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  2338
                    ] ifFalse:[
6020
79c1a6bb497a #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6016
diff changeset
  2339
                        result isProtoObject ifTrue:[
79c1a6bb497a #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6016
diff changeset
  2340
                            s := result displayString.
5148
006f1e2256cd class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  2341
                        ] ifFalse:[
6020
79c1a6bb497a #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6016
diff changeset
  2342
                            (result isInteger
79c1a6bb497a #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6016
diff changeset
  2343
                             and:[ result > 10
79c1a6bb497a #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6016
diff changeset
  2344
                             and:[ InspectorView defaultIntegerDisplayRadix ~= 10]]) ifTrue:[
79c1a6bb497a #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6016
diff changeset
  2345
                                s := result displayString , ' "',(result radixPrintStringRadix: InspectorView defaultIntegerDisplayRadix),'"'.
79c1a6bb497a #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6016
diff changeset
  2346
                            ] ifFalse:[
79c1a6bb497a #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6016
diff changeset
  2347
                                s := result printStringForPrintIt "old: displayString" "very old: printString"
79c1a6bb497a #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6016
diff changeset
  2348
                            ].
79c1a6bb497a #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6016
diff changeset
  2349
                        ]
5148
006f1e2256cd class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  2350
                    ].
5565
e26cfc2a8ae8 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5512
diff changeset
  2351
                    
e26cfc2a8ae8 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5512
diff changeset
  2352
                    self withAutoIndent:false do:[ 
e26cfc2a8ae8 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5512
diff changeset
  2353
                        "/ if the returned string starts with a newLine,
e26cfc2a8ae8 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5512
diff changeset
  2354
                        "/ insert as a bunch of lines after the cursor line.
e26cfc2a8ae8 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5512
diff changeset
  2355
                        (s size > 0 and:[s startsWith:(Character cr)]) ifTrue:[
5566
c25bc1fbc26a #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5565
diff changeset
  2356
                            |cursorLine cursorCol lines|
5565
e26cfc2a8ae8 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5512
diff changeset
  2357
                            
e26cfc2a8ae8 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5512
diff changeset
  2358
                            cursorLine := self cursorLine.
5566
c25bc1fbc26a #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5565
diff changeset
  2359
                            cursorCol := self cursorCol.
5565
e26cfc2a8ae8 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5512
diff changeset
  2360
                            lines := s asStringCollection copyFrom:2.
5566
c25bc1fbc26a #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5565
diff changeset
  2361
                            self insertLines:lines before:cursorLine+((cursorCol == 1) ifTrue:0 ifFalse:1).
5565
e26cfc2a8ae8 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5512
diff changeset
  2362
                            self selectFromLine:cursorLine+1 toLine:cursorLine+lines size.
e26cfc2a8ae8 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5512
diff changeset
  2363
                        ] ifFalse:[    
e26cfc2a8ae8 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5512
diff changeset
  2364
                            self insertSelectedStringAtCursor:s 
e26cfc2a8ae8 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5512
diff changeset
  2365
                        ]
e26cfc2a8ae8 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5512
diff changeset
  2366
                    ]
5148
006f1e2256cd class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  2367
                ]
006f1e2256cd class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  2368
        ]
006f1e2256cd class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  2369
        info:'PrintIt'
3511
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2370
4401
Claus Gittinger <cg@exept.de>
parents: 4398
diff changeset
  2371
    "Modified: / 08-03-2012 / 16:14:34 / cg"
3511
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2372
!
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2373
4471
6b403ca6c388 added profileIt menu item
Claus Gittinger <cg@exept.de>
parents: 4459
diff changeset
  2374
profileIt
6b403ca6c388 added profileIt menu item
Claus Gittinger <cg@exept.de>
parents: 4459
diff changeset
  2375
    "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
  2376
     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
  2377
4472
1eef89af0ef0 added: #spyOnItUsing:
Claus Gittinger <cg@exept.de>
parents: 4471
diff changeset
  2378
    self spyOnItUsing:Tools::Profiler
4471
6b403ca6c388 added profileIt menu item
Claus Gittinger <cg@exept.de>
parents: 4459
diff changeset
  2379
!
6b403ca6c388 added profileIt menu item
Claus Gittinger <cg@exept.de>
parents: 4459
diff changeset
  2380
3511
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2381
replaceIt
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2382
    "like printIt, but replace the selection with the result, instead of
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2383
     pasting it after the selection."
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2384
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2385
    self isReadOnly ifTrue:[
6263
8d70af79d06f #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6223
diff changeset
  2386
        self beepInEditor.
8d70af79d06f #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6223
diff changeset
  2387
        ^ self
3511
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2388
    ].
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2389
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2390
    self
6263
8d70af79d06f #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6223
diff changeset
  2391
        undoableDo:[
8d70af79d06f #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6223
diff changeset
  2392
            self
8d70af79d06f #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6223
diff changeset
  2393
                do:(self selectionOrTextOfCursorLine)
8d70af79d06f #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6223
diff changeset
  2394
                withValueDo:[:result |
8d70af79d06f #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6223
diff changeset
  2395
                    self replaceSelectionBy:(result displayString "printString")
8d70af79d06f #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6223
diff changeset
  2396
                ].
8d70af79d06f #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6223
diff changeset
  2397
                undoSupport actionInfo:'ReplaceIt'.
8d70af79d06f #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6223
diff changeset
  2398
        ]
8d70af79d06f #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6223
diff changeset
  2399
        info:'ReplaceIt'
3511
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2400
ffd673242662 +replaceIt;
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2401
    "Created: / 08-11-2007 / 11:31:54 / cg"
1501
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  2402
!
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  2403
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  2404
spyOnIt
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  2405
    "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
  2406
     and finally restore the cursor. Show profile data on the Transcript"
1eef89af0ef0 added: #spyOnItUsing:
Claus Gittinger <cg@exept.de>
parents: 4471
diff changeset
  2407
1eef89af0ef0 added: #spyOnItUsing:
Claus Gittinger <cg@exept.de>
parents: 4471
diff changeset
  2408
    self spyOnItUsing:MessageTally
1eef89af0ef0 added: #spyOnItUsing:
Claus Gittinger <cg@exept.de>
parents: 4471
diff changeset
  2409
!
1eef89af0ef0 added: #spyOnItUsing:
Claus Gittinger <cg@exept.de>
parents: 4471
diff changeset
  2410
1eef89af0ef0 added: #spyOnItUsing:
Claus Gittinger <cg@exept.de>
parents: 4471
diff changeset
  2411
spyOnItUsing:aProfiler
1eef89af0ef0 added: #spyOnItUsing:
Claus Gittinger <cg@exept.de>
parents: 4471
diff changeset
  2412
    "common code for spyOnIt / profileIt.
1eef89af0ef0 added: #spyOnItUsing:
Claus Gittinger <cg@exept.de>
parents: 4471
diff changeset
  2413
     Show a wait-cursor, evaluate the code with profier on it,
1eef89af0ef0 added: #spyOnItUsing:
Claus Gittinger <cg@exept.de>
parents: 4471
diff changeset
  2414
     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
  2415
5865
e3e40eabdebc #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 5731
diff changeset
  2416
    |code codeToRun|
e3e40eabdebc #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 5731
diff changeset
  2417
        
e3e40eabdebc #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 5731
diff changeset
  2418
    codeToRun := self selectionOrTextOfCursorLine.
e3e40eabdebc #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 5731
diff changeset
  2419
    (codeToRun isEmptyOrNil or:[codeToRun isBlank]) ifTrue:[^ self].
e3e40eabdebc #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 5731
diff changeset
  2420
    
5504
0dda43e18c90 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5396
diff changeset
  2421
    compilerClass == (Smalltalk at:#Compiler) ifFalse:[
5865
e3e40eabdebc #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 5731
diff changeset
  2422
        "sigh - this measurement will include the time to compile - sigh"
e3e40eabdebc #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 5731
diff changeset
  2423
        aProfiler spyDetailedOn:[ self doIt ].
e3e40eabdebc #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 5731
diff changeset
  2424
        ^ self.
4427
9eb0f20e7ed8 changed:
Claus Gittinger <cg@exept.de>
parents: 4416
diff changeset
  2425
    ].
9eb0f20e7ed8 changed:
Claus Gittinger <cg@exept.de>
parents: 4416
diff changeset
  2426
5865
e3e40eabdebc #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 5731
diff changeset
  2427
    code := aProfiler name,' spyDetailedOn:[' , codeToRun, ']'.
4149
105b82a1365d changed:
Stefan Vogel <sv@exept.de>
parents: 4148
diff changeset
  2428
    self do:code withValueDo:[:value| ].
1501
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  2429
!
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  2430
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  2431
timeIt
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  2432
    "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
  2433
     and finally restore cursor; return result of evaluation"
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  2434
5135
4024c8249107 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 5116
diff changeset
  2435
    |code|
4427
9eb0f20e7ed8 changed:
Claus Gittinger <cg@exept.de>
parents: 4416
diff changeset
  2436
5504
0dda43e18c90 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5396
diff changeset
  2437
    compilerClass == (Smalltalk at:#Compiler) ifFalse:[
5135
4024c8249107 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 5116
diff changeset
  2438
        "sigh - this measurement will include the time to compile - sigh"
4024c8249107 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 5116
diff changeset
  2439
        [ self doIt ] benchmark:'execution time: '.
4024c8249107 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 5116
diff changeset
  2440
        ^ self.
4427
9eb0f20e7ed8 changed:
Claus Gittinger <cg@exept.de>
parents: 4416
diff changeset
  2441
    ].
1501
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  2442
5135
4024c8249107 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 5116
diff changeset
  2443
    code := '[' , self selectionAsString, '] benchmark:''execution time: '''.
4149
105b82a1365d changed:
Stefan Vogel <sv@exept.de>
parents: 4148
diff changeset
  2444
    self do:code withValueDo:[:value | ].
1501
5d106262fac2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  2445
4427
9eb0f20e7ed8 changed:
Claus Gittinger <cg@exept.de>
parents: 4416
diff changeset
  2446
    "Modified: / 22-04-1998 / 22:03:51 / ca"
9eb0f20e7ed8 changed:
Claus Gittinger <cg@exept.de>
parents: 4416
diff changeset
  2447
    "Modified (format): / 02-06-2012 / 00:38:51 / cg"
418
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2448
! !
777061f25321 commentary
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
  2449
3968
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2450
!Workspace methodsFor:'misc'!
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2451
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2452
expandAbbreviation
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2453
    "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
  2454
     cursor, find an abbrev for it and expand."
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2455
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2456
    |expandedString abortExpandAction oldSelectionStartLine oldSelectionStartCol oldSelectionEndLine oldSelectionEndCol oldCursorLine oldCursorCol
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2457
     newCursorPos replStartCol|
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2458
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2459
    oldCursorLine := self cursorLine.
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2460
    oldCursorCol := self cursorCol.
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2461
    oldSelectionStartLine := self selectionStartLine.
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2462
    oldSelectionStartCol := self selectionStartCol.
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2463
    oldSelectionEndLine := self selectionEndLine.
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2464
    oldSelectionEndCol := self selectionEndCol.
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2465
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2466
    abortExpandAction :=
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2467
	[
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2468
	    self
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2469
		selectFromLine:oldSelectionStartLine col:oldSelectionStartCol
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2470
		toLine:oldSelectionEndLine col:oldSelectionEndCol.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2471
	    self cursorLine:oldCursorLine col:oldCursorCol.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2472
	].
4706
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2473
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2474
    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
  2475
    expandedString isNil ifTrue:[
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2476
	abortExpandAction value.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2477
	^ self
3968
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2478
    ].
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2479
    newCursorPos := expandedString indexOf:$!!.
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2480
    newCursorPos ~~ 0 ifTrue:[
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2481
	expandedString := expandedString copyWithout:$!!.
3968
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2482
    ].
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2483
    replStartCol := self selectionStartCol.
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2484
    self
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2485
	undoableDo:[
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2486
	    self replaceSelectionBy: expandedString
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2487
	]
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2488
	info:'Replace'.
3968
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2489
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2490
    newCursorPos == 0 ifTrue:[
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2491
	"/ cursor already fine (at the end)
3968
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2492
    ] ifFalse:[
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2493
	self cursorCol:replStartCol+newCursorPos-1
3968
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2494
    ]
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2495
!
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2496
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2497
findAbbreviationKeyBeforeCursor
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2498
    "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
  2499
     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
  2500
     If none is found, return nil"
3968
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2501
4745
ba8ca65cd308 ouch - sniplet is a type;
Claus Gittinger <cg@exept.de>
parents: 4744
diff changeset
  2502
    |snippets keys minMax maxKeyLen minKeyLen stringBeforeCursor|
ba8ca65cd308 ouch - sniplet is a type;
Claus Gittinger <cg@exept.de>
parents: 4744
diff changeset
  2503
5144
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
  2504
    snippets := self class snippets.
4745
ba8ca65cd308 ouch - sniplet is a type;
Claus Gittinger <cg@exept.de>
parents: 4744
diff changeset
  2505
    keys := snippets keys.
4714
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2506
3968
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2507
    minMax := (keys collect:[:k | k size]) minMax.
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2508
    minKeyLen := minMax first.
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2509
    maxKeyLen := minMax second.
4714
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2510
51632062269b class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4709
diff changeset
  2511
    stringBeforeCursor := self lineStringBeforeCursor.
3968
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2512
    maxKeyLen := maxKeyLen min:stringBeforeCursor size.
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2513
4706
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2514
    maxKeyLen to:minKeyLen by:-1 do:[:keyLen |
5144
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
  2515
        |lCharactersBeforeCursor expandedString|
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
  2516
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
  2517
        lCharactersBeforeCursor := stringBeforeCursor last:keyLen.
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
  2518
        expandedString := snippets at:lCharactersBeforeCursor ifAbsent:nil.
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
  2519
        expandedString notNil ifTrue:[
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
  2520
            ^ { lCharactersBeforeCursor . expandedString withCRs }
d5c4faccd1c9 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
  2521
        ].
3968
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2522
    ].
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2523
    ^ nil.
4185
44ac2c080798 changed:
Claus Gittinger <cg@exept.de>
parents: 4184
diff changeset
  2524
44ac2c080798 changed:
Claus Gittinger <cg@exept.de>
parents: 4184
diff changeset
  2525
    "Modified: / 29-10-2010 / 10:22:38 / cg"
4617
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  2526
!
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  2527
4706
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2528
selectAbbreviationKeyBeforeCursor
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2529
    "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
  2530
     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
  2531
     If none is found, do not select and return nil"
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2532
4745
ba8ca65cd308 ouch - sniplet is a type;
Claus Gittinger <cg@exept.de>
parents: 4744
diff changeset
  2533
    |keyAndSnippet snippet key|
ba8ca65cd308 ouch - sniplet is a type;
Claus Gittinger <cg@exept.de>
parents: 4744
diff changeset
  2534
ba8ca65cd308 ouch - sniplet is a type;
Claus Gittinger <cg@exept.de>
parents: 4744
diff changeset
  2535
    (keyAndSnippet := self findAbbreviationKeyBeforeCursor) notNil ifTrue:[
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2536
	key := keyAndSnippet first.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2537
	snippet := keyAndSnippet second.
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2538
	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
  2539
	^ snippet
4706
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2540
    ].
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2541
    ^ nil.
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2542
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2543
    "Modified: / 29-10-2010 / 10:22:38 / cg"
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2544
!
9f5bf17d6d7e class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4705
diff changeset
  2545
4617
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  2546
selectedTextOrSyntaxElement
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  2547
    |selectedText el|
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  2548
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  2549
    selectedText := self selectionAsString.
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  2550
    selectedText isEmptyOrNil ifTrue:[
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2551
        el := self syntaxElementUnderCursor.
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2552
        el notNil ifTrue:[ selectedText := el value ].
4617
fd8ab83afd6a class: Workspace
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  2553
    ].
5053
ce5ca46e8388 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5024
diff changeset
  2554
    ^ selectedText
4998
000a0752dd25 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 4997
diff changeset
  2555
!
000a0752dd25 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 4997
diff changeset
  2556
000a0752dd25 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 4997
diff changeset
  2557
syntaxElementForSelectorUnderCursor
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2558
    "we do not support syntax elements, but subclasses may do"
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2559
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2560
    ^ nil
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2561
!
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2562
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2563
syntaxElementUnderCursor
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2564
    "we do not support syntax elements, but subclasses may do"
4998
000a0752dd25 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 4997
diff changeset
  2565
000a0752dd25 class: Workspace
Stefan Vogel <sv@exept.de>
parents: 4997
diff changeset
  2566
    ^ nil
3968
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2567
! !
37af1e95c4b4 category and comment changes
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
  2568
2646
dcee45d1c5ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2641
diff changeset
  2569
!Workspace methodsFor:'queries'!
dcee45d1c5ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2641
diff changeset
  2570
dcee45d1c5ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2641
diff changeset
  2571
isWorkspace
4395
a862858a2165 comment: #isWorkspace
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2572
    "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
  2573
     (for error feedback)"
a862858a2165 comment: #isWorkspace
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2574
2646
dcee45d1c5ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2641
diff changeset
  2575
    ^ true
4395
a862858a2165 comment: #isWorkspace
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2576
a862858a2165 comment: #isWorkspace
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2577
    "Modified (comment): / 07-03-2012 / 17:52:59 / cg"
5990
31f05a6924f2 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5982
diff changeset
  2578
!
31f05a6924f2 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5982
diff changeset
  2579
31f05a6924f2 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5982
diff changeset
  2580
showLineLimitInMenu
31f05a6924f2 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5982
diff changeset
  2581
    ^ false.
2646
dcee45d1c5ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2641
diff changeset
  2582
! !
dcee45d1c5ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2641
diff changeset
  2583
206
2363a64a7c88 version at the end
Claus Gittinger <cg@exept.de>
parents: 201
diff changeset
  2584
!Workspace class methodsFor:'documentation'!
2363a64a7c88 version at the end
Claus Gittinger <cg@exept.de>
parents: 201
diff changeset
  2585
4402
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  2586
version
5396
c699ff474608 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5290
diff changeset
  2587
    ^ '$Header$'
4402
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  2588
!
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  2589
3959
2d90b5eaada7 changed:
Claus Gittinger <cg@exept.de>
parents: 3910
diff changeset
  2590
version_CVS
5396
c699ff474608 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5290
diff changeset
  2591
    ^ '$Header$'
858
ef7ba327189b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  2592
! !
5065
8297b68f9fe1 class: Workspace
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
  2593