tools/JavaSettingsApplication.st
author Claus Gittinger <cg@exept.de>
Wed, 05 Sep 2018 18:37:31 +0200
branchcvs_MAIN
changeset 3852 c7bece640250
parent 3814 eb2aa2c60642
child 3900 7acd9bc59ce6
permissions -rw-r--r--
#REFACTORING by cg class: JavaRelease changed: #bootClassPath class: JavaRelease::AppleJDK9 changed: #jreHome

"{ Encoding: utf8 }"

"{ Package: 'stx:libjava/tools' }"

"{ NameSpace: Smalltalk }"

AbstractSettingsApplication subclass:#JavaSettingsApplication
	instanceVariableNames:'javaHomeHolder infoPanel javaHomeInfoHolder useDefaultJVM'
	classVariableNames:''
	poolDictionaries:''
	category:'Languages-Java-Tools'
!


!JavaSettingsApplication class methodsFor:'initialization'!

initialize

    self installInSettings

    "Created: / 23-06-2005 / 09:27:10 / masca"
!

installInSettings
    
    Smalltalk addStartBlock:[
        AbstractLauncherApplication 
            addSettingsApplicationByClass:self name withName:'Java' icon:self defaultIcon
"/    AbstractLauncherApplication settingsList 
"/        addLast:(Array with:'Java' with:self name)
    ]

    "Created: / 23-06-2005 / 09:27:10 / masca"
    "Modified: / 09-09-2013 / 01:08:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!JavaSettingsApplication class methodsFor:'image specs'!

defaultIcon
    <resource: #programImage>

    ^ self libjavaCupIconInTree

    "Created: / 19-07-2012 / 11:26:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 28-07-2018 / 09:55:04 / Claus Gittinger"
!

