Results 1 to 3 of 3
  1. #1
    mew
    mew is offline Member
    Join Date
    Nov 2007
    Posts
    70
    Rep Power
    0

    Default Renaming a class

    I have a class in Eclipse. It has few constructor and objects of this class are being created in other classes. I now want to rename this class. How can I rename it in Eclipse so all its references are also changed accordingly.
    Java Code:
    public class Test {
    
    	public Test(){
            ...
            }
    	
    	public Test(int a){
            ...
            }
    	
    	public Test(float a){
            ...
            }
    }

  2. #2
    comando2929 is offline Member
    Join Date
    Dec 2007
    Location
    So Cal
    Posts
    4
    Rep Power
    0

    Default

    I'm not sure if there is a way to change all references that easiy. If it is a public class, you will need to rename the java file (eclipse will automaticly rename the class file to match), and just use the Find/Replace to change all the references.

  3. #3
    staykovmarin is offline Senior Member
    Join Date
    Nov 2007
    Location
    Newport, WA
    Posts
    141
    Rep Power
    0

    Default

    If you right click on the class name > go to Refractor > Rename.
    That will rename all the occurrences in the project (optionally even in comments).

    Or press Alt+Shift+R

Similar Threads

  1. Renaming underlying directory in Java project
    By Rodrigo Braz in forum Eclipse
    Replies: 3
    Last Post: 03-08-2009, 07:25 AM
  2. Replies: 0
    Last Post: 04-02-2008, 07:04 AM
  3. Renaming a method/variable
    By gapper in forum Eclipse
    Replies: 0
    Last Post: 01-31-2008, 01:29 PM
  4. Replies: 5
    Last Post: 01-03-2008, 07:54 AM
  5. Renaming a class in Eclipse
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-04-2007, 10:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •