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).
View Manager
You can get the View Manager with ProjectAccessor#getViewManager().
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 {
= ProjectAccessorFactory.getProjectAccessor();
ProjectAccessor projectAccessor [] selectPresentation = getPresentation(classIdList);
IPresentation
if (selectPresentation != null && selectPresentation.length > 0) {
= projectAccessor.getViewManager().getDiagramViewManager();
IDiagramViewManager dvm .open(selectPresentation[0].getDiagram());
dvm.showInDiagramEditor(selectPresentation[0]);
dvm.select(selectPresentation);
dvm} else {
// not exist presentation
return false;
}
} catch (Exception exp) {
.printStackTrace();
exp}
return true;
}