Open Resource window in eclipse shows pyc files - eclipse

In eclipse the Open Resource window (Hot keyed to Cmd+Shift+R) to open a file by typing its name seems to show *.pyc files despite the Navigator view correctly hiding them.
Is there anyway to set this up to ignore PYC files?
I have looked at the following links and it appears that pydev may require a src folder underneath the main eclipse folder. I do not have that structure however the full project has been marked as a 'source' folder in Pydev - PYTHONPATH under project properties.
http://sourceforge.net/projects/pydev/forums/forum/293649/topic/2183420
http://pydev.org/manual_101_project_conf2.html

I found the solution!
CMD+i on the project folder (or "right click" -> properties), then:
under "resources" -> "resources filters":
click "add"
choose "exclude all"
select "files and folders"
check "all children (recursive)"
type *.pyc in the text field at the bottom
ok
ok
\o/

Related

Eclipse Kepler: Hide specific items in Project Explorer

I'm using Eclipse Kepler and I'm unable to 1) hide the target folder and 2) to hide the duplicate src folder in project explorer.
In previous versions it was possible to filter the folders with a regex, but in Kepler I don't see an option to enter a regex in Customize View->Filters.
I checked "Java output folders" and "Maven build folder" but they are still visible.
For the duplicate src folder:
I would like to only see the top one (the one with the flattened layout)
Here's my build path:
Got it. Apparently the default view in Kepler is "Project Explorer". Switching to "Package Explorer" reveals the old functionality with the familiar "Filters" dialog. There I entered target,src et voila...

Eclipse: "Find All References" ignore target directory

