What is the use of "Virtual Folders" in the Navigator or Package Explorer of Eclipse / Flash Builder? - eclipse

These folders can be created similarly to normal folders by right-clicking > New Folder... and then toggling the "Advanced >>" button to show the virtual folder option.
Since the folder isn't located in the file system, just curious as to how exactly are the files stored when I drag them to this virtual folder, and what's the difference / purpose from a normal folder?

You're right, they have to exist on the file system somewhere :-)
AFAIK linked resources are created for the files under a virtual folder. That means they point to an absolute path on the filesystem, outside of the workspace. If you move the file in the filesystem, it gets broken.
See Virtual folder for a starting point.

Related

File manager for eclipse

Often i need compare or edit some files, which are not in the project. For example from the removable drive. I like to work with any files in eclipse(so much power!). But to see files, they must be in any project.
I try to place files into some project - it's not comfortable. I need to open file manager and copy files into existing project or create new project in eclipse.
I try create project with "d:\" location, but it overlaps my existing projects and eclipse can't create such project.
I search through plugins and install EclipseCommander - it's not what i want, because there is no "compare with" in context menu, it have popup, it overrides my controls(when commander view is open(but not in focus) and i press f5 in package explorer, eclipse try to invoke "copy" :) ), etc.
Best if i can browse all my computer's files in tree-like view, like "package explorer", "navigator" or "project explorer".
Till now best what i find is to create project with "e:\" location. But it creates project on e:\ and still not solve problem with files on d:\ .
So how to browse all local files in eclipse?
You'll have to create projects, or I recommend instead, folders for each drive. It's a Windows limitation/design that every drive has a separate volume and there's no real root to everything on the system.

Eclipse does not show projects in workspace

I have opened Eclipse workspace that I transfered from another computer but it does not show any projects in package explorer (there should be a lot of them). Still project's folders are in workspace folder.
The new machine where I transfered the workspace runs Windows 7 that has the read-only folders issue (more here). That is all the folders that are created on that OS are read-only and that the read-only atribute cannot be removed in any way.
Eclipse originally refused to open the workspace at all saying that .metadata folder of the workspace is read only. After turning user control to the lowest level it opens the workspace but it acts as if it did not contain any projects. I think this is because Eclipse refuses to work with read-only folders and project folders are also read-only.
Did somebody have same problem? How did you solve it? Any suggestions are wellcome.
It is not enough to move your projects in the workspace path folder, you also need to import them. And because of they are in your path folder, you can't import them again because it will say you still have them in your workspace. Move them to another folder (for example in desktop), be sure your workspace folder is empty, and then try to import them from your temporary folder in desktop.

Viewing a modified file in eclipse

I was adding a simple file to one of my programs that updates when I run the program with a particular parameter.
The file updated fine, but it is stored in the /bin directory and I can't figure out how to view the file within the editor.
I can see that the file is updated when I traverse the bin folder manually and open it with notepad.
Is there a way to view the file within the editor?
edit: I have a file in the project already but I doesn't update, instead the copy in the bin folder does; Can I connect the two somehow?
Your <project>/bin directory is being filtered from view. Right click on your project, select Show In->Navigator then you should be able to see your /bin directory and double click your file to have it open in an editor.
Alternatively, you can use ctrl-shift-r to open the Open Resource dialog, from the triangle drop down menu check Show Derived Resources, and then type in the name of your file.
The /bin directory is managed by the Eclipse builders and so you may lose your file if you do a clean. I would suggest using a different directory to house your runtime files.

How to rename the folder name in xcode project with out corrupting the files

