FileContentsBrowser issue

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

FileContentsBrowser issue

Bob Arning-2
I'm not sure how many folks still use FileContentsBrowser, but there is a small issue:

browseStream: aStream named: aString

    | browser |
    Cursor wait showWhile: [ | package packageDict organizer |
        packageDict := Dictionary new.
        browser := self new.
        organizer := SystemOrganizer defaultList: Array new.
        package := (FilePackage new fullName: aString; fileInFrom: aStream).
        packageDict
            at: package packageName
            put: package.
        organizer
            classifyAll: package classes keys
            under: package packageName.
        (browser := self systemOrganizer: organizer)
            packages: packageDict].
    self
        openBrowserView: browser createViews
        label: 'File Contents Browser'.

which soon leads to SystemOrganizer

classify: element under: newCategory
    | oldCategory class |
    oldCategory := self categoryOfElement: element.
    super classify: element under: newCategory.
    class := Smalltalk at: element ifAbsent: [^ self].
    SystemChangeNotifier uniqueInstance
        class: class
        recategorizedFrom: oldCategory
        to: newCategory

which causes all known classes in the file being browsed to be added to the current change set as having a class definition change. Perhaps it makes sense to do the notification only if this SystemOrganizer is actually SystemOrganization.

Cheers,
Bob


Reply | Threaded
Open this post in threaded view
|

Re: FileContentsBrowser issue

Frank Shearar-3
On 16 January 2013 17:39, Bob Arning <[hidden email]> wrote:

> I'm not sure how many folks still use FileContentsBrowser, but there is a
> small issue:
>
> browseStream: aStream named: aString
>
>     | browser |
>     Cursor wait showWhile: [ | package packageDict organizer |
>         packageDict := Dictionary new.
>         browser := self new.
>         organizer := SystemOrganizer defaultList: Array new.
>         package := (FilePackage new fullName: aString; fileInFrom: aStream).
>         packageDict
>             at: package packageName
>             put: package.
>         organizer
>             classifyAll: package classes keys
>             under: package packageName.
>         (browser := self systemOrganizer: organizer)
>             packages: packageDict].
>     self
>         openBrowserView: browser createViews
>         label: 'File Contents Browser'.
>
> which soon leads to SystemOrganizer
>
> classify: element under: newCategory
>     | oldCategory class |
>     oldCategory := self categoryOfElement: element.
>     super classify: element under: newCategory.
>     class := Smalltalk at: element ifAbsent: [^ self].
>     SystemChangeNotifier uniqueInstance
>         class: class
>         recategorizedFrom: oldCategory
>         to: newCategory
>
> which causes all known classes in the file being browsed to be added to the
> current change set as having a class definition change. Perhaps it makes
> sense to do the notification only if this SystemOrganizer is actually
> SystemOrganization.

Bob, I think you're quite right. Usually Browser's systemOrganizer
isKindOf: SystemOrganization, and for a FileContentsBrowser that's
probably not right. Right now you can't (IIRC) inject your own
classOrganizer/systemOrganizer into a Browser. I've been hacking on a
Browser that can browse a remote image over HTTP, and I think - I'd
need to check, and it's late - that I had to fiddle a bit to give
Browser a nudge to pass in my own organizers.

If you raise a Mantis report over on bugs.squeak.org in the Tools
category, I'll be less likely to forget about fixing this issue.

Thanks!

frank

> Cheers,
> Bob
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: FileContentsBrowser issue

David T. Lewis
In reply to this post by Bob Arning-2
A proposed fix is in the inbox:

  Name: System-dtl.512
 
  Only the instance of SystemOrganizer that is the global SystemOrganization
  should send change notifications to the singleton SystemChangeNotifier.
 
  Addresses the case of a FileContentsBrowser that uses a new SystemOrganization
  to load code for browsing and should not initiate a system change notification
  for the class being browsed, as reported by Bob Arning on squeak-dev
  http://lists.squeakfoundation.org/pipermail/squeak-dev/2013-January/167941.html

Dave

On Wed, Jan 16, 2013 at 12:39:57PM -0500, Bob Arning wrote:

> I'm not sure how many folks still use FileContentsBrowser, but there is
> a small issue:
>
> browseStream: aStream named: aString
>
>     | browser |
>     Cursor wait showWhile: [ | package packageDict organizer |
>         packageDict := Dictionary new.
>         browser := self new.
>         organizer := SystemOrganizer defaultList: Array new.
>         package := (FilePackage new fullName: aString; fileInFrom:
> aStream).
>         packageDict
>             at: package packageName
>             put: package.
> *organizer **
> **            classifyAll: package classes keys **
> **            under: package packageName.*
>         (browser := self systemOrganizer: organizer)
>             packages: packageDict].
>     self
>         openBrowserView: browser createViews
>         label: 'File Contents Browser'.
>
> which soon leads to SystemOrganizer
>
> classify: element under: newCategory
>     | oldCategory class |
>     oldCategory := self categoryOfElement: element.
>     super classify: element under: newCategory.
>     class := Smalltalk at: element ifAbsent: [^ self].
> *SystemChangeNotifier uniqueInstance**
> **        class: class**
> **        recategorizedFrom: oldCategory**
> **        to: newCategory *
>
> which causes all known classes in the file being browsed to be added to
> the current change set as having a class definition change. Perhaps it
> makes sense to do the notification only if this SystemOrganizer is
> actually SystemOrganization.
>
> Cheers,
> Bob

>