For Java, you need access to the element filter .
It may be present for other plugins, for example, DB Explorer :

This illustrates how to specify a name / regular expression for all directories that you do not want to see (exclude) in the package explorer.
source share