Eclipse : how to prevent it from loading all the open files on startup? - eclipse

I had 100+ files open in the previous session, then closed eclipse. On a restart, eclipse just hangs with extremely high mem usuage. This problem doesn't happen with only 50 files opened.
How to prevent eclipse from loading all the previously opened files on startup? It would make more sense that the files are loaded on demand, i.e. load when focused.
I am using CDT.

When the Eclipse is open, close those projects which you dont want for now. Right Click on the project name and select "Close Project". Next time you restart the Eclipse the closed projects should not get loaded.

This is not possible. Eclipse will always restore the same state after a restart.
You can mitigate the effects with little fuzz by
closing projects (right click the project you're not working on, select Close Project
closing unrelated projects (right click the project you're working on, select Close Unrelated Projects
using Mylyn! Mylyn will ensure that files you stopped working on will be automatically closed. (But it does more than that. See for more info e.g. help.tasktop.com and www.tasktop.com (pdf)) It takes some time getting used to it, but I eventually fell in love with it. If you don't switch tasks that often, you can just create one general task, activate it and keep working in that one forever.

opened a bug on eclipse, after the help from there, it turns out this is caused by the vrapper plugin I installed. For more details, https://bugs.eclipse.org/bugs/show_bug.cgi?id=377368

Related

Preventing projects from getting disappeared from Eclipse Project Explorer

I've come across this issue so many times irrespective of whether I close eclipse properly or not. I mean, I can understand if the projects disappear if you fail to the close eclipse properly or if it crashes. But even when I close eclipse properly, below issue occurs.
Issue: I create a project in eclipse and work on it. When I'm done, I close eclipse and when I open eclipse after sometime (or after some days) using the same workspace, the project is disappeared from the Project Explorer. I will update with snapshots once I'm able to replicate the issue again.
I was able to recover my projects using the steps provided in this answer, but I'm curious if there is any preventive measure/steps that can be followed to avoid this issue in the future so that I need not import my projects every time I open eclipse.

Sublime Text 2 edited file-changes does not show when refreshing browser in Maven project

I am having problems when editing template-files(HTML-files) in my Maven-project. I have made the Maven-project an Eclipse-project with the command "mvn eclipse:eclipse" (if it matters). I am using the Apache Velocity Engine as template engine for this project.
The problem arises when I'm editing the files in Sublime, and then save the file and refresh the browser. The changes does not show! If I however open the template file in Eclipse, just open it, I can even just open and close it right away, and THEN refresh the browser, the changes will show.
I have done a test to see if this problem occurs on other simple projects as well, and with a single HTML-file and a simple http-server, the work I save in Sublime shows as normal.
Does anybody know what is happening here? Am I bound to keep on using Eclipse as a HTML-editor? :( Does the Eclipse project files prevent me from using other editors? Why are the changes only showing when I open the files in Eclipse?
Any help is greatly appreciated!
In order for the changes to take place you have to right-click the file in Eclipse explorer tab and choose "refresh" in order for the (static) changes to be reloaded to Apache. For dynamic changes you'll need to restart apache or use a plugin such as JRebel.
Eclipse copies the files to the "target"-folder in the webapp. Sublime(and others) does not do this automatically, so you need to do this manually, or by a plug-in that will copy the files on save.

Where does Eclipse save the list of files to open on startup?

Question: where does Eclipse store the list of files it opens on startup?
Background: Having installed a plugin into Eclipse which promptly crashed, my Eclipse workspace is in a bit of a state. When started, the building workspace task pauses indefinitely at 20%. Before I uninstall the plugin I want to give it another chance. I have a feeling that the reason Eclipse is pausing is because of a file which was opened when it crashed, which it tries to reopen on startup. If I can stop this file from opening on startup there's a chance I may be able to coax the plugin to behave. The problem is I have no idea where that list of files is persisted between runs of Eclipse.
...a second before I posted this question, I realised I could just delete the file causing the problem (duh). However, the search has frustrated me enough to want to find the answer.
In your workspace the following file contains your workbench information:
.metadata/.plugins/org.eclipse.ui.workbench/workbench.xml
It is possible to delete it (or edit it but that requires some fiddling around I suppose) without breaking your workspace, the file gets regenerated by Eclipse. When you delete it all workbench related settings are lost (ie all editors are closed), but your projects of that workspace stay intact.
Edit: in Eclipse 4.2 the file is
.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi

Eclipse can't find project source after tomcat restart

I posted this on the eclipse forum in November and didn't get an answer. It seems that someone must have experienced this problem before, so I thought I'd post it here as well.
General Description: Every time I restart my local tomcat web server, the next time I hit a breakpoint, eclipse can't find the project source.
Background: I have been using Eclipse at my current job for about seven months. I did not encounter this problem for the first two months but it has been consistent for the last five months. I thought it might be related to a specific project, but it happens on every project I open, even projects that did not previously have the problem.
Details: Each and every time I restart my tomcat web server, then the next time I hit an eclipse breakpoint, the source window is empty with the message "Source not found." in red, and then below that the button: "Edit Source Lookup Path..."
I click on the button, which brings up the Edit Source Lookup Path window with only Default listed under the Source local Lookup Path section.
I click "Add..." which brings up the Add Source window. In that window, I double click on "Java Project" which brings up the Project Selection window. In that window, there is one project listed (the project which is currently open which I am currently debugging).
I check the checkbox next to that project and click OK (leaving the two other checkboxes checked). This takes me back to the Edit Source Lookup Path window and now my project is listed along with Default under the Source Lookup Path section.
I click OK and the source appears in the editor window and I can proceed without any problems until the next time I restart my tomcat server (which I might do ten or more times a day).
Other Info: I have tried modifying the project's Build Path Source section and adding the local code jar to the Build Path libraries, but nothing seems to fix this. I have done a lot of googling and have searched this forum and the bug list, but can't find any relevant information. As I said, this problem only started occurring out of the blue about five months ago and now it happens every single time. Is there an environment variable I need to set?
Any help is much appreciated!
Thanks,
Jeremy
Just to follow up, today I took the time to create a new workspace in eclipse and it fixed the problem. It wasn't an easy process because my environment has a lot of tricky settings that needed to be restored. But it's done now.
I accomplished creating a new workspace by simply renaming part of the path to my old projects. Once I did that and restarted eclipse with the -clean option, I had no projects and my old workspace settings were all gone. So, then I just created new projects from the existing code ...

Eclipse hangs while opening workspace after upgrading to GWT 2.0/Google app engine 1.2.8

After upgrading to the newest GWT/Google app engine I have problems opening my workspace in Eclipse. On startup, Eclipse hangs almost immediately and needs to be closed. This happens only in the workspace where I use GWT with app engine, and I weren't able to consistently reproduce it - sometimes it starts normally, and sometimes I need to kill the proces and restart it. There is nothing in Eclipse error log. Eclipse version is Galileo, running on Windows 7 RC.
Anyone else had similar problems? I googled but Google is not my friend today.
EDIT: Still happens after upgrading to GWT 2.0.1.
I got frustrated with not being able to open my workspace today, and finally solved this by importing projects into a new clean workspace.
Create new workspace and open it in Eclipse (to create .metadata folder).
Close Eclipse.
Manually copy all settings from old workspace (the most important settings are stored in the .metadata/.plugins/org.eclipse.core.runtime/.settings directory). Alternatively, you could use File / Export / General / Preferences in Eclipse, and then File / Import them, but I wasn't able to open workspace to do that.
Open the new workspace.
File / Import / General / Existing projects into workspace. Select root folder of your old workspace, and take care to check "Copy project into workspace".
Restart Eclipse and check that everything in the new workspace is working as it should.
Delete your old workspace.
EDIT: Another, and a bit better workaround which apparently works:
Close Eclipse.
Temporary move offending project somewhere out of the workspace.
Start Eclipse, wait for workspace to load (it should).
Close Eclipse again.
Move the project back to workspace.
I used "eclipse -refresh". Apparently it hangs on refresh something, the lower right corner tells you, what it's doing. For me it was refreshing the gwt runtime in a specific project, maybe trying to find an update or something. If you don't want to reimport your whole workspace, try -refresh or move this project temporarily out of the way.
I just deleted the state.dat file in the GWT project metadata, which seemed to remove the blocking and then triggered a recompilation.
<workspace>/.metadata/.plugins/org.eclipse.core.resources/.projects/<GWT project>/org.eclipse.jdt.core/state.dat
This probably won't serve as a general solution, but it worked for me and it's a lot quicker than having to copy whole projects. Maybe another file will have the same effect. I think the trick is just to "damage" the GWT project metadata enough to have it rebuilt.