Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "EMF Search---Quick Start Guide"

(Super Bonus : Replace)
(Generate Search Wizard)
Line 53: Line 53:
  
  
Once you generated the Movies Db Model, Edit & Editor plugins, you can right click on the moviesDb.genmodel in the package explorer and invoke "EMF Search > Generate Textual Search Infrastructure"
+
 
 +
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"
  
  
Line 60: Line 61:
  
  
 
+
A Wizard propose EString/String EAttributes coming from packages. You must select one or more of these textual features prior proceeding with Core and/or UI Search infrastructure code generation (Note the two checkbox).
As a result you get a Wizard proposing all EString/String Eattributes coming from the 3 existing packages : db, order, customer. You need to select at least one of these textual features prior proceeding with code generation for Core and/or UI Search infrastructure.
+
  
  
Line 69: Line 69:
  
  
Note that elements to select are only EAttributes of type EString. Coming from this EString EStructuralFeature list, custom code will be generated in two new plugins :
+
Coming from this EString EStructuralFeature list, custom code will be generated in two new plugins :
 +
 
  
 
  org.eclipse.emf.search.tests.movies.search
 
  org.eclipse.emf.search.tests.movies.search
 
  org.eclipse.emf.search.tests.movies.search.ui
 
  org.eclipse.emf.search.tests.movies.search.ui
 
 
  
 
==== Copying Movies DB Data  ====
 
==== Copying Movies DB Data  ====

Revision as of 16:39, 22 April 2008

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


Movies DB Example

Fisrt, you need to grab org.eclipse.emf.search.tests plugin from CVS :

connection : pserver
host : dev.eclipse.org
repository : /cvsroot/modeling
module : org.eclipse.emf/org.eclipse.emf.search/tests/org.eclipse.emf.search.tests
login/pwd : anonymous/anonymous



EMF Search Tests CVS Module



Here is the full directory structure to get in order to be able to replay this "tutorial" :



MoviesDb Containing Plugin


Generate Model, Edit & Editor

In order to avoid generated MoviesDb Search infrastructure staying useless you need first to get Movies Db Model, Edit, Editor plugins generated from GenModel Editor like any other usual EMF projects.



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 3 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 packages. You must select one or more of these textual features prior proceeding with Core and/or UI Search infrastructure code generation (Note the two checkbox).


EMF Search Textual Core and UI Code Generation Wizard


Coming from this EString EStructuralFeature list, custom code will be generated in two new plugins :


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

Copying Movies DB Data

You need to create a new basic project in order storing demo sample data (SimpleMoviesDb for instance) :


CreateSimpleMoviesDbProject.png


Then just copy the content of org.eclipse.emf.search.tests/models/codegen/Movies/data/ in the newly created project :


SimpleMoviesDbPlusDataDir.png


Movies Db Launch Configuration

In order to see your newly generated Movies DB Search in action, you need 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

Now you can open the Movies Db Search Page in your newly started runtime workbench :


MoviesDb Search Drop Down Menu


As a result your custom Movies Db Search Page is displayed in a multi tab dialog :


MoviesDb Customer Textual Query


Note that participant tabs have been created for each of db, customer, order packages plus an additional one containing the union of all the classifiers coming from these 3 packages.


Run A Textual Query On Customer Element

Once you got the cutomer participant tab selected, you could selected Customer element partcipant to get a textual query only qpplied on EString Attribute selected for generation.


As a result you get the customers which textual query matched with previously selected EString attributes.


MoviesDb Customer Textual Query Results


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


MoviesDbCustomerTextualQueryResultsOpenAction.png


450px

Super Bonus : Replace

you can use the "replace..." button and see that you can replace "Peter" by "Lucas" for example ;-)

MoviesDbCustomerTextualReplace.png


MoviesDbCustomerTextualReplace2.png


MoviesDbCustomerTextualReplace3.png


Generated Code Explained

Back to the top