Delete a diagram

Transaction operation is required when creating/editing/deleting diagrams.
Please refer to Transaction Operations.

Sample Code A: Deleting diagram

public void deleteDiagram(IDiagram diagram) 
        throws ClassNotFoundException, InvalidUsingException {
    ProjectAccessor projectAccessor =  AstahAPI.getAstahAPI().getProjectAccessor();
    BlockDefinitionDiagramEditor bdde = projectAccessor.getDiagramEditorFactory().getBlockDefinitionDiagramEditor();
    try {
        TransactionManager.beginTransaction();
        bdde.setDiagram(diagram);
        bdde.deleteDiagram();
        TransactionManager.endTransaction();
    } catch (InvalidEditingException e) {
        e.printStackTrace();
        TransactionManager.abortTransaction();
    }
}

Sample Code B: Deleting diagram

public void deleteDiagram(IDiagram diagram) 
        throws ClassNotFoundException, InvalidUsingException {
    ProjectAccessor projectAccessor =  AstahAPI.getAstahAPI().getProjectAccessor();
    BlockDefinitionDiagramEditor bdde = projectAccessor.getDiagramEditorFactory().getBlockDefinitionDiagramEditor();
    try {
        TransactionManager.beginTransaction();
        bdde.delete(diagram);
        TransactionManager.endTransaction();
    } catch (InvalidEditingException e) {
        e.printStackTrace();
        TransactionManager.abortTransaction();
    }
}