Java.st
author vranyj1
Fri, 19 Aug 2011 08:58:19 +0000
changeset 749 e898eaeff091
parent 748 da0840b7798c
child 2088 d654e34676d7
permissions -rw-r--r--
Synchronized with CVS repository at: :ext:vrany@dialin.exept.de:/cvs/stx
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
454
38f590639d65 *** empty log message ***
cg
parents: 436
diff changeset
     1
"
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
     2
 COPYRIGHT (c) 1996-2011 by Claus Gittinger
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
     3
 COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
     4
                            SWING Research Group, Czech Technical University in Prague
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
     5
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
     6
 Parts of the code written by Claus Gittinger are under following
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
     7
 license:
454
38f590639d65 *** empty log message ***
cg
parents: 436
diff changeset
     8
38f590639d65 *** empty log message ***
cg
parents: 436
diff changeset
     9
 This software is furnished under a license and may be used
38f590639d65 *** empty log message ***
cg
parents: 436
diff changeset
    10
 only in accordance with the terms of that license and with the
38f590639d65 *** empty log message ***
cg
parents: 436
diff changeset
    11
 inclusion of the above copyright notice.   This software may not
38f590639d65 *** empty log message ***
cg
parents: 436
diff changeset
    12
 be provided or otherwise made available to, or used by, any
38f590639d65 *** empty log message ***
cg
parents: 436
diff changeset
    13
 other person.  No title to or ownership of the software is
38f590639d65 *** empty log message ***
cg
parents: 436
diff changeset
    14
 hereby transferred.
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    15
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    16
 Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    17
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    18
 Permission is hereby granted, free of charge, to any person
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    19
 obtaining a copy of this software and associated documentation
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    20
 files (the 'Software'), to deal in the Software without
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    21
 restriction, including without limitation the rights to use,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    22
 copy, modify, merge, publish, distribute, sublicense, and/or sell
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    23
 copies of the Software, and to permit persons to whom the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    24
 Software is furnished to do so, subject to the following
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    25
 conditions:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    26
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    27
 The above copyright notice and this permission notice shall be
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    28
 included in all copies or substantial portions of the Software.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    29
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    30
 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    31
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    32
 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    33
 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    34
 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    35
 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    36
 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    37
 OTHER DEALINGS IN THE SOFTWARE.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    38
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    39
 [1] Code written at SWING Research Group contain a signature
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    40
     of one of the above copright owners.
454
38f590639d65 *** empty log message ***
cg
parents: 436
diff changeset
    41
"
677
63fd7b5d0027 *** empty log message ***
cg
parents: 675
diff changeset
    42
"{ Package: 'stx:libjava' }"
63fd7b5d0027 *** empty log message ***
cg
parents: 675
diff changeset
    43
17
ea80d8a83063 intitial checkin
cg
parents:
diff changeset
    44
Object subclass:#Java
557
469fe709a779 checkin from browser
cg
parents: 552
diff changeset
    45
	instanceVariableNames:''
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    46
	classVariableNames:'Classes UnresolvedClassRefs Release ClassPath SourceDirectories
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    47
		CacheDirectory JavaHome InternedStrings Java_lang_String
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    48
		Java_lang_Class PrettyPrintStyle LastArgumentString Threads
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    49
		ExcludedClassPath FailedToLoadClasses SourceCache
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    50
		SourceArchiveCache'
557
469fe709a779 checkin from browser
cg
parents: 552
diff changeset
    51
	poolDictionaries:''
713
75e92ac63bf1 category change
cg
parents: 711
diff changeset
    52
	category:'Languages-Java-Support'
17
ea80d8a83063 intitial checkin
cg
parents:
diff changeset
    53
!
ea80d8a83063 intitial checkin
cg
parents:
diff changeset
    54
454
38f590639d65 *** empty log message ***
cg
parents: 436
diff changeset
    55
!Java class methodsFor:'documentation'!
38f590639d65 *** empty log message ***
cg
parents: 436
diff changeset
    56
38f590639d65 *** empty log message ***
cg
parents: 436
diff changeset
    57
copyright
38f590639d65 *** empty log message ***
cg
parents: 436
diff changeset
    58
"
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    59
 COPYRIGHT (c) 1996-2011 by Claus Gittinger
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    60
 COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    61
                            SWING Research Group, Czech Technical University in Prague
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    62
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    63
 Parts of the code written by Claus Gittinger are under following
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    64
 license:
454
38f590639d65 *** empty log message ***
cg
parents: 436
diff changeset
    65
38f590639d65 *** empty log message ***
cg
parents: 436
diff changeset
    66
 This software is furnished under a license and may be used
38f590639d65 *** empty log message ***
cg
parents: 436
diff changeset
    67
 only in accordance with the terms of that license and with the
38f590639d65 *** empty log message ***
cg
parents: 436
diff changeset
    68
 inclusion of the above copyright notice.   This software may not
38f590639d65 *** empty log message ***
cg
parents: 436
diff changeset
    69
 be provided or otherwise made available to, or used by, any
38f590639d65 *** empty log message ***
cg
parents: 436
diff changeset
    70
 other person.  No title to or ownership of the software is
38f590639d65 *** empty log message ***
cg
parents: 436
diff changeset
    71
 hereby transferred.
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    72
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    73
 Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    74
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    75
 Permission is hereby granted, free of charge, to any person
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    76
 obtaining a copy of this software and associated documentation
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    77
 files (the 'Software'), to deal in the Software without
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    78
 restriction, including without limitation the rights to use,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    79
 copy, modify, merge, publish, distribute, sublicense, and/or sell
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    80
 copies of the Software, and to permit persons to whom the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    81
 Software is furnished to do so, subject to the following
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    82
 conditions:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    83
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    84
 The above copyright notice and this permission notice shall be
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    85
 included in all copies or substantial portions of the Software.
454
38f590639d65 *** empty log message ***
cg
parents: 436
diff changeset
    86
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    87
 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    88
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    89
 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    90
 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    91
 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    92
 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    93
 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    94
 OTHER DEALINGS IN THE SOFTWARE.
454
38f590639d65 *** empty log message ***
cg
parents: 436
diff changeset
    95
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    96
 [1] Code written at SWING Research Group contain a signature
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    97
     of one of the above copright owners.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    98
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    99
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   100
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   101
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   102
documentation
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   103
"Java class is main entry point or - you might say -
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   104
facade to the Java world inside Smalltalk. It also 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   105
serves as configuration entity - e.g. controlling 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   106
classpath, source paths, etc. Java class is responsible
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   107
for correct initialization and glueing other classes.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   108
"
454
38f590639d65 *** empty log message ***
cg
parents: 436
diff changeset
   109
! !
17
ea80d8a83063 intitial checkin
cg
parents:
diff changeset
   110
135
098936234135 *** empty log message ***
cg
parents: 121
diff changeset
   111
!Java class methodsFor:'accessing'!
24
4a9822b95fc0 checkin from browser
cg
parents: 21
diff changeset
   112
147
14fc6545fb32 checkin from browser
cg
parents: 146
diff changeset
   113
classForName:aString
14fc6545fb32 checkin from browser
cg
parents: 146
diff changeset
   114
    "return a javaClass - either existing or loaded"
14fc6545fb32 checkin from browser
cg
parents: 146
diff changeset
   115
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   116
    |cls loader|
147
14fc6545fb32 checkin from browser
cg
parents: 146
diff changeset
   117
14fc6545fb32 checkin from browser
cg
parents: 146
diff changeset
   118
    cls := self at:aString.
14fc6545fb32 checkin from browser
cg
parents: 146
diff changeset
   119
    cls isNil ifTrue:[
340
79f09bb1ac21 remember classes which failed to load - dont try those again.
cg
parents: 324
diff changeset
   120
        FailedToLoadClasses notNil ifTrue:[
79f09bb1ac21 remember classes which failed to load - dont try those again.
cg
parents: 324
diff changeset
   121
            (FailedToLoadClasses includes:aString) ifTrue:[
79f09bb1ac21 remember classes which failed to load - dont try those again.
cg
parents: 324
diff changeset
   122
"/                ('JAVA [info]: class loading already failed: ' , aString) infoPrintCR.
79f09bb1ac21 remember classes which failed to load - dont try those again.
cg
parents: 324
diff changeset
   123
                ^ nil
79f09bb1ac21 remember classes which failed to load - dont try those again.
cg
parents: 324
diff changeset
   124
            ]
79f09bb1ac21 remember classes which failed to load - dont try those again.
cg
parents: 324
diff changeset
   125
        ].
79f09bb1ac21 remember classes which failed to load - dont try those again.
cg
parents: 324
diff changeset
   126
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   127
        "/('JAVA [info]: late class loading: ' , aString) infoPrintCR.
548
063963638b8d raise -> query
cg
parents: 546
diff changeset
   128
        loader := JavaClassReader classLoaderQuerySignal query.
340
79f09bb1ac21 remember classes which failed to load - dont try those again.
cg
parents: 324
diff changeset
   129
        loader isNil ifTrue:[
79f09bb1ac21 remember classes which failed to load - dont try those again.
cg
parents: 324
diff changeset
   130
            "/ load using default (ST/X) loader
79f09bb1ac21 remember classes which failed to load - dont try those again.
cg
parents: 324
diff changeset
   131
            cls := JavaClassReader loadClass:aString.
79f09bb1ac21 remember classes which failed to load - dont try those again.
cg
parents: 324
diff changeset
   132
        ] ifFalse:[
79f09bb1ac21 remember classes which failed to load - dont try those again.
cg
parents: 324
diff changeset
   133
            "/ load using a Java class loader
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   134
"/            classURL := Java as_URL:('file:' , aString , '.class').
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   135
"/            loader loadClass:classURL.
340
79f09bb1ac21 remember classes which failed to load - dont try those again.
cg
parents: 324
diff changeset
   136
            loader perform:#'loadClass(Ljava/lang/String;)Ljava/lang/Class;'
79f09bb1ac21 remember classes which failed to load - dont try those again.
cg
parents: 324
diff changeset
   137
                with:(Java as_String:aString).
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   138
340
79f09bb1ac21 remember classes which failed to load - dont try those again.
cg
parents: 324
diff changeset
   139
            cls := self at:aString.
79f09bb1ac21 remember classes which failed to load - dont try those again.
cg
parents: 324
diff changeset
   140
        ].
79f09bb1ac21 remember classes which failed to load - dont try those again.
cg
parents: 324
diff changeset
   141
        cls isNil ifTrue:[
79f09bb1ac21 remember classes which failed to load - dont try those again.
cg
parents: 324
diff changeset
   142
            FailedToLoadClasses isNil ifTrue:[
79f09bb1ac21 remember classes which failed to load - dont try those again.
cg
parents: 324
diff changeset
   143
                FailedToLoadClasses := Set new.
79f09bb1ac21 remember classes which failed to load - dont try those again.
cg
parents: 324
diff changeset
   144
            ].
79f09bb1ac21 remember classes which failed to load - dont try those again.
cg
parents: 324
diff changeset
   145
            FailedToLoadClasses add:aString
79f09bb1ac21 remember classes which failed to load - dont try those again.
cg
parents: 324
diff changeset
   146
        ]
147
14fc6545fb32 checkin from browser
cg
parents: 146
diff changeset
   147
    ].
14fc6545fb32 checkin from browser
cg
parents: 146
diff changeset
   148
    ^ cls
14fc6545fb32 checkin from browser
cg
parents: 146
diff changeset
   149
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   150
    "Created: / 18-03-1997 / 16:45:57 / cg"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   151
    "Modified: / 27-04-1998 / 15:00:52 / cg"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   152
    "Modified: / 18-08-2011 / 19:30:50 / jv"
147
14fc6545fb32 checkin from browser
cg
parents: 146
diff changeset
   153
!
14fc6545fb32 checkin from browser
cg
parents: 146
diff changeset
   154
90
918e2740098c resolve rewritten
cg
parents: 84
diff changeset
   155
classNamed:aString
918e2740098c resolve rewritten
cg
parents: 84
diff changeset
   156
    ^ self at:aString
32
0dbaa43a73db checkin from browser
cg
parents: 27
diff changeset
   157
!
0dbaa43a73db checkin from browser
cg
parents: 27
diff changeset
   158
699
f222b26cbd3e *** empty log message ***
cg
parents: 694
diff changeset
   159
intern:aJavaString
f222b26cbd3e *** empty log message ***
cg
parents: 694
diff changeset
   160
    |stString internedString|
f222b26cbd3e *** empty log message ***
cg
parents: 694
diff changeset
   161
f222b26cbd3e *** empty log message ***
cg
parents: 694
diff changeset
   162
    stString := self as_ST_String:aJavaString.
f222b26cbd3e *** empty log message ***
cg
parents: 694
diff changeset
   163
    internedString := InternedStrings at:stString ifAbsent:nil.
f222b26cbd3e *** empty log message ***
cg
parents: 694
diff changeset
   164
    internedString isNil ifTrue:[
f222b26cbd3e *** empty log message ***
cg
parents: 694
diff changeset
   165
        InternedStrings at:stString put:aJavaString.
f222b26cbd3e *** empty log message ***
cg
parents: 694
diff changeset
   166
        internedString := aJavaString
f222b26cbd3e *** empty log message ***
cg
parents: 694
diff changeset
   167
    ].
f222b26cbd3e *** empty log message ***
cg
parents: 694
diff changeset
   168
    ^ internedString
f222b26cbd3e *** empty log message ***
cg
parents: 694
diff changeset
   169
!
f222b26cbd3e *** empty log message ***
cg
parents: 694
diff changeset
   170
167
77dcbc4b2201 *** empty log message ***
cg
parents: 162
diff changeset
   171
java_lang_Class
77dcbc4b2201 *** empty log message ***
cg
parents: 162
diff changeset
   172
    Java_lang_Class isNil ifTrue:[
552
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
   173
        Java_lang_Class := self at:'java.lang.Class'
167
77dcbc4b2201 *** empty log message ***
cg
parents: 162
diff changeset
   174
    ].
77dcbc4b2201 *** empty log message ***
cg
parents: 162
diff changeset
   175
    ^ Java_lang_Class
77dcbc4b2201 *** empty log message ***
cg
parents: 162
diff changeset
   176
77dcbc4b2201 *** empty log message ***
cg
parents: 162
diff changeset
   177
    "Created: 26.3.1997 / 13:42:59 / cg"
77dcbc4b2201 *** empty log message ***
cg
parents: 162
diff changeset
   178
    "Modified: 26.3.1997 / 13:46:24 / cg"
77dcbc4b2201 *** empty log message ***
cg
parents: 162
diff changeset
   179
!
77dcbc4b2201 *** empty log message ***
cg
parents: 162
diff changeset
   180
77dcbc4b2201 *** empty log message ***
cg
parents: 162
diff changeset
   181
java_lang_String
77dcbc4b2201 *** empty log message ***
cg
parents: 162
diff changeset
   182
    Java_lang_String isNil ifTrue:[
552
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
   183
        Java_lang_String := self at:'java.lang.String'
167
77dcbc4b2201 *** empty log message ***
cg
parents: 162
diff changeset
   184
    ].
77dcbc4b2201 *** empty log message ***
cg
parents: 162
diff changeset
   185
    ^ Java_lang_String
