How do I stop Eclipse from refreshing some dir? - eclipse

Every time I start Eclipse it tries to refresh an entire project, which translates to more than 10 minutes of wait time, not to mention the ridiculous amount of memory it would consume.
I know there's a global setting to turn off automatic refreshing (General -> Workspace -> Refresh automatically). Is there a way to turn that off on individual directories? The rationale is that some directories are seldom changed in some of my projects.

According to this thread, no:
no settings per projects (for disabling auto-refresh)
no settings per directory within one project.
For more recent versions of Eclipse, as detailed in Eclipse help page, you can use Resource filters (also initially mentioned below by pcoucke)
Resource filters can be created, edited and removed in the File > Properties > Resource > Resources Filters property page for a project or folder resource.
Resource filters only apply to files and/or folders that are implicitly included in the workspace by the refresh operation
An "Exclude" resource filter prevent all files and/or folders that match the filter condition to be included in the workspace during the refresh operation.
I mentioned an example in "How to have .git folders ignored by Eclipse projects"

For individual directories you can do it by adding Resource filters.
Right-click a project folder in Project Explorer tree and go to "Properties".
Resource -> Resource Filters.
Add as much exclusion filters for files/folders as you like.
See this answer: https://stackoverflow.com/a/6321688/1194584

If your problem is the refresh on startup, try: Preferences -> General -> Startup and Shutdown -> Refresh workspace on startup.

I found an effective hack that can in effect make Eclipse ignore a directory. See Eclipse - Ignore Entire Directories

To exclude entire projects, you could close them. Don't know a way for individual directories.

I'm sorry but I don't know anything about such a setting. As one already mentioned you could close the project within Eclipse (once it is open). This prevents the repetitive refreshing on that project. Otherwise I can just give you the suggestion to have 1 workspace per project and not include multiple different projects into the same workspace (unless they are related to each other). This is a much better practice and what I'm doing every day when working with Eclipse. And I didn't experience any problems so far of the type you mentioned.

I ran in to this same problem. When an eclipse project refreshes it seems to want to touch every file regardless of settings. The code base I'm working on has ~70K files, and took nearly 2 minutes to refresh. I eventually redefined the eclipse project to be a much smaller subset of that (~10K files) that has a ~ 1 second refresh. Not ideal, but the long refresh times are intolerable.
FYI the "Derived" check box and "Exclude from build..." options DON'T prevent a folder from being refreshed.
Note, the computer I'm using is 4-5 years old (Pentium IV processor, 7200 rpm hard drive). I bet one of these newer fast solid state hard drives would dramatically improve refresh times!

I found out a way to stop auto refreshing at eclipse startup.Below are the steps:-
Windows->Preferences->(Search Keyword:-Workspace)->General->Startup And ShutDown->Uncheck Referesh workspace on start up.
Done ...!!!
Work like charm for me.

Edit the file .project inside the folder .metadata.plugins\org.eclipse.jdt.core.org.eclipse.jdt.core.external.folders of your workspace folder.
Then remove any content between the linkedResources tags.
That worked for me (eclipse-jee-helios-SR2-win32)

You know what. Just close unused projects and that's was all for me.!

Related

Why would IntelliJ IDEA not be able to index files for a GitHub commit?

The title pretty much says it all, but to make things worse, new files aren't tracked as well. I figured that this is likely a rare exception, but it would be good to know what is causing the issue - in case a large project gets bugged by it. This question might help anyone who gets in this mess, so please post your suggestions.
Here is a screenshot of the situation: http://i.stack.imgur.com/iMn3O.png
Here is the screenshot I posted of the Settings... > Version Control > Ignored Files page: http://i.imgur.com/XwByblX.png It shows what is wrong on the 3rd line.
If you still can't index:
It might be because after removing the ignoring of your files, that the VCS hasn't been brought up to speed of the fact. Go to VCS > Show Changes View and then hit CTRL+F5 or click the Refresh Icon. Now you have Unversioned Files and you're ready to add files to the index.
I have solved the issue with a roundabout way. What I did was: I didn't include the .classpath file that Eclipse creates. IntellIJ asked if I wanted to open .project, I canceled that and just opened the project regularly, that solved it for me. It might have quietly induced the ignore entry from the screenshot.
The file is ignored. You have added your entire project directory to "Ignored files" in Settings | Version Control | Ignored Files, which leads to IntelliJ IDEA not showing any files as unversioned, and not allowing you to add them to Git.
You need to remove the project directory from the Ignored Files list.

