I have multiple files of different types in a source folder in my Eclipse project (not a Java project). I know how to hide files from the Project Explorer view (using view filters). But I did not find a way to hide (not exclude) a file from the source folder. Is that possible to achieve?
Example:
Say my project has a folder: src, which contains three files: Main.java, and config1.xml, config2.xml.
Once I add src as a source folder, it along with its file children show up as source folder (see upper balloon in image) and also a simple folder (separately) (see lower balloon in image) under the same project in Project Explorer.
I know that I can set an inclusion filter so that I build only the java file, and not the xml. But how can I set a view filter so that the config1.xml file is hidden, but not config2.xml? (Clearly, I do not want to set a filter on *.xml, because that would hide both xml files.
UPDATE: When I attempt to add a resource filter according to Simon's solution, the file gets hidden from both the source folder and the folder view. I want to hide it only from the source folder view (upper balloon) and not the simple folder view (lower balloon). That way we know about the existence of config1.xml, but its exclusion from source.
If you want the file to be hidden from the view, then do the following
Open the context menu on the "src" folder and select Properties
Choose Resource > Resource Filters page
Click the "Add" button.
In the dialog, select "Exclude all" filter type option, "Files" applies
to option, and type in the file name config1.xml (Name matches)
Close all the dialogs and refresh your project in the Project Explorer
view.
The file config1.xml should no longer be visible
Related
I have a project made, but I had to copy and move the java source file to another location in our clear case. If I want that file to be changed when I make further changes how would I do that? It is now a new name so I will probably have to make a new project but I'm not sure how to just import that one source file into the new project or even the existing project.
Update:
I have a project with a package that has some classes in it. I moved the java source file somewhere else and now need to use that file in that location instead of the original. I created a new project and imported the source file. Now it doesn't recognize the package or the class. Its says class "example" is public, should be declared in a file named "example". And the package error says "incorrect package". I'm not sure how to fix this to where The project runs just like the other except uses the file from the other location, so it can stay updated
Click on the Projects tab to open up your projects. Right click the project you wish to import source code from and choose Properties down at the bottom. You will arrive at the Sources tab automatically.
Under Source Package Folders click the Add Folder button to add the folder containing your source. Once it's been added, you will see it appended in the table. You can then double click the row's text under the Label column to edit the way it appears in the browsing window.
Importing this way means that you don't need a new project just to include files from other places on your computer. You can simply browse for the files you wish to include!
Since upgrading to xcode 4, I can't find where to specify what Target a resource belongs to. Previously, I selected the file and hit command+i, but this now seems to run the program, rather than bring up the info box for that file.
Select the project file in the document explorer. On the Right margin of the Xcode window make sure to display the right drawer view if it isn't already there (it usually has Object library and Quick Help). In the top margin, click on the icon that looks like a document (rather than the one with the waves that is quick help). The target membership and the other info from the old Get Info command is there.
Select the project file in the document explorer pane, select your target from the list, select the build phases tab and add/remove your resources in the copy bundle resources phase or source code in the compile sources phase.
Right click on a folder (eg. resource) on the document explorer (which is the left column with all your files and folders in your project), select Add Files to "Project Name". Below you will see check boxes that determine the file's association with each target.
#makdad - This also works for the 'blue folder' situation.
Note: if you already have a file in xcode, the only way you can add targets to a file that's in a 'blue folder' is to remove the file and follow the steps stated above.
I'm working on a new Eclipse workspace and my setup is very simple:
My source folder is named src, my classes folder is named classes and I have in my classpath also the classes from the build on the server located under server_classes.
When I use the Find Type option in Eclipse it shows me the .java files under src and the .class files under server_classes.
Is there anyway to instruct it ton exclude those files by default? (I want to keep them in the classpath - just not run into them by mistake when looking for a particular class)
When you open the Open Type window (ctrl-shift-t), at the top right there is a little black triangle. Click on that and select "Select Working Set..."
You can then create your own working set that only includes your source directory.
Open the Search Dialogue by pressing Ctrl+H, and select the "Java Search" Tab. The "Search In" Section should be self describing.
If you don't see a "Java Search" Tab press the Customize button.
I'm confused because this isn't done through xcode. I must find the project folder in finder and then really move files into those *.lproj folders. Is that correct? Or is there a way to see those *.lproj folders in Xcode like Groups and then just drag&drop the files in there?
Get Info on the file you wish to localize.
Click the General tab in the window that appears.
Click the Make File Localizable button at the bottom of that tab view.
Interact further with the interface as needed.
After you make a file localizable, Xcode treats the file itself as if it were a folder. There will be a disclosure arrow next to its name in the Group Tree that you can turn down to reveal all the file's existing localizations.
I had a bunch of images in my Xcode project. They were originally added without choosing "Create Folder References for any added folders". So I removed the references and re-added as per these instructions Include a resource directory hierarchy into app bundle
Unfortunately, Interface Builder will not display any of the images inside that directory. On the project tree the directory comes up with a blue icon and all the files are there!
The file names show in the IB Inspector (i.e. under the 'Image' property), but I get missing image icons for everything located in that directory.
Any ideas how to get the images showing again?
Problem solved! Turns out that blue folder references are fine, but IB will not read them!
For anyone else who cares to know, if you have the following:
/iphone-project-dir/images/pic.png
Once you've added them in a blue folder in Xcode (as detailed in link above), you can refer to them in IB as follows:
images/pic.png
In the XIB's XML it will look something like this
<string key="NSResourceName">images/pic.png</string>
Simple! The only drawback is Interface Builder's WYSIWYG preview does not process these paths!
I found the answer here http://www.iphonedevsdk.com/forum/iphone-sdk-development/6457-xcode-folder-directories.html
If you like to have your images structured in your SCM and under XCode but really doesn't mind that all images will be placed in one directory once building the final .ipa package, here is what you need to do:
Create a directory called e.g. "Images" in your root folder
Place all your images into this folder
Add a new group from within XCode and call this "Images" too
Right-click this group and choose "Add Files to ..."
Select all your files and uncheck "Copy items into destination group's folder" because they are already in there
Make sure to select your right targets
From Interface Builder you are now able to pick your images without prefixing it with the folder name and you will see a preview of your images within Interface Builder.
Gives me both my IB preview and a neat folder structure when designing my app.
Copy Images folder to your project folder.
Add this folder to project. In "Choose options for adding these files" dialog, you must check "Create groups".
"Copy items if needed" you can leave checked.
Make sure to select your right targets
Finish