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 the currently-opened diagram, zoom, move the 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 [] selectPresentations = getPresentation(classIdList);
IPresentation
if (selectPresentations != null && selectPresentations.length > 0) {
= projectAccessor.getViewManager().getDiagramViewManager();
IDiagramViewManager dvm .open(selectPresentations[0].getDiagram());
dvm.showInDiagramEditor(selectPresentations[0]);
dvm.select(selectPresentations);
dvm} else {
// not exist presentation
return false;
}
} catch (Exception exp) {
.printStackTrace();
exp}
return true;
}