20.1. Advanced SearchReference Projects
Eclipse provides an excellent Java search facility for locating source (see Section 1.6.2, Java Search, on page 30), yet the scope of any search is limited to the projects loaded in the workspace; if a Java class is located in a plug-in's jar file, and the plug-in is not on the Java build path of an open project, then the class will not be found. When building Eclipse plug-ins, it is advantageous to include all Eclipse plug-ins in the search scope, even those not referenced by any projects under development.
One approach is to load all the plug-in projects from the Eclipse CVS server (see Section 20.6.1, Modifying the Eclipse base, on page 727). Unfortunately, this chews up memory and clutters your workspace with hundreds of additional projects.
Another approach is to create binary projects, one for each Eclipse plug-in. To create one or more binary projects, open the PDE > Plug-ins view using the Show View dialog (see Show View in Section 2.5, Installing and Running the Product, on page 86), select the plug-ins to be imported as projects, then right-click and select Import > As Binary Project. Although binary projects take up less memory than source projects, this too will clutter your workspace with hundreds of additional projects.
The approach hereuseful for searching and supporting multiple versions of Eclipse at the same time (see Section 19.2.6, Building against different versions of Eclipse, on page 693)is to create one reference project for each version of Eclipse to be searched. This project contains no source of its own, but contains all the Eclipse plug-ins on its classpath so that a search can include the entire source for Eclipse. To include or exclude a particular version of Eclipse from your searches, simply open or close the corresponding reference project.
To create a reference project, first create a Java project (see Section 1.4.1, Using the new Java Project wizard, on page 19), and then add each jar file in each Eclipse plug-in to the project's Java build path (see Section 1.4.2, .classpath and .project files, on page 22). Adding each plug-in can be a tedious process, so a new project wizard to automate this process was created (see Section 11.2, Wizards, on page 430 for specific information about creating wizards).
A wizard for creating reference projects is available as part of the QualityEclipse Tools plug-in, downloadable from www.qualityeclipse.com/tools.