Is there any way to limit the search for "Find all References" in Eclipse so that it ignores files in the target directory. This is not the same as the answer from this question: Limit “Find References” in Eclipse to only references from my code. That answer only works for text search. I want all references to a particular variable.
Maven Java project?
If the target folder is properly set as Default output folder in the project's properties > Java build path > Source you should be fine.
Source: just tested on Eclipse Indigo (I've tried Ctrl+Shift+G on both classes and variables); the search is limited to src/main and src/test.
Try:
Go to Window->Customize Perspective. In Command And Groups Availability tab enable Window Working Set option if not enabled. Click OK
Go to Window->Working Sets->Edit. A dialog will pop up. Click NEW button
A dialog will pop up. Select Resource option in that. Click Next Button
Click on Select All Button. Deselect the target folder. Enter the name for this working set say "Exclude target folder".
Open the source file in editor. Keep cursor on a variable. Right on that variable
Go References->Working set->Exclude target folder
By this you can also exclude some files along with folders. One drawback in this is that you have to manually deselect each and every files and folders to exclude.
Right-click and select properties and then check the derived check-box. Done.
This works for the target directory and any other directories and files you want to exclude from searches and your normal workflow since the IDE will view these derived resources as resources that are not original data, and can be recreated from their source files.

Delete source folder in PyDev project generates error "Source folder not found"

When deleting a source folder in a PyDev project in the Project Explorer, the project PYTHONPATH is not updated and there is a red x marking in the outline with an error message saying "Source folder: [source folder name] not found".
Is this really the intended behavior? I would expect the PYTHONPATH to be updated if source folders are removed.
I'm using PyDev version 2.7.3 and Eclipse 3.7.2.
Steps to repeat the problem:
In Project Explorer, create a new PyDev project with File -> New -> PyDev Project
Create a new PyDev source folder by right-clicking the new project and selecting New -> Source Folder (under the PyDev menu)
Remove the source folder (which was just added) by right-clicking the source folder and select Delete.
Add a new source folder (needed to trigger the error).
There is a red x error mark and a message saying "Source folder: [source folder name] not found".
Go to PyDev Properties. The deleted folder is still listed in the Source Folders tab under PyDev-PYTHONPATH.
Note: When repeating the steps above in the Package Explorer instead of the Project Explorer, the red x's don't show up - so you can't see there is a problem. However, if you look in PyDev properties the behavior is the same - PYTHONPATH is not updated.
Right click on your project folder->Properties->PyDev - PYTHONPATH. Select the directories causing the errors and click Remove on the right.
Looks like the problem happens when project name doesn't match directory name.
e.g.,
env/VersionModifier/src/myfile.py
.project file = CoolTool
source folder not found
env/VersionModifier/src/myfile.py
.project file = VersionModifier
OK
You could call it a bug or an "enforcement of best practice" but right clicking on the project and making its name match its enclosing directory fixed the problem for me in Kepler.
Good luck
Peter
the way i resolved it is to go to the folder in which your code is stored and find a file by the name of .pydevproject. It is an invisible file in eclipse/aptana so you may have to do this through cli or file browser. look for a structure that look like <path>path/to/your/file</path> and delete the ones that show errors in your package explorer. this will resolve your problems for now, but this is a bug and needs to be reported.
I think the problem stems from the fact that pydev fails to remove the <path>...</path> vars once the user deletes the source folder.
Below is how I resolved this, hope it helps.
Clean Up:
Removed the project from eclipse; of course, leaving it as on disk.
From the source directory removed ".project" and ".pydevproject" files.
Recreate:
Created a new PyDev project (in eclipse), providing the existing source directory. In the New Project dialog, selected "Create 'src' folder and add it to the PYTHONPATH".
The project got created properly, without any source-folder errors.
Now add the folder you want to add as source directory, by right-clicking the folder and selecting the option under "PyDev".
At the end, you may just delete the "src" directory that was created by eclipse.

Is there an equivalent of "Add existing file" (to project) in Eclipse?

I am trying to map my Visual Studio experience onto Eclipse. Right now, I wish to add a file existing somewhere on the file system into a project in Eclipse. I expect it to be copied to the project source folder.
Currently, I see only one way - switch to the windows explorer (total commander, in my case) and copy the file myself, after which to refresh the project.
Can I do the same without leaving the Eclipse IDE?
Thanks.
I had the same problem, but found yet another solution.
Let me state my problem so that we're sure we're talking about the same thing.
I had a file in a directory where a bunch of code files were and some of the files in that directory were shown as "in my project" and some of the files were missing. I wanted the missing files to appear in my project.
I simply selected the folder in my project and pressed 'F5' or right-clicked and selected 'refresh' and the files appeared in my project. It looks like that is the intended way of doing this.
File->Import->General->File System should do it.
There you can select the file(s) from some file system folder to your project (into folder).
Even easier. Just drag and drop the file from explorer into the correct package in Eclipse. It will ask you if you want to copy or link the file(s).
I am a newbie to Eclipse Luna (the 64 bit latest version on Windows 7) but this worked for me:
Copy the preexisting source files you which add to your project.
In Project Explorer, right click your project and select New > File
In the "New File" dialog box, your project's name / folder should be displayed as the parent folder for your new (existing) source file.
Click on the "Advanced" button at the bottom of the "New File" dialog box.
Check the "Link to file in the file system" checkbox.
Click the "Browse" and browse to your preexisting source.
Click the "Finish" button at the bottom of the dialog box.
In my case, I had to:
right-click the project's name
choose "Close Project"
right-click the (now closed) project's name again
choose "Open Project"
Refreshing didn't work for me. :(
Hopefully this helps someone else...
Just found the quickest way to add files:
Copy-paste your file into your project disk directory using your file browser.
In Eclipse project browser select your project.
Click [right mouse button]->Refresh (or press F5 on Windows machine).
Voila
(worked on Neon-4.6.2)
I just got this to work. YMMV
I don't suppose it has to be there, but I put my file, xyz.cpp, into my project's source directory. My project has a source subdir named src, as in ProjName/src.
Right Click on project name (my project was open and the only one open).
NEW->FILE. Put in the filename, xyz.cpp. Click OK or press enter.
The file will open in the editor and complain that it is empty. Close it WITHOUT SAVING.
Reopen the file. It now has its contents.
It turns out that just simply dragging the files into the src folder would work!
Right-click on the file after you have copied it into the project directory. Select Properties... in the left hand pane select C/C++ Build. There will be a checkbox "Exclude resource from build" uncheck that check box.

How to hide folder "Search Paths" in a Texlipse project

I am using Eclipse/Texlipse plugin and if I create a new project Texclipse
automatically creates a folder called "Search Paths". You are not possible to do
a right click on that folder to get to the properties etc. I was wondering whether it is
possible to somehow hide that folder as it just includes the paths for the latex compilers etc.
The "Search Paths" folder is only virtual and is not created by TeXlipse on the file system. Furthermore, it is solely shown in the "Project explorer" view. You can use Eclipse's "Navigator" view instead, which is similar to the "Project explorer".