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"

(Open Movies DB Search Page)
m (Eclipse Live Demo)
 
(33 intermediate revisions by the same user not shown)
Line 7: Line 7:
  
  
=== Movies DB Example ===
+
=== 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 :
 +
 
 +
#Resources retrieval from CVS
 +
#Model Plugins Generation
 +
##Model
 +
##Edit
 +
##Editor
 +
#Search Infrastructure Generation Configuration
 +
##Select textual features to consider
 +
##Select infrastructure to generate : Core and/or UI
 +
#Runtime Launch Configuration Setting
 +
#Setup Environment Setting
 +
##Create new project
 +
##Copy sample data
 +
#Generated Feature Integrity Verification
 +
##Run a simple test query
 +
##Verify results consistency
 +
##Go back to editor by clicking
 +
 
 +
==== Eclipse Live Demo ====
 +
 
 +
 
 +
Here are links to screencast & demos in case you don't like to read :
 +
 
 +
[http://live.eclipse.org/node/515 Eclipse Live Demo : Textual Search/Replace Infrastructure Generation]
 +
[http://74.53.13.78/eclipse/EMFSearch/EMFSearchCodegen.htm Direct Access to screencast]
 +
 
 +
 
 +
==== Movies DB Example Plugin CVS Retrieval ====
 +
 
 +
 
 +
 
 +
You first need org.eclipse.emf.search.tests plugin from CVS :
 +
 
  
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
 
  module : org.eclipse.emf/org.eclipse.emf.search/tests/org.eclipse.emf.search.tests
login/pwd : anonymous/anonymous
 
  
[[Image:EMFSearchTestsCVSModule.png|230px|EMF Search Tests CVS Module]]
 
  
Here is the full directory structure to get in order to be able to replay this "tutorial" :
+
[http://wiki.eclipse.org/EMF/Getting_Source#Checking_Out_Code_as_an_Anonymous_User EMF CVS How To : Checking Out Code as an Anonymous User]
 +
 
 +
 
 +
 
 +
Directory structure needed for the example :
 +
 
 +
 
  
 
[[Image:MoviesDbContainingPlugin.png|270px|MoviesDb Containing Plugin]]
 
[[Image:MoviesDbContainingPlugin.png|270px|MoviesDb Containing Plugin]]
 +
  
  
 
==== Generate Model, Edit & Editor ====
 
==== 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.
+
 
 +
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)
 +
 
 +
 
 +
 
  
 
[[Image:GenerateMoviesDbModelEditAndEditorPlugins.png|450px|Generate Model, Edit, Editor Plugins from GenModel Editor]]
 
[[Image:GenerateMoviesDbModelEditAndEditorPlugins.png|450px|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).
+
 
 +
 
 +
(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 ====
 
==== Generate Search Wizard ====
  
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"
 +
 
 +
 
  
 
[[Image:EMFSearchCodegenAction.PNG|450px|EMF Search Textual Core and UI Code Generation Action]]
 
[[Image:EMFSearchCodegenAction.PNG|450px|EMF Search Textual Core and UI Code Generation Action]]
  
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.
+
 
 +
 
 +
A Wizard propose EString/String EAttributes coming from analyzed packages.
 +
 
 +
 
  
 
[[Image:GenerateSearchCoreAndUIWizard.png|450px|EMF Search Textual Core and UI Code Generation Wizard]]
 
[[Image:GenerateSearchCoreAndUIWizard.png|450px|EMF Search Textual Core and UI Code Generation Wizard]]
  
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 :
+
 
 +
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
 
  org.eclipse.emf.search.tests.movies.search.ui
 
  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 :
 +
 +
 +
 +
[[Image:CreateSimpleMoviesDbProject.png|450px]]
 +
 +
 +
 +
Copy all *.movies, *.customers, *.orders from org.eclipse.emf.search.tests/models/codegen/Movies/data/ to new project :
 +
 +
 +
 +
[[Image:SimpleMoviesDbPlusDataDir.png|320px]]
  
 
==== Movies Db Launch Configuration ====
 
==== Movies Db Launch Configuration ====
  
In order to see your newly generated Movies DB Search in action, you need to create a new launch configuration :
+
 
 +
 
 +
Testing your newly generated Movies DB Search in action require to create a new launch configuration :
 +
 
 +
 
  
 
[[Image:MoviesDbRuntimeLaunchConfiguration.png|450px|MoviesDb Runtime Launch Configuration]]
 
[[Image:MoviesDbRuntimeLaunchConfiguration.png|450px|MoviesDb Runtime Launch Configuration]]
 +
 +
  
 
Be sure the following pluins are checked in the "plugins"  tab :
 
Be sure the following pluins are checked in the "plugins"  tab :
 +
  
 
  org.eclipse.emf.search.tests.movies
 
  org.eclipse.emf.search.tests.movies
Line 60: Line 145:
 
  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
 +
 +
  
 
==== Open Movies DB Search Page ====
 
==== Open Movies DB Search Page ====
  
Now you can open the Movies Db Search Page in your newly started runtime workbench :
+
 
 +
 
 +
Open the Movies Db Search Page in your newly started runtime workbench (Ctrl + H) :
 +
 
 +
 
  
 
[[Image:MoviesDbSearchDropDownMenu.png|400px|MoviesDb Search Drop Down Menu]]
 
[[Image:MoviesDbSearchDropDownMenu.png|400px|MoviesDb Search Drop Down Menu]]
  
As a result your custom Movies Db Search Page is displayed in a multi tab dialog :
+
 
 +
 
 +
Custom Movies Db Search Page is displayed in a multi tab dialog :
 +
 
 +
 
  
 
[[Image:MoviesDbCustomerTextualQuery.png|450px|MoviesDb Customer Textual Query]]
 
[[Image:MoviesDbCustomerTextualQuery.png|450px|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.
+
 
 +
 
 +
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 ====
 
==== 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.
+
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.
 +
 
 +
 
 +
 
 +
[[Image:MoviesDbCustomerTextualQueryResults.png|450px|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:
 +
 
 +
 
 +
 
 +
[[Image:MoviesDbCustomerTextualQueryResultsOpenAction.png|450px]]
 +
 
 +
 
 +
 
 +
[[Image:MoviesDbCustomerFinalSelectionToViewer.png|450px]]
 +
 
 +
 
 +
 
 +
==== Super Bonus : Replace ====
 +
 
 +
 
 +
Using "replace..." button allows you to replace "Peter" by "Lucas" for example ;-)
 +
 
 +
 
 +
 
 +
[[Image:MoviesDbCustomerTextualReplace.png|450px]]
 +
 
 +
 
 +
 
 +
[[Image:MoviesDbCustomerTextualReplace2.png|450px]]
 +
 
 +
 
 +
 
 +
[[Image:MoviesDbCustomerTextualReplace3.png|450px]]
 +
 
 +
=== Generated Code Explained ===
 +
 
 +
To be continued ...

Latest revision as of 06:16, 24 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


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