vol
vol

Reputation: 1553

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

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?

Upvotes: 19

Views: 21859

Answers (5)

ZiglioUK
ZiglioUK

Reputation: 2610

For me the least painful solution is to go under

eclipse-workspace\.metadata\.plugins

and rename or remove

org.eclipse.e4.workbench

Upvotes: 0

carl verbiest
carl verbiest

Reputation: 1295

Based katsharp's answer I created 2 simple bash scripts.

On windows environment I run these from a git bash prompt. Maxdepth is specific for my environment.

# close_projects.sh
for dir in $(find . -maxdepth 3 -name .project -printf '%h\n')
do
    echo mv $dir/.project $dir/closed.project
    mv $dir/.project $dir/closed.project
done
# open_projects.sh
for dir in $(find . -maxdepth 3 -name .project -printf '%h\n')
do
    echo mv $dir/.project $dir/closed.project
    mv $dir/.project $dir/closed.project
done

Upvotes: 0

dk_2094
dk_2094

Reputation: 1

I havent found any such method but you can do this while eclipse is running. Go to package Explorer , select all the projects then go to Project -> Close Project. This will close all the projects.So next time when you start Eclipse, it will not load all the projects and it will response earlier than before.

Upvotes: -2

user1626000
user1626000

Reputation: 55

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

It closes all projects except that one.

Upvotes: 2

katsharp
katsharp

Reputation: 2551

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

Upvotes: 18

Related Questions