Multiple sub-workspaces in Eclipse

I write code in several languages (Python, C, C++, and Java) using Eclipse. Is it possible to designate a directory on my machine (say /home/workspace/) as the "primary" workspace for any Eclipse session, but then to have subfolders, /home/workspace/python, /home/workspace/java, etc., in which I can create new Eclipse projects.
I don't want to have to navigate menus and select different workspaces for each session of Eclipse that I start up. I would rather just always have permission to manipulate any projects from a variety of folders at any time, but I can't find a clear answer about whether this can be done and how to do it.
As I understand your question; You want to have one workspace, but be able to code in several different languages without switching workspace but at the same time keep the projects separated?
First I would suggest you consider several workspaces, I find it convenient to keep settings and projects in separate workspaces. I rarely have to switch language that often.
But. I think what you want to do is to keep several working sets. You create one java working set, one C++ set and associate your different projects with a working set. Then you can minimize the java working set when you are running C++. For working sets you dont need any subfolders on the harddrive.
You might also want to look into Mylyn. Its a great tool for those who often are switching context. It saves the context (eclipse perspective, open files, etc) as associated with a task.
How about setting Eclipse to prompt for the workspace at launch? It wouldn't allow you to work in two languages at once, but should do the trick otherwise.
An Eclipse workspace can contain projects slated for different languages and those projects can live anywhere on your hard drive. There are at least two ways to do what you want. When creating a new project, uncheck the Use default location checkbox and browse to or specify the folder where you want your project to live. If a project already exists import the project into the workspace using the File->Import menu option and then select Existing Projects into workspace. In the next screen make sure the checkbox for Copy projects into workspace is not selected. This will leave the source files in the original folder.
In the Project explorer view, all the projects are going to look like they live at the root level. However you can group related projects into working sets. Then select just the working set you're interested in and all the others will disappear from view.
A warning is in order if you make use of eclipse variables in external tools (and possibly elsewhere). The syntax you use for paths needs to be adjusted. For example with projects outside the workspace this syntax ${workspace_loc:/MyProject/MyFile.txt} is no longer the same as this syntax ${workspace_loc}/MyProject/MyFile.txt

Avoiding "resource is out of sync with the filesystem"

I develop Java code with Eclipse and regularly get this message:
resource is out of sync with the filesystem.
Right-click > Refresh will always clear this.
But why can't Eclipse refresh automatically when it finds this condition? Are there cases where you want the resource to be out of sync?.
If there are such conditions and they don't apply to my work, is there a way of getting Eclipse to refresh automatically when it encounters this state?. (I appreciate that it should refresh as little as it needs to in normal development to increase performance for human developers.)
UPDATE (2012-06-25):
My latest update (Version: Indigo Release Build id: 20110615-0604)
no longer shows
Preferences - General - Workspace - Refresh Automatically
There is an option "Refresh on access" - should I use this?
You can enable this in Window - Preferences - General - Workspace - Refresh Automatically (called Refresh using native hooks or polling in newer builds)
The only reason I can think why this isn't enabled by default is performance related.
For example, refreshing source folders automatically might trigger a build of the workspace. Perhaps some people want more control over this.
There is also an article on the Eclipse site regarding auto refresh.
Basically, there is no external trigger that notifies Eclipse of files changed outside the workspace. Rather a background thread is used by Eclipse to monitor file changes that can possibly lead to performance issues with large workspaces.
Just right click on the file or on the project and click Refresh. The error will vanish. I also faced the same issue and it worked for me.
Window -> Preferences -> General -> Workspace
For the new Indigo version, the Preferences change to "Refresh on access", and with a detail explanation : Automatically refresh external workspace changes on access via the workspace.
As “resource is out of sync with the filesystem” this problem happens when I use external workspace, so after I select this option, problem solved.
This happens to me all the time.
Go to the error log, find the exception, and open a few levels until you can see something more like a root cause. Does it says "Resource is out of sync with the file system" ?
When renaming packages, of course, Eclipse has to move files around in the file system. Apparently what happens is that it later discovers that something it thinks it needs to clean up has been renamed, can't find it, throws an exception.
There are a couple of things you might try. First, go to Window: Preferences, Workspace, and enable "Refresh Automatically". In theory this should fix the problem, but for me, it didn't.
Second, if you are doing a large refactoring with subpackages, do the subpackages one at a time, from the bottom up, and explicitly refresh with the file system after each subpackage is renamed.
Third, just ignore the error: when the error dialog comes up, click Abort to preserve the partial change, instead of rolling it back. Try it again, and again, and you may find you can get through the entire operation using multiple retries.
If this occurs trying to delete a folder (on *nix) and Refresh does not help, open a terminal and look for a symlink below the folder you are trying to delete and remove this manually. This solved my issues.
When you open an Eclipse workspace from within a clearcase view and try to rename the project, you will often get the pop-up warning ... “Resource ‘project’ is out of sync with the file system”. If refreshing the project does not fix the problem, then do the following workaround: a. Open workspace WITHOUT being in a view b. Select the project in Project Explorer c. ClearCase -> Associate Project (project should now look like project [] ) d. Right click project -> Refresh (vob sub-folders should now be empty) e. Right click project -> Rename ... f. Enter New name
Now you can close the workspace, reopen it in a view and refresh the project. You may also dissociate the project if you prefer the project not to be associated with the vob.
A little hint. The message often appears during rename operation. The quick workaround for me is pressing Ctrl-Y (redo shortcut) after message confirmation. It works only if the renaming affects a single file.
If you are a regular Eclipse user than you might have got this error many times. The error simply says, “you’ve made changes in files in your workspace from outside eclipse”. The simplest solution would be to select the project and press F5 (Right click -> Refresh).
if you need more explanation you can read from this web site
I was not able to resolve this error by either refresh or by turning on "native polling" workspace feature. Turned out my project was also opened in two instances of eclipse. Once I closed the other instance, the error went away. So make sure your project is only opened at one place if you are seeing this error.