77dcbc4b2201 *** empty log message ***
cg
parents: 162
diff changeset
   186
77dcbc4b2201 *** empty log message ***
cg
parents: 162
diff changeset
   187
    "Created: 26.3.1997 / 13:43:17 / cg"
77dcbc4b2201 *** empty log message ***
cg
parents: 162
diff changeset
   188
    "Modified: 26.3.1997 / 13:50:21 / cg"
76
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
   189
!
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
   190
188
5de467ea7e45 support color printing
cg
parents: 176
diff changeset
   191
prettyPrintStyle
5de467ea7e45 support color printing
cg
parents: 176
diff changeset
   192
    ^ PrettyPrintStyle
5de467ea7e45 support color printing
cg
parents: 176
diff changeset
   193
5de467ea7e45 support color printing
cg
parents: 176
diff changeset
   194
    "Created: 1.8.1997 / 10:37:57 / cg"
248
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   195
!
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   196
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   197
release
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   198
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   199
    ^Release
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   200
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   201
    "Created: / 22-11-2010 / 12:38:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   202
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   203
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   204
release: aJavaRelease
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   205
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   206
    Release := aJavaRelease.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   207
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   208
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   209
        Java release: JavaRelease openJDK6. 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   210
        Java release: JavaRelease sunJDK6. 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   211
        
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   212
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   213
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   214
    "Created: / 22-11-2010 / 12:38:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   215
    "Modified: / 30-11-2010 / 11:54:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   216
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   217
538
6e695c5be20a checkin from browser
cg
parents: 527
diff changeset
   218
systemPropertyAt:key put:something
6e695c5be20a checkin from browser
cg
parents: 527
diff changeset
   219
    JavaVM systemProperties at:key put:something
6e695c5be20a checkin from browser
cg
parents: 527
diff changeset
   220
6e695c5be20a checkin from browser
cg
parents: 527
diff changeset
   221
    "Created: / 9.1.1999 / 14:49:35 / cg"
6e695c5be20a checkin from browser
cg
parents: 527
diff changeset
   222
!
6e695c5be20a checkin from browser
cg
parents: 527
diff changeset
   223
248
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   224
threads
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   225
    Threads isNil ifTrue:[
552
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
   226
        Threads := WeakIdentityDictionary new.
248
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   227
    ].
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   228
    ^ Threads
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   229
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   230
    "Created: 26.8.1997 / 19:53:57 / cg"
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   231
    "Modified: 26.8.1997 / 19:55:27 / cg"
192
80dde7b3cd73 checkin from browser
cg
parents: 191
diff changeset
   232
! !
80dde7b3cd73 checkin from browser
cg
parents: 191
diff changeset
   233
80dde7b3cd73 checkin from browser
cg
parents: 191
diff changeset
   234
!Java class methodsFor:'accessing paths'!
80dde7b3cd73 checkin from browser
cg
parents: 191
diff changeset
   235
80dde7b3cd73 checkin from browser
cg
parents: 191
diff changeset
   236
addToClassPath:aPath
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   237
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   238
    | path |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   239
    path := aPath asFilename.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   240
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   241
    (aPath asString includes: $*) ifTrue:[
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   242
        self addToClassPathFilesMatching: path baseName
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   243
             in: path directoryName.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   244
    ] ifFalse:[
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   245
        (ClassPath includes:aPath asString) ifFalse:[
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   246
            ClassPath add:aPath asString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   247
            self addToClassPathInRuntime:aPath.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   248
            FailedToLoadClasses := nil
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   249
        ]
192
80dde7b3cd73 checkin from browser
cg
parents: 191
diff changeset
   250
    ]
