Clean up settings application and remove obsolete settings
Apart of GDB executable itself, users may (should) use `$HOME/.vdbinit.st`
file.
"
jv:vdb - Visual / VM Debugger
Copyright (C) 2015-now Jan Vrany
This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License'
You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/
"
"{ Package: 'jv:vdb' }"
"{ NameSpace: Smalltalk }"
AbstractSettingsApplication subclass:#VDBSettingsApplication
instanceVariableNames:'infoPanel gdbCommand'
classVariableNames:''
poolDictionaries:''
category:'VDB-UI-Others'
!
!VDBSettingsApplication class methodsFor:'documentation'!
copyright
"
jv:vdb - Visual / VM Debugger
Copyright (C) 2015-now Jan Vrany
This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License'
You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/
"
! !
!VDBSettingsApplication class methodsFor:'initialization'!
initialize
self installInSettings
"Created: / 23-06-2005 / 09:27:10 / masca"
!
installInSettings
Smalltalk addStartBlock:[
AbstractLauncherApplication
addSettingsApplicationByClass:self name withName:'Tools/Visual VM Debugger' icon:self defaultIcon
]
"Created: / 23-06-2005 / 09:27:10 / masca"
"Modified: / 10-04-2018 / 16:56:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!VDBSettingsApplication class methodsFor:'help specs'!
helpSpec
"This resource specification was automatically generated
by the UIHelpTool of ST/X."
"Do not manually edit this!! If it is corrupted,
the UIHelpTool may not be able to read the specification."
"
UIHelpTool openOnClass:VDBSettingsApplication
"
<resource: #help>
^ super helpSpec addPairsFrom:#(
#ExecutableLabel
'Path to GDB executable. If left empty, system GDB is used.'
)
! !
!VDBSettingsApplication class methodsFor:'interface specs'!
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:VDBSettingsApplication andSelector:#windowSpec
VDBSettingsApplication new openInterface:#windowSpec
VDBSettingsApplication open
"
<resource: #canvas>
^
#(FullSpec
name: windowSpec
uuid: 'fed33670-91af-11e9-b25b-606720e43e2c'
window:
(WindowSpec
label: 'Java Settings'
name: 'Java Settings'
uuid: '10c0dbf1-3cd7-11e8-882f-0021ccd5e3d3'
min: (Point 10 10)
bounds: (Rectangle 0 0 695 627)
)
component:
(SpecCollection
collection: (
(LabelSpec
label: ' Visual/VM Debugger Settings'
name: 'SettingsTitle'
layout: (LayoutFrame 0 0 0 0 0 1 66 0)
style: (FontDescription helvetica medium roman 18 #'iso10646-1' nil nil)
uuid: '10c0dbf2-3cd7-11e8-882f-0021ccd5e3d3'
backgroundColor: (Color 100.0 100.0 100.0)
translateLabel: true
adjust: left
)
(LabelSpec
label: 'Icon'
name: 'Icon'
layout: (LayoutFrame -75 1 0 0 0 1 66 0)
uuid: '10c10300-3cd7-11e8-882f-0021ccd5e3d3'
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)
uuid: '10c10301-3cd7-11e8-882f-0021ccd5e3d3'
level: 0
initiallyInvisible: true
hasHorizontalScrollBar: false
hasVerticalScrollBar: false
clientKey: infoPanel
createNewBuilder: false
)
(VerticalPanelViewSpec
name: 'Controls'
layout: (LayoutFrame 10 0 70 0 -10 1 0 1)
uuid: '10c10302-3cd7-11e8-882f-0021ccd5e3d3'
horizontalLayout: fit
verticalLayout: top
horizontalSpace: 3
verticalSpace: 3
component:
(SpecCollection
collection: (
(ViewSpec
name: 'Spacer1'
uuid: 'fed33671-91af-11e9-b25b-606720e43e2c'
extent: (Point 675 15)
)
(ViewSpec
name: 'CommandPane'
uuid: '7628c0d0-c755-11e8-8f9c-0021ccd5e3d3'
component:
(SpecCollection
collection: (
(LabelSpec
label: ''';gdb'' command:'
name: 'CommandLabel'
layout: (LayoutFrame 0 0 0 0 120 0 0 1)
uuid: 'fed33672-91af-11e9-b25b-606720e43e2c'
translateLabel: true
adjust: left
)
(FilenameInputFieldSpec
name: 'Command'
layout: (LayoutFrame 120 0 0 0 -100 1 0 1)
uuid: '7628c0d2-c755-11e8-8f9c-0021ccd5e3d3'
model: gdbCommand
immediateAccept: true
acceptOnPointerLeave: true
emptyFieldReplacementText: 'Autodetect'
)
(ActionButtonSpec
label: 'Browse'
name: 'BrowseButton'
layout: (LayoutFrame -100 1 0 0 -8 1 0 1)
uuid: '7628c0d3-c755-11e8-8f9c-0021ccd5e3d3'
translateLabel: true
model: doSelectExecutable
)
)
)
extent: (Point 675 25)
)
(ViewSpec
name: 'Spacer'
uuid: '7628c0d4-c755-11e8-8f9c-0021ccd5e3d3'
extent: (Point 675 15)
)
)
)
)
)
)
)
! !
!VDBSettingsApplication methodsFor:'actions'!
doSelectExecutable
| guess executable |
guess := self gdbCommand value asNilIfEmpty.
guess isNil ifTrue:[
guess := GDBProcess gdbCommand
].
[ guess notNil and:[ (guess := guess asFilename) exists not ] ] whileTrue:[
| p |
p := guess directory.
(p notNil and:[ p pathName = guess pathName ]) ifTrue:[
p := nil.
].
guess := p.
].
guess isNil ifTrue:[
guess := GDBProcess gdbCommand
].
executable := Dialog requestFileName:(resources string:'Select GDB executable') default: guess ifFail:[ ^ self ].
self infoPanel hide.
(executable includes: Character space) ifTrue:[
executable := '"' , executable , '"'.
].
self gdbCommand value: executable
"Created: / 03-10-2018 / 22:46:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 18-06-2019 / 10:42:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!VDBSettingsApplication methodsFor:'aspects'!
aspects
^ #(gdbCommand)
"Created: / 10-04-2018 / 16:53:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 17-06-2019 / 13:38:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
gdbCommand
"return/create the 'gdbCommand' value holder (automatically generated)"
gdbCommand isNil ifTrue:[
gdbCommand := ValueHolder new.
gdbCommand onChangeSend:#doCheckSettings to:self.
gdbCommand onChangeSend:#updateModifiedChannel to:self.
].
^ gdbCommand
"
UserPreferences current gdbCommand
"
"Modified: / 18-06-2019 / 11:16:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
infoPanel
infoPanel isNil ifTrue:[
infoPanel := Tools::InlineMessageDialog new.
].
^ infoPanel
"Created: / 10-04-2018 / 16:52:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!VDBSettingsApplication methodsFor:'checks'!
doCheckCommand
"Check `hg` command. Return true if `hg` command exists
and of supported version, false otherwise."
| command |
command := self gdbCommand value.
command isEmptyOrNil ifTrue:[
command := GDBProcess gdbCommandDefault.
command isNil ifTrue:[
self infoPanel
reset;
beWarning;
message: (resources string:'Cannot find path to `gdb` command');
addButtonWithLabel: (self resources string:'Browse') action: [ self doSelectExecutable ];
show.
^ false
].
].
[
GDBProcess gdbCommandParseAndValidate:command
] on: GDBError do:[:ex |
self infoPanel
reset;
beWarning;
message: (resources string:ex description);
addButtonWithLabel: (self resources string:'Browse') action: [self infoPanel hide. self doSelectExecutable ];
show.
^ false
].
^ true.
"Created: / 18-06-2019 / 10:47:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
doCheckSettings
self doCheckCommand ifFalse:[ ^ self ].
self infoPanel hide.
"Created: / 18-06-2019 / 10:45:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!VDBSettingsApplication methodsFor:'hooks'!
commonPostOpen
self doCheckSettings
"Created: / 18-06-2019 / 10:44:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!VDBSettingsApplication methodsFor:'protocol'!
basicSaveSettings
self gdbCommand value = '' ifTrue:[
self gdbCommand setValue: nil
].
super basicSaveSettings.
"Created: / 04-10-2018 / 09:46:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 17-06-2019 / 13:40:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!VDBSettingsApplication class methodsFor:'documentation'!
version_HG
^ '$Changeset: <not expanded> $'
! !
VDBSettingsApplication initialize!