Eclipse - renaming a package got rid of a bunch of stuff, is there a way to recover it?

So I made a package, lets call it dev.example.project for example purposes. all my other packages extended off of that one, with names like dev.example.project.handler or dev.example.project.assets. But I decided to go back and change the dev.example.project package's name to something else, like dev.betterexample.project.

I thought it would be a simple matter of renaming all the other packages and import statements so no errors would happen, but right after i changed the name, all the packages in my project turned white and became inaccessible. I changed the name back to what it originally was, but when i opened Eclipse again, some packages and files were simply not there.

I spent a lot of time on this project, someone help?

Upvotes: 1

Views: 73

Answers (1)

GhostCat
GhostCat

Reputation: 140573

Depending how exactly you did that renaming, various things could have gone wrong.

Remember: you can always go in and work outside of eclipse. Close it, open a file explorer and create directories that use the names you want to use. Then move files manually to their target directories. If you want to, open them in another text editor and fix the package lines. When you now open eclipse, do a refresh and full rebuild. Things should be fine then.

That is probably not the most elegant solution, but it always works. And more importantly, you are in full control of everything that happens!

And for the record: the real answer to avoid catastrophic loss of code is to use a source code management system such as git. And to then push your changes constantly out to that "backup" facility.

Upvotes: 2

Related Questions