Skip to content

cobigen eclipse_usage

Fabian Kreis edited this page Jun 26, 2015 · 19 revisions

Usage

CobiGen has two different generation modes depending on the input selected for generation. The first one is the simple mode, which will be started if the input contains only one input artifact, e.g. for Java an input artifact currently is a Java file. The second one is the batch mode, which will be started if the input contains multiple input artifacts, e.g. for Java this means a list of files. In general this means also that the batch mode might be started when selecting complex models as inputs, which contain multiple input artifacts. The latter scenario has only been covered in the research group,yet.

Simple Mode

Selecting the menu entry Generate…​ the generation wizard will be opened:

generate wizard page1

The left side of the wizard shows all available increments, which can be selected to be generated. Increments are a container like concept encompassing multiple files to be generated, which should result in a semantically closed generation output. On the right side of the wizard all files, which might be effected by the generation. Dependent on the increment selection on the left side, potenially effected files will be shown on the right side. The type of modification of each file will be encoded into following color scheme if the files are selected for generation:

  • green: files, which are currently non-existent in the file system. These files will be created during generation

  • yellow: files, which are currently existent in the file system and which are configured to be merged with generated contents.

  • red: files, which are currently existent in the file system. These files will be overwritten if manually selected.

  • no color: files, which are currently existent in the file system. Additionally files, which were unselected and thus will be ignored during generation.

Selecting an increment on the left side will initialize the selection of all shown files to be generated on the right side, whereas green and yellow categorized files will be selected intially. A manual modification of the pre-selection can be performed by switching to the customization tree using the Customize button on the right lower corner.

Optional: If you want to customize the generation object model of a Java input class, you might continue with the Next > button instead of finishing the generation wizard. The next generation wizard page is currently available for Java file inputs and lists all non-static fields of the input. Unselecting entries will lead to an adapted object model for generation, such that unselected fields will be removed in the object model for generation. By default all fields will be included in the object model.

Using the Finish button, the generation will be performed. Finally, CobiGen runs the eclipse internal organize imports and format source code for all generated sources and modified sources. Thus it is possible, that---especially organize imports opens a dialog if some types could not be determined automatically. This dialog can be easily closed by pressing on Continue. If the generation is finished, the Success! dialog will pop up.

Batch mode

Are there multiple input elements selected, e.g., Java files, CobiGen will be started in batch mode. For the generation wizard dialog this means, that the generation preview will be contrained to the first selected input element. It does not preview the generation for each element of the selection or of a complex input. The selection of the files to be generated will be generated for each input element analogously afterwards.

generate wizard page1 batch

Thus the color encoding differs also a little bit:

  • yellow: files, which are configured to be merged.

  • red: files, which are not configured with any merge strategy and thus will be created if the file does not exist or overwritten if the file already exists

  • no color: files, which will be ignored during generation

Initially all possible files to be generated will be selected.

Health Check

To check whether CobiGen can run appropriately for the selected element(s) the user can perform a Health Check clicking on the respective menu entry.

image:https://cloud.githubusercontent.com/assets/1427255/8206537/c9e500aa-14fa-11e5-9f54-7e8f5e9a9e2b.png [start Health Check]

The check includes 3 steps. As long as any of these steps fail, the Generate button is grayed out.

The first step is to check whether there are templates available. If this check fails you see the following message:

image:images/health_check_no_templates.png [no Templates]

This means that there is no Project available with the name Cobigen\_Templates. In this case it might be necessary to import such a template project. For more information see Eclipse Installation

The second step is to check whether the template project includes a valid context.xml. If this check fails you see the following message:

image:images/health_check_invalid_config.png [invalid config]

This means that either your config.xml does not exist (or has another name) or it is not valid. It might also happen that you see the following message:

image:images/health_check_old_context.png [outdated config]

This means that your config.xml is available with the correct name but is outdated (belongs to an older CobiGen version). In this case just click on Upgrade Context Configuration to get the latest version.

The third step checks whether there are templates for the selected element(s). If this check fails you see the following message:

image:images/health_check_no_matching_triggers.png [no triggers]

This means, that there are no templates found which match the selection. The reason might be that your selection is faulty or that you imported the wrong template project (e.g. you are working on a OASP project, but imported the Templates for the Register Factory).

If all the checks are passed you see the following message:

image:images/health_check_all_OK.png [OK]

In this case everything is OK and the Generate button is not grayed out anymore so thtat you are able to trigger it and see the generation wizard (see above). You also have the opportunity to do an Advanced Health Check:

image:images/health_check_advanced_up_to_date.png [advanced check]

Clone this wiki locally