[Vm-dev] Re: [Pharo-project] Issue 3446 in pharo: VMMakerTool load config buttondoesn't work

Levente Uzonyi leves at elte.hu
Fri Dec 17 17:39:33 UTC 2010


On Fri, 17 Dec 2010, Javier Pimás wrote:

> OK, if I'm correct the 3449 issue is fixed and integrated now. So how do we
> solve this one? Because the method lays on VMMakerTool's code, for squeak.
> Maybe we can add a line to ConfigurationOfVMMaker>>#fixVMMakerForPharo like
> this:
>
> (Smalltalk at: #VMMakerTool) compile:
>    'loadConfig
> | fileResult file |
> fileResult := UIManager default chooseFileMatching: #(''*.config'') label:
> ''Select
> VMMaker configuration...''.
> fileResult
> ifNotNil: [file := fileResult.
> [vmMaker := VMMaker forConfigurationFile: file.
> vmMaker logger: logger.
> vmMaker platformDirectory]
> on: Error
> do: [self inform: ''Possible problem with path settings or platform
> name?''].
> self updateAllViews]'
>
>
> It's a bit of a dirty hack, maybe there's a cleaner way. What do you think?

No need to do dirty hacks, just communicate your needs properly. Ask David 
to update the method. Squeak (since 3.9) also implements UIManager >> 
#chooseFileMatching:label:. Note that the name of this method is a bit 
misleading. The first argument is a list of "file extensions", not a list 
of patterns. So this should work in both Squeak and Pharo:

fileResult := UIManager default
 	chooseFileMatching: #('config')
 	label: 'Select VMMaker configuration...'.

Since fileResult is a string that contains the full path, the variable 
"file" is not necessary anymore.


Levente

>
> Regards,
>        Javier.
>
> On Fri, Dec 17, 2010 at 8:35 AM, Gary Chambers <gazzaguru2 at btinternet.com>wrote:
>
>> It seems the implementation in MorphicUIManager uses the patterns
>> as extensions.
>>
>> So
>> fileResult := UIManager default chooseFileMatching: #('config') label:
>> 'Select
>> VMMaker configuration...'.
>>
>> would work.
>>
>> However, that misses the meaning of patterns.
>> I've raised issue http://code.google.com/p/pharo/issues/detail?id=3449with change set attached...
>>
>> Regards, Gary
>>
>> ----- Original Message ----- From: <pharo at googlecode.com>
>> To: <pharo-project at lists.gforge.inria.fr>
>> Sent: Friday, December 17, 2010 4:21 AM
>> Subject: [Pharo-project] Issue 3446 in pharo: VMMakerTool load config
>> buttondoesn't work
>>
>>
>>
>>  Status: New
>>> Owner: ----
>>>
>>> New issue 3446 by elpochodelagente: VMMakerTool load config button doesn't
>>> work
>>> http://code.google.com/p/pharo/issues/detail?id=3446
>>>
>>> Pharo image: dev 1.1.1
>>> Pharo core version: Pharo-1.1-11411
>>> Virtual machine used: custom linux, allmost latest VMMaker, classic (not
>>> cog)
>>> Class browser used if applicable:  OBSystemBrowserAdaptor
>>>
>>> Steps to reproduce:
>>> 1. Load VMMaker with
>>> 2. Open the VMMakerTool with: "VMMakerTool openInWorld"
>>> 3. Push load config button, you get an error message
>>>
>>> The problem is that VMMaker tool makes use of StandardFileDialog, which
>>> isn't present in Pharo anymore. The method that raises the error is
>>>
>>> VMMakerTool>>#loadConfig
>>>    | fileResult file |
>>>    fileResult := (StandardFileMenu oldFileMenu: FileDirectory default
>>> withPattern: '*.config') startUpWithCaption: 'Select VMMaker
>>> configuration...'.
>>>    fileResult
>>>        ifNotNil: [
>>>            file := fileResult directory fullNameFor: fileResult name.
>>>            [
>>>                vmMaker := VMMaker forConfigurationFile: file.
>>>                vmMaker logger: logger.
>>>                vmMaker platformDirectory
>>>            ]
>>>            on: Error
>>>            do: [self inform: 'Possible problem with path settings or
>>> platform name?'].
>>>            self updateAllViews]
>>>
>>>
>>> Changing
>>>
>>> fileResult := (StandardFileMenu oldFileMenu: FileDirectory default
>>> withPattern: '*.config') startUpWithCaption: 'Select VMMaker
>>> configuration...'.
>>>
>>> for
>>>
>>> fileResult := UIManager default chooseFileMatching: nil label: 'Select
>>> VMMaker configuration...'.
>>>
>>> and
>>>
>>> file := fileResult directory fullNameFor: fileResult name.
>>>
>>> for
>>>
>>> file := fileResult
>>>
>>> Fixes it almost completely. It would be better to use chooseFileMatching:
>>> #('*.config') but it didn't work well.
>>>
>>>
>>>
>>>
>>
>>
>
>
> -- 
> Javier Pimás
> Ciudad de Buenos Aires
>


More information about the Vm-dev mailing list