80dde7b3cd73 checkin from browser
cg
parents: 191
diff changeset
   251
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   252
    "Created: / 01-08-1997 / 21:10:07 / cg"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   253
    "Modified: / 17-09-1998 / 20:43:55 / cg"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   254
    "Modified: / 07-08-2011 / 14:06:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   255
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   256
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   257
addToClassPathFilesMatching: pattern in: path
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   258
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   259
    | dir |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   260
    dir := path asFilename.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   261
    dir directoryContents do:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   262
        [:fname|
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   263
        (fname matches: pattern) ifTrue:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   264
            [| p |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   265
            p := (dir / fname) pathName.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   266
            (ClassPath includes:p) ifFalse:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   267
                [ClassPath add:p.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   268
                self addToClassPathInRuntime:p.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   269
                FailedToLoadClasses := nil]]].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   270
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   271
    "Created: / 20-12-2010 / 17:26:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   272
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   273
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   274
addToClassPathInRuntime:aPath
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   275
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   276
    | path file url scl |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   277
    "Java might not be loaded/or initialized, in this case
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   278
     there is no no need to inform java about new entry in classpath"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   279
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   280
    JavaVM booted ifFalse:[^self].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   281
    scl := (Java classForName:'java.lang.ClassLoader') instVarNamed: #scl.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   282
    scl ifNil:[
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   283
        scl := (Java classForName:'java.lang.ClassLoader') perform: #'getSystemClassLoader()Ljava/lang/ClassLoader;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   284
    ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   285
    path := Java as_String: aPath asString.        
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   286
    file := (Java at:'java.io.File') new perform: #'<init>(Ljava/lang/String;)V' with: path; yourself.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   287
    url := file perform: #'toURL()Ljava/net/URL;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   288
    scl perform: #'addURL(Ljava/net/URL;)V' with: url.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   289
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   290
    "Created: / 01-08-1997 / 21:10:07 / cg"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   291
    "Modified: / 17-09-1998 / 20:43:55 / cg"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   292
    "Created: / 07-08-2011 / 14:01:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
192
80dde7b3cd73 checkin from browser
cg
parents: 191
diff changeset
   293
!
80dde7b3cd73 checkin from browser
cg
parents: 191
diff changeset
   294
198
5543d1079a4a *** empty log message ***
cg
parents: 192
diff changeset
   295
addToSourcePath:aPath
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   296
    SourceDirectories ifNil:[SourceDirectories := OrderedCollection new].
198
5543d1079a4a *** empty log message ***
cg
parents: 192
diff changeset
   297
    (SourceDirectories includes:aPath) ifFalse:[
552
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
   298
        SourceDirectories add:aPath
198
5543d1079a4a *** empty log message ***
cg
parents: 192
diff changeset
   299
    ]
5543d1079a4a *** empty log message ***
cg
parents: 192
diff changeset
   300
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   301
    "Created: / 02-08-1997 / 14:12:31 / cg"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   302
    "Modified: / 06-02-2011 / 22:51:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   303
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   304
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   305
cacheDirectory
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   306
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   307
    CacheDirectory ifNil:[
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   308
        CacheDirectory := Filename homeDirectory / '.smalltalk' / 'libjava' / 'caches' /
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   309
            (((Smalltalk at:#stx_libjava) svnRepositoryUrlBase copyReplaceAll:$/ with:$_) replaceAll:$: with:$_)
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   310
    ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   311
    ^CacheDirectory
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   312
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   313
    "Created: / 08-04-2011 / 15:02:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   314
    "Modified: / 08-04-2011 / 16:58:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
198
5543d1079a4a *** empty log message ***
cg
parents: 192
diff changeset
   315
!
5543d1079a4a *** empty log message ***
cg
parents: 192
diff changeset
   316
192
80dde7b3cd73 checkin from browser
cg
parents: 191
diff changeset
   317
classPath
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   318
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   319
    | CLASSPATH |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   320
    CLASSPATH := ((OperatingSystem getEnvironment: 'CLASSPATH') ? '') 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   321
        tokensBasedOn: OperatingSystem pathSeparator.
192
80dde7b3cd73 checkin from browser
cg
parents: 191
diff changeset
   322
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   323
    ^
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   324
        "for testing only"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   325
        "/Release classPath,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   326
        (Array 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   327
            with: ((Smalltalk packageDirectoryForPackageId:'stx:libjava') / 'java' / 'libjava-projects' / 'Conversion' / 'bin' ) pathName
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   328
            with: ((Smalltalk packageDirectoryForPackageId:'stx:libjava') / 'java' / 'libjava-support' / 'bin' ) pathName
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   329
        ),
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   330
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   331
        (ClassPath ? #()),
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   332
            CLASSPATH
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   333
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   334
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   335
        Java classPath
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   336
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   337
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   338
    "Created: / 07-02-1997 / 19:23:45 / cg"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   339
    "Modified: / 12-08-2011 / 08:57:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
192
80dde7b3cd73 checkin from browser
cg
parents: 191
diff changeset
   340
!
80dde7b3cd73 checkin from browser
cg
parents: 191
diff changeset
   341
80dde7b3cd73 checkin from browser
cg
parents: 191
diff changeset
   342
classPath:aCollectionOfPaths
369
3d0628c9b63e flush failedToLoadedClasses whenever classPath changes.
cg
parents: 367
diff changeset
   343
    ClassPath := aCollectionOfPaths asOrderedCollection.
3d0628c9b63e flush failedToLoadedClasses whenever classPath changes.
cg
parents: 367
diff changeset
   344
    FailedToLoadClasses := nil
192
80dde7b3cd73 checkin from browser
cg
parents: 191
diff changeset
   345
369
3d0628c9b63e flush failedToLoadedClasses whenever classPath changes.
cg
parents: 367
diff changeset
   346
    "Created: / 7.2.1997 / 19:23:45 / cg"
3d0628c9b63e flush failedToLoadedClasses whenever classPath changes.
cg
parents: 367
diff changeset
   347
    "Modified: / 17.9.1998 / 20:44:09 / cg"
192
80dde7b3cd73 checkin from browser
cg
parents: 191
diff changeset
   348
!
80dde7b3cd73 checkin from browser
cg
parents: 191
diff changeset
   349
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   350
effectiveClassPath
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   351
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   352
    ^self release classPath , self classPath
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   353
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   354
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   355
    Java effectiveClassPath
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   356
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   357
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   358
    "Created: / 22-11-2010 / 13:03:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   359
    "Modified: / 17-01-2011 / 09:44:16 / kursjan <kursjan@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   360
    "Modified: / 12-08-2011 / 08:57:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   361
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   362
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   363
effectiveSourceDirectories
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   364
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   365
    ^Release sourcePath ,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   366
        (SourceDirectories ? #())
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   367
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   368
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   369
        Java effectiveSourceDirectories 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   370
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   371
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   372
    "Created: / 30-11-2010 / 11:53:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   373
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   374
276
70c74d8bd43f added path exclusion
cg
parents: 274
diff changeset
   375
excludedClassPath
70c74d8bd43f added path exclusion
cg
parents: 274
diff changeset
   376
    ^ ExcludedClassPath
70c74d8bd43f added path exclusion
cg
parents: 274
diff changeset
   377
70c74d8bd43f added path exclusion
cg
parents: 274
diff changeset
   378
    "Modified: / 7.2.1997 / 19:23:55 / cg"
70c74d8bd43f added path exclusion
cg
parents: 274
diff changeset
   379
    "Created: / 27.1.1998 / 21:57:13 / cg"
70c74d8bd43f added path exclusion
cg
parents: 274
diff changeset
   380
!
70c74d8bd43f added path exclusion
cg
parents: 274
diff changeset
   381
70c74d8bd43f added path exclusion
cg
parents: 274
diff changeset
   382
isExcludedFromClassPath:fileName
70c74d8bd43f added path exclusion
cg
parents: 274
diff changeset
   383
    |nm|
70c74d8bd43f added path exclusion
cg
parents: 274
diff changeset
   384
70c74d8bd43f added path exclusion
cg
parents: 274
diff changeset
   385
    nm := fileName asFilename pathName.
70c74d8bd43f added path exclusion
cg
parents: 274
diff changeset
   386
    ExcludedClassPath do:[:excludedPath |
70c74d8bd43f added path exclusion
cg
parents: 274
diff changeset
   387
        (nm startsWith:excludedPath) ifTrue:[^ true].
70c74d8bd43f added path exclusion
cg
parents: 274
diff changeset
   388
    ].
70c74d8bd43f added path exclusion
cg
parents: 274
diff changeset
   389
    ^ false
70c74d8bd43f added path exclusion
cg
parents: 274
diff changeset
   390
70c74d8bd43f added path exclusion
cg
parents: 274
diff changeset
   391
    "Created: / 27.1.1998 / 22:00:40 / cg"
70c74d8bd43f added path exclusion
cg
parents: 274
diff changeset
   392
!
70c74d8bd43f added path exclusion
cg
parents: 274
diff changeset
   393
201
912c48b6e7ac *** empty log message ***
cg
parents: 200
diff changeset
   394
javaHome
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   395
    ^ JavaHome ifNil:[Release javaHome]
201
912c48b6e7ac *** empty log message ***
cg
parents: 200
diff changeset
   396
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   397
    "Created: / 06-08-1997 / 00:53:19 / cg"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   398
    "Modified: / 22-11-2010 / 12:39:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
201
912c48b6e7ac *** empty log message ***
cg
parents: 200
diff changeset
   399
!
912c48b6e7ac *** empty log message ***
cg
parents: 200
diff changeset
   400
912c48b6e7ac *** empty log message ***
cg
parents: 200
diff changeset
   401
javaHome:aPath
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   402
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   403
    <resource: #obsolete>
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   404
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   405
    self obsoleteMethodWarning: 'javaHome is now controlled by java release'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   406
201
912c48b6e7ac *** empty log message ***
cg
parents: 200
diff changeset
   407
    JavaHome := aPath
912c48b6e7ac *** empty log message ***
cg
parents: 200
diff changeset
   408
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   409
    "Created: / 06-08-1997 / 00:53:23 / cg"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   410
    "Modified: / 22-11-2010 / 12:40:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
201
912c48b6e7ac *** empty log message ***
cg
parents: 200
diff changeset
   411
!
912c48b6e7ac *** empty log message ***
cg
parents: 200
diff changeset
   412
668
babdc674688d java setup
cg
parents: 666
diff changeset
   413
newJavaHome:newJavaHome
babdc674688d java setup
cg
parents: 666
diff changeset
   414
    self javaHome:newJavaHome.
babdc674688d java setup
cg
parents: 666
diff changeset
   415
babdc674688d java setup
cg
parents: 666
diff changeset
   416
!
babdc674688d java setup
cg
parents: 666
diff changeset
   417
192
80dde7b3cd73 checkin from browser
cg
parents: 191
diff changeset
   418
removeFromClassPath:aPath
80dde7b3cd73 checkin from browser
cg
parents: 191
diff changeset
   419
    (ClassPath includes:aPath) ifTrue:[
552
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
   420
        ClassPath remove:aPath
192
80dde7b3cd73 checkin from browser
cg
parents: 191
diff changeset
   421
    ]
80dde7b3cd73 checkin from browser
cg
parents: 191
diff changeset
   422
80dde7b3cd73 checkin from browser
cg
parents: 191
diff changeset
   423
    "Modified: 7.2.1997 / 19:23:55 / cg"
80dde7b3cd73 checkin from browser
cg
parents: 191
diff changeset
   424
    "Created: 1.8.1997 / 21:10:21 / cg"
188
5de467ea7e45 support color printing
cg
parents: 176
diff changeset
   425
!
5de467ea7e45 support color printing
cg
parents: 176
diff changeset
   426
198
5543d1079a4a *** empty log message ***
cg
parents: 192
diff changeset
   427
removeFromSourcePath:aPath
5543d1079a4a *** empty log message ***
cg
parents: 192
diff changeset
   428
    (SourceDirectories includes:aPath) ifTrue:[
552
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
   429
        SourceDirectories remove:aPath
198
5543d1079a4a *** empty log message ***
cg
parents: 192
diff changeset
   430
    ]
5543d1079a4a *** empty log message ***
cg
parents: 192
diff changeset
   431
5543d1079a4a *** empty log message ***
cg
parents: 192
diff changeset
   432
    "Modified: 7.2.1997 / 19:23:55 / cg"
5543d1079a4a *** empty log message ***
cg
parents: 192
diff changeset
   433
    "Created: 2.8.1997 / 14:13:01 / cg"
5543d1079a4a *** empty log message ***
cg
parents: 192
diff changeset
   434
!
5543d1079a4a *** empty log message ***
cg
parents: 192
diff changeset
   435
76
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
   436
sourceDirectories
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
   437
    ^ SourceDirectories
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
   438
!
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
   439
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
   440
sourceDirectories:aCollectionOfPaths
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
   441
    SourceDirectories := aCollectionOfPaths asOrderedCollection
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
   442
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
   443
    "
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
   444
     Java
552
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
   445
        sourceDirectories:#(
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
   446
                            '/phys/ibm3/java/src'
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
   447
                           )
76
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
   448
    "
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
   449
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
   450
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   451
!
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   452
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   453
sourcePath
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   454
    ^ SourceDirectories
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   455
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   456
    "Created: / 16.1.1998 / 13:26:55 / cg"
24
4a9822b95fc0 checkin from browser
cg
parents: 21
diff changeset
   457
! !
4a9822b95fc0 checkin from browser
cg
parents: 21
diff changeset
   458
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   459
!Java class methodsFor:'change & update'!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   460
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   461
update: what with: param from: sender
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   462
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   463
    what == #restarted ifTrue:[
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   464
        self reinitialize.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   465
    ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   466
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   467
    "Created: / 14-12-2010 / 21:00:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   468
! !
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   469
135
098936234135 *** empty log message ***
cg
parents: 121
diff changeset
   470
!Java class methodsFor:'class initialization'!
47
b5f63f59c2c1 some net primitives added
cg
parents: 43
diff changeset
   471
b5f63f59c2c1 some net primitives added
cg
parents: 43
diff changeset
   472
initAllClasses
340
79f09bb1ac21 remember classes which failed to load - dont try those again.
cg
parents: 324
diff changeset
   473
    |system|
147
14fc6545fb32 checkin from browser
cg
parents: 146
diff changeset
   474
340
79f09bb1ac21 remember classes which failed to load - dont try those again.
cg
parents: 324
diff changeset
   475
    FailedToLoadClasses := nil.
79f09bb1ac21 remember classes which failed to load - dont try those again.
cg
parents: 324
diff changeset
   476
    self initAllStaticFields.
147
14fc6545fb32 checkin from browser
cg
parents: 146
diff changeset
   477
340
79f09bb1ac21 remember classes which failed to load - dont try those again.
cg
parents: 324
diff changeset
   478
    system := self classForName:'java.lang.System'.
79f09bb1ac21 remember classes which failed to load - dont try those again.
cg
parents: 324
diff changeset
   479
    system isInitialized ifFalse:[
79f09bb1ac21 remember classes which failed to load - dont try those again.
cg
parents: 324
diff changeset
   480
        self initSystemClass.
79f09bb1ac21 remember classes which failed to load - dont try those again.
cg
parents: 324
diff changeset
   481
    ].
147
14fc6545fb32 checkin from browser
cg
parents: 146
diff changeset
   482
340
79f09bb1ac21 remember classes which failed to load - dont try those again.
cg
parents: 324
diff changeset
   483
    self allClassesDo:[:cls |
79f09bb1ac21 remember classes which failed to load - dont try those again.
cg
parents: 324
diff changeset
   484
       cls isInitialized ifFalse:[
79f09bb1ac21 remember classes which failed to load - dont try those again.
cg
parents: 324
diff changeset
   485
           cls classInit
79f09bb1ac21 remember classes which failed to load - dont try those again.
cg
parents: 324
diff changeset
   486
       ]
79f09bb1ac21 remember classes which failed to load - dont try those again.
cg
parents: 324
diff changeset
   487
    ]
47
b5f63f59c2c1 some net primitives added
cg
parents: 43
diff changeset
   488
509
b06f892d2f52 *** empty log message ***
cg
parents: 508
diff changeset
   489
     "
b06f892d2f52 *** empty log message ***
cg
parents: 508
diff changeset
   490
      Java initAllClasses
b06f892d2f52 *** empty log message ***
cg
parents: 508
diff changeset
   491
     "
b06f892d2f52 *** empty log message ***
cg
parents: 508
diff changeset
   492
b06f892d2f52 *** empty log message ***
cg
parents: 508
diff changeset
   493
    "Modified: / 27.11.1998 / 00:33:05 / cg"
47
b5f63f59c2c1 some net primitives added
cg
parents: 43
diff changeset
   494
!
b5f63f59c2c1 some net primitives added
cg
parents: 43
diff changeset
   495
102
de5ab089cf47 checkin from browser
cg
parents: 98
diff changeset
   496
initAllStaticFields
de5ab089cf47 checkin from browser
cg
parents: 98
diff changeset
   497
     self allClassesDo:[:cls |
552
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
   498
        cls initializeStaticFields
102
de5ab089cf47 checkin from browser
cg
parents: 98
diff changeset
   499
     ]
de5ab089cf47 checkin from browser
cg
parents: 98
diff changeset
   500
de5ab089cf47 checkin from browser
cg
parents: 98
diff changeset
   501
!
de5ab089cf47 checkin from browser
cg
parents: 98
diff changeset
   502
146
0aa6ccd0c1b1 checkin from browser
cg
parents: 145
diff changeset
   503
initSystemClass
198
5543d1079a4a *** empty log message ***
cg
parents: 192
diff changeset
   504
    |system|
5543d1079a4a *** empty log message ***
cg
parents: 192
diff changeset
   505
5543d1079a4a *** empty log message ***
cg
parents: 192
diff changeset
   506
    system := Java at:'java.lang.System'.
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   507
    system isNil ifTrue:[
542
260c8c742627 checkin from browser
cg
parents: 538
diff changeset
   508
"/        JavaVM initializeVM.
260c8c742627 checkin from browser
cg
parents: 538
diff changeset
   509
"/        system := Java at:'java.lang.System'.
260c8c742627 checkin from browser
cg
parents: 538
diff changeset
   510
"/        system isNil ifTrue:[
715
80cd026d89e9 no need for asText when sending allBold
cg
parents: 713
diff changeset
   511
        self warn:'JavaVM: no ''' , 'java.lang.System' allBold , ''' class.'.
550
2dc6c18efc89 checkin from browser
cg
parents: 548
diff changeset
   512
"/            self error:'no ''java.lang.System'' class'.
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   513
            ^ self
542
260c8c742627 checkin from browser
cg
parents: 538
diff changeset
   514
"/        ].
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   515
    ].
429
99990a8a3509 *** empty log message ***
cg
parents: 426
diff changeset
   516
99990a8a3509 *** empty log message ***
cg
parents: 426
diff changeset
   517
    system classInit.
200
518c67464105 *** empty log message ***
cg
parents: 198
diff changeset
   518
    (system implements:#'initializeSystemClass()V') ifTrue:[
414
0f33ff2c2fd3 checkin from browser
cg
parents: 407
diff changeset
   519
        system perform: "invokeStatic:" #'initializeSystemClass()V'.
198
5543d1079a4a *** empty log message ***
cg
parents: 192
diff changeset
   520
    ].
146
0aa6ccd0c1b1 checkin from browser
cg
parents: 145
diff changeset
   521
147
14fc6545fb32 checkin from browser
cg
parents: 146
diff changeset
   522
    "
14fc6545fb32 checkin from browser
cg
parents: 146
diff changeset
   523
     Java initSystemClass
215
f8e28c816033 *** empty log message ***
cg
parents: 214
diff changeset
   524
f8e28c816033 *** empty log message ***
cg
parents: 214
diff changeset
   525
     (Java at:'java.lang.System') 
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   526
        perform:#'getProperty(Ljava/lang/String;)Ljava/lang/String;'
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   527
        with:(Java as_String:'java.home')
147
14fc6545fb32 checkin from browser
cg
parents: 146
diff changeset
   528
    "
14fc6545fb32 checkin from browser
cg
parents: 146
diff changeset
   529
429
99990a8a3509 *** empty log message ***
cg
parents: 426
diff changeset
   530
    "Modified: / 10.11.1998 / 12:39:58 / cg"
146
0aa6ccd0c1b1 checkin from browser
cg
parents: 145
diff changeset
   531
!
0aa6ccd0c1b1 checkin from browser
cg
parents: 145
diff changeset
   532
76
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
   533
initialize
706
ddadb8eb2297 *** empty log message ***
cg
parents: 705
diff changeset
   534
    JavaNativeMethod flushAllCachedNativeMethods.
ddadb8eb2297 *** empty log message ***
cg
parents: 705
diff changeset
   535
699
f222b26cbd3e *** empty log message ***
cg
parents: 694
diff changeset
   536
    InternedStrings := Dictionary new.
694
e76b0c9144c0 checkin from browser
cg
parents: 683
diff changeset
   537
    FailedToLoadClasses := nil.
364
571d544bf2d0 search more directories for javaHome.
cg
parents: 360
diff changeset
   538
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   539
    ClassPath := OrderedCollection new. 
276
70c74d8bd43f added path exclusion
cg
parents: 274
diff changeset
   540
    ExcludedClassPath := OrderedCollection new.
70c74d8bd43f added path exclusion
cg
parents: 274
diff changeset
   541
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   542
    SourceCache := CacheDictionary new: 32.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   543
    SourceArchiveCache := CacheDictionary new: 32.
457
38a5f940feb7 checkin from browser
cg
parents: 454
diff changeset
   544
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   545
    self initializeRelease. "lazy initialization of Release"
188
5de467ea7e45 support color printing
cg
parents: 176
diff changeset
   546
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   547
    self initializePrettyPrintStyle.
381
b8348aa2d1b2 check for more jdk's
cg
parents: 372
diff changeset
   548
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   549
    ObjectMemory addDependent: self.
188
5de467ea7e45 support color printing
cg
parents: 176
diff changeset
   550
274
0a9193e3f2be *** empty log message ***
cg
parents: 270
diff changeset
   551
    "
700
9b8a1133d748 checkin from browser
cg
parents: 699
diff changeset
   552
     Java flushAllJavaResources.   
364
571d544bf2d0 search more directories for javaHome.
cg
parents: 360
diff changeset
   553
     Java initialize.
274
0a9193e3f2be *** empty log message ***
cg
parents: 270
diff changeset
   554
     JavaVM initializeVM
668
babdc674688d java setup
cg
parents: 666
diff changeset
   555
     Java classPath inspect
274
0a9193e3f2be *** empty log message ***
cg
parents: 270
diff changeset
   556
    "
76
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
   557
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   558
    "Modified: / 06-11-2001 / 09:24:12 / cg"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   559
    "Created: / 03-10-2010 / 15:54:02 / Jan Kurs <kurs.jan@post.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   560
    "Modified: / 15-10-2010 / 17:37:20 / Jan Kurs <kurs.jan@post.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   561
    "Modified: / 10-02-2011 / 23:08:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
188
5de467ea7e45 support color printing
cg
parents: 176
diff changeset
   562
!
5de467ea7e45 support color printing
cg
parents: 176
diff changeset
   563
668
babdc674688d java setup
cg
parents: 666
diff changeset
   564
initializeForNewClassPath:directoriesToSearch
babdc674688d java setup
cg
parents: 666
diff changeset
   565
    |jClasses jHome jSources|
babdc674688d java setup
cg
parents: 666
diff changeset
   566
babdc674688d java setup
cg
parents: 666
diff changeset
   567
    jClasses := OrderedCollection new.
babdc674688d java setup
cg
parents: 666
diff changeset
   568
babdc674688d java setup
cg
parents: 666
diff changeset
   569
    directoriesToSearch do:[:aPath | 
babdc674688d java setup
cg
parents: 666
diff changeset
   570
        |dir libDir toAdd|
babdc674688d java setup
cg
parents: 666
diff changeset
   571
babdc674688d java setup
cg
parents: 666
diff changeset
   572
        dir := aPath asFilename.
babdc674688d java setup
cg
parents: 666
diff changeset
   573
        (jHome isNil and:[dir exists]) ifTrue:[
babdc674688d java setup
cg
parents: 666
diff changeset
   574
            ((dir hasSuffix:'jar')
babdc674688d java setup
cg
parents: 666
diff changeset
   575
            or:[dir hasSuffix:'zip']) ifTrue:[
babdc674688d java setup
cg
parents: 666
diff changeset
   576
                toAdd := dir pathName.
babdc674688d java setup
cg
parents: 666
diff changeset
   577
            ] ifFalse:[
babdc674688d java setup
cg
parents: 666
diff changeset
   578
babdc674688d java setup
cg
parents: 666
diff changeset
   579
                "/ there must be either a classes directory,
babdc674688d java setup
cg
parents: 666
diff changeset
   580
                "/ or a classes.zip file ...
babdc674688d java setup
cg
parents: 666
diff changeset
   581
                (libDir := dir construct:'lib') exists ifTrue:[
babdc674688d java setup
cg
parents: 666
diff changeset
   582
                    ((libDir construct:'classes') exists 
babdc674688d java setup
cg
parents: 666
diff changeset
   583
                    and:[(libDir construct:'classes') isDirectory]) ifTrue:[
babdc674688d java setup
cg
parents: 666
diff changeset
   584
                        jHome := aPath.
babdc674688d java setup
cg
parents: 666
diff changeset
   585
                        toAdd := (libDir constructString:'classes').
babdc674688d java setup
cg
parents: 666
diff changeset
   586
                    ] ifFalse:[
babdc674688d java setup
cg
parents: 666
diff changeset
   587
                        (libDir construct:'classes.zip') exists ifTrue:[
babdc674688d java setup
cg
parents: 666
diff changeset
   588
                            jHome := aPath.
babdc674688d java setup
cg
parents: 666
diff changeset
   589
                            toAdd := (libDir constructString:'classes.zip').
babdc674688d java setup
cg
parents: 666
diff changeset
   590
                        ] ifFalse:[
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   591
                            (libDir construct:'rt.jar') exists ifTrue:[
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   592
                                jHome := aPath.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   593
                                toAdd := (libDir constructString:'rt.jar').
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   594
                            ].
668
babdc674688d java setup
cg
parents: 666
diff changeset
   595
                            (libDir construct:'rt.zip') exists ifTrue:[
babdc674688d java setup
cg
parents: 666
diff changeset
   596
                                jHome := aPath.
babdc674688d java setup
cg
parents: 666
diff changeset
   597
                                toAdd := (libDir constructString:'rt.zip').
babdc674688d java setup
cg
parents: 666
diff changeset
   598
                            ] 
babdc674688d java setup
cg
parents: 666
diff changeset
   599
                        ]
babdc674688d java setup
cg
parents: 666
diff changeset
   600
                    ]
babdc674688d java setup
cg
parents: 666
diff changeset
   601
                ] ifFalse:[
babdc674688d java setup
cg
parents: 666
diff changeset
   602
                    ((dir construct:'classes') exists 
babdc674688d java setup
cg
parents: 666
diff changeset
   603
                    and:[(dir construct:'classes') isDirectory]) ifTrue:[
babdc674688d java setup
cg
parents: 666
diff changeset
   604
                        jHome := aPath.
babdc674688d java setup
cg
parents: 666
diff changeset
   605
                        toAdd := (dir constructString:'classes').
babdc674688d java setup
cg
parents: 666
diff changeset
   606
                    ] ifFalse:[
babdc674688d java setup
cg
parents: 666
diff changeset
   607
                        (dir construct:'classes.zip') exists ifTrue:[
babdc674688d java setup
cg
parents: 666
diff changeset
   608
                            jHome := aPath.
babdc674688d java setup
cg
parents: 666
diff changeset
   609
                            toAdd := (dir constructString:'classes.zip').
babdc674688d java setup
cg
parents: 666
diff changeset
   610
                        ] ifFalse:[
babdc674688d java setup
cg
parents: 666
diff changeset
   611
                            (dir construct:'rt.zip') exists ifTrue:[
babdc674688d java setup
cg
parents: 666
diff changeset
   612
                                jHome := aPath.
babdc674688d java setup
cg
parents: 666
diff changeset
   613
                                toAdd := (dir constructString:'rt.zip').
babdc674688d java setup
cg
parents: 666
diff changeset
   614
                            ] 
babdc674688d java setup
cg
parents: 666
diff changeset
   615
                        ]
babdc674688d java setup
cg
parents: 666
diff changeset
   616
                    ]
babdc674688d java setup
cg
parents: 666
diff changeset
   617
                ].
babdc674688d java setup
cg
parents: 666
diff changeset
   618
            ].
babdc674688d java setup
cg
parents: 666
diff changeset
   619
        ].
babdc674688d java setup
cg
parents: 666
diff changeset
   620
        toAdd notNil ifTrue:[
babdc674688d java setup
cg
parents: 666
diff changeset
   621
            Transcript showCR:'Adding to classPath: ' , toAdd.
babdc674688d java setup
cg
parents: 666
diff changeset
   622
            jClasses add:toAdd.
babdc674688d java setup
cg
parents: 666
diff changeset
   623
        ].
babdc674688d java setup
cg
parents: 666
diff changeset
   624
    ].
babdc674688d java setup
cg
parents: 666
diff changeset
   625
babdc674688d java setup
cg
parents: 666
diff changeset
   626
    self javaHome:jHome.
babdc674688d java setup
cg
parents: 666
diff changeset
   627
    self classPath:(jClasses collect:[:f | f asFilename name]).
babdc674688d java setup
cg
parents: 666
diff changeset
   628
    jHome isNil ifTrue:[
babdc674688d java setup
cg
parents: 666
diff changeset
   629
        Transcript showCR:'no java home directory found'.
babdc674688d java setup
cg
parents: 666
diff changeset
   630
    ] ifFalse:[
babdc674688d java setup
cg
parents: 666
diff changeset
   631
        jHome := jHome asFilename.
babdc674688d java setup
cg
parents: 666
diff changeset
   632
        Transcript showCR:'Found javaHome in: ' , jHome pathName.
babdc674688d java setup
cg
parents: 666
diff changeset
   633
babdc674688d java setup
cg
parents: 666
diff changeset
   634
        (jSources := jHome construct:'source') exists ifFalse:[
babdc674688d java setup
cg
parents: 666
diff changeset
   635
            (jSources := jHome construct:'src') exists ifFalse:[
babdc674688d java setup
cg
parents: 666
diff changeset
   636
                (jSources := jHome construct:'sources') exists ifFalse:[
babdc674688d java setup
cg
parents: 666
diff changeset
   637
                    (jSources := jHome construct:'src.zip') exists ifFalse:[
babdc674688d java setup
cg
parents: 666
diff changeset
   638
                        jSources := nil.
babdc674688d java setup
cg
parents: 666
diff changeset
   639
                    ]
babdc674688d java setup
cg
parents: 666
diff changeset
   640
                ]
babdc674688d java setup
cg
parents: 666
diff changeset
   641
            ]
babdc674688d java setup
cg
parents: 666
diff changeset
   642
        ].
babdc674688d java setup
cg
parents: 666
diff changeset
   643
babdc674688d java setup
cg
parents: 666
diff changeset
   644
        jSources isNil ifTrue:[
babdc674688d java setup
cg
parents: 666
diff changeset
   645
            Transcript showCR:'no java source directory found'.
babdc674688d java setup
cg
parents: 666
diff changeset
   646
        ] ifFalse:[
babdc674688d java setup
cg
parents: 666
diff changeset
   647
            Transcript showCR:'Found javaSources in: ' , jSources pathName.
babdc674688d java setup
cg
parents: 666
diff changeset
   648
            self sourceDirectories:(Array with:jSources pathName).
babdc674688d java setup
cg
parents: 666
diff changeset
   649
        ].
babdc674688d java setup
cg
parents: 666
diff changeset
   650
    ].
babdc674688d java setup
cg
parents: 666
diff changeset
   651
babdc674688d java setup
cg
parents: 666
diff changeset
   652
    "
babdc674688d java setup
cg
parents: 666
diff changeset
   653
     self initializeForNewClassPath:(Java classPath)
babdc674688d java setup
cg
parents: 666
diff changeset
   654
     self initializeForNewClassPath:(Array with:'/home/java/jdk113')
babdc674688d java setup
cg
parents: 666
diff changeset
   655
    "
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   656
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   657
    "Modified: / 03-10-2010 / 15:49:02 / Jan Kurs <kurs.jan@post.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   658
    "Modified: / 19-10-2010 / 10:49:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
668
babdc674688d java setup
cg
parents: 666
diff changeset
   659
!
babdc674688d java setup
cg
parents: 666
diff changeset
   660
188
5de467ea7e45 support color printing
cg
parents: 176
diff changeset
   661
initializePrettyPrintStyle
5de467ea7e45 support color printing
cg
parents: 176
diff changeset
   662
    PrettyPrintStyle := IdentityDictionary new.
5de467ea7e45 support color printing
cg
parents: 176
diff changeset
   663
    PrettyPrintStyle  at:#accessAttribute put:(#color -> (Color red:0 green:0 blue:25)).
5de467ea7e45 support color printing
cg
parents: 176
diff changeset
   664
    PrettyPrintStyle  at:#className       put:(Array with:(#color -> Color black) with:#bold).
5de467ea7e45 support color printing
cg
parents: 176
diff changeset
   665
    PrettyPrintStyle  at:#methodName      put:(Array with:(#color -> Color black) with:#bold).
5de467ea7e45 support color printing
cg
parents: 176
diff changeset
   666
    PrettyPrintStyle  at:#code            put:(#color -> Color black).
5de467ea7e45 support color printing
cg
parents: 176
diff changeset
   667
5de467ea7e45 support color printing
cg
parents: 176
diff changeset
   668
5de467ea7e45 support color printing
cg
parents: 176
diff changeset
   669
     "
5de467ea7e45 support color printing
cg
parents: 176
diff changeset
   670
      Java initializePrettyPrintStyle
5de467ea7e45 support color printing
cg
parents: 176
diff changeset
   671
     "
5de467ea7e45 support color printing
cg
parents: 176
diff changeset
   672
5de467ea7e45 support color printing
cg
parents: 176
diff changeset
   673
    "Created: 1.8.1997 / 11:08:43 / cg"
5de467ea7e45 support color printing
cg
parents: 176
diff changeset
   674
    "Modified: 1.8.1997 / 11:09:58 / cg"
76
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
   675
!
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
   676
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   677
initializeRelease
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   678
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   679
    Release ifNil:[Release := JavaRelease any].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   680
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   681
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   682
        Release := nil. 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   683
        self initializeRelease.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   684
        Release
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   685
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   686
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   687
    "Created: / 22-11-2010 / 13:41:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   688
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   689
47
b5f63f59c2c1 some net primitives added
cg
parents: 43
diff changeset
   690
reinitAllClasses
b5f63f59c2c1 some net primitives added
cg
parents: 43
diff changeset
   691
     self markAllClassesUninitialized.
b5f63f59c2c1 some net primitives added
cg
parents: 43
diff changeset
   692
     self initAllClasses
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 248
diff changeset
   693
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 248
diff changeset
   694
     "
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 248
diff changeset
   695
      Java reinitAllClasses
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 248
diff changeset
   696
     "
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 248
diff changeset
   697
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 248
diff changeset
   698
    "Modified: / 4.1.1998 / 00:34:29 / cg"
248
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   699
!
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   700
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   701
reinitialize
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   702
    "/ all JavaThreads are lost on a restart (for now)
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   703
340
79f09bb1ac21 remember classes which failed to load - dont try those again.
cg
parents: 324
diff changeset
   704
    FailedToLoadClasses := nil.
248
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   705
    Threads := nil.
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   706
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   707
    "Kludge"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   708
    JavaMethod reinitialize.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   709
    JavaMethodWithException reinitialize.    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   710
    JavaMethodWithHandler reinitialize.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   711
    JavaNativeMethod reinitialize.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   712
    JavaNativeMethod flushAllCachedNativeMethods.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   713
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   714
285
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 283
diff changeset
   715
    "
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 283
diff changeset
   716
     Java reinitialize
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 283
diff changeset
   717
    "
248
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   718
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   719
    "Created: / 26-08-1997 / 20:07:00 / cg"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   720
    "Modified: / 27-04-1998 / 14:57:23 / cg"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   721
    "Modified: / 14-12-2010 / 21:30:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
248
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   722
!
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   723
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   724
startupJavaSystem
527
7eb6f6291fea *** empty log message ***
cg
parents: 514
diff changeset
   725
    |javaEventThread haveEventThread haveScreenUpdater|
285
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 283
diff changeset
   726
340
79f09bb1ac21 remember classes which failed to load - dont try those again.
cg
parents: 324
diff changeset
   727
    FailedToLoadClasses := nil.
79f09bb1ac21 remember classes which failed to load - dont try those again.
cg
parents: 324
diff changeset
   728
248
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   729
    "/
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   730
    "/ check if already running
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   731
    "/
301
2945ec2eee92 better reinit (look for both event-thread AND screenUpdater thread)
cg
parents: 285
diff changeset
   732
2945ec2eee92 better reinit (look for both event-thread AND screenUpdater thread)
cg
parents: 285
diff changeset
   733
    haveEventThread := true.
527
7eb6f6291fea *** empty log message ***
cg
parents: 514
diff changeset
   734
    javaEventThread := JavaVM javaEventThread.
7eb6f6291fea *** empty log message ***
cg
parents: 514
diff changeset
   735
    (javaEventThread isNil or:[javaEventThread isDead]) ifTrue:[
301
2945ec2eee92 better reinit (look for both event-thread AND screenUpdater thread)
cg
parents: 285
diff changeset
   736
        haveEventThread := false
2945ec2eee92 better reinit (look for both event-thread AND screenUpdater thread)
cg
parents: 285
diff changeset
   737
    ].
2945ec2eee92 better reinit (look for both event-thread AND screenUpdater thread)
cg
parents: 285
diff changeset
   738
2945ec2eee92 better reinit (look for both event-thread AND screenUpdater thread)
cg
parents: 285
diff changeset
   739
    haveScreenUpdater := false.
2945ec2eee92 better reinit (look for both event-thread AND screenUpdater thread)
cg
parents: 285
diff changeset
   740
    haveEventThread ifTrue:[
2945ec2eee92 better reinit (look for both event-thread AND screenUpdater thread)
cg
parents: 285
diff changeset
   741
        self threads do:[:aJavaThread |
2945ec2eee92 better reinit (look for both event-thread AND screenUpdater thread)
cg
parents: 285
diff changeset
   742
            aJavaThread name = 'JAVA-Screen Updater' ifTrue:[
2945ec2eee92 better reinit (look for both event-thread AND screenUpdater thread)
cg
parents: 285
diff changeset
   743
                aJavaThread isDead ifFalse:[
2945ec2eee92 better reinit (look for both event-thread AND screenUpdater thread)
cg
parents: 285
diff changeset
   744
                    "/ already running
2945ec2eee92 better reinit (look for both event-thread AND screenUpdater thread)
cg
parents: 285
diff changeset
   745
                    haveScreenUpdater := true
2945ec2eee92 better reinit (look for both event-thread AND screenUpdater thread)
cg
parents: 285
diff changeset
   746
                ]
2945ec2eee92 better reinit (look for both event-thread AND screenUpdater thread)
cg
parents: 285
diff changeset
   747
            ]
2945ec2eee92 better reinit (look for both event-thread AND screenUpdater thread)
cg
parents: 285
diff changeset
   748
        ].
2945ec2eee92 better reinit (look for both event-thread AND screenUpdater thread)
cg
parents: 285
diff changeset
   749
    ].
2945ec2eee92 better reinit (look for both event-thread AND screenUpdater thread)
cg
parents: 285
diff changeset
   750
2945ec2eee92 better reinit (look for both event-thread AND screenUpdater thread)
cg
parents: 285
diff changeset
   751
    (haveEventThread and:[haveScreenUpdater]) ifTrue:[
2945ec2eee92 better reinit (look for both event-thread AND screenUpdater thread)
cg
parents: 285
diff changeset
   752
        ^ self
248
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   753
    ].
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   754
436
8ac4dcd7fba9 in #startupJavaSystem:
cg
parents: 429
diff changeset
   755
    JavaClass orderOfClassInits isNil ifTrue:[
8ac4dcd7fba9 in #startupJavaSystem:
cg
parents: 429
diff changeset
   756
        "/ the very first start ...
8ac4dcd7fba9 in #startupJavaSystem:
cg
parents: 429
diff changeset
   757
        'JAVA [info]: (re)initializing JAVA environment completely ...' infoPrintCR.
285
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 283
diff changeset
   758
436
8ac4dcd7fba9 in #startupJavaSystem:
cg
parents: 429
diff changeset
   759
        JavaVM initializeVM.
8ac4dcd7fba9 in #startupJavaSystem:
cg
parents: 429
diff changeset
   760
    ] ifFalse:[
654
da8d060a3150 checkin from browser
cg
parents: 648
diff changeset
   761
        JavaVM initializeVMIfNoEventThreadRunning
436
8ac4dcd7fba9 in #startupJavaSystem:
cg
parents: 429
diff changeset
   762
    ].    
248
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   763
    'JAVA [info]: done JAVA initialization.' infoPrintCR.
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   764
285
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 283
diff changeset
   765
    "
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 283
diff changeset
   766
     Java startupJavaSystem
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 283
diff changeset
   767
    "
248
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   768
654
da8d060a3150 checkin from browser
cg
parents: 648
diff changeset
   769
    "Modified: / 24.12.1999 / 01:37:49 / cg"
248
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   770
!
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   771
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   772
terminateAllThreads
305
872463871468 checkin from browser
cg
parents: 301
diff changeset
   773
    |myself threadsToKill|
248
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   774
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   775
    Threads isNil ifTrue:[
270
6f21225aab53 *** empty log message ***
cg
parents: 267
diff changeset
   776
        ^ self
248
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   777
    ].
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   778
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   779
    myself := Processor activeProcess.
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   780
305
872463871468 checkin from browser
cg
parents: 301
diff changeset
   781
    threadsToKill := IdentitySet new.
248
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   782
    Threads do:[:aJavaThread |
270
6f21225aab53 *** empty log message ***
cg
parents: 267
diff changeset
   783
        aJavaThread ~~ myself ifTrue:[
6f21225aab53 *** empty log message ***
cg
parents: 267
diff changeset
   784
            (aJavaThread isNil or:[aJavaThread == 0]) ifFalse:[
6f21225aab53 *** empty log message ***
cg
parents: 267
diff changeset
   785
                (aJavaThread isMemberOf:JavaProcess) ifTrue:[
6f21225aab53 *** empty log message ***
cg
parents: 267
diff changeset
   786
                    aJavaThread isDead ifFalse:[
305
872463871468 checkin from browser
cg
parents: 301
diff changeset
   787
                        threadsToKill add:aJavaThread
270
6f21225aab53 *** empty log message ***
cg
parents: 267
diff changeset
   788
                    ]
6f21225aab53 *** empty log message ***
cg
parents: 267
diff changeset
   789
                ]
6f21225aab53 *** empty log message ***
cg
parents: 267
diff changeset
   790
            ]
6f21225aab53 *** empty log message ***
cg
parents: 267
diff changeset
   791
        ]
248
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   792
    ].
305
872463871468 checkin from browser
cg
parents: 301
diff changeset
   793
    threadsToKill do:[:aThread |
527
7eb6f6291fea *** empty log message ***
cg
parents: 514
diff changeset
   794
aThread == JavaVM javaScreenUpdaterThread ifTrue:[self halt].
654
da8d060a3150 checkin from browser
cg
parents: 648
diff changeset
   795
aThread == JavaVM javaEventQueueThread ifTrue:[self halt].
305
872463871468 checkin from browser
cg
parents: 301
diff changeset
   796
        aThread terminate
872463871468 checkin from browser
cg
parents: 301
diff changeset
   797
    ].
248
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   798
    Threads := nil.
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   799
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   800
    "
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   801
     Java terminateAllThreads
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   802
    "
964ad5f9e8bc no reinit - multiple browsers
cg
parents: 241
diff changeset
   803
270
6f21225aab53 *** empty log message ***
cg
parents: 267
diff changeset
   804
    "Created: / 26.8.1997 / 19:57:40 / cg"
654
da8d060a3150 checkin from browser
cg
parents: 648
diff changeset
   805
    "Modified: / 24.12.1999 / 02:34:53 / cg"
47
b5f63f59c2c1 some net primitives added
cg
parents: 43
diff changeset
   806
! !
b5f63f59c2c1 some net primitives added
cg
parents: 43
diff changeset
   807
135
098936234135 *** empty log message ***
cg
parents: 121
diff changeset
   808
!Java class methodsFor:'enumerating'!
43
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
   809
90
918e2740098c resolve rewritten
cg
parents: 84
diff changeset
   810
allClasses
208
054c2bbc03e8 *** empty log message ***
cg
parents: 205
diff changeset
   811
    ^ Classes ? #()
054c2bbc03e8 *** empty log message ***
cg
parents: 205
diff changeset
   812
280
274951f1502c checkin from browser
cg
parents: 279
diff changeset
   813
    "
274951f1502c checkin from browser
cg
parents: 279
diff changeset
   814
    |if|
274951f1502c checkin from browser
cg
parents: 279
diff changeset
   815
274951f1502c checkin from browser
cg
parents: 279
diff changeset
   816
    if := Java at:'java.awt.GraphicsEnvironment'.
274951f1502c checkin from browser
cg
parents: 279
diff changeset
   817
    Java allClasses select:[:aClass |
274951f1502c checkin from browser
cg
parents: 279
diff changeset
   818
                                aClass hasInterface:if
274951f1502c checkin from browser
cg
parents: 279
diff changeset
   819
                            ]
274951f1502c checkin from browser
cg
parents: 279
diff changeset
   820
    "
274951f1502c checkin from browser
cg
parents: 279
diff changeset
   821
274951f1502c checkin from browser
cg
parents: 279
diff changeset
   822
    "Modified: / 28.1.1998 / 01:42:04 / cg"
90
918e2740098c resolve rewritten
cg
parents: 84
diff changeset
   823
!
918e2740098c resolve rewritten
cg
parents: 84
diff changeset
   824
43
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
   825
allClassesDo:aBlock
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
   826
    Classes notNil ifTrue:[
552
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
   827
        Classes do:aBlock
43
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
   828
    ]
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
   829
! !
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
   830
205
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   831
!Java class methodsFor:'object conversions'!
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   832
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   833
as_Float:aNumber
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   834
    "convert an ST-float into a Java Float"
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   835
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   836
    |i|
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   837
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   838
    i := (Java at:'java.lang.Float') new.
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   839
    i perform:#'<init>(F)V' with:(aNumber asShortFloat).
205
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   840
    ^ i
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   841
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   842
    "
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   843
     Java as_Float:1
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   844
     Java as_Float:3.14159
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   845
    "
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   846
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   847
    "Created: 7.8.1997 / 21:21:13 / cg"
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   848
    "Modified: 7.8.1997 / 21:22:05 / cg"
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   849
!
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   850
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   851
as_Hashtable:aDictionary
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   852
    "given a smalltalk dictionary, create and return
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   853
     a Java hashTable for it"
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   854
205
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   855
    |hashTable|
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   856
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   857
    hashTable := (self classForName:'java.util.Hashtable') new.
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   858
    aDictionary keysAndValuesDo:[:k :v |
552
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
   859
        |sk sv jk jv|
205
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   860
552
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
   861
        (sk := k) isSymbol ifTrue:[
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
   862
            sk := sk asString
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
   863
        ].
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
   864
        (sv := v) isSymbol ifTrue:[
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
   865
            sv := sv asString
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
   866
        ].
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
   867
        jk := self as_Object:sk.
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
   868
        jv := self as_Object:sv.
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   869
552
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
   870
        hashTable 
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
   871
            perform:#'put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;'    
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
   872
            with:jk
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
   873
            with:jv.
205
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   874
    ].
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   875
    ^ hashTable
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   876
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   877
    "
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   878
     Java as_Hashtable:(Dictionary new
552
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
   879
                           at:'hello' put:'Hallo';
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
   880
                           at:'world' put:'Welt';       
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
   881
                           yourself)
205
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   882
    "
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   883
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   884
    "Modified: / 14.1.1998 / 17:02:13 / cg"
205
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   885
!
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   886
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   887
as_Integer:anInteger
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   888
    "convert an ST-integer into a Java Integer"
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   889
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   890
    |i|
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   891
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   892
    i := (Java at:'java.lang.Integer') new.
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   893
    i perform:#'<init>(I)V' with:anInteger.
205
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   894
    ^ i
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   895
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   896
    "
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   897
     Java as_Integer:1
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   898
    "
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   899
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   900
    "Modified: 7.8.1997 / 21:19:37 / cg"
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   901
    "Created: 7.8.1997 / 21:21:13 / cg"
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   902
!
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   903
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   904
as_Object:anObject
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   905
    "convert an ST-Object into a Java Object"
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   906
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   907
    anObject isString ifTrue:[
552
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
   908
        ^ self as_String:anObject
205
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   909
    ].
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   910
    anObject isInteger ifTrue:[
552
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
   911
        ^ self as_Integer:anObject
205
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   912
    ].
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   913
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   914
    self halt.
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   915
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   916
    "
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   917
     Java as_Object:'hello world'
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   918
    "
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   919
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   920
    "Created: 7.8.1997 / 21:15:38 / cg"
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   921
    "Modified: 7.8.1997 / 21:20:07 / cg"
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   922
!
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   923
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   924
as_ST_String: aJavaString 
205
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   925
    "hard-coding internas of java.lang.String here is bad ..."
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   926
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   927
    | str  count  offs  start  stop |
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   928
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   929
    aJavaString isNil ifTrue: [ ^ nil ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   930
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   931
    "/ count := aJavaString instVarNamed:'count'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   932
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   933
    count := aJavaString instVarAt: 3.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   934
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   935
    "/ str := aJavaString instVarNamed:'value'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   936
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   937
    str := aJavaString instVarAt: 1.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   938
    str size == count 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   939
        ifTrue: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   940
            [ "cos I don't see any reason to do this"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   941
            "/ ^ str asOneByteString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   942
            ^ str ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   943
    
407
568d64f6d7d6 checkin from browser
cg
parents: 393
diff changeset
   944
    "/ offs := (aJavaString instVarNamed:'offset').
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   945
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   946
    offs := aJavaString instVarAt: 2.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   947
    
407
568d64f6d7d6 checkin from browser
cg
parents: 393
diff changeset
   948
    "/ start := offs + 1.
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   949
    
407
568d64f6d7d6 checkin from browser
cg
parents: 393
diff changeset
   950
    start := offs + 1.
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   951
    
205
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   952
    "/ stop := start + (aJavaString instVarNamed:'count') - 1.
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   953
    
407
568d64f6d7d6 checkin from browser
cg
parents: 393
diff changeset
   954
    stop := start + count - 1.
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   955
    
205
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   956
    "/ ^ ((aJavaString instVarNamed:'value') copyFrom:start to:stop) asString
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   957
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   958
    ^ (str copyFrom: start to: stop) asOneByteString
205
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   959
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   960
    "Created: / 08-08-1997 / 12:02:55 / cg"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   961
    "Modified: / 04-01-1999 / 23:55:08 / cg"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   962
    "Modified: / 22-03-2011 / 17:21:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   963
    "Modified: / 10-08-2011 / 23:32:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
205
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   964
!
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   965
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   966
as_String:aString
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   967
    "convert an ST-String into a Java String"
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   968
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   969
    "hard-coding internas of java.lang.String here is bad ..."
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   970
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   971
    |s|
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   972
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   973
    s := Java_lang_String basicNew.
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   974
    s instVarNamed:'value'  put: aString.
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   975
    s instVarNamed:'offset' put: 0.
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   976
    s instVarNamed:'count'  put: aString size.
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   977
    s instVarNamed:'hash'   put: 0.
205
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   978
    ^ s
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   979
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   980
    "
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   981
     Java as_String:'hello world'
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   982
    "
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   983
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   984
    "Created: / 07-08-1997 / 21:15:49 / cg"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   985
    "Modified: / 03-02-2011 / 23:33:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
205
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   986
!
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   987
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   988
as_URL:aString
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   989
    "convert an ST-String into a Java String"
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   990
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   991
    "hard-coding internas of java.lang.String here is bad ..."
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   992
608
b0d71dcc94f6 kludge for MSDOS volumes
cg
parents: 607
diff changeset
   993
    |u s|
b0d71dcc94f6 kludge for MSDOS volumes
cg
parents: 607
diff changeset
   994
b0d71dcc94f6 kludge for MSDOS volumes
cg
parents: 607
diff changeset
   995
    s := aString.
205
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
   996
608
b0d71dcc94f6 kludge for MSDOS volumes
cg
parents: 607
diff changeset
   997
    "/ kludge for volume
b0d71dcc94f6 kludge for MSDOS volumes
cg
parents: 607
diff changeset
   998
    OperatingSystem isMSDOSlike ifTrue:[
b0d71dcc94f6 kludge for MSDOS volumes
cg
parents: 607
diff changeset
   999
        ((s size > 1) and:[(s at:2) == $:]) ifTrue:[
b0d71dcc94f6 kludge for MSDOS volumes
cg
parents: 607
diff changeset
  1000
            s := 'file:' , (s copy at:2 put:$|)
b0d71dcc94f6 kludge for MSDOS volumes
cg
parents: 607
diff changeset
  1001
        ]
b0d71dcc94f6 kludge for MSDOS volumes
cg
parents: 607
diff changeset
  1002
    ].
421
165be3b9ee05 *** empty log message ***
cg
parents: 419
diff changeset
  1003
    u := (self at:'java.net.URL') newCleared.
608
b0d71dcc94f6 kludge for MSDOS volumes
cg
parents: 607
diff changeset
  1004
    u perform:#'<init>(Ljava/lang/String;)V' with:(self as_String:s).
205
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
  1005
    ^ u
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
  1006
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
  1007
    "
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
  1008
     Java as_URL:'http://www.altavista.com'
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
  1009
     Java as_URL:'file:/foo/bar'
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
  1010
    "
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
  1011
421
165be3b9ee05 *** empty log message ***
cg
parents: 419
diff changeset
  1012
    "Created: / 7.8.1997 / 21:15:49 / cg"
608
b0d71dcc94f6 kludge for MSDOS volumes
cg
parents: 607
diff changeset
  1013
    "Modified: / 25.9.1999 / 22:22:21 / cg"
205
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
  1014
! !
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
  1015
168
90e39cb3fa04 *** empty log message ***
cg
parents: 167
diff changeset
  1016
!Java class methodsFor:'queries'!
90e39cb3fa04 *** empty log message ***
cg
parents: 167
diff changeset
  1017
90e39cb3fa04 *** empty log message ***
cg
parents: 167
diff changeset
  1018
smalltalkClassFor:typeRef
90e39cb3fa04 *** empty log message ***
cg
parents: 167
diff changeset
  1019
self halt.
90e39cb3fa04 *** empty log message ***
cg
parents: 167
diff changeset
  1020
"/    (typeString startsWith:'[[') ifTrue:[
90e39cb3fa04 *** empty log message ***
cg
parents: 167
diff changeset
  1021
"/        ^ Array
90e39cb3fa04 *** empty log message ***
cg
parents: 167
diff changeset
  1022
"/    ].
90e39cb3fa04 *** empty log message ***
cg
parents: 167
diff changeset
  1023
"/    (typeString startsWith:'[F') ifTrue:[
90e39cb3fa04 *** empty log message ***
cg
parents: 167
diff changeset
  1024
"/        ^ FloatArray
90e39cb3fa04 *** empty log message ***
cg
parents: 167
diff changeset
  1025
"/    ].
90e39cb3fa04 *** empty log message ***
cg
parents: 167
diff changeset
  1026
    self halt.
90e39cb3fa04 *** empty log message ***
cg
parents: 167
diff changeset
  1027
90e39cb3fa04 *** empty log message ***
cg
parents: 167
diff changeset
  1028
    "Modified: 7.4.1997 / 13:33:46 / cg"
90e39cb3fa04 *** empty log message ***
cg
parents: 167
diff changeset
  1029
!
90e39cb3fa04 *** empty log message ***
cg
parents: 167
diff changeset
  1030
90e39cb3fa04 *** empty log message ***
cg
parents: 167
diff changeset
  1031
smalltalkDerefType:typeString
90e39cb3fa04 *** empty log message ***
cg
parents: 167
diff changeset
  1032
    (typeString startsWith:'[') ifTrue:[
552
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
  1033
        ^ typeString copyFrom:2
168
90e39cb3fa04 *** empty log message ***
cg
parents: 167
diff changeset
  1034
    ].
90e39cb3fa04 *** empty log message ***
cg
parents: 167
diff changeset
  1035
    self halt.
90e39cb3fa04 *** empty log message ***
cg
parents: 167
diff changeset
  1036
90e39cb3fa04 *** empty log message ***
cg
parents: 167
diff changeset
  1037
    "Modified: 7.4.1997 / 13:13:24 / cg"
90e39cb3fa04 *** empty log message ***
cg
parents: 167
diff changeset
  1038
! !
90e39cb3fa04 *** empty log message ***
cg
parents: 167
diff changeset
  1039
135
098936234135 *** empty log message ***
cg
parents: 121
diff changeset
  1040
!Java class methodsFor:'registering java classes'!
17
ea80d8a83063 intitial checkin
cg
parents:
diff changeset
  1041
ea80d8a83063 intitial checkin
cg
parents:
diff changeset
  1042
at:aJavaName
43
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1043
    "search & return for a class by name;
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1044
     if there is no such class, return nil.
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1045
     The argument, aJavaName may be either an internal name
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1046
     (sep'd by slashes) or an external name (sep'd by periods).
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1047
     The 'java/lang' standard packages prefix may be ommitted."
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1048
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1049
    |sym nm cls|
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1050
17
ea80d8a83063 intitial checkin
cg
parents:
diff changeset
  1051
    Classes isNil ifTrue:[^ nil].
43
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1052
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1053
    sym := aJavaName asSymbolIfInterned.
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1054
    sym notNil ifTrue:[
360
e3df9401df00 use #copyReplaceAll:with:
cg
parents: 358
diff changeset
  1055
        cls := Classes at:sym ifAbsent:nil.
e3df9401df00 use #copyReplaceAll:with:
cg
parents: 358
diff changeset
  1056
        cls notNil ifTrue:[^ cls].
43
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1057
    ].
17
ea80d8a83063 intitial checkin
cg
parents:
diff changeset
  1058
43
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1059
    nm := aJavaName.
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1060
    (nm includes:$.) ifTrue:[
360
e3df9401df00 use #copyReplaceAll:with:
cg
parents: 358
diff changeset
  1061
        nm := (nm asString copyReplaceAll:$. with:$/).
e3df9401df00 use #copyReplaceAll:with:
cg
parents: 358
diff changeset
  1062
        sym := nm asSymbolIfInterned.
e3df9401df00 use #copyReplaceAll:with:
cg
parents: 358
diff changeset
  1063
        sym notNil ifTrue:[
e3df9401df00 use #copyReplaceAll:with:
cg
parents: 358
diff changeset
  1064
            cls := Classes at:sym ifAbsent:nil.
e3df9401df00 use #copyReplaceAll:with:
cg
parents: 358
diff changeset
  1065
            cls notNil ifTrue:[^ cls].
e3df9401df00 use #copyReplaceAll:with:
cg
parents: 358
diff changeset
  1066
        ].
43
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1067
    ].
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1068
        
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1069
    (nm includes:$/) ifFalse:[
360
e3df9401df00 use #copyReplaceAll:with:
cg
parents: 358
diff changeset
  1070
        "/
e3df9401df00 use #copyReplaceAll:with:
cg
parents: 358
diff changeset
  1071
        "/ try java.lang.Foo
e3df9401df00 use #copyReplaceAll:with:
cg
parents: 358
diff changeset
  1072
        "/
e3df9401df00 use #copyReplaceAll:with:
cg
parents: 358
diff changeset
  1073
        nm := 'java/lang/' , nm.
e3df9401df00 use #copyReplaceAll:with:
cg
parents: 358
diff changeset
  1074
        sym := nm asSymbolIfInterned.
e3df9401df00 use #copyReplaceAll:with:
cg
parents: 358
diff changeset
  1075
        sym notNil ifTrue:[
e3df9401df00 use #copyReplaceAll:with:
cg
parents: 358
diff changeset
  1076
            cls := Classes at:sym ifAbsent:nil.
e3df9401df00 use #copyReplaceAll:with:
cg
parents: 358
diff changeset
  1077
            cls notNil ifTrue:[^ cls].
e3df9401df00 use #copyReplaceAll:with:
cg
parents: 358
diff changeset
  1078
        ].
43
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1079
    ].
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1080
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1081
    ^ nil
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1082
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1083
    "
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1084
     Java at:'java/lang/String' 
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1085
     Java at:'java.lang.String'
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1086
     Java at:'String'          
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1087
     Java at:'System'            
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1088
     Java at:'Foo'               
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1089
    "
360
e3df9401df00 use #copyReplaceAll:with:
cg
parents: 358
diff changeset
  1090
e3df9401df00 use #copyReplaceAll:with:
cg
parents: 358
diff changeset
  1091
    "Modified: / 18.7.1998 / 22:55:16 / cg"
17
ea80d8a83063 intitial checkin
cg
parents:
diff changeset
  1092
!
ea80d8a83063 intitial checkin
cg
parents:
diff changeset
  1093
ea80d8a83063 intitial checkin
cg
parents:
diff changeset
  1094
at:aJavaName put:aJavaClass
591
0a52b3e7c77f checkin from browser
cg
parents: 580
diff changeset
  1095
    |nameSymbol oldClass|
90
918e2740098c resolve rewritten
cg
parents: 84
diff changeset
  1096
17
ea80d8a83063 intitial checkin
cg
parents:
diff changeset
  1097
    Classes isNil ifTrue:[
552
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
  1098
        Classes := IdentityDictionary new.
17
ea80d8a83063 intitial checkin
cg
parents:
diff changeset
  1099
    ].
90
918e2740098c resolve rewritten
cg
parents: 84
diff changeset
  1100
918e2740098c resolve rewritten
cg
parents: 84
diff changeset
  1101
    nameSymbol := aJavaName asSymbol.
918e2740098c resolve rewritten
cg
parents: 84
diff changeset
  1102
    (Classes includesKey:nameSymbol) ifTrue:[
591
0a52b3e7c77f checkin from browser
cg
parents: 580
diff changeset
  1103
        oldClass := Classes at:nameSymbol.
0a52b3e7c77f checkin from browser
cg
parents: 580
diff changeset
  1104
        oldClass == aJavaClass ifTrue:[
0a52b3e7c77f checkin from browser
cg
parents: 580
diff changeset
  1105
            ^ self
0a52b3e7c77f checkin from browser
cg
parents: 580
diff changeset
  1106
        ].
552
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
  1107
        ('JAVA: class ' , aJavaName , ' is already loaded') infoPrintCR.
591
0a52b3e7c77f checkin from browser
cg
parents: 580
diff changeset
  1108
        self updateClassRefsFrom:oldClass to:aJavaClass.
65
cc8721023892 *** empty log message ***
cg
parents: 54
diff changeset
  1109
    ].
54
f37bcefb7091 avoid loading classes twice
cg
parents: 47
diff changeset
  1110
90
918e2740098c resolve rewritten
cg
parents: 84
diff changeset
  1111
    Classes at:nameSymbol put:aJavaClass.
918e2740098c resolve rewritten
cg
parents: 84
diff changeset
  1112
    nameSymbol == #'java/lang/String' ifTrue:[
552
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
  1113
        Java_lang_String := aJavaClass
90
918e2740098c resolve rewritten
cg
parents: 84
diff changeset
  1114
    ].
21
b9dd73f299dd checkin from browser
cg
parents: 17
diff changeset
  1115
43
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1116
"/    UnresolvedClassRefs notNil ifTrue:[
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1117
"/        UnresolvedClassRefs do:[:toResolve |
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1118
"/        ]
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1119
"/    ].
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1120
27
4560bb77bb36 checkin from browser
cg
parents: 24
diff changeset
  1121
    self changed:#classes
17
ea80d8a83063 intitial checkin
cg
parents:
diff changeset
  1122
ea80d8a83063 intitial checkin
cg
parents:
diff changeset
  1123
    "Created: 17.4.1996 / 23:29:31 / cg"
205
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
  1124
    "Modified: 7.8.1997 / 19:15:58 / cg"
21
b9dd73f299dd checkin from browser
cg
parents: 17
diff changeset
  1125
!
b9dd73f299dd checkin from browser
cg
parents: 17
diff changeset
  1126
168
90e39cb3fa04 *** empty log message ***
cg
parents: 167
diff changeset
  1127
flushAllJavaResources
90e39cb3fa04 *** empty log message ***
cg
parents: 167
diff changeset
  1128
    self flushClasses.
90e39cb3fa04 *** empty log message ***
cg
parents: 167
diff changeset
  1129
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1130
    SourceCache := CacheDictionary new: 32.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1131
    SourceArchiveCache := CacheDictionary new: 32.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1132
168
90e39cb3fa04 *** empty log message ***
cg
parents: 167
diff changeset
  1133
    ObjectMemory allObjectsDo:[:someObject |
318
8720093188f7 debugPrints
cg
parents: 313
diff changeset
  1134
        someObject isBehavior ifTrue:[
8720093188f7 debugPrints
cg
parents: 313
diff changeset
  1135
            someObject isJavaClass ifTrue:[
8720093188f7 debugPrints
cg
parents: 313
diff changeset
  1136
                someObject setConstantPool:nil.
8720093188f7 debugPrints
cg
parents: 313
diff changeset
  1137
                someObject setInterfaces:nil.
8720093188f7 debugPrints
cg
parents: 313
diff changeset
  1138
                someObject setMethodDictionary:(MethodDictionary new).
711
88d966b256d0 *** empty log message ***
cg
parents: 706
diff changeset
  1139
                'JAVA [info]: flushing ' print. someObject fullName printCR.
318
8720093188f7 debugPrints
cg
parents: 313
diff changeset
  1140
            ]
8720093188f7 debugPrints
cg
parents: 313
diff changeset
  1141
        ].
168
90e39cb3fa04 *** empty log message ***
cg
parents: 167
diff changeset
  1142
    ].
711
88d966b256d0 *** empty log message ***
cg
parents: 706
diff changeset
  1143
    JavaClass flushClassesInitOrder.
88d966b256d0 *** empty log message ***
cg
parents: 706
diff changeset
  1144
168
90e39cb3fa04 *** empty log message ***
cg
parents: 167
diff changeset
  1145
    self flushClasses
90e39cb3fa04 *** empty log message ***
cg
parents: 167
diff changeset
  1146
90e39cb3fa04 *** empty log message ***
cg
parents: 167
diff changeset
  1147
    "
90e39cb3fa04 *** empty log message ***
cg
parents: 167
diff changeset
  1148
     Java flushAllJavaResources
90e39cb3fa04 *** empty log message ***
cg
parents: 167
diff changeset
  1149
    "
90e39cb3fa04 *** empty log message ***
cg
parents: 167
diff changeset
  1150
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1151
    "Modified: / 06-11-2001 / 09:49:37 / cg"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1152
    "Modified: / 26-07-2011 / 17:59:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
168
90e39cb3fa04 *** empty log message ***
cg
parents: 167
diff changeset
  1153
!
90e39cb3fa04 *** empty log message ***
cg
parents: 167
diff changeset
  1154
21
b9dd73f299dd checkin from browser
cg
parents: 17
diff changeset
  1155
flushClasses
167
77dcbc4b2201 *** empty log message ***
cg
parents: 162
diff changeset
  1156
    Classes := UnresolvedClassRefs := nil.
168
90e39cb3fa04 *** empty log message ***
cg
parents: 167
diff changeset
  1157
    Smalltalk keys copy do:[:aKey | 
381
b8348aa2d1b2 check for more jdk's
cg
parents: 372
diff changeset
  1158
        (aKey startsWith:'JAVA::') ifTrue:[ Smalltalk removeKey:aKey ]
168
90e39cb3fa04 *** empty log message ***
cg
parents: 167
diff changeset
  1159
    ].
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1160
    Smalltalk removeKey:#'JAVA'.
711
88d966b256d0 *** empty log message ***
cg
parents: 706
diff changeset
  1161
167
77dcbc4b2201 *** empty log message ***
cg
parents: 162
diff changeset
  1162
    Java_lang_String := Java_lang_Class := nil.
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1163
    JavaVM releaseAllJavaResources.
90
918e2740098c resolve rewritten
cg
parents: 84
diff changeset
  1164
    JavaUnresolvedConstant flushPatchLists.
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1165
    Debugger == DebugView ifTrue:[Debugger newDebugger].
423
08af061c56a8 javaClass now uses its fullName in name
cg
parents: 421
diff changeset
  1166
    ObjectMemory flushCaches.
21
b9dd73f299dd checkin from browser
cg
parents: 17
diff changeset
  1167
b9dd73f299dd checkin from browser
cg
parents: 17
diff changeset
  1168
    "
b9dd73f299dd checkin from browser
cg
parents: 17
diff changeset
  1169
     Java flushClasses
b9dd73f299dd checkin from browser
cg
parents: 17
diff changeset
  1170
    "
b9dd73f299dd checkin from browser
cg
parents: 17
diff changeset
  1171
711
88d966b256d0 *** empty log message ***
cg
parents: 706
diff changeset
  1172
    "Modified: / 6.11.2001 / 09:47:49 / cg"
21
b9dd73f299dd checkin from browser
cg
parents: 17
diff changeset
  1173
!
b9dd73f299dd checkin from browser
cg
parents: 17
diff changeset
  1174
43
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1175
markAllClassesUninitialized
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1176
    self allClassesDo:[:aJavaClass |
552
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
  1177
        aJavaClass markUninitialized
43
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1178
    ].
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1179
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1180
    "
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1181
     Java markAllClassesUninitialized
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1182
    "
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1183
!
2c4ca2eb8d07 checkin from browser
cg
parents: 32
diff changeset
  1184
21
b9dd73f299dd checkin from browser
cg
parents: 17
diff changeset
  1185
rememberUnresolved:anUnresolvedClassRef
90
918e2740098c resolve rewritten
cg
parents: 84
diff changeset
  1186
    ('JAVA: remember unresolved class: ' , anUnresolvedClassRef fullName) infoPrintCR.
918e2740098c resolve rewritten
cg
parents: 84
diff changeset
  1187
918e2740098c resolve rewritten
cg
parents: 84
diff changeset
  1188
    UnresolvedClassRefs isNil ifTrue:[
393
1efe41b5bc98 #removeClass: fix
cg
parents: 381
diff changeset
  1189
        UnresolvedClassRefs := Dictionary new.
90
918e2740098c resolve rewritten
cg
parents: 84
diff changeset
  1190
    ].
393
1efe41b5bc98 #removeClass: fix
cg
parents: 381
diff changeset
  1191
    UnresolvedClassRefs 
1efe41b5bc98 #removeClass: fix
cg
parents: 381
diff changeset
  1192
        at:anUnresolvedClassRef fullName
1efe41b5bc98 #removeClass: fix
cg
parents: 381
diff changeset
  1193
        put:anUnresolvedClassRef
21
b9dd73f299dd checkin from browser
cg
parents: 17
diff changeset
  1194
393
1efe41b5bc98 #removeClass: fix
cg
parents: 381
diff changeset
  1195
    "Created: / 18.4.1996 / 00:05:31 / cg"
1efe41b5bc98 #removeClass: fix
cg
parents: 381
diff changeset
  1196
    "Modified: / 19.10.1998 / 20:57:44 / cg"
90
918e2740098c resolve rewritten
cg
parents: 84
diff changeset
  1197
!
918e2740098c resolve rewritten
cg
parents: 84
diff changeset
  1198
162
15b1e9c8e2f5 preps for class-remove
cg
parents: 147
diff changeset
  1199
removeClass:aJavaClass
15b1e9c8e2f5 preps for class-remove
cg
parents: 147
diff changeset
  1200
    "/ remove it from myself
15b1e9c8e2f5 preps for class-remove
cg
parents: 147
diff changeset
  1201
393
1efe41b5bc98 #removeClass: fix
cg
parents: 381
diff changeset
  1202
    |javaName sym nm cls p ns|
162
15b1e9c8e2f5 preps for class-remove
cg
parents: 147
diff changeset
  1203
15b1e9c8e2f5 preps for class-remove
cg
parents: 147
diff changeset
  1204
    javaName := aJavaClass fullName.
15b1e9c8e2f5 preps for class-remove
cg
parents: 147
diff changeset
  1205
15b1e9c8e2f5 preps for class-remove
cg
parents: 147
diff changeset
  1206
    sym := javaName asSymbolIfInterned.
15b1e9c8e2f5 preps for class-remove
cg
parents: 147
diff changeset
  1207
    sym notNil ifTrue:[
360
e3df9401df00 use #copyReplaceAll:with:
cg
parents: 358
diff changeset
  1208
        cls := Classes at:sym ifAbsent:nil.
162
15b1e9c8e2f5 preps for class-remove
cg
parents: 147
diff changeset
  1209
    ].
15b1e9c8e2f5 preps for class-remove
cg
parents: 147
diff changeset
  1210
    cls isNil ifTrue:[
360
e3df9401df00 use #copyReplaceAll:with:
cg
parents: 358
diff changeset
  1211
        nm := javaName.
e3df9401df00 use #copyReplaceAll:with:
cg
parents: 358
diff changeset
  1212
        (nm includes:$.) ifTrue:[
e3df9401df00 use #copyReplaceAll:with:
cg
parents: 358
diff changeset
  1213
            "/
e3df9401df00 use #copyReplaceAll:with:
cg
parents: 358
diff changeset
  1214
            "/ try pckg/.../name
e3df9401df00 use #copyReplaceAll:with:
cg
parents: 358
diff changeset
  1215
            "/
e3df9401df00 use #copyReplaceAll:with:
cg
parents: 358
diff changeset
  1216
            nm := (nm asString copyReplaceAll:$. with:$/).
e3df9401df00 use #copyReplaceAll:with:
cg
parents: 358
diff changeset
  1217
            sym := nm asSymbolIfInterned.
e3df9401df00 use #copyReplaceAll:with:
cg
parents: 358
diff changeset
  1218
            sym notNil ifTrue:[
e3df9401df00 use #copyReplaceAll:with:
cg
parents: 358
diff changeset
  1219
                cls := Classes at:sym ifAbsent:nil.
e3df9401df00 use #copyReplaceAll:with:
cg
parents: 358
diff changeset
  1220
            ].
e3df9401df00 use #copyReplaceAll:with:
cg
parents: 358
diff changeset
  1221
        ].
162
15b1e9c8e2f5 preps for class-remove
cg
parents: 147
diff changeset
  1222
    ].
212
9b5e1b60d0c2 checkin from browser
cg
parents: 208
diff changeset
  1223
    (cls notNil and:[cls == aJavaClass]) ifTrue:[
360
e3df9401df00 use #copyReplaceAll:with:
cg
parents: 358
diff changeset
  1224
        Classes removeKey:sym.
e3df9401df00 use #copyReplaceAll:with:
cg
parents: 358
diff changeset
  1225
        self updateClassRefsFrom:aJavaClass to:nil.
162
15b1e9c8e2f5 preps for class-remove
cg
parents: 147
diff changeset
  1226
    ].
393
1efe41b5bc98 #removeClass: fix
cg
parents: 381
diff changeset
  1227
    Smalltalk removeKey:('JAVA::' , javaName) asSymbol.
592
2728f2aa4c30 checkin from browser
cg
parents: 591
diff changeset
  1228
    Smalltalk removeKey:javaName asSymbol.
2728f2aa4c30 checkin from browser
cg
parents: 591
diff changeset
  1229
    Smalltalk removeKey:((javaName , '') copy replaceAll:$/ with:$.) asSymbol.
393
1efe41b5bc98 #removeClass: fix
cg
parents: 381
diff changeset
  1230
1efe41b5bc98 #removeClass: fix
cg
parents: 381
diff changeset
  1231
    "/ remove myself from the JAVA::-::-:: namespace
1efe41b5bc98 #removeClass: fix
cg
parents: 381
diff changeset
  1232
    "/ (which exists for convenient smalltalk access only)
162
15b1e9c8e2f5 preps for class-remove
cg
parents: 147
diff changeset
  1233
393
1efe41b5bc98 #removeClass: fix
cg
parents: 381
diff changeset
  1234
    p := aJavaClass nameSpacePath.
1efe41b5bc98 #removeClass: fix
cg
parents: 381
diff changeset
  1235
    p knownAsSymbol ifTrue:[
1efe41b5bc98 #removeClass: fix
cg
parents: 381
diff changeset
  1236
        ns := Smalltalk at:p asSymbol.
675
d409e317e7ff *** empty log message ***
cg
parents: 669
diff changeset
  1237
        (ns notNil and:[ns isNameSpace]) ifTrue:[
592
2728f2aa4c30 checkin from browser
cg
parents: 591
diff changeset
  1238
            Smalltalk removeKey:(p , '::' , aJavaClass lastName) asSymbol
393
1efe41b5bc98 #removeClass: fix
cg
parents: 381
diff changeset
  1239
        ]
1efe41b5bc98 #removeClass: fix
cg
parents: 381
diff changeset
  1240
    ].
1efe41b5bc98 #removeClass: fix
cg
parents: 381
diff changeset
  1241
1efe41b5bc98 #removeClass: fix
cg
parents: 381
diff changeset
  1242
    "Modified: / 19.10.1998 / 20:58:49 / cg"
162
15b1e9c8e2f5 preps for class-remove
cg
parents: 147
diff changeset
  1243
!
15b1e9c8e2f5 preps for class-remove
cg
parents: 147
diff changeset
  1244
90
918e2740098c resolve rewritten
cg
parents: 84
diff changeset
  1245
unresolvedClassRefFor:aClassName
918e2740098c resolve rewritten
cg
parents: 84
diff changeset
  1246
    UnresolvedClassRefs isNil ifTrue:[^ nil].
918e2740098c resolve rewritten
cg
parents: 84
diff changeset
  1247
    ^ UnresolvedClassRefs at:aClassName ifAbsent:nil.
393
1efe41b5bc98 #removeClass: fix
cg
parents: 381
diff changeset
  1248
1efe41b5bc98 #removeClass: fix
cg
parents: 381
diff changeset
  1249
    "Modified: / 19.10.1998 / 20:56:46 / cg"
167
77dcbc4b2201 *** empty log message ***
cg
parents: 162
diff changeset
  1250
!
77dcbc4b2201 *** empty log message ***
cg
parents: 162
diff changeset
  1251
77dcbc4b2201 *** empty log message ***
cg
parents: 162
diff changeset
  1252
updateClassRefsFrom:oldClass to:newClass
77dcbc4b2201 *** empty log message ***
cg
parents: 162
diff changeset
  1253
    "update all references to oldClass to now refer to newClass.
77dcbc4b2201 *** empty log message ***
cg
parents: 162
diff changeset
  1254
     sent, when a class is reloaded"
77dcbc4b2201 *** empty log message ***
cg
parents: 162
diff changeset
  1255
214
76588d86cbfb checkin from browser
cg
parents: 212
diff changeset
  1256
    newClass notNil ifTrue:[
552
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
  1257
        "/
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
  1258
        "/ kludge: the new class might have been resolved with the oldClass ...
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
  1259
        "/
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
  1260
        newClass constantPool 
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
  1261
            updateClassRefsFrom:oldClass to:newClass.
214
76588d86cbfb checkin from browser
cg
parents: 212
diff changeset
  1262
    ].
205
11cd2ad78854 *** empty log message ***
cg
parents: 203
diff changeset
  1263
203
67af98594672 *** empty log message ***
cg
parents: 201
diff changeset
  1264
    self allClassesDo:[:aJavaClass |
552
c1c3f3685801 checkin from browser
cg
parents: 550
diff changeset
  1265
        aJavaClass updateClassRefsFrom:oldClass to:newClass
203
67af98594672 *** empty log message ***
cg
parents: 201
diff changeset
  1266
    ].
167
77dcbc4b2201 *** empty log message ***
cg
parents: 162
diff changeset
  1267
77dcbc4b2201 *** empty log message ***
cg
parents: 162
diff changeset
  1268
    "Created: 26.3.1997 / 13:49:20 / cg"
214
76588d86cbfb checkin from browser
cg
parents: 212
diff changeset
  1269
    "Modified: 12.8.1997 / 03:04:44 / cg"
17
ea80d8a83063 intitial checkin
cg
parents:
diff changeset
  1270
! !
ea80d8a83063 intitial checkin
cg
parents:
diff changeset
  1271
135
098936234135 *** empty log message ***
cg
parents: 121
diff changeset
  1272
!Java class methodsFor:'source management'!
76
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
  1273
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1274
classSource:filename package:package in:dirOrZipFile 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1275
    |fn zar f |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1276
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1277
    fn := dirOrZipFile asFilename.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1278
    fn isDirectory 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1279
        ifTrue:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1280
            [ package notNil 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1281
                ifTrue:[ (f:= fn / package / filename) exists ifTrue:[ ^ f contents asString ]. ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1282
            (f := fn / filename) exists ifTrue:[ ^ f contents asString ]. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1283
        ifFalse:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1284
            [ (dirOrZipFile last == $p and: [fn hasSuffix:'zip'])
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1285
                ifTrue:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1286
                    [ zar := SourceArchiveCache 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1287
                                at: dirOrZipFile 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1288
                                ifAbsentPut:[ZipArchive oldFileNamed:fn pathName].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1289
                    zar notNil 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1290
                        ifTrue:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1291
                            [   package notNil 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1292
                                ifTrue:[ 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1293
                                    OperatingSystem fileSeparator ~~ $/ ifTrue: [ 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1294
                                        f := (package copyReplaceAll: OperatingSystem fileSeparator with: $/) , '/' , filename
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1295
                                    ] ifFalse:[
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1296
                                        f := package , '/' , filename.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1297
                                    ]]                                
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1298
                                ifFalse:[ f := filename].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1299
                            (zar findMember: f) ifNotNil:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1300
                                [          
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1301
                                    "Kludge because of broken ZipArchive"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1302
                                    |  cache |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1303
                                    cache := Java cacheDirectory / Release name / 'src'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1304
                                    cache exists ifFalse:[cache recursiveMakeDirectory].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1305
                                    (cache / f) exists ifTrue:[^(cache / f) contents asString].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1306
                                    OperatingSystem 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1307
                                        executeCommand:('unzip "%1" "%2"' bindWith: fn asAbsoluteFilename asString 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1308
                                                            with: f asString)
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1309
                                        inDirectory: cache asString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1310
                                    (f := cache / f) exists ifTrue:[^f contents asString]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1311
                                ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1312
                            ]]].            
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1313
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1314
    ^ nil
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1315
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1316
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1317
        Java classSource: 'Object.java' package:'java/lang' in:'/home/jv/Projects/JavaX/java-6-openjdk/src'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1318
        Java classSource: 'Object.java' package:'java/lang' in:'/usr/lib/jvm/java-6-openjdk/src.zip'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1319
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1320
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1321
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1322
    "Modified: / 29-03-1998 / 21:46:40 / cg"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1323
    "Created: / 30-11-2010 / 12:32:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1324
    "Modified: / 08-04-2011 / 15:01:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1325
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1326
76
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
  1327
classSourceOf:aClass
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1328
    |package dirName binary sourceFileName sourceFile loader codeBaseURL protocol codeBaseURLIdx src|
76
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
  1329
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
  1330
    aClass isNil ifTrue:[
267
105b82469d81 checkin from browser
cg
parents: 264
diff changeset
  1331
        ^ nil
76
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
  1332
    ].
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1333
    "/ look at the cache"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1334
    SourceCache at: aClass ifPresent: [:src|^src].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1335
76
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
  1336
    "/ first, look in the directory, where the binary
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
  1337
    "/ was loaded from.
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
  1338
198
5543d1079a4a *** empty log message ***
cg
parents: 192
diff changeset
  1339
    binary := aClass binaryFile.
5543d1079a4a *** empty log message ***
cg
parents: 192
diff changeset
  1340
    binary notNil ifTrue:[
267
105b82469d81 checkin from browser
cg
parents: 264
diff changeset
  1341
        binary := binary asFilename.
324
f92b236baea5 checkin from browser
cg
parents: 318
diff changeset
  1342
        aClass sourceFile notNil ifTrue:[
f92b236baea5 checkin from browser
cg
parents: 318
diff changeset
  1343
            sourceFileName := binary directory constructString:(aClass sourceFile).
f92b236baea5 checkin from browser
cg
parents: 318
diff changeset
  1344
            sourceFileName asFilename exists ifFalse:[
f92b236baea5 checkin from browser
cg
parents: 318
diff changeset
  1345
                sourceFileName := nil.
f92b236baea5 checkin from browser
cg
parents: 318
diff changeset
  1346
            ]
f92b236baea5 checkin from browser
cg
parents: 318
diff changeset
  1347
        ].
f92b236baea5 checkin from browser
cg
parents: 318
diff changeset
  1348
        sourceFileName isNil ifTrue:[
f92b236baea5 checkin from browser
cg
parents: 318
diff changeset
  1349
            sourceFileName := binary withSuffix:'java'.
f92b236baea5 checkin from browser
cg
parents: 318
diff changeset
  1350
        ].
267
105b82469d81 checkin from browser
cg
parents: 264
diff changeset
  1351
        sourceFile := sourceFileName asFilename.
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1352
    ] ifFalse:[
267
105b82469d81 checkin from browser
cg
parents: 264
diff changeset
  1353
        "/ maybe it was loaded by a java classLoader ...
105b82469d81 checkin from browser
cg
parents: 264
diff changeset
  1354
        (loader := aClass classLoader) notNil ifTrue:[
546
56e1665483d2 *** empty log message ***
cg
parents: 543
diff changeset
  1355
            codeBaseURLIdx := loader class instVarOffsetOf:'codeBaseURL'.
56e1665483d2 *** empty log message ***
cg
parents: 543
diff changeset
  1356
            codeBaseURLIdx notNil ifTrue:[
56e1665483d2 *** empty log message ***
cg
parents: 543
diff changeset
  1357
                (codeBaseURL := loader instVarAt:codeBaseURLIdx) notNil ifTrue:[
56e1665483d2 *** empty log message ***
cg
parents: 543
diff changeset
  1358
                    (protocol := codeBaseURL instVarNamed:'protocol') notNil ifTrue:[
56e1665483d2 *** empty log message ***
cg
parents: 543
diff changeset
  1359
                        (Java as_ST_String:protocol) = 'file' ifTrue:[
56e1665483d2 *** empty log message ***
cg
parents: 543
diff changeset
  1360
                            dirName := Java as_ST_String:(codeBaseURL instVarNamed:'file').
571
b5ae2faeb568 allow for the sources to be stored in one big zip-archive
cg
parents: 567
diff changeset
  1361
                            dirName := dirName asFilename.
b5ae2faeb568 allow for the sources to be stored in one big zip-archive
cg
parents: 567
diff changeset
  1362
                            dirName exists ifTrue:[
546
56e1665483d2 *** empty log message ***
cg
parents: 543
diff changeset
  1363
                                aClass sourceFile notNil ifTrue:[
571
b5ae2faeb568 allow for the sources to be stored in one big zip-archive
cg
parents: 567
diff changeset
  1364
                                    sourceFile := sourceFileName := dirName construct:aClass sourceFile.
546
56e1665483d2 *** empty log message ***
cg
parents: 543
diff changeset
  1365
                                ]
267
105b82469d81 checkin from browser
cg
parents: 264
diff changeset
  1366
                            ]
105b82469d81 checkin from browser
cg
parents: 264
diff changeset
  1367
                        ]
105b82469d81 checkin from browser
cg
parents: 264
diff changeset
  1368
                    ]
105b82469d81 checkin from browser
cg
parents: 264
diff changeset
  1369
                ]
105b82469d81 checkin from browser
cg
parents: 264
diff changeset
  1370
            ]
105b82469d81 checkin from browser
cg
parents: 264
diff changeset
  1371
        ]
198
5543d1079a4a *** empty log message ***
cg
parents: 192
diff changeset
  1372
    ].
5543d1079a4a *** empty log message ***
cg
parents: 192
diff changeset
  1373
    sourceFile notNil ifTrue:[
267
105b82469d81 checkin from browser
cg
parents: 264
diff changeset
  1374
        sourceFile exists ifFalse:[
105b82469d81 checkin from browser
cg
parents: 264
diff changeset
  1375
            binary notNil ifTrue:[
105b82469d81 checkin from browser
cg
parents: 264
diff changeset
  1376
                sourceFileName := binary withSuffix:'jav'.
105b82469d81 checkin from browser
cg
parents: 264
diff changeset
  1377
                sourceFile := sourceFileName asFilename.
105b82469d81 checkin from browser
cg
parents: 264
diff changeset
  1378
                sourceFile exists ifFalse:[
105b82469d81 checkin from browser
cg
parents: 264
diff changeset
  1379
                    sourceFileName := binary withSuffix:'JAV'.
105b82469d81 checkin from browser
cg
parents: 264
diff changeset
  1380
                    sourceFile := sourceFileName asFilename.
105b82469d81 checkin from browser
cg
parents: 264
diff changeset
  1381
                    sourceFile exists ifFalse:[
105b82469d81 checkin from browser
cg
parents: 264
diff changeset
  1382
                        sourceFileName := binary withSuffix:'JAVA'.
105b82469d81 checkin from browser
cg
parents: 264
diff changeset
  1383
                        sourceFile := sourceFileName asFilename.
105b82469d81 checkin from browser
cg
parents: 264
diff changeset
  1384
                    ].
105b82469d81 checkin from browser
cg
parents: 264
diff changeset
  1385
                ].
105b82469d81 checkin from browser
cg
parents: 264
diff changeset
  1386
            ]
105b82469d81 checkin from browser
cg
parents: 264
diff changeset
  1387
        ].
76
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
  1388
    ].
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
  1389
176
16f64026e8ec *** empty log message ***
cg
parents: 168
diff changeset
  1390
    "/ special case: there were multiple classes in a single
76
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
  1391
    "/ source file.
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
  1392
601
7e45fca24adf checkin from browser
cg
parents: 592
diff changeset
  1393
    (binary notNil and:[aClass sourceFile notNil]) ifTrue:[
267
105b82469d81 checkin from browser
cg
parents: 264
diff changeset
  1394
        binary withoutSuffix baseName ~= aClass sourceFile asFilename withoutSuffix baseName ifTrue:[
683
a2ff7b26573f *** empty log message ***
cg
parents: 677
diff changeset
  1395
            'JAVA: trouble extracting fileName: ' infoPrint.
a2ff7b26573f *** empty log message ***
cg
parents: 677
diff changeset
  1396
            binary withoutSuffix baseName print. ' vs. ' infoPrint.
a2ff7b26573f *** empty log message ***
cg
parents: 677
diff changeset
  1397
            aClass sourceFile asFilename withoutSuffix baseName infoPrintCR.
267
105b82469d81 checkin from browser
cg
parents: 264
diff changeset
  1398
        ].
76
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
  1399
    ].
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
  1400
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
  1401
    "/ if that fails, look in standard places
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
  1402
198
5543d1079a4a *** empty log message ***
cg
parents: 192
diff changeset
  1403
    (sourceFile isNil or:[sourceFile exists not]) ifTrue:[
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1404
        sourceFile := aClass sourceFile.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1405
        package := aClass javaPackageAsDirname.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1406
        self effectiveSourceDirectories do:[:dir|
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1407
            src := self classSource: sourceFile package: package in: dir.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1408
            src ifNotNil:[^src]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1409
        ]
76
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
  1410
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
  1411
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
  1412
    ].
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1413
    sourceFile isFilename ifFalse:[^nil].
76
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
  1414
    ^ (sourceFile contentsOfEntireFile).
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
  1415
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1416
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1417
        Java classSourceOf: JAVA::java::lang::Object
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1418
    "
571
b5ae2faeb568 allow for the sources to be stored in one big zip-archive
cg
parents: 567
diff changeset
  1419
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1420
    "Modified: / 27-01-1999 / 20:40:30 / cg"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1421
    "Modified: / 10-02-2011 / 23:10:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
76
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
  1422
! !
9ff95e14dbfb *** empty log message ***
cg
parents: 71
diff changeset
  1423
224
164850a15533 moved main-startup into Java (useful for others too)
cg
parents: 215
diff changeset
  1424
!Java class methodsFor:'starting apps'!
164850a15533 moved main-startup into Java (useful for others too)
cg
parents: 215
diff changeset
  1425
164850a15533 moved main-startup into Java (useful for others too)
cg
parents: 215
diff changeset
  1426
javaProcessForMainOf:aJavaClass
164850a15533 moved main-startup into Java (useful for others too)
cg
parents: 215
diff changeset
  1427
    "ask for a commandLine, create a java process to invoke
164850a15533 moved main-startup into Java (useful for others too)
cg
parents: 215
diff changeset
  1428
     its main and return it. The process is not scheduled for
164850a15533 moved main-startup into Java (useful for others too)
cg
parents: 215
diff changeset
  1429
     execution."
164850a15533 moved main-startup into Java (useful for others too)
cg
parents: 215
diff changeset
  1430
508
21d8af9a9b41 checkin from browser
cg
parents: 494
diff changeset
  1431
    ^ self javaProcessForMainOf:aJavaClass argumentString:nil
224
164850a15533 moved main-startup into Java (useful for others too)
cg
parents: 215
diff changeset
  1432
508
21d8af9a9b41 checkin from browser
cg
parents: 494
diff changeset
  1433
    "Modified: / 30.12.1998 / 20:24:25 / cg"
224
164850a15533 moved main-startup into Java (useful for others too)
cg
parents: 215
diff changeset
  1434
!
164850a15533 moved main-startup into Java (useful for others too)
cg
parents: 215
diff changeset
  1435
508
21d8af9a9b41 checkin from browser
cg
parents: 494
diff changeset
  1436
javaProcessForMainOf:aJavaClass argumentString:argStringIn
224
164850a15533 moved main-startup into Java (useful for others too)
cg
parents: 215
diff changeset
  1437
    "create a java process, ready to invoke the classes main
164850a15533 moved main-startup into Java (useful for others too)
cg
parents: 215
diff changeset
  1438
     method. Returns the process - ready to run but not yet resumed"
164850a15533 moved main-startup into Java (useful for others too)
cg
parents: 215
diff changeset
  1439
741
a8950a7fd2bd use collect:as:
cg
parents: 715
diff changeset
  1440
    |p argStringArray argString stdInReplacement alreadyAskedForStdin|
508
21d8af9a9b41 checkin from browser
cg
parents: 494
diff changeset
  1441
21d8af9a9b41 checkin from browser
cg
parents: 494
diff changeset
  1442
    argString := argStringIn.
21d8af9a9b41 checkin from browser
cg
parents: 494
diff changeset
  1443
    argString isNil ifTrue:[
21d8af9a9b41 checkin from browser
cg
parents: 494
diff changeset
  1444
        argString := Dialog 
21d8af9a9b41 checkin from browser
cg
parents: 494
diff changeset
  1445
                    request:'argument string:' 
21d8af9a9b41 checkin from browser
cg
parents: 494
diff changeset
  1446
                    initialAnswer:LastArgumentString ? ''
21d8af9a9b41 checkin from browser
cg
parents: 494
diff changeset
  1447
                    onCancel:nil.
21d8af9a9b41 checkin from browser
cg
parents: 494
diff changeset
  1448
        argString isNil ifTrue:[^ nil].
21d8af9a9b41 checkin from browser
cg
parents: 494
diff changeset
  1449
21d8af9a9b41 checkin from browser
cg
parents: 494
diff changeset
  1450
        LastArgumentString := argString.
21d8af9a9b41 checkin from browser
cg
parents: 494
diff changeset
  1451
    ].
224
164850a15533 moved main-startup into Java (useful for others too)
cg
parents: 215
diff changeset
  1452
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1453
    JavaVM initializeVMIfNoEventThreadRunning.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1454
    (Java at:'java.lang.System') instVarNamed:'security' put:nil.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1455
224
164850a15533 moved main-startup into Java (useful for others too)
cg
parents: 215
diff changeset
  1456
    argString isEmpty ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 248
diff changeset
  1457
        argStringArray := #()
224
164850a15533 moved main-startup into Java (useful for others too)
cg
parents: 215
diff changeset
  1458
    ] ifFalse:[
741
a8950a7fd2bd use collect:as:
cg
parents: 715
diff changeset
  1459
        argStringArray := argString asCollectionOfWords collect:[:s | Java as_String:s] as:Array.
224
164850a15533 moved main-startup into Java (useful for others too)
cg
parents: 215
diff changeset
  1460
    ].
164850a15533 moved main-startup into Java (useful for others too)
cg
parents: 215
diff changeset
  1461
164850a15533 moved main-startup into Java (useful for others too)
cg
parents: 215
diff changeset
  1462
    p := JavaProcess 
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 248
diff changeset
  1463
            for:[
580
24f16f7bb058 checkin from browser
cg
parents: 577
diff changeset
  1464
                    "/ if the program reads from stdin, let user provide a file
24f16f7bb058 checkin from browser
cg
parents: 577
diff changeset
  1465
                    "/ for it.
577
18407fb4087b provide Stdin replacement;
cg
parents: 571
diff changeset
  1466
                    JavaVM stdinReplacementFileQuerySignal handle:[:ex |
18407fb4087b provide Stdin replacement;
cg
parents: 571
diff changeset
  1467
                        |fn|
18407fb4087b provide Stdin replacement;
cg
parents: 571
diff changeset
  1468
18407fb4087b provide Stdin replacement;
cg
parents: 571
diff changeset
  1469
                        alreadyAskedForStdin == true ifFalse:[
580
24f16f7bb058 checkin from browser
cg
parents: 577
diff changeset
  1470
                            fn := Dialog 
24f16f7bb058 checkin from browser
cg
parents: 577
diff changeset
  1471
                                    requestFileName:'Program reads from Stdin - give inputFile or cancel for EOF'
24f16f7bb058 checkin from browser
cg
parents: 577
diff changeset
  1472
                                    default:nil
24f16f7bb058 checkin from browser
cg
parents: 577
diff changeset
  1473
                                    fromDirectory:(FileSelectionBox lastFileSelectionDirectory).
577
18407fb4087b provide Stdin replacement;
cg
parents: 571
diff changeset
  1474
                            fn notNil ifTrue:[
18407fb4087b provide Stdin replacement;
cg
parents: 571
diff changeset
  1475
                                stdInReplacement := fn asFilename readStream.
18407fb4087b provide Stdin replacement;
cg
parents: 571
diff changeset
  1476
                            ].
18407fb4087b provide Stdin replacement;
cg
parents: 571
diff changeset
  1477
                            alreadyAskedForStdin := true.
18407fb4087b provide Stdin replacement;
cg
parents: 571
diff changeset
  1478
                        ].
18407fb4087b provide Stdin replacement;
cg
parents: 571
diff changeset
  1479
                        ex proceedWith:stdInReplacement
18407fb4087b provide Stdin replacement;
cg
parents: 571
diff changeset
  1480
                    ] do:[
18407fb4087b provide Stdin replacement;
cg
parents: 571
diff changeset
  1481
                        aJavaClass 
18407fb4087b provide Stdin replacement;
cg
parents: 571
diff changeset
  1482
                            performStatic:#'main([Ljava/lang/String;)V'
18407fb4087b provide Stdin replacement;
cg
parents: 571
diff changeset
  1483
                            with:argStringArray.
18407fb4087b provide Stdin replacement;
cg
parents: 571
diff changeset
  1484
                    ]
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 248
diff changeset
  1485
                ]
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 248
diff changeset
  1486
            priority:(Processor activePriority - 1).
224
164850a15533 moved main-startup into Java (useful for others too)
cg
parents: 215
diff changeset
  1487
164850a15533 moved main-startup into Java (useful for others too)
cg
parents: 215
diff changeset
  1488
    p name:(aJavaClass fullName , '::main()').
654
da8d060a3150 checkin from browser
cg
parents: 648
diff changeset
  1489
    p restartable:true.
224
164850a15533 moved main-startup into Java (useful for others too)
cg
parents: 215
diff changeset
  1490
    ^ p
164850a15533 moved main-startup into Java (useful for others too)
cg
parents: 215
diff changeset
  1491
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 248
diff changeset
  1492
    "Created: / 15.8.1997 / 04:41:20 / cg"
654
da8d060a3150 checkin from browser
cg
parents: 648
diff changeset
  1493
    "Modified: / 24.12.1999 / 01:50:21 / cg"
224
164850a15533 moved main-startup into Java (useful for others too)
cg
parents: 215
diff changeset
  1494
! !
164850a15533 moved main-startup into Java (useful for others too)
cg
parents: 215
diff changeset
  1495
135
098936234135 *** empty log message ***
cg
parents: 121
diff changeset
  1496
!Java class methodsFor:'documentation'!
17
ea80d8a83063 intitial checkin
cg
parents:
diff changeset
  1497
ea80d8a83063 intitial checkin
cg
parents:
diff changeset
  1498
version
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1499
    ^ '$Id: Java.st,v 1.134 2011/08/18 18:42:48 vrany Exp $'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1500
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1501
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1502
version_SVN
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1503
    ^ '$Id: Java.st,v 1.134 2011/08/18 18:42:48 vrany Exp $'
17
ea80d8a83063 intitial checkin
cg
parents:
diff changeset
  1504
! !
713
75e92ac63bf1 category change
cg
parents: 711
diff changeset
  1505
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
  1506
Java initialize!