Misleading indeed, probably why I had it that way initially.
Obviously this will no longer work with the earlier fix.

Guess it is time to decide whether we want patterns or extensions.
I suggest we have another UIManager method with extensions in addition
to the (semantically) fixed patterns one (that is more flexible).

Regards, Gary

----- Original Message ----- From: "Levente Uzonyi" <[email protected]>
To: <[email protected]>
Cc: <[email protected]>
Sent: Friday, December 17, 2010 5:39 PM
Subject: Re: [Pharo-project] Issue 3446 in pharo: VMMakerTool load config buttondoesn't work


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 <[email protected]>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: <[email protected]>
To: <[email protected]>
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



Reply via email to