how to change views with clearcase on eclipse

I'm using eclipse to work on a HUGE C project and it works generally well except for not being able to change views.
I create a new project and set the project source to the clearcase vob directory and it works just fine except it stores the project files in the vob. then when I change views the project cant be opened because its meta-data is sitting in the old view. I can create a new project but eclipse refuses to have two projects with the same path so I (probably unwisely) remove the original project and create it again. I'm spending too much time waiting for the indexer every time I switch views.
How can I switch views with out having to re-index everything?
I also worked on a project that used ClearCase with Eclipse. The same kind of drama that you describe happened to us on a regular basis. ClearCase was a big part of my reason for leaving that job.
With some distance between me an that horror, I've thought up a possible solution: Set up several different installations of Eclipse, with not just separate workspaces but separate .metadata and related stuff. Check out into separate Eclipses from the different views, then shut down one and fire up another to work with another view.
I haven't tried this, but it seems to me this should work.
Oh yes, you'll want to export your preferences between Eclipse installations.
Are you talking about snapshot or dynamic views here?
The path should be unique per view in both cases anyway.
In either case, what eclipse will not let you do is to have, in the same (eclipse) workspace, two projects with the same (eclipse) name.
You can try:
to have them in two different workspaces
to have a different .project per view (with a different name), provided those views reference the LATEST of two different branches.
(as As mentioned earlier in Which eclipse files belong under Version Control, those two files -- .project and .classpath -- can be under version control, provided they only use relative path.)
Perhaps the answer here is not to let clearcase anywhere near your workspace?
Use 'create project from existing source', so that the project lives inside the clearcase view, instead of having the project live in the workspace with a source folder inside the view.
Then you can have one workspace for each of your views.
This does imply checking in .cproject, .project, .classpath, etc.
if i switch view and use the same project it sometimes works if I manually copy .cproject and .project from one view to the other.

Excluding/Disabling Validation in Eclipse

