Eclipse: How do I restore the original project structure? - eclipse

After checking out a very old commit of a project, I checked back out to the current state of the project. However, this somehow messed up my directory structure in Eclipse. Here is what the structure was before (and what I need it to be now):
And this is what it currently looks like:
So here are my questions:
Is there some quick and easy fix to get the directory structure back to how it was? It seems like Eclipse still "remembers" what the structure looked like, but misinterprets it.
Why did this happen in the first place and how can I prevent it form happening again? A few others I know had the same problem (which made them promptly switch to InelliJ rather than fixing the issue).
Thanks in advance!

It seems that the project folder is wrongly set as source folder.
This can be corrected in Project > Properties: Java Build Path, in the tab Source: select the source folder Quoridor, click Edit... and enter src.

Related

I moved my eclipse workspace, and now all my files are missing src

Long story short, I switched computers, and literally just copied my entire workspace folder into a flash drive, and when I tried to apply it to my new computer by clicking import> Existing projects into workspace > Select archive file. This is how they look when i try to view them:
http://prntscr.com/daj38x
While they should look like this:
http://prntscr.com/daj4fk
Am I doing something wrong while importing these files? Please help, I want to code again ;(
I think you are missing the source folder (in the 1st screenshot). Notice that there's a src folder in the 2nd picture (along with the .settings folder).
I think there is also a good chance you're missing the .project and .classpath files, no?
This has also happened to me when trying to copy entire projects from one machine to another. You could create a new project and copy the classes, but I think that would be quite time consuming.

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.

How to modify Xcode 4 Project to be Machine independent like Visual Studio or Eclipse behave

I'm very surprised not to be able to open my Xcode project on another mac, I have never that kind of problem with Visual Studio or Eclipse. I have tried this Info.plist file "no such file" error but it's not enough.
I have other errors like MyAppViewController files not found in some folder whereas I checked that the files are actually there.
So how do I modify XCode 4 project so that it can be opened on any mac ?
Update: contrary to what is claimed here Duplicating / importing Xcode projects from one Mac to another copying isn't enough
Update 2: should I be obliged to buy that kind of tools to do so ? http://itunes.apple.com/fr/app/project-duplicator-for-xcode/id467950482?mt=12
Copying the files over is enough, as long as you copy all files over and no files are referenced from your project file using absolute paths.
Note that you don't have to choose to have absolute paths. I'm unsure of the exact details, but I've ended up with absolute paths in projects without doing so explicitly.
For example, here's a project with a missing file:
When I select the missing file, I can see that it's using an absolute path:
At this point, you have two options:
You can click the button in the bottom right of that red box I've drawn to find the file. Make sure you pick the right file; if you pick one with a different name, Xcode will happily replace DetailViewController.m with SomeUnrelatedFile.m and you'll have lost the hint about the original file. After finding it, make sure to pick Location: Relative To Group (usually, that'll be the right choice anyway) to avoid this happening again.
Possibly safer, go back to the original computer. For any file that you know is missing on the destination computer, pick Location: Relative To Group. Then copy everything over again.
I'm not sure if this is what you're after but it might help; I use git on to keep my two laptops in sync with a single project. I don't have any file missing errors and it comes with all those other repository benefits.
You shouldn't need any tools to do this, Xcode projects can be moved, shared between other members of your team and opened on any supported machine.
There must be another problem you have, so you need to post the error.
And when you get it resolved.... using a free remote source control service such as bitbucket, would be good for you to know and get into the practice of using.

Easily Open Existing Non-Eclipse Project in Eclipse?

Alright, this has caused me enough grief. The answer may be dead simple, but I need some help.
I figured it would be simple to open an existing project in Eclipse, but I'm having quite a time actually making this work. I don't want to change where it's located. I don't want to pull a bunch of strings to get Eclipse to point to it. I just want to take the project directory from where it is now and open it in Eclipse.
Is there any way to do this?
Not sure that I entirely follow, but here's my general routine for creating projects in Eclipse.
I go to File > New > Project and
pick out what sort of project I
want, and hit Next.
I enter the name I want to use for
the project, and the path where I
want to store it. I never store
stuff in my workspace folder.
For projects with existing code, I
just put the path to the existing
folder, and Eclipse just imports the
code.
Hoping that answers your question, but if not let me know.

Eclipse: Refreshing known types in Java project

If you press Shift+Ctrl+T or choose "Navigate > Open Type..." you get the "Open Type" dialog for quickly navigating to a known class. When you start typing a name only the classes for which the name matches stay visible. That way you can find a class of which you know the name very quick without having to browse through the package explorer tree.
This has been working great for me up until this morning. All of a sudden for a couple of my projects I am only seeing some of the types that exist. Of course I tried the obvious steps of refreshing the projects, cleaning the projects, re-building the projects, rebuilding the projects externally, but all to no avail. It is a bit odd since the types are known in other places. If I add an import statement Eclipse does not complain that it doesn't know the type and I can Ctrl-Click through the types to get to their file. However, the type navigation knows nothing about them.
In the past when InteliJ used to do this to me I would go find its cache files and delete them forcing it to rebuild. Does Eclipse have something similar I might do (I'm an Eclipse newbie)? I am using Eclipse 3.4.2 and I have it configured to not delete files on a clean (because our actual build process puts files into the output directories that I don't want Eclipse mucking with).
Have you tried closing and reopening the project? Only types from open projects are held in memory, and the refresh occurs when you Shift+Ctrl+T for the first time on a newly opened project.
Edit to add: Ctrl+Shift+R also displays the types (along with everything else) but it also supports the Camel-case thing to find the Java types quickly.
Close eclipse and delete any .index files and the savedIndexNames.txt file in workspace/.metadata/.plugins/org.eclipse.jdt.core once eclipse is restarted it will rebuildl the entire index for Ctrl+T
try starting eclipse with the -clean flag, you can add this to your eclipse.ini which can be found in the same directory as you eclispe.exe, or if you start eclipse using a bat or shell script, add it as a startup argument, e.g. eclipse -clean.
The clean will tidy your workspace, and should force eclipse JDT to recalulate types. Ive had issue with .snap files (with seem to be created on dirty shutdowns) that seem to corrupt my workspace until I clean them up, not long ago eclipse lost the Object class!! made for some interesting errors!
I get problems like this often. I tried your solution, noticed it seemed to rebuild its search index, but I still couldn't find any of my classes. Then I took a look at the little green arrow on top right corner of that dialog, and noticed I had a working set selected which belonged to another project. I find it a little dumb that Eclipse doesn't warn you about this or anything, since this can be a very annoying little detail that one tends to forget (me at least ;-)).
Anyways, clicked on "Deselect Working Set" and bam I can find my classes again. Thought I'd add this here since others may make the same mistake.
This worked for me -
Select your project in Package Explorer
Press F5 or Right click and select Refresh
I used the "-clean" as first line in the eclipse.ini (version Juno) and worked like a charm.
I'v tried all the answers and I still had the issue. I then tried this:
I deleted the project (it's a maven project) and re-imported it. This time I made sure i check the "Add Project(s) to working set" checkbox. After that Eclipse was able to find the classes in that project.
The problem must have started because I didn't check this checkbox when i first imported this project.
By the way, I'm using Neon
(Warning: Shameless marketing ahead)
If you like this feature, you would love nWire. nWire allows, among other things, to quickly search not only for types, but for any possible Java element like method or field. It also uses a navigator view which is non-modal. After searching you can see the class associations in a very quick and easy way. Check out the video on our site.