And you can see and reason about changes before applying it :)

For example, in the latest GTInspector (not yet in Pharo), you can preview changes right in the inspector:


Cheers,
Doru


On Feb 9, 2016, at 4:47 PM, stepharo <stepharo@free.fr> wrote:

It checks that the class does not already exist. 
And check the preconditions. 

Le 9/2/16 16:41, Peter Uhn��k a ��crit :
What's the practical difference between calling

```
(RBAddClassRefactoring
                addClass: #SomeClass
                superclass: #Object
                subclasses: {}
                category: #Category) primitiveExecute; changes.
```
and
```
Object subclass: #SomeClass
instanceVariableNames: ''
classVariableNames: ''
package: 'Category'
```

likewise for the attribute?

I am doing source code generation in one project and using the latter approach, so I am curious about the benefit of the first one.

Thanks,
Peter


On Mon, Feb 8, 2016 at 12:22 PM, Tudor Girba <tudor@tudorgirba.com> wrote:
Great! Thanks a lot.

Doru


> On Feb 8, 2016, at 10:57 AM, Nicolai Hess <nicolaihess@gmail.com> wrote:
>
> Not the best way maybe:
>
>     | model refactoring1 refactoring2 browser |
>     model := RBNamespace onEnvironment: RBBrowserEnvironment new.
>     refactoring1 := RBAddClassRefactoring
>         model: model
>         addClass: #SomeClass
>         superclass: #Object
>         subclasses: {}
>         category: #Category.
>     refactoring1 primitiveExecute.
>     refactoring2 := RBAddInstanceVariableRefactoring
>         model: model
>         variable: 'x'
>         class: #SomeClass.
>     refactoring2 primitiveExecute.
>     browser := ChangesBrowser new.
>     browser changesTree roots: (model changes whatToDisplayIn: browser).
>     browser open
>
>
>
> 2016-02-07 22:24 GMT+01:00 Tudor Girba <tudor@tudorgirba.com>:
> Hi,
>
> I would like to create a class with instance variables and methods using RB, and preview the changes with the changes browser.
>
> I know how to create AddClass, AddInstanceVariable, AddMethod refactorings individually and query for their changes. For example:
>
> (RBAddClassRefactoring
>                 addClass: #SomeClass
>                 superclass: #Object
>                 subclasses: {}
>                 category: #Category) primitiveExecute; changes.
>
> (RBAddInstanceVariableRefactoring
>         variable: 'x'
>         class: #SomeClass) primitiveExecute; changes
>
> My question is: is it possible to create them all in one batch and preview their changes in one single window?
>
> Cheers,
> Doru
>
>
> --
> www.tudorgirba.com
> www.feenk.com
>
> "If you interrupt the barber while he is cutting your hair,
> you will end up with a messy haircut."
>
>
>

--
www.tudorgirba.com
www.feenk.com

"No matter how many recipes we know, we still value a chef."











--
www.tudorgirba.com
www.feenk.com

"There are no old things, there are only old ways of looking at them."