I have the (mis)fortune of having a large project source-base in which I am working primarily on PHP and JavaScript. I have to have the full project area as the project root in Eclipse, but unfortunately this includes several directories that drive the validation built into WST/DLTK/etc. nuts.
I have tried disabling all validators in the project properties. I have gone into the validators one at a time and added rules to the "Exclude Group" set to exclude the specific folders. I have removed the folders from the PHP build path in the project properties. And yet, my Problems view/tab is still littered with thousands of red flags that stem mostly from a folder that we use to keep copies of external elements (Apache, PHP, etc.). You know, typical "have a copy of the specific versions we currently use" sort of thing.
The signal-to-noise ratio is so bad that I'm unable to use the view at all, which is a shame. If I'm not going to have the benefits of the IDE, I might as well be using vim for this (I use it for other stuff, but for this codebase a good IDE is a better choice, providing I can get it to work). It seems to me that it would be an obvious feature to be able to right-click a folder in a project and select "Exclude from Validation", but alas there is no such feature. Is there another way to get the validators (PHP, HTML, etc.) to ignore the folders I need ignored?
Tried solution;
Right click project
Select properties
Select validation
Check Enable Project specific settings
On the XML Validator row, click the '...' button
Select Exclude Gruop
Click Add rule
Select 'Folder or file name'
Click Next
Select files or folder which are not validated.
Click Finish
Click OK
Click OK
This solved my problem. Because eclipse validation gives error for generated GWT files.
Best regards.
I came upon this question while looking for the same answer. I will list the steps I did here and hopefully it will help someone in the future.
I am using Eclipse 4.1 and I do the following to exclude validation for specific xml files. I am sure if you configure the different validators it will work for other files as well.
Go to Preferences -> Validation
Find the Validator you wish to change and select settings (not all of the validators have settings, hopefully yours do).
In the settings you can add an Exclude Group where you can add a rule to specify to exclude the validator for specific extensions, folder or file name, project nature, facet or content type.
I have Eclipse for PHP Developers and I was dealing with the same issue.
In addition tot he excellent answers above, I have one more suggestion.
My first recommendation is not to use Aptana unless you actually want those validators (as they are nearly impossible to turn off from my experience).
Beyond that, go to File -> Properties -> Builders, and deselect "Validation" and "Script Builder" and "JavaScript Validator".
So far it's helped speed up some operations tremendously.
I also recommend disabling "Automatic Build". Because you're using PHP, the odds that you actually need it to build anything if you don't want validation is slim.
In the main menu, go to Project and uncheck "Build Automatically". You will want to build your project every now and then by right clicking on the project and selecting "Build Project".
All the above steps have helped me get the basic editor, which is exactly what I wanted.
I used to exclude resources from validation via project specific Exclude Group (as the most answer here suggests). But in case anyone is still having problems with disabling validation for a specified folder in 2014 - just mark the folder resource as Derived:
This should disable validation for that folder.
If you are using EGIT you might also want to disable automatic inclusion of derived resources in .gitignore:
It is not really possible to select a directory, at least under Windows.
After having pressed Preferences->Validation->Settings->Add Exclude Group->Add Rule->Folder or filename->Browse Folder->(selecting some directory)->[OK]
The "Browse for folder" dialog is being closed, with the "File or folder" field staying empty.
I had the same problem with the web app i'm developping.
I ended up disabling automatic build, and building once a day (Project->Build automatically), that way i still get the benefits of code completion from libraries, while speeding up the program on older computers.
I found in the project properties there is a Builders category. In the list of builders I had a JavaScript Builder. I deselected this builder and all my annoying javascript validation woes went away.
this worked for me:
Properties > Builders section and unchecking the corresponding box. https://bugs.eclipse.org/bugs/show_bug.cgi?id=317833
seems to be a bug in some versions of eclipse.
There are more gloabal validation parameters. You can suspend all validation (or only the ones you don't need) by going to:
Window > Preferences > Validation.
Here, check the box "Suspend all validators".
Alternatively, uncheck the validators you don't need from the list below.
A full build will be requested which might take some time. But Eclipse will run a lot faster afterwards [But without validation of course]
http://www.flickr.com/photos/jesuspresley/5094048124/
Solution.
Go configure what's displayed in the Problems View like lothar proposed, create new custom filter and in "Scope" area choose "On working set". Now press the button right below this option to configure what working set would it be: in working set selection pop-up hit the "New" button and mark all your project files EXCEPT those you want to exclude from validation. You might want to save this working set under convenient name, like "No_Validation_Set".
Summary:
1) working set excluding problematic files.
2) custom Problems View filter to operate on this set.
Issues:
when adding new files to project you need to update your working set, so they are validated too.
When I excluded files from validation for the project, my setting didn't seem to be recognised until I restarted Eclipse and cleaned the project.