Generating code in Eclipse

You can check your model, generate code, and edit the resulting code using Eclipse facilities.

About this task

For detailed instructions describing IBM® Rational® Rhapsody® code generation, see Generating code from a Rational Rhapsody model.

Rational Rhapsody uses an Eclipse IDE project for code generation. Before you can generate code, you must perform the following tasks:

To create IDE projects to use for Rational Rhapsody code generation:

Procedure

  1. In the model browser, right‑click an Eclipse configuration and select Create IDE Project.
  2. If you have an existing Eclipse project in your work area, that project is listed in the Existing Project list. However, you need to create a special Eclipse IDE project, so select the New Project radio button.
  3. Click Finish.
  4. In the New Project window, select the project type based on your environment.
  5. Click Next.
  6. Enter a project name on the Project window and click Next.
  7. If necessary, make a configuration selection on the Select Configurations window, and then click Finish.
  8. If your project type selection is different from your current perspective, an Open Associated Perspective window opens to give you an opportunity to switch perspectives; click Yes. If you want to keep using your currently active perspective, click No.

Results

After setting up the IDE project to receive the generated code, choose Code Generator > Generate and one of these options:

The system generates the requested code and displays messages in a log file.

Note: To show a complete log report, the following figure shows a very short report. Typically, especially for the first code generation, there might be more messages for each group (for example, the listing of code generated might be longer).

Feedback