libjavaCupIcon
    "This resource specification was automatically generated
     by the ImageEditor of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the ImageEditor may not be able to read the specification."

    "
     self libjavaCupIcon inspect
     ImageEditor openOnClass:self andSelector:#libjavaCupIcon
     Icon flushCachedIcons
    "

    <resource: #image>

    ^Icon
        constantNamed:'JavaSettingsApplication libjavaCupIcon'
        ifAbsentPut:[(Depth24Image new) width: 66; height: 66; photometric:(#rgb); bitsPerSample:(#(8 8 8)); samplesPerPixel:(3); bits:(ByteArray fromPackedString:'
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
?????????????????????????????????_O)?/_1????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
?????????????????????????????????????????????????????????/+7<+E4????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????:8X(?/#2????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????:(D >MZ6????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
??????????;>:G\N=\FQ????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
?????????????????????????????????N7_96<@<;*D????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????=\FQ96<@=,&_????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
??????????????????????????????????????????????????????????????????????????????;=:8 ,96<@>>#W????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????=,"]96<@:8$.????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
?N/\:G\N96<@=,&_????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
?????????????????????_G'':(L$96<@:8X)??7;????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
?????????????????????????????????????????_G'':(P%96<@97DC>.GJ????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
?????????????????????????????????????????????????????????????OC$;H,196<@96<@<;"A????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????>.KL:W8Z96<@96<@;99T??;>????????????????
?????????????????_W.????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????=<6'':GTJ96<@96<@;))M
?//8????????????????????????>>[S<;Y>=\JS?_W.????????????????????????????????????????????????????????????????????????????
?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????/39
<Z5.96<@96<@96<@;95R?/39?????????????????/''5=\VY;H,2;Y@;>>WQ????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
?????????????????_K(;I@:96<@96<@96<@<*90??7<?????????????/39=\NT:''8[:GPH=\FR??7<????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
?????????????????????????????????????N+Z:(L#96<@96<@97DC=\NT????????????????>]&;:(H!!96<@:8 ->>''X????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????>.GJ:W,U96<@96<@:GXL>MV4??????????????7;<;U<97@B96<@;:AW?/#2????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????>>SP:W$Q96<@96<@:GXL>-?F?????????????//8;)%J
96<@96<@<Z-+??;>????????????????????????????????????????????????????????????????????????????????????????????????????????
?????????????????????????????????????????????????????????????????????????????????????????????????/_0:(H"96<@96<@97DD>]":
??????????????;>;)1O96<@96<@<Z))??;>????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
<Z-*96<@96<@96<@=K.F????????????????=\FQ96<@96<@;H04??7<????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
?????????????????????_W.:GLG96<@96<@:(L$??7;?????????????/''5:W$Q96<@96<@==F-????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????>M^896<@96<@96<@=\BP????????????????=,2$96<@96<@96<@?_K(????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????>MR296<@96<@96<@>>#V????????????????<;Q;96<@96<@96<@
>>_T????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
?????????????????????????????????????????????????????????????????????????????????????????????OC$96<@96<@96<@?/#2????????
????????<Z-+96<@96<@96<@<;"B????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
:8 -96<@96<@?OC$????????????????=\NT96<@96<@96<@:W$Q?_O*????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????=<6&96<@96<@==F.????????????????>>[R96<@96<@96<@96<@<J]$????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
??????????????????????????????????????????????????7<;H8796<@;))M????????????????????;)]F96<@96<@96<@96<@=<:)????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
?????????????????????????????????????????????????????????????????????????????N3^:G\N96<@>.KL????????????????>].?97@B96<@
96<@96<@:W0W?/_0????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????=<6''97@A;)]G??;>
????????????????<;Q;96<@96<@96<@96<@=K6K????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????=\VX96<@=\VY??????????????????7;;I@:96<@96<@96<@;91P????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????<;]?:W P?N?#????????????????>>#W:GLG96<@96<@;9=U????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????=\RW;YH>??7<????????????????;))M96<@96<@=<:(????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????=\NT=,&_????????????????
<*9096<@:(L$?/+7????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????>]*=?/''5????????????;99S:GPH>.KK????????????????????????????????????????9.713M+#2-#"9>72????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????>O+;6NO*-\''V*LCO2-#"
:^?3??????????????????????????????;=?????????_G'':W0W>].?????????????????????????????????????9.71);?O+LOR$J?CV8"%T8J!!_*F9
7>#.????????????????????????????????????????????????????????????????????????????????????????????????????????????:?G4+<WT
]Y.4W(*''$;GD3M+#>/3<??????????????????????????????????????????????;><;"A>>#W????????????????????????????????????????????
????????????=/#:"**?T8J!!V(^%6^O*????????????????????????????????????????????????????????????????????????????????????????
????????5>K)"Z&>UXN"T8J!!''[_I=O_9?????????????????????????????????????????????????????????/_1??7<????????????????????????
????????>O+;9^31?/??????????????????????>/3<ZYJ-T8J!![)Z0?/??????????????????????????????????????????????????????????????
????????????????????????????.<7ZUHJ!!T8J!!T8J!!T8J!!,L[T;/O6????????????????????????????????????????????????????????????????
=?'';8.+/3]/$.,7Y)[;N$Z?C_JB7Z)N.'';''J<?[8????????????????????????????);?OT8J!!T8J!!7._-????????????????????????????????????
????????????????????????????????????????????????????8^''. JN:UXN"T8J!!T8J!!T8J!!T8J!!ZYJ-^Y:6!!ZZ<$J?C&KSG&KSG&KSG&KSG%;SF#J3@
!!ZZ<_:J9]Y.3Z)N.XH.(U(R"T8J!!T8J!!T8J!!U8V#\9*3%KGD-L''V9^31????????????????????????????????????-\+WT8J!!T8J!!4=?''????????????
????????????????????????????????????????????????????????????????????????????????????<_W72=''#*<KQ&+WH"Z&>^):6Z)N.W(*''W(*''
VHZ$T8J!!T8J!!T8J!!UHJ!!W(*''XH2(Z)N.[YV/_ZF8$+CC)K7M-\+W2-#"7>_-?O7=????????????????????????????????????????????????????%+OF
T8J!!UHJ!!<OS7????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????<_W7WH"&T8J!!"Z&>????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????=O_9????????????????????????????????????????????????????????????????????????????????
?????????????????????????????????????/??":/@T8J!!XX2):^?3????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????:N;2"**?.,7Y????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????([/LT8J!!XH2(6>W+????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????8>/0WH"&T8J!!);?O>/3<????????????????????????????
????????????????????????????>O+;7N[,/-C\(+/L4-?''????????????????????????????>/3<$+CDT8J!!^I65:N;2????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????5NC''UHJ!!T8J!!T8J!!VHZ$]925
!!*^=$Z?C''[_I*LCO+<WS+<WS+<WS+<WS*LCO&;[H#*7A JJ9ZYJ-UHJ!!T8J!!T8J!!T8J!!UXN"''K_I;/O6????????????????8^''/\)&2Z9R.0MG\?/??????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????3=3%_ZF8UHN"T8J!!T8J!!T8J!!T8J!!T8J!!T8J!!T8J!!T8J!!T8J!!T8J!!T8J!!T8J!!T8J!!T8J!!T8J!!T8J!!T8J!!U(R#\)&2&[WG1MS_;?S7????????=/#:*\CP
#J/@3M+#?/;>????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????<OS72M_!!*\GP%+OF!!JZ<\I^1Z)N.Z)N.Z)N.Z)N.Z)N.Z)N.\9*3 JJ9$+CC*,GQ0-O^7._->?3=????????
????????????????6^O*>O+;????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
?????????????????????????????????????????????????????????????????????????????????????????????O7=????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????5>K)!!JZ<;_K5
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????4M7%UHJ!!T8J!!"**?0-K]8.+/<OS7?_;>?????????????????????/;>;/O66.S+/,?[(;3M"J&>,,_U>/3<????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????4-?''UHN"T8J!!T8J!!T8J!!T8J!!T8J!!T8J!!W(*''Z)N.Z)N.Z)N.Y)B+U(R#T8J!!T8J!!T8J!!T8J!!T8J!!T8J!!X86)*\GP
;?S7????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????4-?'']).4T8J!!T8J!!T8J!!T8J!!T8J!!T8J!!T8J!!T8J!!T8J!!T8J!!T8J!!T8J!!T8J!!
T8J!!T8J!!T8J!!UHN"_ZB8/=C\>O+;????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????;/O64-;&1=[ 1-W =O_9????????????????8^''.+\OR!!JZ<XH.(T8J!!T8J!!T8J!!
T8J!!T8J!!T8J!!T8J!!T8J!!XH2(_ZF8&+WH1]W_</W8????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????9^31'';''K[)Z0]).4+,SS6.S+=/'':????????????????????????
????????????=_#98N#.7^[,7^[,7^[,7>#.;_K5>/3<????????????????????????????????????????????????????????????????????5^C(=?'';
????????????????????????????????????????????????????????????????????????????????????9^31!!*^=UHJ!!]Y.36>W+????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????''[#J1-W ????????????????????????????????????????????????????????????????????????????????0MG\U8V#T8J!!T8J!!
+,SS????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????>_/<2=''# :V;#J3@>//<????????????????????????????????????????????????????????????????????????
????????^Y66T8J!!T8J!!T8J!!T8J!![)Z0(;3M2=''#;OG5?/??????????????????????????????????????????????????????????????????????????
????????????????????????????????</W86>W+1MS_(K+K^Y66WH"&#J/@5^G(?????????????_;>=O_9????????????????????????????????????
????????????????????????????????9>;2%[KEYH:*T8J!!T8J!!T8J!!T8J!!T8J!!T8J!!VHZ$[9^0"J">''+#J*\GP-L''V0MG\2-''"4];&4];&4];&4];&4];&
4];&4];&4];&4];&1-W 1-W 1MS_-</X*,GQ''[#J$J?C!!JV<\9&2WH&&T8J!!UHJ!![9Z0&[WG1-[ =O_9????????????????:/C4#J/@=_#9????????????
????????????????????????????????????????????????????????????????????;_K55NC''/L;[)[7N#J3@]925YX>+U(R"T8J!!T8J!!T8J!!T8J!!T8J!!
T8J!!T8J!!T8J!!T8J!!T8J!!T8J!!T8J!!T8J!!T8J!!T8J!!T8J!!T8J!!T8J!!T8J!!T8J!!U8V#Y9B,_ZB8%+OF,L[T3-3$=O_9?????????????????????/;>3=3%#J/@
XX2)5NC''????????????????????????????????????????????????????????????????????????????????????????????????????????????????
?/??;?O67>_-4];&1-[ /L;[,,_U*LCO(;3M(;3M(;3M(;3M(;3M)+;N+<WS,\_U/,?[2-#"5.G)8.+/</W8?????????????????????????????????/??
9^310]K]$+CCXX2)U8V#%[KE:?C4????????????????????????????????????????????????????????????????????????????????????????????
?????????????????/??7>#.;_K5?/;>????????????????????????????????????????????????????????????????????????????????????????
</W85>K).,7Y''K_I_*F9WX&''T8J!!UHN"]925+\OR;?O6????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????=O_9.,7Y&KSG"**? JN:$Z?C([/L(;3M);?O+<WS+<WS.L3X.,7Y.,7Y.,7Y.,7Y.,7Y-</X*<KQ
(K+K%KKE"**?^):6ZIF,VHV$T8J!!T8J!!WX&''\9&2$+CC,<#U4=?''=O_9????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????<OS78^''.3-3$/=C\+<WT*,GQ(;3M&+WH
&KSG&KSG&KSG&KSG&KSG&KSG&KSG(;3M+\OR-\''V/,?[3=3%8>+0=?'';????????????????????????????????????????????????????????????????
????????????????????????') ; yourself]
!

libjavaCupIconInTree
    "This resource specification was automatically generated
     by the ImageEditor of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the ImageEditor may not be able to read the specification."

    "
     self libjavaCupIconInTree inspect
     ImageEditor openOnClass:self andSelector:#libjavaCupIconInTree
     Icon flushCachedIcons
    "

    <resource: #image>

    ^Icon
        constantNamed:'JavaSettingsApplication libjavaCupIconInTree'
        ifAbsentPut:[(Depth8Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(8)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
G1<_G1<_G1<_G1<_G1<_G1<_G1<_G1<_G1<_G1<_G1<_G1<_G1<_G1<_G1<_G1<_G1<_G1<_G1<_G1<_G1<_G1<_G1<_G1<_G1<_G1<_C1<_G1<_G1<_G1<_
G1<_G1<_G1<_DA<_G1<_G1<_G1<_G1<_G1<_G1<_DA<_DQ<_G1<_G1<_G1<_G1<_G1<_DA<_D!!<_G1<_G1<_G1<_G1<_G1<_DA<_DA<_G1<_G1<_G1<_G1<_
G1<_G1@_G1@_G1<_G1<_G1<_G1<_G1<_G1<NG1<PC1<_G1<_G1<_G1<_G1<_G1<_G08_G1@_G1<_G1<_G1<_G1<_G1<_G1<_G1<PG1<_G1<_G1<_G1<_G1<_
G1<_G1<_G1<_G1<HG1<_G1<_G1<_BP0B@ HCB H_G1<_G0 _G1<_G1<_G1<_G1<_G1<_G1<_G04_G1<_G1<_G1<_B ,B@ HMA $_G1<_G1<_G1<_G1<_G1<_
G1<_G1<_G1<_G1<_G1<_G1<_G1<_BQ<_G1<HG1<_G1<_G1<_G1<_G1<_G1<DCP4GG1<_G1<_G1<_G1<_G0$_G1<_G1<_G1<_G1<_G1<_G1<_G1<_G0(AB (J
B TA@A<_G1<_G1<_G1<_G1<_G1<_G1<_G1<_G1<_G1<_G0@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@a') ; colorMapFromArray:#[82 129 161 83 129 160 83 129 161 83 129 162 84 129 160 84 129 161 82 130 161 82 130 162 83 130 160 83 130 161 83 130 162 84 130 161 82 131 161 83 131 161 231 110 0 230 111 0 231 111 0 231 112 0 232 112 0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255]; mask:((ImageMask new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@ @@A@@@BP@@D @@I@@@I@@@I @@D @@@ @@@A@A?  @@A@@?0@@@@@@P @@O@@D@@@A?0@@@@@') ; yourself); yourself]
! !

!JavaSettingsApplication class methodsFor:'interface opening'!

open    

    | settingsApp |

    settingsApp := SettingsDialog new.
    settingsApp addApplClass:self fullName
                withName:'Java'.
    settingsApp showRoot: false.
    settingsApp selectedItem value:
        (settingsApp applicationList root children anElement).
    settingsApp open.

    "Created: / 19-07-2012 / 11:25:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 09-10-2017 / 17:19:44 / stefan"
! !

!JavaSettingsApplication class methodsFor:'interface specs'!

packageBundleTabSpec
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIPainter may not be able to read the specification."

    "
     UIPainter new openOnClass:JavaSettingsApplication andSelector:#userBundleTabSpec
     JavaSettingsApplication new openInterface:#userBundleTabSpec
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: packageBundleTabSpec
        window: 
       (WindowSpec
          label: 'Package Libraries'
          name: 'Package Libraries'
          min: (Point 10 10)
          bounds: (Rectangle 0 0 300 300)
        )
        component: 
       (SpecCollection
          collection: (
           (SubCanvasSpec
              name: 'SubCanvas1'
              layout: (LayoutFrame 0 0 0 0 0 1 0 1)
              hasHorizontalScrollBar: false
              hasVerticalScrollBar: false
              majorKey: JavaCodeBundleEditor
              subAspectHolders: 
             (Array
                
               (SubChannelInfoSpec
                  subAspect: bundleHolder
                  aspect: packageBundleHolder
                ) 
               (SubChannelInfoSpec
                  subAspect: readonlyHolder
                  aspect: trueHolder
                )
              )
              createNewApplication: true
              createNewBuilder: true
            )
           )
         
        )
      )

    "Created: / 28-01-2013 / 20:33:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

userBundleTabSpec
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIPainter may not be able to read the specification."

    "
     UIPainter new openOnClass:JavaSettingsApplication andSelector:#userBundleTabSpec
     JavaSettingsApplication new openInterface:#userBundleTabSpec
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: userBundleTabSpec
        window: 
       (WindowSpec
          label: 'User Libraries'
          name: 'User Libraries'
          min: (Point 10 10)
          bounds: (Rectangle 0 0 300 300)
        )
        component: 
       (SpecCollection
          collection: (
           (SubCanvasSpec
              name: 'SubCanvas1'
              layout: (LayoutFrame 0 0 0 0 0 1 0 1)
              hasHorizontalScrollBar: false
              hasVerticalScrollBar: false
              majorKey: JavaCodeBundleEditor
              subAspectHolders: 
             (Array
                
               (SubChannelInfoSpec
                  subAspect: bundleHolder
                  aspect: userBundleHolder
                ) 
               (SubChannelInfoSpec
                  subAspect: readonlyHolder
                  aspect: #falseHolder
                )
              )
              createNewApplication: true
              createNewBuilder: true
            )
           )
         
        )
      )

    "Modified: / 28-01-2013 / 20:34:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

windowSpec
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIPainter may not be able to read the specification."

    "
     UIPainter new openOnClass:JavaSettingsApplication andSelector:#windowSpec
     JavaSettingsApplication new openInterface:#windowSpec
     JavaSettingsApplication open
    "

    <resource: #canvas>

    ^ 
    #(FullSpec
       name: windowSpec
       window: 
      (WindowSpec
         label: 'Java Settings'
         name: 'Java Settings'
         min: (Point 10 10)
         bounds: (Rectangle 0 0 695 627)
       )
       component: 
      (SpecCollection
         collection: (
          (LabelSpec
             label: ' Java Settings'
             name: 'SubVersiSettingsTitle'
             layout: (LayoutFrame 0 0 0 0 0 1 66 0)
             style: (FontDescription helvetica medium roman 18 #'iso10646-1' nil nil)
             backgroundColor: (Color 100.0 100.0 100.0)
             translateLabel: true
             adjust: left
           )
          (LabelSpec
             label: 'Icon'
             name: 'JavaIcon'
             layout: (LayoutFrame -75 1 0 0 0 1 66 0)
             hasCharacterOrientedLabel: false
             backgroundColor: (Color 100.0 100.0 100.0)
             translateLabel: true
             labelChannel: libjavaCupIcon
           )
          (SubCanvasSpec
             name: 'InfoPanel'
             layout: (LayoutFrame 0 0 67 0 0 1 107 0)
             level: 0
             initiallyInvisible: true
             hasHorizontalScrollBar: false
             hasVerticalScrollBar: false
             clientKey: infoPanel
             createNewBuilder: false
           )
          (VerticalPanelViewSpec
             name: 'Controls'
             layout: (LayoutFrame 0 0 70 0 0 1 0 1)
             horizontalLayout: fit
             verticalLayout: top
             horizontalSpace: 3
             verticalSpace: 3
             component: 
            (SpecCollection
               collection: (
                (FramedBoxSpec
                   label: 'Java'
                   name: 'JavaReleasePanel'
                   labelPosition: topLeft
                   translateLabel: true
                   component: 
                  (SpecCollection
                     collection: (
                      (CheckBoxSpec
                         label: 'Use Default JVM ("java" command)'
                         name: 'CheckBox1'
                         layout: (LayoutFrame 106 0 1 0 0 1 23 0)
                         model: useDefaultJVM
                         translateLabel: true
                       )
                      (LabelSpec
                         label: 'Java Home:'
                         name: 'JavaHomeLabel'
                         layout: (LayoutFrame 0 0 34 0 105 0 59 0)
                         translateLabel: true
                         adjust: left
                       )
                      (ComboBoxSpec
                         name: 'JavaHomeField'
                         layout: (LayoutFrame 110 0.0 34 0 -100 1.0 59 0)
                         enableChannel: notUseDefaultJVM
                         model: javaHomeHolder
                         acceptOnPointerLeave: false
                         comboList: javaHomeList
                         postBuildCallback: postBuildJavaHomeFIeld:
                       )
                      (ActionButtonSpec
                         label: 'Browse'
                         name: 'Button1'
                         layout: (LayoutFrame -100 1 34 0 0 1 59 0)
                         translateLabel: true
                         model: doBrowseJavaHome
                         enableChannel: notUseDefaultJVM
                       )
                      (LabelSpec
                         label: 'Label'
                         name: 'Label1'
                         layout: (LayoutFrame 110 0 64 0 0 1 89 0)
                         translateLabel: true
                         labelChannel: javaHomeInfoHolder
                         adjust: left
                       )
                      )
                    
                   )
                   extent: (Point 695 124)
                 )
                )
              
             )
           )
          )
        
       )
     )
! !

!JavaSettingsApplication methodsFor:'actions'!

doBrowseJavaHome
    <resource: #uiCallback>

    | java_home |

    java_home := Dialog requestDirectoryName:(resources string:'Java Installation Directory').
    java_home notEmptyOrNil ifTrue:[
        self javaHomeHolder value: java_home
    ]

    "Modified: / 09-12-2014 / 11:11:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

updateJavaHomeInfo
    | home release info |

    home := self javaHomeHolder value.
    info := ''.

    JavaReleaseNotFoundError handle:[:ex |
        release := nil.
    ] do:[    
        home isEmptyOrNil ifTrue:[ 
            release := JavaRelease default.
        ] ifFalse:[ 
            home asFilename isDirectory ifTrue:[  
                release := JavaRelease inDirectory: home.
            ]
        ].
    ].    
    release isNil ifTrue:[
        info := 'No java found (or release is not supported)' withColor:Color red
    ] ifFalse:[    
        info :='%1 (%2%3) ' bindWith: release name
                                         with: (release jdkHome notNil ifTrue:[ 'JDK' ] ifFalse:[ 'JRE' ])
                                         with: (release isSystem ifTrue:[ ', system' ] ifFalse:[ '' ]).
        release isSystem ifTrue:[ 
            info := info asText. "/ not underlined - how severe is this info?
        ].    
    ].
    self javaHomeInfoHolder value: info

    "Created: / 09-12-2014 / 12:56:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 09-12-2014 / 14:08:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 28-08-2018 / 15:47:51 / Claus Gittinger"
! !

!JavaSettingsApplication methodsFor:'aspects'!

infoPanel
    infoPanel isNil ifTrue:[
        infoPanel := Tools::InlineMessageDialog new.
    ].
    ^ infoPanel

    "Created: / 09-02-2012 / 19:23:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

javaHomeHolder
    <resource: #uiAspect>

    javaHomeHolder isNil ifTrue:[
        javaHomeHolder := ValueHolder with: Java release javaHome.
        javaHomeHolder onChangeSend: #updateModifiedChannel to: self.
        javaHomeHolder onChangeSend: #updateJavaHomeInfo to: self.  
    ].
    ^ javaHomeHolder.

    "Created: / 27-07-2012 / 00:06:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 09-12-2014 / 12:57:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

javaHomeInfoHolder
    <resource: #uiAspect>

    "automatically generated by UIPainter ..."

    "*** the code below creates a default model when invoked."
    "*** (which may not be the one you wanted)"
    "*** Please change as required and accept it in the browser."
    "*** (and replace this comment by something more useful ;-)"

    javaHomeInfoHolder isNil ifTrue:[
        javaHomeInfoHolder := ValueHolder new.
"/ if your app needs to be notified of changes, uncomment one of the lines below:
"/       javaHomeInfoHolder addDependent:self.
"/       javaHomeInfoHolder onChangeSend:#javaHomeInfoHolderChanged to:self.
    ].
    ^ javaHomeInfoHolder.
!

javaHomeList
    <resource: #uiAspect>

    ^ [
        | homesAndReleases |    

        JavaReleaseNotFoundError handle:[:ex |
            homesAndReleases := OrderedCollection new.
        ] do:[
            homesAndReleases := OrderedCollection withAll: JavaRelease available .
        ].
        JavaRelease system notNil ifTrue:[
            (homesAndReleases includesIdentical: JavaRelease system) ifFalse:[ 
                homesAndReleases add: JavaRelease system.
            ].
        ].
        (homesAndReleases anySatisfy: [:release | release javaHome = self javaHomeHolder value ]) ifFalse:[ 
            homesAndReleases addFirst: self javaHomeHolder value.
        ].
        homesAndReleases addLast: ((resources string:'Autodetect') asText colorizeAllWith: Color gray).
        homesAndReleases.
    ]

    "Created: / 09-12-2014 / 11:22:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 09-12-2014 / 14:06:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 28-08-2018 / 15:43:13 / Claus Gittinger"
!

notUseDefaultJVM
    <resource: #uiAspect>

    ^ BlockValue forLogicalNot:self useDefaultJVM 
!

trueHolder
    ^true

    "Created: / 28-01-2013 / 20:34:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

useDefaultJVM
    <resource: #uiAspect>

    useDefaultJVM isNil ifTrue:[
        useDefaultJVM := ValueHolder new.
    ].
    ^ useDefaultJVM.
! !

!JavaSettingsApplication methodsFor:'hooks'!

postBuildJavaHomeFIeld: aComboBox
    aComboBox menuSelectAction: [ :value |
        value = (resources string:'Autodetect') ifTrue:[
            aComboBox field contents: ''
        ] ifFalse:[ 
            aComboBox field contents: (value isString ifTrue:[ value ] ifFalse:[ value javaHome ])
        ]
    ].
    aComboBox field emptyFieldReplacementText: (resources string:'Autodetect')

    "Modified: / 09-12-2014 / 14:04:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!JavaSettingsApplication methodsFor:'protocol'!

basicReadSettings
    |javaHome|

    self javaHomeHolder value: (javaHome := currentUserPrefs javaHome).
    self useDefaultJVM value:(javaHome isEmptyOrNil).    
    self updateJavaHomeInfo.

    "Modified (format): / 09-12-2014 / 14:53:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

basicSaveSettings
    |javaHome|

    self useDefaultJVM value ifTrue:[
        javaHome := nil.
    ] ifFalse:[
        javaHome := self javaHomeHolder value
    ].
    currentUserPrefs javaHome:javaHome
!

helpFilename
    "subclasses must return the relative name of a helpFile
     in the doc/online/<language>/help directory.
     Or nil, if no help is available."

    ^ '../programming/java-installation.html#config'

    "Modified: / 14-08-2012 / 18:57:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!JavaSettingsApplication methodsFor:'queries'!

hasUnsavedChanges

    self validate ifFalse:[ 
        ^ false "/ Effectively disables the 'Apply' button.
    ].

    self javaHomeHolder value ~= currentUserPrefs javaHome ifTrue:[ ^ true ].

    ^ false

    "Modified: / 09-12-2014 / 12:42:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!JavaSettingsApplication methodsFor:'validation'!

validate
    self validateJavaHome ifFalse:[ ^ false ].
    self validationOK.
    ^ true

    "Created: / 09-12-2014 / 12:27:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

validateJavaHome    
    | javaHome javaRelease |

    javaHome := self javaHomeHolder value.
    javaHome isEmptyOrNil ifTrue:[ 
        ^ true.
    ].
    javaHome asFilename exists ifFalse:[  
        self validationError: (resources string: 'Java home does not exist').
        ^ false.
    ].
    javaHome asFilename isDirectory ifFalse:[  
        self validationError: (resources string: 'Java home is not a directory').
        ^ false.
    ].
    javaRelease := JavaRelease inDirectory: javaHome.
    javaRelease isNil ifTrue:[ 
        self validationError: (resources string: 'Cannot find JDK or JRE in specified java home').
        ^ false
    ].
    ^ true

    "Created: / 09-12-2014 / 12:19:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 09-12-2014 / 14:06:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

validationError:message
    self infoPanel
        reset;
        beWarning;
        message: message;
        show.

    "Created: / 09-12-2014 / 12:23:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

validationOK
    self infoPanel
        reset;
        hide.

    "Created: / 09-12-2014 / 12:26:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!JavaSettingsApplication class methodsFor:'documentation'!

version_CVS
    ^ '$Header$'
!

version_HG

    ^ '$Changeset: <not expanded> $'
!

version_SVN
    ^ '$Id$'
! !


JavaSettingsApplication initialize!