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 "Lyo/modelling and generation/working from source code"

< Lyo
(Replaced content with "This page has moved to Lyo Designer's new home under the [https://github.com/eclipse/lyo.designer/wiki/Working-from-Source-Code Eclipse Foundation's Github]")
 
Line 1: Line 1:
The instructions below help you setup an eclipse environment for developing or testing the Lyo plugins from the latest available source code.
+
This page has moved to Lyo Designer's new home under the [https://github.com/eclipse/lyo.designer/wiki/Working-from-Source-Code Eclipse Foundation's Github]
 
+
Besides the OSLC4J SDK, the Lyo project contains 2 eclipse plugins that help you develop OSLC-based applications:
+
 
+
# The '''Lyo Modeller''' - allows you to graphically model an oslc4j-based toolchain.
+
# The '''Lyo Code Generator''' - generates java code based on the toolchain model.
+
 
+
The instructions below support three setups that depend on which aspect of the plugins you plan to test or develop:
+
 
+
* '''Scenario1''' - Testing or using the Lyo plugins based on the latest versions of the source code
+
* '''Scenario2''' - Developing the Lyo Modeller plugin (with less concern about the code generation)
+
* '''Scenario3''' - Developing the Code Generator plugin (with less concern about the graphical modelling capabilities)
+
 
+
To simply use the latest plugin release, the reader is referred to the [[Lyo/ToolchainModellingAndCodeGenerationWorkshop|Toolchain Designer workshop on Modelling and Code Generation]] instead.
+
 
+
= Eclipse Setup =
+
 
+
If you desire to work with the source code of the modelling tool, the following once-only installation and configuration of your Eclipse environment are required:
+
 
+
# Make sure your environment is setup for OSLC4J development as instructed on [https://wiki.eclipse.org/Lyo/General_Setup_for_OSLC4J_Development General Setup for OSLC4J development]
+
# Uninstall any current Lyo plugins from your Eclipse workspace
+
#* To avoid confusions, it is recommended to run different Eclipse workspaces for Lyo plugin binaries, and running from source code.
+
# Install the following additional Eclipse packages
+
## Acceleo
+
## Sirius Specifier Environment
+
## A suitable EMF editor such as “EMF Facet SDK”* or ''“EMF - Eclipse Modeling Framework SDK”'' .
+
## Eclipse Plugin Development Environment
+
# Clone the OSLC Tools repository git://git.eclipse.org/gitroot/lyo/org.eclipse.lyo.tools.git
+
# View the Git repository in Eclipse
+
## Open the Git Repositories perspective in Eclipse
+
## Click the '''''Add an existing local Git repository''''' icon.
+
## Select the ''org.eclipse.lyo.tools'' repository
+
## The repository should now show up in your Git Repositories view
+
# Import the necessary Eclipse projects from the Git repository
+
## In the Git Repositories view, right click the org.eclipse.lyo.tools repository and select '''''Import Projects'''''
+
## Select the '''''Import Existing Projects''''' wizard and click '''''next'''''
+
## Select all projects.
+
# Create a new ''Eclipse Application'' configuration called '''Tool Chain Design'''
+
## Select '''Run &gt; Run Configurations …'''
+
## Select '''Eclipse Application'''
+
## Press '''New''' button to create a new configuration
+
## In the new dialog,
+
### Set '''name''' to ''Tool Chain Design''
+
### In Arguments tab, change '''VM argument''' value to ''-Xms256m -Xmx768m''
+
 
+
= Testing or using the Lyo plugins =
+
 
+
To test or use the Lyo plugins based on the latest versions of the source code:
+
 
+
# Run the ''Tool Chain Design'' configuration (created above) in order to run a new Eclipse workspace with the required plugins
+
## Select '''Run &gt; Run Configurations …'''
+
## Select the ''Tool Chain Design'' configuration
+
## Press '''Run'''
+
# In the new ''Tool Chain Design'' Eclipse workspace, switch to the '''Sirius''' perspective
+
# Proceed with the modelling and generation as instructed in the [[Lyo/ToolchainModellingAndCodeGenerationWorkshop#Create_a_Toolchain_Modelling_Project|Toolchain Modelling And Code Generation Workshop]]
+
 
+
= Developing the Lyo Modeller plugin =
+
 
+
To develop the Lyo Modeller plugin (with less concern about the code generation):
+
 
+
# Run the ''Tool Chain Design'' configuration (created above)
+
# create a Toolchain Modelling project as instructed in the [[Lyo/modelling_and_generation/working_from_source_code#Testing_or_using_the_Lyo_plugins|Testing or using the Lyo plugins]] section above.
+
# Switch to the '''Sirius''' perspective
+
# Import the ''org.eclipse.lyo.tools.toolchain.design'' eclipse project into the Eclipse workspace from the OSLC Tools git repository.
+
# open and modify the ''description/ToolChainModel.odesign'' file as necessary.
+
#* You can now see the effects of your changes directly on any opened Lyo Modelling views.
+
 
+
= Developing the Code Generator plugin =
+
 
+
To develop the Code Generator plugin (with less concern about the graphical modelling capabilities):
+
 