In my xcode project i have created a folder manually named "MyClasses" to place the newly added files/classes to this folder.
Now i have nearly 30 classes in this folder.
when i renamed this folder , all the files in this folder are gets Erased.
Now i need to rename the folder to "ViewControllerClasses".
But i lost 30 .h, .m, xib files. [lucky i have a copy & and zip file]
How to rename the folder with out corrupting the files.
Renamed it to myviewcontrollerclasswes
When i renamed
Two Solutions
Method_1. Try Manual editing:
« Drag your MedChart.xcodeproj to TextWrangler (or any text editor)
« Use find button to find "FolderName" (Your folder name)
« Replace all with new name.
« In some project you may notice header search path problem...goto header search path and replace with new name.
Method_2. Use Xcode to choose base folder:
Rename folder in finder then use Xcode to choose same folder.
NOTE as of 2017:
Now Xcode 9 synchronises the folder and the project hierarchy automatically.
NOTE as of 2013:
Duplicate and rename Xcode project & associated folders
The "folders" what you see in XCode under your project file are not real folders in the file system, only virtual folders administered in the .xcodeproj file. You can organize your files in the project folder independently from their location in the file system. Some prefers to map the file system folder structure inside the project folder structure, some others store all source files in one big folder in the file system and organize them only in the project folders: it's rather a question of preference.
However if you rename/move physically the files in the file system, you will have to delete and re-add them to your project since XCode will not know where to find them. Pay attention not to delete them physically only remove them from XCode project, then re-add them and reorganize as you want.
One more thing to note: if you are using version control system you will have to inform also its client (svn or git most likely) that you have renamed/moved your files. If you want to keep file revision history it will be a good idea to issue the copy/move command explicitly to the version control otherwise it will treat your files as deleted from the old location and added as new in the new location.
In case anyone is still having trouble with this:
Select the folder or file in the left-side bar of XCode corresponding to the folder you want to rename (for me I renamed the folder containing all my files so I selected the topmost folder)
On the right-side bar, below where it says 'Location', click the folder icon.
In the file explorer that opens up rename the existing folder to whatever name you'd like it to be, then afterwards select it and press 'Ok'.
XCode should update the file locations accordingly.
Keep in mind that if you rename something which contains a file that is hard-coded as a certain path in your build settings, XCode will throw an error. You'll have to manually change those paths in your build settings.
This worked for me, hope it works for you too.
You should just run a search and replace on the project file (if you are working with version control and with other developers you will have seen this file a lot without a doubt), it's the project.pbxproj file located inside the xxxxxxxx.xcodeproj file.
Just right click (Control + Click) on the file and select "Show Package Contents" to find the xcodeproj file.
I still find it easier than all these methods to simply create a new folder in your file navigator and then drag your files from the other folder into it. Sometimes the simplest way is the best way. It literally takes me 10 seconds and I don't need to leave Xcode.

Eclipse - Ignore Entire Directories

I use Aptana Studio (based on Eclipse). I'm trying to get Eclipse to completely ignore an entire directory inside a project. I mean COMPLETELY. I don't want it to display in the project folder. I don't want Eclipse to even be aware it exists.
Unfortunately, all my efforts to add it as a filter don't work. See http://forums.aptana.com/viewtopic.php?f=14&t=8340#p33714 . I think the filter only prevents the folder from being displayed in the project display. It doesn't keep Eclipse from actually looking at all the files in that folder for code assist, etc.
My problem is that directory has thousands of text files. So, each time Eclipse opens or refreshes this project, it analyzes all those files.
How can I prevent this?
Not sure about this aptana thing, but there is a convenient way to do it in native eclipse:
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.
If your project tree is not refreshed immediately, press F5 to enforce it.
Consider also the 'Derived' checkbox: right-click an entry in the package explorer, choose properties, check Derived. This may solve part of your problem.
See http://robmayhew.com/eclipse-ignore-folder/
If you have a linked resource (pointing off to some other file/folder on disk) with the same name in the same location in the resource tree, then the real folder on disk will be hidden from the resource model.
Unfortunately you can't create the linked resource if the real directory is already there in the project structure. You can try something like this:
On disk, rename/move the directory in question
Refresh the project, the directory is gone
Create a linked resource ( New -> File/Folder >> Advanced -> Link to file in the file system ). Name it the same as the original directory.
On disk, restore the original name of the directory
Refresh project.
Try right-clicking "Properties" and unchecking all permissions.