Project context service

Modelio v3.5

The Project context service can be used to get information about the project opened in Modelio:
– the Project context service interface is IProjectStructure.
– the IProjectStructure instance can be obtained from the IModuleContext of the module.

Available data is represented by the following diagram:

fig 1

The following code snippet lists the Project context available data.

 1IModule myModule = MyModule.getInstance();
 2IProjectContext project = myModule.getModuleContext().getProjectStructure();
 4System.out.println("Current project:");
 5System.out.println("  name = " + project.getName());
 6System.out.println("  path = " + project.getPath());
 8// Display the modules of the project
 9for (IModuleStructure module : project.getModules() ) {
10   System.out.printf("  %s %s\n", module.getName(), module.getVersion());
13// Display the model fragments
14for (IFragmentStructure fragment : project.getfragments() ) {
15   System.out.printf("  %s %s %s\n", fragment.getName(), fragment.getType(), fragment.getRemoteLocation());

line 1: Get the unique instance of our module
line 2: Get the IProjectContext instance from the module context
lines 5,6,10,15: Use the different accessors to retrieve the information about the project

See System.out limitations

ProjectStructure.png (13 KB) Philippe Vlaemynck, 03 February 2016 13:28