+
# In the primary Eclipse workspace, modify the Acceleo template files in the project ''org.eclipse.lyo.tools.oslc4emf.codegenerator'' as necessary.
+
# Build the generator by selecting the menu item '''Project --&gt; Build Project'''
+
 
+
== Configure and run the adaptor generator ==
+
 
+
To run the code generator from soure code, the following steps are needed:
+
 
+
# Define a “run configuration” for adaptor code generation
+
## Select '''Run --&gt; Run Configurations...'''
+
## Select ''Acceleo Application''
+
## Press the '''New launch configuration''' button
+
### '''Name''': something practical such as ''Generate YourProviderProjectName''
+
### '''Project''': select the ''org.eclipse.lyo.oslc4j.codegenerator'' project
+
### '''Main class''': ''org.eclipse.lyo.oslc4j.codegenerator.main.Generate''
+
### '''Model''': the newly created ''adaptormodel'' in the ''YourProviderProjectName'' project
+
### '''Target''': The YourProviderProjectName project
+
### '''Runner''': Acceleo Plug-in Application
+
## Press '''Apply'''
+
## Press '''Close'''.
+
# Once you are satisfied with your model, you can generate the adaptor code:
+
## Select '''Run &gt; Run Configurations …'''
+
## Select the ''Generate YourProviderProjectName'' configuration
+
## Press '''Run'''
+
 
+
== Create a new adaptorInterface model ==
+
 
+
To test the code generator changes, you can run an Acceleo generation configuration on any toolchain model. In most cases, it is more convenient to create the models graphically using the existing Lyo plugins - using another Eclipse workspace with the plugins installed.
+
 
+
You can however create and modify an adaptorInterface model within your source code environment, with the following steps:
+
 
+
# Open the ''adaptorInterface.ecore'' model in the org.eclipse.lyo.oslc4j.adaptormodel project (folder ''model'')
+
# Expand the ecore model until the ''AdaptorInterface'' EClass
+
# Right-click on the AdaptorInterface EClass &amp; select '''Create Dynamic Instance...'''
+
# In the dialog that appears
+
## select the folder ''adaptorModel'' under the ''YourProviderProjectName'' project as the “parent folder”
+
## choose a suitable File name for the adaptor model - ''AdaptorInterface.xmi'' is fine.
+
# Right-click on the newly created ''AdaptorInterface.xmi'' file, and select '''open with --&gt; Other... --&gt; EMF Facet Model Browser'''.
+
 
+
== Problems when composing models ==
+
 
+
Did you compose your model from other models and reference some of its elements in your adaptor model? Currently, the way EMF models reference each other in the xmi files causes problems with the code generator. Before you trigger the code generator, perform the following steps: (These steps need to be repeated if the adaptor model is later changed to include further references).
+
 
+
# Copy the workspace location of any loaded resources (EMF models)
+
## In the ''Project Explorer'' window, right-click on the ''AdaptorInterface.xmi'' file, and select '''open with --&gt; Other ... --&gt; Sample Reflective Ecore Model Editor'''.
+
## In the newly opened window, right-click and select the context menu '''Load Resource …'''
+
## Select '''Browse Workspace...'''
+
## Select the domain specification EMF model that you have earlier loaded.
+
## Copy the path to the xmi file selected into the clipboard (it will be something like ''platform:/resource/org.eclipse.lyo.oslc4j.adaptormodel/model/someSpecification.xmi'')
+
## Press '''Cancel'''.
+
# In the Project Explorer window, right-click on the ''AdaptorInterface.xmi'' file, and select '''open with --&gt; XML Editor'''
+
# Search and replace each ''href'' entry that refers to your domain specification.
+
## Replace href values that look like ''href=&quot;../../org.eclipse.lyo.oslc4j.adaptormodel/model/someSpecification.xmi#//...'' with the copied value (which ought to look more like ''href=“platform:/resource/org.eclipse.lyo.oslc4j.adaptormodel/model/someSpecification.xmi#//...”'').
+
# Repeat these steps for each domain specification model you have loaded and referenced.
+
 
+
== Problems opening an Adaptor Model using the EMF editor ==
+
 
+
When running from source, the metamodels are not available in the Eclipse workspace, which causes errors when trying to open the models using an EMF editor.
+
 
+
Although the models can be used to generate code from, it may sometimes be desired to edit them beforehand.
+
 
+
Edit the models and manually add the pathes as follows:
+
 
+
<pre>&lt;oslc4j_tc:Toolchain ….. xsi:schemaLocation=&quot;http://org.eclipse.lyo/oslc4j/toolChain ../org.eclipse.lyo.oslc4j.adaptormodel/model/toolchain.ecore&quot; …&gt;
+
 
+
&lt;adaptorInterfaces xsi:schemaLocation=&quot;http://org.eclipse.lyo/oslc4j/adaptorInterface ../org.eclipse.lyo.oslc4j.adaptormodel/model/adaptorInterface.ecore&quot; name=&quot;Testing Tool&quot; …</pre>
+

Latest revision as of 09:13, 9 June 2018

This page has moved to Lyo Designer's new home under the Eclipse Foundation's Github

Back to the top