Hide empty folders and other files in Eclipse CDT - eclipse

In Eclipse CDT, how can the navigator and project view be filtered to hide empty folders and other undesirable file types?
The customize options seem to be a bit limited e.g. hide non-c content also hides makefiles which isn't helpful to me.
Is there a plug-in to add this functionality?

In the project explorer panel, click on the down arrow icon in the top left > customize view > flag 'Empty folders'.

Related

Eclipse Mars - imported projects don't show up in Project/Enterprise Explorer

I currently have 48 projects in my workspace. All are cloned git repos that had existing projects that were then imported into Eclipse.
The last three repos that I've imported into Eclipse have imported and migrated successfully but don't show up in either the Project or Enterprise Explorer views. I can see that they exist in the .metadata/.plugins/org.eclipse.core.resources/.projects folder.
I can search the projects and create a working set, and I can add the EAR files to the server, and I can open the files, but I can't do anything that I would normally do from the Project Explorer, including viewing their properties or deleting them.
I had thought that Eclipse might have an upper limit on how many projects could be viewed, but my co-worker says she has 107 projects currently in her workspace.
Maybe the projects are hidden by an active Working Set or by Focus on Active Task.
From the first link:
How to change Eclipse's "Project Explorer" "Filters and Customization" view settings to force projects and files and folders to show up and not be hidden, such as nested projects
Tested in Eclipse Version 2021-06 (4.20.0), Build ID: 20210612-2011 on Linux Ubuntu 18.04.
Quick Summary
Go to the "Project Explorer" tab, click the 3 vertical dots in the top-right corner of that pane, then go to "Filters and Customization...", as shown here:
Uncheck the box for "Nested Projects: hide top-level project if shown as nested" and "Nested Projects: hide folders when project is shown as nested", and click "OK":
Details
I'm having this exact problem in Eclipse Version 2021-06 (4.20.0), Build ID: 20210612-2011 on Linux Ubuntu 18.04.
It turns out it's because of the Project Explorer "Filters and Customization..." settings, as I learned from #howlger's answer.
After adding a code repository directory as a project, I can see it showing up in the deprecated "Navigator" tab, shown as "Navigator (Deprecated)" in Eclipse here (I have blurred images for privacy):
However, it does not show up in the "Project Explorer" tab, which is shown below!
The problem is that the "Project Explorer" tab's "Filters and Customization..." settings are filtering out this project and not showing it. In my particular case, that is because the project I am adding is a subrepo within another git repo, which means it is a project nested within another Eclipse project, and my view settings are mistakenly set to exclude all "nested projects". Your case or reason may be different, but in either case, if your project is not showing up in your "Project Explorer" tab, then it is likely because your "Filters and Customization" settings are set to exclude it from view.
To fix this for my case, go to the "Project Explorer" tab, click the 3 vertical dots in the top-right corner of that pane, then go to "Filters and Customization...", as shown here:
Next, click the "Pre-set filters" tab, then scroll down and uncheck the box for "Nested Projects: hide top-level project if shown as nested". I recommend you also uncheck the box for "Nested Projects: hide folders when project is shown as nested", but I'm not 100% sure what that one does, as unchecking the other box alone caused my project to show up. Here is a screenshot, with the appropriate areas highlighted in yellow:
Any of the items in this list will be hidden from view in the "Project Explorer" tab if their box is checked. So, go through the list in detail and uncheck anything else you might see fit, if applicable. I took a look and left all the rest of my view settings there as-is.
Click the "OK" button when done, and voila!--my nested and previously-added project now shows up in the "Project Explorer" view!
NB: due to some sort of bug in Eclipse, you may have to repeat the above process every time you close and reopen Eclipse. :( But, you can probably do it faster now from the "Recent Filters" section of the 3-dots menu.
Update: it looks like changing the "Projects Presentation" setting from "Hierarchical" to "Flat" blocks this bug and prevents you from having to fix the "Filters and Customization" setting every time you re-open Eclipse.
Here is how: click the 3 vertical dots menu in the "Project Explorer" window --> "Projects Presentation" --> choose "Flat", as shown below:
Other references
Here is the relevant official Eclipse documentation on this: https://help.eclipse.org/: Showing or hiding files in the Project Explorer view:
Showing or hiding files in the Project Explorer view
You can choose to hide system files or generated class files in one of the navigation views. (System files are those that have only a file extension but no file name, for example .classpath.)
On the toolbar for the Project Explorer, click the Menu button Menu button [3 vertical dots] to open the drop-down menu of display options.
Select Filters and Customization..,.
In the dialog box that opens, select the Filters tab and then select the checkboxes for the types of files that you want to hide or define your own name-based filters in the User filters tab.
In addition, you can restrict the displayed files to a working set.
On the toolbar for the Project Explorer, click the Menu button [3 vertical dots] to open the drop-down menu of display options.
Choose Select Working Set...
Select an existing working set from the list or create a new one by selecting New...
My Q&A on how to blur images in GIMP: Graphic Design: How do I do a privacy blur on a section, selection, or region of an image in GIMP?
My personal Eclipse setup document: Eclipse setup instructions on a new Linux (or other OS) computer: Troubleshooting

How to remove additional class drop down in Eclipse Project Explorer view?

In the Project Explorer view of Eclipse Luna, there's an additional drop down for Java files which represents the class inside the file (the green C icon). It expands when I double click to open a class. I don't need this there. Is there a way to filter this out?
Uncheck Preferences / Java / Appearance / "Show members in Package Explorer" checkbox.
It affect both Package and Project explorer.
Preferences windows with that checkbox
It's possible if you use Package Explorer instead of Project Explorer: go to prefs, Java, Appearance and disable "Show members in Package Explorer".
You can disable various elements in the explorer tree via the View config toolbar button (small white triangle on the toolbar just below the Project Explorer tab); select Customize View... then the Content tab; there you can disable, for example, Java Elements. But doing so will hide all Java-related elements from the Project Explorer tree; if you want that, at that point you should just use the Navigator view instead of Project Explorer. Navigator is just a file-system view of the projects.
There is an option for this. Click to three dots on the right top corner in Project Explorer window, click to "Filters and Customisation", then click to "Content" tab. You will see like that things:
Uncheck "Java Elements" (PHP Elements for Eclipse PDT) then clik to OK button. Then you will see that dropdown triangle shit goes to the hell...

Eclipse: How to disable outline tree view for files?

Is there a way to disable the outline tree view for files in Eclipse?
I never use it (on purpose at least) and find it to be quite distracting. (I prefer ctrl + O.)
For the Java Package Explorer, there is an option for this in the Preferences:
Go to Preferences -> Java -> Appearance and un-check 'Show members in Package Explorer'.
Alternatively, most of Eclipse's different navigator views offer the ability to Filter what to display. Click on the small triangular "menu" symbol at the top of the view and select "Customize View", or "Filter", depending on the view. You are then presented with a menu where you call select what to show and what to hide.
This works with the Java Package Explorer, Project Explorer, the general Navigator and also with the PyDev Package Explorer View, and probably a few more. This is a bit more manual, but allows for a finer adjustment. (Options what to show and what to hide differ between the different views.)
The creator of PyDev commented on my bug report and this is how you do it:
Select the PyDev perspective and then the Package Explorer (if not already).
Press CTRL + F10
Click on Customize View.
Select PyDev: Nodes: All
Press OK.

Eclipse does not display /target/classes folder in "project explorer view"

This is what it looks like in project->properties->java Build Path-> source tab . Don't know what I am missing but /target/classes folder is not showing up in "project explorer" view. Can anyone help?
The Project Explorer view defaults to not showing the output folders.
To change this click the small down arrow at the top right of the view and choose the Customize View option. Uncheck the 'Java output folders' option in the filters list.
Note that from Eclipse 2019-12 onwards the small down arrow is replaced by a 'hamburger' menu (three vertical dots).
Try this
Click on Filters and customization and uncheck *.class resources

How to see .htaccess files in Eclipse PDT?

I can't seem to find/view .htaccess files in Eclipse PDT. I looked in the preferences, but couldn't find any relevant options when it came to hiding files. How can I enable this in Eclipse so I can edit .htaccess files?
In the view on the left that shows all your files, click the little white down-arrow button on the view's toolbar. That opens a menu that should have a "filters" or "customize view" option.
In the filters window, uncheck the ".* resources" item. That'll make Eclipse show files whose name begins with a dot.