Search Your Model Repositories
Christian W. Damus
The first new feature of CDO model repository integration in the Luna release of Papyrus has landed: model search.
As usual, I have recorded a short video demonstrating this new feature.
In the Kepler release, Papyrus added text-based and OCL-based searching of models in the Papyrus Search tab of the Eclipse Search dialog. Naturally, this only covered searching models in the workspace.
Now, with the latest nightly build of Papyrus and the latest integration build of CDO (yes, both are required!), you can start searching models in your repository by matching substrings or regular expressions (case-insensitive or not) against:
- element name
- all string-valued attributes of each element
- specific attributes (string-valued or not) of specific kinds of elements — the "Advanced" mode
Searches can be scoped to:
- the workspace: all currently connected repositories, including all open projects in the local workspace
- the selection: selected repositories, folders, and models in the Model Repositories view
Search results are shown as usual in the Search view and expand to show how individual attributes matched. Double-clicking a search result navigates to that element in the model, opening it in an editor first, if necessary. When a repository connection is closed, all search results from that repository are purged from the Search view.
Searches are implemented using CDO's awesome server-side OCL query capability, by generating OCL query expressions based on the search criteria specified by the user in the UI. CDO's OCL support was already pretty awesome in the Kepler release, but it is made even awesomer by a couple of new enhancements in Luna implemented to assist applications like Papyrus:
- using CDO's standard query parameter API it is now possible to specify an implicit root
EClass
for objects. This is often used to make the operations defined byEObject
easily accessible in your OCL expresions — cf. bug 416366 - the OCL environment in the CDO server now provides two additional operations on the
OclAny
class to simplify querying — cf. bug 416474cdoAllProperContents(OclType)
— gathers all instances of a given type within a resource as a collection of that typecdoMatches(String)
— efficiently determines whether any string attribute of an object matches a regular expression
Download a build (you will need CDO, the Papyrus main build, and the CDO integration feature from the "Papyrus Extra" build) and start searching! Or wait for M2 of the Luna Modeling package if you're patient. See bug 415371 for details.