Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

EMF Search---Quick Start Guide

This quick start guide will explain :

  • Steps to generate textual search infrastructure for arbitrary Ecore model (Here MoviesDb)
  • Generated Code and relations to EMF Search framework architecture
  • Explain Extensibility in context of this example
  • Hints for code customizations


Quick Start

This document intent to explain how to generate EMF Search infrastructure from arbitrary Ecore models mainly relying on user defined *.genmodel resources.


Following steps will be described :

  1. Resources retrieval from CVS
  2. Model Plugins Generation
    1. Model
    2. Edit
    3. Editor
  3. Search Infrastructure Generation Configuration
    1. Select textual features to consider
    2. Select infrastructure to generate : Core and/or UI
  4. Runtime Launch Configuration Setting
  5. Setup Environment Setting
    1. Create new project
    2. Copy sample data
  6. Generated Feature Integrity Verification
    1. Run a simple test query
    2. Verify results consistency
    3. Go back to editor by clicking

Eclipse Live Demo

Here are links to screencast & demos in case you don't like to read :

Eclipse Live Demo : Textual Search/Replace Infrastructure Generation
Direct Access to screencast


Movies DB Example Plugin CVS Retrieval

You first need org.eclipse.emf.search.tests plugin from CVS :


module : org.eclipse.emf/org.eclipse.emf.search/tests/org.eclipse.emf.search.tests


EMF CVS How To : Checking Out Code as an Anonymous User


Directory structure needed for the example :


MoviesDb Containing Plugin


Generate Model, Edit & Editor

First step consist in generating MoviesDb Model, Edit, Editor plugins from GenModel Editor like any other usual EMF projects. (Eg. right click on MoviesDb GenModel element)



Generate Model, Edit, Editor Plugins from GenModel Editor


(Note that you could be able to generate search stuff without these plugins existing, but the demo need these Movies Db plugins at runtime).

Generate Search Wizard

Once you generated Movies DB Model, Edit & Editor plugins, right click on moviesDb.genmodel in package explorer and select "EMF Search > Generate Textual Search Infrastructure"


EMF Search Textual Core and UI Code Generation Action


A Wizard propose EString/String EAttributes coming from analyzed packages.


EMF Search Textual Core and UI Code Generation Wizard


You must select one or more of proposed textual features prior proceeding with Core and/or UI Search infrastructure code generation (Note the two checkbox : Core & UI).


Coming from this EString EStructuralFeature selection, Search infrastructure custom code will be generated in two new plugins (one if only one checkbox selected) :


org.eclipse.emf.search.tests.movies.search
org.eclipse.emf.search.tests.movies.search.ui


Copying Movies DB Sample Data

You need to create a project and to copy demo sample data. Name the project "SimpleMoviesDb" or whatever you like :


CreateSimpleMoviesDbProject.png


Copy all *.movies, *.customers, *.orders from org.eclipse.emf.search.tests/models/codegen/Movies/data/ to new project :


SimpleMoviesDbPlusDataDir.png

Movies Db Launch Configuration

Testing your newly generated Movies DB Search in action require to create a new launch configuration :


MoviesDb Runtime Launch Configuration


Be sure the following pluins are checked in the "plugins" tab :


org.eclipse.emf.search.tests.movies
org.eclipse.emf.search.tests.movies.edit
org.eclipse.emf.search.tests.movies.editor
org.eclipse.emf.search.tests.movies.search
org.eclipse.emf.search.tests.movies.search.ui


Open Movies DB Search Page

Open the Movies Db Search Page in your newly started runtime workbench (Ctrl + H) :


MoviesDb Search Drop Down Menu


Custom Movies Db Search Page is displayed in a multi tab dialog :


MoviesDb Customer Textual Query


Participant tabs have been created for each of the 3 packages plus an additional one containing the union of all the classifiers.


Run A Textual Query On Customer Element

Once you got the cutomer participant tab selected, you can selected Customer as unique element partcipant to laucnh a textual query.

This query will only be applied on EString EAttributes previously selected for Search plugins code generation.


MoviesDb Customer Textual Query Results


The query result gives you the customers instances which textual query expression matched previously selected EString attributes current values.


After clicking on given result, Peter for example, you get the corresponding element selected in customer legacy Ecore editor:


MoviesDbCustomerTextualQueryResultsOpenAction.png


450px


Super Bonus : Replace

Using "replace..." button allows you to replace "Peter" by "Lucas" for example ;-)


MoviesDbCustomerTextualReplace.png


MoviesDbCustomerTextualReplace2.png


MoviesDbCustomerTextualReplace3.png

Generated Code Explained

To be continued ...

Back to the top