(例)クラス図/オブジェクト図の作成
public IDiagram createClassDiagram(IModel project, String diagramName) throws InvalidUsingException, ClassNotFoundException { ProjectAccessor projectAccessor = AstahAPI.getAstahAPI().getProjectAccessor(); ClassDiagramEditor cde = projectAccessor.getDiagramEditorFactory().getClassDiagramEditor(); try { TransactionManager.beginTransaction(); IDiagram iClassDiagram = cde.createClassDiagram(project, diagramName); TransactionManager.endTransaction(); return iClassDiagram; } catch (InvalidEditingException e) { e.printStackTrace(); TransactionManager.abortTransaction(); } } |
public void deleteDiagram(IDiagram diagram) throws ClassNotFoundException, InvalidUsingException { ProjectAccessor projectAccessor = AstahAPI.getAstahAPI().getProjectAccessor(); ClassDiagramEditor cde = projectAccessor.getDiagramEditorFactory().getClassDiagramEditor(); try { TransactionManager.beginTransaction(); cde.setDiagram(diagram); cde.deleteDiagram(); TransactionManager.endTransaction(); } catch (InvalidEditingException e) { e.printStackTrace(); TransactionManager.abortTransaction(); } } |
public void deleteDiagram(IDiagram diagram) throws ClassNotFoundException, InvalidUsingException { ProjectAccessor projectAccessor = AstahAPI.getAstahAPI().getProjectAccessor(); ClassDiagramEditor cde = projectAccessor.getDiagramEditorFactory().getClassDiagramEditor(); try { TransactionManager.beginTransaction(); cde.delete(diagram); TransactionManager.endTransaction(); } catch (InvalidEditingException e) { e.printStackTrace(); TransactionManager.abortTransaction(); } } |