Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Replacing One Class With Another
Replacing One Class With Another [message #217345] Fri, 22 June 2007 08:19 Go to next message
Eclipse UserFriend
Originally posted by: hal.thresholddigital.com

I have a number of classes that used the class DataTables. I copied
DataTables and named the copy DataCore since it was handling a lot of data
tracking other than the tables it originally was dealing with. When I
finish with DataCore, I'd like to be able to tell all the other
classes, "Use DataCore now instead of DataTables." Is there a way to
replace one class with another by refactoring?

I figure I can copy DataTables to another package, open the original
DataTables and DataCore, copy the entire contents of DataCore to inside
DataTables, then use CTRL-F to rename all references in the text from
DataCore to DataTables, save it, then rename it through refactoring. That
seems a round about way to do it.

I'd rather be able to somehow just have all references to DataTables in all
classes (other than DataTables) changed to DataCore. Is that possible?

Thanks!

Hal
Re: Replacing One Class With Another [message #217360 is a reply to message #217345] Fri, 22 June 2007 09:00 Go to previous message
Eclipse UserFriend
Originally posted by: spamgrube.mpaap.de

Hal Vaughan wrote:

> I have a number of classes that used the class DataTables. I copied
> DataTables and named the copy DataCore since it was handling a lot of data
> tracking other than the tables it originally was dealing with. When I
> finish with DataCore, I'd like to be able to tell all the other
> classes, "Use DataCore now instead of DataTables." Is there a way to
> replace one class with another by refactoring?

I don't know, if there is a better way, but this works:

1. Create your own class DataTable in your project, in the same Package
as the original.

2. Copy the code of the original into this class.

3. Rename the class to DataCore, using the Rename-Refactoring.

4. Change the package name or move the class to another package.

Greetings,
Michael
Previous Topic:Removing Faulty Classes From Project (Temporarily)
Next Topic:java.lang.OutOfMemoryError: Java heap space
Goto Forum:
  


Current Time: Fri Apr 19 22:50:58 GMT 2024

Powered by FUDForum. Page generated in 0.09440 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top