Chapter 14. Builders, Markers, and Natures


Incremental project builders, also knows as builders, automatically execute whenever a resource in an associated project changes. For example, when a Java source file is created or revised, Eclipse's incremental Java compiler annotates the source file and generates a class file. Because Java class files can be entirely regenerated by the compiler from the Java source files, they are known as derived resources.

Markers are used to annotate locations within a resource. For example, the Eclipse Java compiler annotates source files by adding markers to indicate compilation errors, deprecated member usage, bookmarks, and so on. These markers show up along the left margin, which is sometimes referred to as the gutter, when editing a Java file, and in the Problems view or Tasks view as appropriate.

Project natures are used to associate projects and builders (see Figure 14-1). The Java nature of a project makes it a Java project and associates the Eclipse incremental Java compiler.

Figure 14-1. Builders and natures.


The goal of this chapter is to discuss builders, markers, and natures in the context of a new plugin.properties file auditor in the Favorites product. The properties auditor is implemented as a builder and cross-references property keys in the plugin.xml with entries in the plugin.properties file. Markers are used to report problems that the auditor finds; keys in the plugin.xml that are not declared in the plugin.properties file are marked as missing, while keys in the plugin.properties file that are not referenced in the plugin.xml file are marked as unused. A new project nature is created to associate the auditor with a project.



Eclipse(c) Building Commercial-Quality Plug-ins
Eclipse: Building Commercial-Quality Plug-ins (2nd Edition)
ISBN: 032142672X
EAN: 2147483647
Year: 2004
Pages: 200

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net