facebook

How to remove unused import stmts from all files in project

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #241708 Reply

    Hi,
    Myeclipse has the option to remove unused imports from the source code by right clicking on the specific file and source -> organize imports. This works fine, but our requirement is how to remove the unwanted import from all the files in the project at a single click of a button?
    Myeclipse shows the un-used variables, but is there any way to remove the un-used variables similar to removing unused imports?

    Since we have 100’s of file doing this manually is a painful process.

    Your help is highly appreciated.

    Regards,
    Sun.

    #241742 Reply

    Greg
    Member

    I believe you can accomplish this by right-clicking the toplevel source folder for your project, and selection Source > Organize Imports. That will go through and straighten up all imports by removing unused ones and also expanding out all java.util.* to individual imports.

    #241761 Reply

    Hi,
    Thanks for your quick turnaround. This is the one thing I really like with MyEclipse. You guys are responding very fast to user queries. Kudos to MyEclipse team. Myeclipse shows the un-used variables. But this has to be deleted manually. Is there any way to remove the un-used variables similar to removing unused imports that MyEclipse has?

    Regards,
    Sun

    #241762 Reply

    Greg
    Member

    I don’t know of a way to remove un-unsed variables, but you can turn those warnings off. Go to Windows > Preferences > Java > Compiler > Errors/Warnings > Unnecessary Code > Unused local or private members Set the combo to ignore. FYI, this causes a full rebuild of all of your projects to remove the warnings.

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: How to remove unused import stmts from all files in project

You must be logged in to post in the forum log in