Source

The source layer can be any library giving access to the source code that is represented in the UML diagrams. It basically provides the possibility to read and write source files and the containing directory structures. In case of the Java support it is the JDT (see 3.1), which gives convenient access to the Java source in the Eclipse workspace.

Figure 4.2: Class diagram of the source layer for Java.
Image overview_source

We mainly used the part of JDT that is build around the interface IJavaElement. It has many derived interfaces where each presents a part of Java source code. Figure 4.2 shows an extract of it.

ICompilationUnit presents classes and interfaces and normally has a corresponding .java file. IPackageFragment is a package, e.g. "org.jupe" and usually has a corresponding directory in the file system. As they are both interfaces they can't be created directly, but using the JavaCore class. It provides create() methods that construct them from a given IFile or IFolder, the representations of files and directories in the Eclipse API. Additionally, JDT provides IMethod to access methods and IField for attributes of a class or interface. Each interface offers getters to obtain the most important properties, like the name or visibility.

The mentioned interfaces are handlers, so they can exist without a corresponding file or directory in the physical file system.

Michael Pradel 2006-06-01