[squeak-dev] Double click on an data file

View: New views
3 Messages — Rating Filter:   Alert me  

[squeak-dev] Double click on an data file

by Javier Reyes :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello !

I have created a Mac Application which stores certain information in files. These files are saved using Reference Stream. I have obviously provided a mechanism to read them back, but my problem comes if a user double clicks on the file icon at the Mac Osx operating system level. When that happens, the application opens with it's last image and the file is read as a text in a SystemWindow (Lots of fancy binary simbols!).  Is there a way I can control which method takes responsability of that process ?

All the best,
                            Javier



Re: [squeak-dev] Double click on an data file

by Edgar J. De Cleene :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message




El 7/14/08 2:14 PM, "Javier Reyes" <jreyes@...> escribió:

> Hello !
>
> I have created a Mac Application which stores certain information in files.
> These files are saved using Reference Stream. I have obviously provided a
> mechanism to read them back, but my problem comes if a user double clicks on
> the file icon at the Mac Osx operating system level. When that happens, the
> application opens with it's last image and the file is read as a text in a
> SystemWindow (Lots of fancy binary simbols!).  Is there a way I can control
> which method takes responsability of that process ?
>
> All the best,
>                             Javier
Use services.
You could made any exterrnal file was processed using your logic.
I add two examples of my own use, one for read objects saved to  disk the
other for my own "SqueakBooks"

Edgar


'From SqueakLight|II of 31 May 2008 [latest update: #7195] on 14 July 2008 at 5:02:38 pm'! !Object class methodsFor: '*services-extras' stamp: 'edc 2/14/2008 08:24'! fileReaderServicesForFile: fullName suffix: suffix | services | services _ OrderedCollection new. (fullName asLowercase endsWith: '.obj') ifTrue: [ services add: self serviceLoadObject ]. ^services! ! !Object class methodsFor: '*services-extras' stamp: 'edc 2/14/2008 08:26'! serviceLoadObject "Answer a service for opening a saved Object" ^ (SimpleServiceEntry provider: self label: 'saved Object' selector: #readAndInspect: description: 'open a Object' buttonLabel: 'object') argumentGetter: [:fileList | fileList readOnlyStream]! !
!MiStack class methodsFor: '*services-extras' stamp: 'edc 10/25/2006 17:45'! registeredServices ^ { Service new label: 'Open saved SqueakBook'; shortLabel: 'SqueakBook'; description: 'load back saved notes '; action: [:stream | self unzip: (FileStream oldFileOrNoneNamed:stream name)]; shortcut: nil; categories: Service worldServiceCat.} ! ! !MiStack class methodsFor: '*services-extras' stamp: 'edc 9/7/2006 10:58'! fileReaderServicesForFile: fullName suffix: suffix | services | services _ OrderedCollection new. (fullName asLowercase endsWith: '.shc') ifTrue: [ services add: self serviceLoadSqueakBook ]. ^services! ! !MiStack class methodsFor: '*services-extras' stamp: 'edc 10/25/2006 17:43'! serviceLoadSqueakBook "Answer a service for opening a saved SqueakBook" ^ (SimpleServiceEntry provider: self label: 'saved SqueakBook' selector: #unzip: description: 'open a SqueakBook' buttonLabel: 'SqueakBook') argumentGetter: [:fileList | fileList readOnlyStream]! !


Re: [squeak-dev] Double click on an data file

by Javier Reyes :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks very much Edgar,

That's exactly what I was looking for.

Best regards,
                            Javier

On Mon, Jul 14, 2008 at 10:06 PM, Edgar J. De Cleene <edgardec2001@...> wrote:



El 7/14/08 2:14 PM, "Javier Reyes" <jreyes@...> escribió:

> Hello !
>
> I have created a Mac Application which stores certain information in files.
> These files are saved using Reference Stream. I have obviously provided a
> mechanism to read them back, but my problem comes if a user double clicks on
> the file icon at the Mac Osx operating system level. When that happens, the
> application opens with it's last image and the file is read as a text in a
> SystemWindow (Lots of fancy binary simbols!).  Is there a way I can control
> which method takes responsability of that process ?
>
> All the best,
>                             Javier

Use services.
You could made any exterrnal file was processed using your logic.
I add two examples of my own use, one for read objects saved to  disk the
other for my own "SqueakBooks"

Edgar







LightInTheBox - Buy quality products at wholesale price