Manage View

To manage the view of Astah Instance or diagrams-view, you use the View Manager.
With the View Manager, you can customize the view to the Project View, Diagram Editor and Extra View (only through the Plug-ins).

astah screen

View Manager

You can get the View Manager with ProjectAccessor#getViewManager().

View InterfaceView

Each view manager can perform the following operations.

View Manager Target View What you can do
IProjectViewManager Project View Select Models in the Structure Tree, show properties of selected models..etc.
IDiagramViewManager Diagram Editor Open and close a specific diagram, get currently-opened diagram, zoom, move selected diagram to the center…etc.
IExtraViewManager Extra View Show/hide the Extra View
IIconManager - Get Icons.

Example

This is an example of opening a diagram with a specific presentation located in the center of the diagrams (Reference: AstahAccessor.java of Bookmark Plugin).

    public boolean selectPresentation(String[] classIdList) {

        try {
            ProjectAccessor projectAccessor = ProjectAccessorFactory.getProjectAccessor();
            IPresentation[] selectPresentation = getPresentation(classIdList);

            if (selectPresentation != null && selectPresentation.length > 0) {
                IDiagramViewManager dvm = projectAccessor.getViewManager().getDiagramViewManager();
                dvm.open(selectPresentation[0].getDiagram());
                dvm.showInDiagramEditor(selectPresentation[0]);
                dvm.select(selectPresentation);
            } else {
                // not exist presentation
                return false;
            }

        } catch (Exception exp) {
            exp.printStackTrace();
        }

        return true;
    }