Class>>rename:

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

Class>>rename:

Fernando olivero

Hi , please integrate this change to Class>>rename:


rename: aString
        "The new name of the receiver is the argument, aString."

        | oldName newName |
        (newName := aString asSymbol) = (oldName := self name)
                ifTrue: [^ self].
        (self environment includesKey: newName)
                ifTrue: [^ self error: newName , ' already exists'].
        name := newName.
        self environment renameClass: self from: oldName.
       
        (Undeclared includesKey: newName)
                ifTrue: [self inform: 'There are references to, ' , aString printString , '
from Undeclared. Check them after this change.'].


I moved the (Undeclared..... ) statement to the end.

To  send   #inform: after performing the actual change, and not before.

In this way you can catch the ProvideAnswerNotification, and remove the modal dialog that pops up and still perform the actual class rename!

For example...

[ self performRefactoring: refactoring ] on: ProvideAnswerNotification do:[:err | " do not inform the user! " ].


Please let me know if you agree, and will integrate it.
Saludos,
Fernando


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Class-rename.st (952 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Class>>rename:

Mariano Martinez Peck
Hola Fernando.

If you want something to be integrated, you should follow the rules. As an start, open a bug ticket, set the correct status and label, and commit to inbox.
Otherwise, this mail will be forgotten.

Cheers

Mariano


2010/4/27 Fernando olivero <[hidden email]>

Hi , please integrate this change to Class>>rename:


rename: aString
       "The new name of the receiver is the argument, aString."

       | oldName newName |
       (newName := aString asSymbol) = (oldName := self name)
               ifTrue: [^ self].
       (self environment includesKey: newName)
               ifTrue: [^ self error: newName , ' already exists'].
       name := newName.
       self environment renameClass: self from: oldName.

       (Undeclared includesKey: newName)
               ifTrue: [self inform: 'There are references to, ' , aString printString , '
from Undeclared. Check them after this change.'].


I moved the (Undeclared..... ) statement to the end.

To  send   #inform: after performing the actual change, and not before.

In this way you can catch the ProvideAnswerNotification, and remove the modal dialog that pops up and still perform the actual class rename!

For example...

[ self performRefactoring: refactoring ] on: ProvideAnswerNotification do:[:err | " do not inform the user! " ].


Please let me know if you agree, and will integrate it.
Saludos,
Fernando


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Class>>rename:

Stéphane Ducasse
and a test would help too :)

On Apr 28, 2010, at 7:57 PM, Mariano Martinez Peck wrote:

> Hola Fernando.
>
> If you want something to be integrated, you should follow the rules. As an start, open a bug ticket, set the correct status and label, and commit to inbox.
> Otherwise, this mail will be forgotten.
>
> Cheers
>
> Mariano
>
>
> 2010/4/27 Fernando olivero <[hidden email]>
>
> Hi , please integrate this change to Class>>rename:
>
>
> rename: aString
>        "The new name of the receiver is the argument, aString."
>
>        | oldName newName |
>        (newName := aString asSymbol) = (oldName := self name)
>                ifTrue: [^ self].
>        (self environment includesKey: newName)
>                ifTrue: [^ self error: newName , ' already exists'].
>        name := newName.
>        self environment renameClass: self from: oldName.
>
>        (Undeclared includesKey: newName)
>                ifTrue: [self inform: 'There are references to, ' , aString printString , '
> from Undeclared. Check them after this change.'].
>
>
> I moved the (Undeclared..... ) statement to the end.
>
> To  send   #inform: after performing the actual change, and not before.
>
> In this way you can catch the ProvideAnswerNotification, and remove the modal dialog that pops up and still perform the actual class rename!
>
> For example...
>
> [ self performRefactoring: refactoring ] on: ProvideAnswerNotification do:[:err | " do not inform the user! " ].
>
>
> Please let me know if you agree, and will integrate it.
> Saludos,
> Fernando
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Class>>rename:

Fernando olivero
Ok, will do!

On Apr 28, 2010, at 8:54 PM, Stéphane Ducasse wrote:

> and a test would help too :)
>
> On Apr 28, 2010, at 7:57 PM, Mariano Martinez Peck wrote:
>
>> Hola Fernando.
>>
>> If you want something to be integrated, you should follow the rules. As an start, open a bug ticket, set the correct status and label, and commit to inbox.
>> Otherwise, this mail will be forgotten.
>>
>> Cheers
>>
>> Mariano
>>
>>
>> 2010/4/27 Fernando olivero <[hidden email]>
>>
>> Hi , please integrate this change to Class>>rename:
>>
>>
>> rename: aString
>>       "The new name of the receiver is the argument, aString."
>>
>>       | oldName newName |
>>       (newName := aString asSymbol) = (oldName := self name)
>>               ifTrue: [^ self].
>>       (self environment includesKey: newName)
>>               ifTrue: [^ self error: newName , ' already exists'].
>>       name := newName.
>>       self environment renameClass: self from: oldName.
>>
>>       (Undeclared includesKey: newName)
>>               ifTrue: [self inform: 'There are references to, ' , aString printString , '
>> from Undeclared. Check them after this change.'].
>>
>>
>> I moved the (Undeclared..... ) statement to the end.
>>
>> To  send   #inform: after performing the actual change, and not before.
>>
>> In this way you can catch the ProvideAnswerNotification, and remove the modal dialog that pops up and still perform the actual class rename!
>>
>> For example...
>>
>> [ self performRefactoring: refactoring ] on: ProvideAnswerNotification do:[:err | " do not inform the user! " ].
>>
>>
>> Please let me know if you agree, and will integrate it.
>> Saludos,
>> Fernando
>>
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Class>>rename:

Fernando olivero
Issue 2437.

Fix in Pharo Inbox:
Name: Kernel-FernandoOlivero.662
Author: FernandoOlivero




_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Class>>rename:

Igor Stasenko
Is #rename: still untracked by changes log?


2010/5/17 Fernando olivero <[hidden email]>:

> Issue 2437.
> Fix in Pharo Inbox:
>
> Name: Kernel-FernandoOlivero.662
> Author: FernandoOlivero
>
>
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>



--
Best regards,
Igor Stasenko AKA sig.

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Class>>rename:

Fernando olivero
Class>>rename: aString
        ..
        self environment renameClass: self from: oldName.
        ..


I've believe that when the method   SystemDictionary>>classRenamed: from: to: inCategory:  is sent , the rename get's logged.

Is that what you were asking?

Fernando



On May 17, 2010, at 1:11 PM, Igor Stasenko wrote:

> Is #rename: still untracked by changes log?
>
>
> 2010/5/17 Fernando olivero <[hidden email]>:
>> Issue 2437.
>> Fix in Pharo Inbox:
>>
>> Name: Kernel-FernandoOlivero.662
>> Author: FernandoOlivero
>>
>>
>>
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>
>
>
> --
> Best regards,
> Igor Stasenko AKA sig.
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Class>>rename:

Igor Stasenko
On 17 May 2010 16:54, Fernando olivero <[hidden email]> wrote:

> Class>>rename: aString
>        ..
>        self environment renameClass: self from: oldName.
>        ..
>
>
> I've believe that when the method   SystemDictionary>>classRenamed: from: to: inCategory:  is sent , the rename get's logged.
>
> Is that what you were asking?
>
yes

> Fernando
>
>
>
> On May 17, 2010, at 1:11 PM, Igor Stasenko wrote:
>
>> Is #rename: still untracked by changes log?
>>
>>
>> 2010/5/17 Fernando olivero <[hidden email]>:
>>> Issue 2437.
>>> Fix in Pharo Inbox:
>>>
>>> Name: Kernel-FernandoOlivero.662
>>> Author: FernandoOlivero
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Pharo-project mailing list
>>> [hidden email]
>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>
>>
>>
>>
>> --
>> Best regards,
>> Igor Stasenko AKA sig.
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>



--
Best regards,
Igor Stasenko AKA sig.

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project