Package org.eclipse.debug.core.sourcelookup.containers

# Class DirectorySourceContainer

java.lang.Object
org.eclipse.core.runtime.PlatformObject
org.eclipse.debug.core.sourcelookup.containers.AbstractSourceContainer
org.eclipse.debug.core.sourcelookup.containers.CompositeSourceContainer
org.eclipse.debug.core.sourcelookup.containers.DirectorySourceContainer

All Implemented Interfaces:
  `IAdaptable`, `ISourceContainer`

public class DirectorySourceContainer extends CompositeSourceContainer
A directory in the local file system. Source elements returned from `findSourceElements(...)` are instances of `LocalFileStorage`.

Clients may instantiate this class.

Since:
  3.0
Restriction:
  This class is not intended to be subclassed by clients.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`TYPE_ID`
Unique identifier for the directory source container type (value `org.eclipse.debug.core.containerType.directory`).

### Fields inherited from class org.eclipse.debug.core.sourcelookup.containers.AbstractSourceContainer

`EMPTY`

## Constructor Summary

Constructors
Constructor
Description
`DirectorySourceContainer(File dir, boolean subfolders)`
Constructs an external folder container for the directory identified by the given file.
`DirectorySourceContainer(IPath dirPath, boolean subfolders)`
Constructs an external folder container for the directory identified by the given path.

## Method Summary

Modifier and Type
Method
Description
`protected ISourceContainer[]`
`createSourceContainers()`
Creates the source containers in this composite container.
`boolean`
`equals(Object obj)`
`Object[]`
`findSourceElements(String name)`
Returns a collection of source elements in this container corresponding to the given name.
`File`
`getDirectory()`
Returns the root directory in the local file system associated with this source container.
`String`
`getName()`
The name of this source container that can be used for presentation purposes.
`ISourceContainerType`
`getType()`
Returns this container's type.
`int`
`hashCode()`
`boolean`
`isComposite()`
Returns whether this container is a composite container.

### Methods inherited from class org.eclipse.debug.core.sourcelookup.containers.CompositeSourceContainer

`dispose, findSourceElements, getSourceContainers`

### Methods inherited from class org.eclipse.debug.core.sourcelookup.containers.AbstractSourceContainer

`abort, getDirector, getSourceContainerType, init, isFindDuplicates, warn`

### Methods inherited from class org.eclipse.core.runtime.PlatformObject

`getAdapter`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.eclipse.core.runtime.IAdaptable

`getAdapter`

## Field Details

### TYPE_ID

public static final String TYPE_ID
Unique identifier for the directory source container type (value `org.eclipse.debug.core.containerType.directory`).

## Constructor Details

### DirectorySourceContainer

public DirectorySourceContainer(IPath dirPath, boolean subfolders)
Constructs an external folder container for the directory identified by the given path.

Parameters:
  `dirPath` - path to a directory in the local file system
  `subfolders` - whether folders within the root directory should be searched for source elements

### DirectorySourceContainer

public DirectorySourceContainer(File dir, boolean subfolders)
Constructs an external folder container for the directory identified by the given file.

Parameters:
  `dir` - a directory in the local file system
  `subfolders` - whether folders within the root directory should be searched for source elements

## Method Details

### getName

public String getName()
Description copied from interface: `ISourceContainer`
The name of this source container that can be used for presentation purposes. For example, the name of a project.

Returns:
  the name of this source container

### getDirectory

public File getDirectory()
Returns the root directory in the local file system associated with this source container.

Returns:
  the root directory in the local file system associated with this source container

### getType

public ISourceContainerType getType()
Description copied from interface: `ISourceContainer`
Returns this container's type.

Returns:
  this container's type

### findSourceElements

public Object[] findSourceElements(String name) throws CoreException
Description copied from interface: `ISourceContainer`
Returns a collection of source elements in this container corresponding to the given name. Returns an empty collection if no source elements are found. This source container's source lookup director specifies if duplicate source elements should be searched for, via `isFindDuplicates()`. When `false` the returned collection should contain at most one source element. If this is a composite container, the containers contained by this container are also searched.

The format of the given name is implementation specific but generally conforms to the format of a file name. If a source container does not recognize the name format provided, an empty collection should be returned. A source container may or may not require names to be fully qualified (i.e. be qualified with directory names).

Specified by:
  `findSourceElements` in interface `ISourceContainer`
Overrides:
  `findSourceElements` in class `CompositeSourceContainer`
Parameters:
  `name` - the name of the source element to search for
Returns:
  a collection of source elements corresponding to the given name
Throws:
  `CoreException` - if an exception occurs while searching for source elements

### isComposite

public boolean isComposite()
Description copied from interface: `ISourceContainer`
Returns whether this container is a composite container. A composite container is composed of other source containers. For example, a workspace source container may be composed of project source containers.

Specified by:
  `isComposite` in interface `ISourceContainer`
Overrides:
  `isComposite` in class `CompositeSourceContainer`
Returns:
  whether this container is a composite container

### equals

public boolean equals(Object obj)

Overrides:
  `equals` in class `Object`

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`

### createSourceContainers

protected ISourceContainer[] createSourceContainers() throws CoreException
Description copied from class: `CompositeSourceContainer`
Creates the source containers in this composite container. Subclasses should override this methods.

Specified by:
  `createSourceContainers` in class `CompositeSourceContainer`
Returns:
  the array of `ISourceContainer`s
Throws:
  `CoreException` - if unable to create the containers