Access project

To get or modify models using Astah API, you need to access the project first.

How to access a project

In order to access a project, you need to use ProjectAccessor.

You can access only one project at a time. So when you want to edit more than one project, make sure you open only one project at a time, and close before you move to another. Here’s a sample for how to use ProjectAccessor.

// Getting ProjectAccessor
ProjectAccessor projectAccessor = AstahAPI.getAstahAPI().getProjectAccessor();

try {

    // Register a project
    if (new File(PROJECT_PATH).exists()) {
        System.out.println("Opening Project : " + PROJECT_PATH);;
    } else {
        System.out.println("Creating Project : " + PROJECT_PATH);

    // Reference process

    // Editing process

    // Save the project
    if (!projectAccessor.isProjectModified()) {
    System.out.println("Save the project.");;

} finally {

    // Close a Project
    System.out.println("Closed the project.");


Get project models

All the models and presentations exist in the Project Model which can be accessed by calling ProjectAccessor#getProject().

public IModel getProjectModel(ProjectAccessor projectAccessor) throws ProjectNotFoundException {
    return projectAccessor.getProject();