How can I close all projects in an Eclipse workspace while eclipse is closed?

16,887

Solution 1

I have not found the piece of metadata that says whether or not a project is closed, I suspect it is not possible through that route as I have grepped through the files created and not found one.

I have 2 workarounds, the first of which is:

  1. Close Eclipse.

  2. Rename the .project file in the top level of each project (painful to do manually if you have a lot, you could write a script).

  3. Start Eclipse.

  4. Projects should show up as closed.

Note: to undo this you will have to revert the name changes (ie turn them all back to .project files) before you try to open them.

The advantages of this approach is that you can work at getting one project behaving at a time (if this is appropriate for your needs).

The other approach is to simply create a new workspace, get that set up correctly (whatever it is you need - VCS, correct JRE, Target Platform etc) and then import each of your projects 1 (or more) at a time.

This could be more work, depending on how customised your workspace gets (perspective layouts, preferences, code templates etc), however this would give you a clean slate. This might be best if things are truly that bad.

Note: basing all this on 3.7.1

Solution 2

Right click on one of the open projects ---> Close unrelated projects.

It closes all projects except that one.

Share:
16,887

Related videos on Youtube

vol
Author by

vol

Android developer

Updated on June 04, 2022

Comments

  • vol
    vol over 1 year

    I have a problem with one of my workspaces; if I start eclipse with all of the projects open, eclipse might take 20 minutes to even reach the point where it's even responsive, if not longer.

    Is it possible to start eclipse in "safe mode", where none of the projects are open and plugins are disabled, so that I can get my workspace in order?

  • vol
    vol almost 12 years
    This isn't a bad solution. The big problem is that because of memory and deadlock constraints, opening all of the problems simultaneously causes me to spin endlessly. So, if I can close a few projects manually, that could help. Thanks!
  • Travis Schneeberger
    Travis Schneeberger over 11 years
    for Windows users: windows explorer may give you problems renaming a file that starts with a dot. for example I renamed .project to .project.bac. Then when I tried to change it back to .project and windows explorer would not let me. The easiest solution is to jump to the command line for the rename.
  • vol
    vol over 9 years
    The problem was that I could not open eclipse. The question was "How do I do this while eclipse is closed."
  • Rohan Khude
    Rohan Khude over 7 years
    This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you earn sufficient reputation you will be able to comment on any post. If you have a related but different question, ask a new question referencing this one if it will help provide context.
  • bigbadmouse
    bigbadmouse almost 6 years
    this doesn't help as the user can't realistically open the workspace.
  • bigbadmouse
    bigbadmouse almost 6 years
    @katsharp i up-voted you for point 2) as I've got the same issue with a particular project and can't open the workspace at all (for different reasons). I also failed to find the metadata so your solution is a neat one.