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 "EEF/Tutorials/First Generation"

< EEF
(EEF Generation in EMF tree editor)
(EEF Generation in EMF tree editor)
Line 36: Line 36:
  
 
Here is an exmaple for the demo project :
 
Here is an exmaple for the demo project :
{{{<extension
+
 
 +
<extension
 
         point="org.eclipse.emf.eef.runtime.PropertiesEditionProvider">
 
         point="org.eclipse.emf.eef.runtime.PropertiesEditionProvider">
 
   <PropertiesEditionComponentProvider
 
   <PropertiesEditionComponentProvider
Line 54: Line 55:
 
   </PropertiesEditionPartProvider>
 
   </PropertiesEditionPartProvider>
 
  </extension>
 
  </extension>
}}}
+
 
  
 
Extension points to declare properties views in the editor project have also to be added. They are generated and are in the file "src-gen/properties.plugin.xml". For example :
 
Extension points to declare properties views in the editor project have also to be added. They are generated and are in the file "src-gen/properties.plugin.xml". For example :
{{{<extension
+
<extension
 
         point="org.eclipse.ui.views.properties.tabbed.propertyContributor">
 
         point="org.eclipse.ui.views.properties.tabbed.propertyContributor">
 
       <propertyContributor
 
       <propertyContributor
Line 121: Line 122:
 
       </propertySections>
 
       </propertySections>
 
   </extension>
 
   </extension>
}}}
 

Revision as of 06:43, 9 September 2009

Presentation

This first tutorial will show you the common use of EEF. It describes the step to obtains the EEF models and generate the associated. Finally, It shows how to link the generated code with a simple treeview EMF editor.

Tutorial

First you have to do this tutorial in a "EEF ready" environment. To obtain this environment, read the EEF Installation Guide.

EEF Models initialization

In the EEF environment, the first step is to initialize the EEF models. These models describe the visual elements of the generated editing components and the binding between these elements and the meta-classes of your meta-model. EEF provides an action to create these models. To call this action, perform a right click on the genmodel of your metamodel and lauch the action EEF > Initialize EEF models.

InitializeEEFmodels.png

Generation and parameterization

The initializer has just created elements for meta-class attributes choosing predefined default widgets. So you need to parametrize models to model correctly the generation, for example, references representations, widgets changes.

By default, the generation is done in the plug-in where is the example model and the parametrization model assigns a "src-gen" directory to know where the code is going to be generated. This information can be modified.

When parametrization is done, generation can be done with the action "Generate EEF Architecture" on the right click on the EEFGen model.

GenerateEEFArchitecture.png

The generation create an architecture displaying properties views corresponding to the parameterized models which have :

  • Components for the control part
  • Parts for views
  • Providers for the structure instantiation

Global providers are also generated. They defined the instantiation strategy of the structure and the elements edition. This two providers have to be declared in the plugin.xml file with the extension points defined by EEF runtime (explained in the next part : EEF generation with EMF tree editor).

EEF Generation in EMF tree editor

  • Add dependency on EEF runtime

In order to compile the code generation, the plug-in with the generated code must have a dependency on the EEF runtime : "org.eclipse.emf.eef.runtime". The tree editor has also to depend on it.

  • Extension points declaration

For the generation, EEF creates two generic providers which have to be configured with extension points in the project where the code is generated. The extension point declare a "PropertiesEditionProviders" and a "PropertieEditionPolicyProviders".

Here is an exmaple for the demo project :

<extension
       point="org.eclipse.emf.eef.runtime.PropertiesEditionProvider">
  <PropertiesEditionComponentProvider
       providerClass="org.eclipse.emf.eef.nonreg.providers.NonregPackagePropertiesEditionProvider">
  </PropertiesEditionComponentProvider>
</extension>
<extension
     point="org.eclipse.emf.eef.runtime.PropertiesEditionPolicyProvider">
  <PropertiesEditionPolicyProvider
       providerClass="org.eclipse.emf.eef.nonreg.providers.NonregPackagePropertiesEditionPolicyProvider">
  </PropertiesEditionPolicyProvider>
</extension>
<extension
     point="org.eclipse.emf.eef.runtime.PropertiesEditionPartProvider">
  <PropertiesEditionPartProvider
       providerClass="org.eclipse.emf.eef.nonreg.providers.NonregPropertiesEditionPartProvider">
  </PropertiesEditionPartProvider>
</extension>


Extension points to declare properties views in the editor project have also to be added. They are generated and are in the file "src-gen/properties.plugin.xml". For example :

<extension
        point="org.eclipse.ui.views.properties.tabbed.propertyContributor">
     <propertyContributor
           contributorId="org.eclipse.emf.eef.components.properties">
        <propertyCategory
              category="default">
        </propertyCategory>
        <propertyCategory
              category="extended">
        </propertyCategory>
        <propertyCategory
              category="advanced">
        </propertyCategory>
     </propertyContributor>
  </extension>
  <extension
        point="org.eclipse.ui.views.properties.tabbed.propertyTabs">
     <propertyTabs
           contributorId="org.eclipse.emf.eef.components.properties">
        <propertyTab
              label="Base"
              category="default"
              id="Base">
        </propertyTab>
     </propertyTabs>
  </extension>
  <extension
        point="org.eclipse.ui.views.properties.tabbed.propertySections">
     <propertySections
           contributorId="org.eclipse.emf.eef.components.properties">
        <propertySection
              tab="Base"
              class="org.eclipse.emf.eef.runtime.ui.properties.sections.PropertiesEditionSection"
              id="org.eclipse.emf.eef.components.section.PropertiesEditionContext">
            <input
                   type="org.eclipse.emf.eef.components.PropertiesEditionContext">
            </input>
        </propertySection>
        <propertySection
              tab="Base"
              class="org.eclipse.emf.eef.runtime.ui.properties.sections.PropertiesEditionSection"
              id="org.eclipse.emf.eef.components.section.PropertiesEditionComponent">
            <input
                   type="org.eclipse.emf.eef.components.PropertiesEditionComponent">
            </input>
        </propertySection>
        <propertySection
              tab="Base"
              class="org.eclipse.emf.eef.runtime.ui.properties.sections.PropertiesEditionSection"
              id="org.eclipse.emf.eef.components.section.PropertiesEditionElement">
            <input
                   type="org.eclipse.emf.eef.components.PropertiesEditionElement">
            </input>
        </propertySection>
        <propertySection
              tab="Base"
              class="org.eclipse.emf.eef.runtime.ui.properties.sections.PropertiesEditionSection"
              id="org.eclipse.emf.eef.components.section.PropertiesMultiEditionElement">
            <input
                   type="org.eclipse.emf.eef.components.PropertiesMultiEditionElement">
            </input>
        </propertySection>
     </propertySections>
  </extension>

Copyright © Eclipse Foundation, Inc. All Rights Reserved.