score:16

Accepted answer

Filters will hide resources from view, but they're still in the project. If you create a project in another location you can create linked resources to the folders you want to include in your project.

For reference I posted another answer that describes how to use linked resources in more detail.

score:0

Right click on the root folder of all the files / folders you want to exclude and select Build Path and exclude

exclude

score:1

The way I've always done it is to explicitly check out projects as peers. e.g:

~/myworkspace/goodproject
~/myworkspace/3rdparty

then import only "goodproject" into eclipse. If "3rdparty" is a subdirectory of goodproject, you can fake it out... Say for example your svn project looks like this:

project/
       src/
          main/
          3rdparty/

You can locally create project/src/ then checkout only the "main" directory, and have eclipse rely on a packaged version (e.g. point to the jar if your project is java).

score:1

If you want to add filters directly inside .project file, these are some rules:

    <type>6</type> <!-- exclude all, files -->
    <type>5</type> <!-- include only, files -->
    <type>13</type> <!-- include only, files and folders -->
    <type>26</type><!-- exclude all, folders, all children -->

    <arguments>1.0-name-matches-false-false-xyz</arguments> <!-- case sensitive=false, regular expression=false, something named=xyz -->
    <arguments>1.0-name-matches-true-false-EEE</arguments> <!-- case sensitive = true, regular expression = false, something named=EEE -->
    <arguments>1.0-name-matches-false-false-www</arguments> <!--case sensitive=false, regular expression = false, something named=www -->

One .project filter section for example:

    <filteredResources>
        <filter>
            <id>1567020347706</id>
            <name></name>
            <type>6</type> <!-- exclude all, files -->
            <matcher>
                <id>org.eclipse.ui.ide.multiFilter</id>
                <arguments>1.0-name-matches-false-false-abc</arguments>
            </matcher>
        </filter>
        <filter>
            <id>1567020347708</id>
            <name></name>
            <type>5</type> <!-- include only, files -->
            <matcher>
                <id>org.eclipse.ui.ide.multiFilter</id>
                <arguments>1.0-name-matches-false-false-xyz</arguments> <!-- case sensitive=false, regular expression=false -->
            </matcher>
        </filter>
        <filter>
            <id>1567020347711</id>
            <name></name>
            <type>13</type>
            <matcher>
                <id>org.eclipse.ui.ide.multiFilter</id>
                <arguments>1.0-name-matches-false-false-mno</arguments>
            </matcher>
        </filter>
        <filter>
            <id>1567020347713</id>
            <name></name>
            <type>26</type><!-- exclude all, folders, all children -->
            <matcher>
                <id>org.eclipse.ui.ide.multiFilter</id>
                <arguments>1.0-name-matches-true-false-EEE</arguments> <!-- case sensitive = true, regular expression = false -->
            </matcher>
        </filter>
        <filter>
            <id>1567020347716</id>
            <name></name>
            <type>26</type> <!-- exclude all, folders, all children -->
            <matcher>
                <id>org.eclipse.ui.ide.multiFilter</id>
                <arguments>1.0-name-matches-false-false-www</arguments> <!-- case sensitive = false, regular expression = false -->
            </matcher>
        </filter>
    </filteredResources>

score:6

Yes, you may place a custom filter on your project. In your project explorer view, there should be a white, downwards pointing arrow near the top of the panel by the Package Explorer tab. Click it, and go to Filters. From there, you can specify certain folder patterns you do not want detected by checking the box next to Name Filter Patterns. In this case, I would put the name of the 3rd party library.

score:202

There is a straight way to do it:

  1. Right-click a project folder in Project Explorer tree and go to "Properties".
  2. Resource -> Resource Filters.
  3. Add as many exclusion filters for files/folders as you like.

P.S. If your project tree is not updated automatically you may have to press F5 while having input focus in Project Explorer window.


Related Query

More Query from same tag