[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.newcomer] Re: Moving inner class to package
|
"Wojtek" <nowhere@xxxxx> wrote in message
news:mn.1a357d930e9a5713.70216@xxxxxxxx
> If I have an inner class:
>
> -----------------------------
> package ca.here
>
> public class MyClass
> {
> public class OtherClass
> {
> }
> }
> -----------------------------
>
> How do I refactor OtherClass so that both are in the package:
>
> -----------------------------
> package ca.here
>
> public class MyClass
> {
> }
>
> package ca.here
>
> public class OtherClass
> {
> }
> -----------------------------
>
> Other than manually creating a new class in the package, then cut/paste
> the contents of the inner class into the new class. Then fixing all the
> compiler errors.
Use the Refactor -> Convert Member Type To Top Level... menu command.
Note that you might want to make the inner class be static, first. If you
don't, Eclipse will do that for you but it might not do it the way you want
(i.e. it will create a field for the previously-outer type).