Eclipse Project Explorer

The Eclipse Project Explorer adapter identifies workspace resources in Eclipse as traceable artifacts. It also provides access to various properties of these resources.

Data access

The Eclipse Project Explorer data access can be configured to access arbitrary files, folders and projects within the Eclipse workspace. You can define patterns to specify the locations and filenames that will be taken into account.

Configuration

Open the YT configuration with the YT configuration editor, and add a new data access as described in section "Data accesses". Select Eclipse Project Explorer as data access type.

Supported keywords:

  • resource – Resource filter pattern.

Example:

resource /de.itemis.*/*

The above example specifies all resources (i.e., folders, files, and projects) that are located in projects whose names start with de.itemis..

Artifact type

The Eclipse Project Explorer artifact type identifies each of the resources that match the patterns defined in the associated Eclipse Project Explorer data access as an artifact. It supports selection propagation from artifacts in YT to resources in the Project Explorer view in Eclipse and vice versa.

Configuration

Open the YT configuration with the YT configuration editor, and add a new artifact type as described in section "Artifact types". Select your previously-configured Eclipse Project Explorer data access in the Data access drop-down list.

The Eclipse Project Explorer artifact type can be configured to access several properties of these resources, e.g., the type of resource, the date of the last modification, or whether the resource is read-only. You can concatenate these properties with static strings and with each other and assign them to custom attributes of the artifact. You can also define the name of artifacts in the same way. By default, the name of the artifact will be the name of the resource.

For an example, consider that you want the name of each artifact to be the full name of the resource, followed by the type of resource (file, folder, or project) in parentheses. You can concatenate strings as usual with the + operator, and you can access properties with the valueOf keyword, followed by the name of the property in parentheses. For the sake of this example, you can define the artifact name using the following line in the artifact type configuration:

name valueOf(fullName) + " (" + valueOf(type) + ")"

Let us consider that you also want to assign the values of some properties to some custom attributes. You want to have custom attributes containing the path of the resource, the date of the last modification, and – in a single attribute – whether the resource is read-only and whether it is hidden or not. For files, you also want to maintain the file size in an attribute. The following lines in the artifact configuration accomplish this:

map{
	Path to valueOf(path)
	LastModification to valueOf(lastModified)
	State to "read-only: " + valueOf(isReadOnly)+ ", hidden: " + valueOf(isHidden)
	FileSize to valueOf(fileSize) + " bytes"
}
Configuration keywords

The Eclipse Project Explorer artifact type configuration supports the following keywords:

  • map – Maps artifact properties to custom attributes. For each attribute it contains an expression of the form attribute to expression, where attribute is the attribute name and expression defines how the assigned value is computed.
  • name expr – Specifies the name of the artifact as the value the expression expr evaluates to. By default, an artifact’s name is the name of the corresponding resource.
  • valueOf( property) – Refers to the value of the resource property whose name is specified by property. The adapter supports access to the following properties:
    • extension – The filename extension of the resource. This is only relevant for files.
    • fileSize – The size of the resource in bytes, if the resource is a file. Otherwise, the result will be the empty string.
    • fullName – The (full) name oft the resource. In case of files, this includes the filename extension.
    • isArchive – A boolean flag, indicating whether or not the resource is marked as an archive.
    • isDirectory – A boolean flag, indicating whether or not the resource is a directory.
    • isExecutable – A boolean flag, indicating whether or not the resource is marked as an executable file in the file system. Note that Microsoft Windows does not support this flag.
    • isHidden – A boolean flag, indicating whether or not the resource is hidden on the file system level.
    • isReadOnly – A boolean flag, indicating whether or not the resource is read-only.
    • lastModified – The date and time of the last modification of this resource.
    • lastModifiedDate – The date of the last modification of this resource.
    • lastModifiedTime – The time of the last modification of this resource.
    • modificationStamp – The internal resource modification timestamp of the resource in Eclipse.
    • numberOfContents – The number of elements contained in the resource, if the resource is a folder. Otherwise, the result will be the empty string.
    • OSPath – The path to the resource in the format specific to the user’s operating system.
    • path – The platform-independent path to the resource.
    • shortName – The name of the resource without any filename extension.
    • type – The type of the resource. It is either „file”, „folder”, or „project”.

Version

An artifact’s version is used for suspicious links validation. The version of an artifact of this type is its resource modification timestamp.