Attention

This document was written for an old version of Plone, Plone 3, and was last updated 1204 days ago.

To learn how to upgrade to the current version of Plone, read the upgrade manual.

Searching multiple files

by Mikko Ohtamaa last modified Feb 04, 2009 03:08 AM
With large Python codebase, like Plone, you often need to search all the files to find a specific function or definition. Eclipse's internal search function is very flexible and valuable tool here.

Traditionally Plone and Zope code trees are searched using *grep* command line tool. With Eclipse, this is not needed anymore. The internal search feature can accomplist all the same things as grep, but much easier.

Eclipse provides two different search and replace functions:

* *Edit -> Find*: find/replace in the open file. Find acts like any normal text editor find feature.

* *Search -> Search*: search/replace in a the specific file set.

Search is a bit more complicated in Eclipse. Search comes handy, when you are debugging or studying the codebase. Often Plone and Zope lack proper code documentation and in many cases you don't know

1. what is the type of the object you are manipulating

2. what is the return type of the fuction you are calling

3. what are the parameter types and parameter options of the function you are calling

Working sets
------------

Working sets are another Eclipse specific concept. Instead of slow search through all 10 000 Zope and Plone files once, you can select different subsets of workspace files for search target. For example, one could have working sets of

* Zope and Plone Python files e.g. *products/omelette* tree with filemask \*.py

* Templates and styles, CSS and TAL files

* Your in-development products

Creating and managing working sets can be done in Resource Explorer or inline through Search dialog.


Contribute

Something wrong or out of date? Anybody can edit or create a new article in the knowledge base. Simply create an account on this site, log in, and click the Edit button to contribute.