2. Start Poseidon in Eclipse

Before you can work with the Poseidon Eclipse integration, you must start the Poseidon application inside Eclipse. The following sections outline the three possible scenarios.

2.1. New Eclipse Project, New Poseidon Model

Poseidon projects exist somewhat independently from Eclipse projects, yet are closely related. The Poseidon project is stored as a part of the Eclipse project, but the .zuml file can be opened and edited as usual by a standalone version of Poseidon. Each Eclipse project may have only one Poseidon project.

Because the Poseidon projects are part of the Eclipse project, the source directories defined in Eclipse will be the source directories available to Poseidon. You can add, edit, and delete source directories from Project | Properties | Java Build Path | Source.

2.1.1. Create a Project from Scratch

  1. Click the 'New Project' button.

  2. Select 'Java Project' from the New Project Wizard.

  3. Name the new project. Although it is possible to use the project root as the source folder, separate source and output folders are highly recommended; if the project root is used as the source folder, roundtrip will open with an error message and the project root will have to be explicitly set in the resulting dialog.

  4. Select 'Show UML Model' from the new project's context menu to open the associated model.

2.2. Existing Poseidon Model

The simplest way to incorporate an existing Poseidon project into Eclipse is to directly import the UML model. As each Eclipse project can have at most one UML model, if a model currently exists for the Eclipse project, you will be asked for permission to overwrite it. If you decline to overwrite, the import will be cancelled.

To import a UML model:

  1. Open or create an Eclipse project.

  2. Right-click on the project name and show the UML model.

  3. Poseidon will start if it isn't running already, and the UML menu option will appear. Select Import UML Project... from this menu. Note that the project will be imported into the current UML project displayed, regardless of the project selected in the Eclipse navigator.

  4. A dialog will open where you can save changes to the project - you must select 'No'. If you save the changes to the model, the UML project will not be imported.

  5. Roundtrip is enabled and the synchronization dialog appears because there are elements in the model that do not exist in the generated code. Click 'Synchronize Source Code' to generate the code for these model elements.

  6. If the Eclipse project had elements like packages and classes prior to the import, you will be asked to import these into the Poseidon model. Click 'Synchronize Model' to import them into Poseidon.

  7. Now that they have been added to the model, Poseidon has added identification information to these elements and therefore the source does not match the Eclipse source. Click 'Synchronize Source Code' once again to update the source in Eclipse.

It is possible to merge an existing .zuml file into the current UML model. Simply select UML | File | Merge Project into Current and then select the desired .zuml file from the file chooser.

You can also add a UML model to the Eclipse project by creating a directory called 'uml' in your Eclipse workspace directory under the project directory. Copy the desired .zuml file to this directory, keeping in mind that only one .zuml file may exist here. Refresh the Eclipse navigator with F5 to see the new directory.

Note that double-clicking the UML model name will open the model in standalone Poseidon. To open the model in Eclipse, use the 'Show UML Model' option from the context menu.

2.3. Existing Eclipse Project

Select the Eclipse project in the Eclipse navigator panel, then select 'Show UML Model' from the context menu of the project. An empty UML model is created. To see the code from the Eclipse project in Poseidon, you must now import the code. See Section 3.1, “Importing Source Code”.