Please refer to astah* API JavaDoc for each interface and method.
Creating/Deleting presentation are supported in astah* UML and professional. (ER Diagram is supported in astah* professional only.)
Class Diagram/Object Diagram | ClassDiagramEditor |
UseCase Diagram | UseCaseDiagramEditor |
Statemachine Diagram | StateMachineDiagramEditor |
Activity Diagram | ActivityDiagramEditor |
Sequence Diagram | SequenceDiagramEditor |
Composite Structure Diagram | CompositeStructureDiagramEditor |
ER Diagram | ERDiagramEditor |
Mind Map | MindmapEditor |
Requirement Diagram | RequirementDiagramEditor |
public INodePresentation createNotePresentation(IDiagram dgm, String note, Point2D location) throws ClassNotFoundException, InvalidEditingException, InvalidUsingException { INodePresentation ps = null; ClassDiagramEditor cde = AstahAPI.getAstahAPI().getProjectAccessor().getDiagramEditorFactory().getClassDiagramEditor(); try { TransactionManager.beginTransaction(); //set diagram cde.setDiagram(dgm); //create presentation ps = cde.createNote(note, location); TransactionManager.endTransaction(); } catch (InvalidEditingException e) { e.printStackTrace(); TransactionManager.abortTransaction(); } return ps; } |
public ILinkPresentation createNoteAnchorPresentation(IDiagram dgm, INodePresentation note, IPresentation annotatedElement) throws ClassNotFoundException, InvalidEditingException, InvalidUsingException { ILinkPresentation ps = null; ClassDiagramEditor cde = AstahAPI.getAstahAPI().getProjectAccessor().getDiagramEditorFactory().getClassDiagramEditor(); try { TransactionManager.beginTransaction(); //set diagram cde.setDiagram(dgm); //create presentation ps = cde.createNoteAnchor(note, annotatedElement); TransactionManager.endTransaction(); } catch (InvalidEditingException e) { e.printStackTrace(); TransactionManager.abortTransaction(); } return ps; } |
public INodePresentation createClassPresentation(IDiagram dgm, IClass iClass, Point2D location) throws ClassNotFoundException, InvalidEditingException, InvalidUsingException { INodePresentation ps = null; ClassDiagramEditor cde = AstahAPI.getAstahAPI().getProjectAccessor().getDiagramEditorFactory().getClassDiagramEditor(); try { TransactionManager.beginTransaction(); //set diagram cde.setDiagram(dgm); //create presentation ps = cde.createNodePresentation(iClass, location); TransactionManager.endTransaction(); } catch (InvalidEditingException e) { e.printStackTrace(); TransactionManager.abortTransaction(); } return ps; } |
public INodePresentation createClassModelAndPresentation(IDiagram dgm, String className, Point2D location) throws ClassNotFoundException, InvalidEditingException, InvalidUsingException { INodePresentation ps = null; BasicModelEditor bme = AstahAPI.getAstahAPI().getProjectAccessor().getModelEditorFactory().getBasicModelEditor(); ClassDiagramEditor cde = AstahAPI.getAstahAPI().getProjectAccessor().getDiagramEditorFactory().getClassDiagramEditor(); try { TransactionManager.beginTransaction(); //create model IClass iClass = bme.createClass(project, className); //set diagram cde.setDiagram(dgm); //create presentation ps = cde.createNodePresentation(iClass, location); TransactionManager.endTransaction(); } catch (InvalidEditingException e) { e.printStackTrace(); TransactionManager.abortTransaction(); } return ps; } |
public ILinkPresentation createAssociationPresentation(IDiagram dgm, IAssociation iAssociation, INodePresentation sourcePs, INodePresentation targetPs) throws ClassNotFoundException, InvalidEditingException, InvalidUsingException { ILinkPresentation ps = null; ClassDiagramEditor cde = AstahAPI.getAstahAPI().getProjectAccessor().getDiagramEditorFactory().getClassDiagramEditor(); try { TransactionManager.beginTransaction(); //set diagram cde.setDiagram(dgm); //create presentation ps = cde.createLinkPresentation(iAssociation, sourcePs, targetPs); TransactionManager.endTransaction(); } catch (InvalidEditingException e) { e.printStackTrace(); TransactionManager.abortTransaction(); } return ps; } |
public INodePresentation createUseCasePresentation(IDiagram dgm, IUseCase iUseCase, Point2D location) throws ClassNotFoundException, InvalidEditingException, InvalidUsingException { INodePresentation ps = null; UseCaseDiagramEditor cde = AstahAPI.getAstahAPI().getProjectAccessor().getDiagramEditorFactory().getUseCaseDiagramEditor(); try { TransactionManager.beginTransaction(); //set diagram cde.setDiagram(dgm); //create presentation ps = cde.createNodePresentation(iUseCase, location); TransactionManager.endTransaction(); } catch (InvalidEditingException e) { e.printStackTrace(); TransactionManager.abortTransaction(); } return ps; } |
public ILinkPresentation createExtendPresentation(IDiagram dgm, IExtend iExtend, INodePresentation sourcePs, INodePresentation targetPs) throws ClassNotFoundException, InvalidEditingException, InvalidUsingException { ILinkPresentation ps = null; UseCaseDiagramEditor cde = AstahAPI.getAstahAPI().getProjectAccessor().getDiagramEditorFactory().getUseCaseDiagramEditor(); try { TransactionManager.beginTransaction(); //set diagram cde.setDiagram(dgm); //create presentation ps = cde.createLinkPresentation(iExtend, sourcePs, targetPs); TransactionManager.endTransaction(); } catch (InvalidEditingException e) { e.printStackTrace(); TransactionManager.abortTransaction(); } return ps; } |
public INodePresentation createStatePresentation(IDiagram dgm, String stateName, INodePresentation parent, Point2D location) throws ClassNotFoundException, InvalidEditingException, InvalidUsingException { INodePresentation ps = null; StateMachineDiagramEditor ste = AstahAPI.getAstahAPI().getProjectAccessor().getDiagramEditorFactory().getStateMachineDiagramEditor(); try { TransactionManager.beginTransaction(); //set diagram ste.setDiagram(dgm); //create presentation ps = ste.createState(stateName, parent, location); TransactionManager.endTransaction(); } catch (InvalidEditingException e) { e.printStackTrace(); TransactionManager.abortTransaction(); } return ps; } |
public ILinkPresentation createTransitionPresentation(IDiagram dgm, INodePresentation sourcePs, INodePresentation targetPs) throws ClassNotFoundException, InvalidEditingException, InvalidUsingException { ILinkPresentation ps = null; StateMachineDiagramEditor ste = AstahAPI.getAstahAPI().getProjectAccessor().getDiagramEditorFactory().getStateMachineDiagramEditor(); try { TransactionManager.beginTransaction(); //set diagram ste.setDiagram(dgm); //create presentation ps = ste.createTransition(sourcePs, targetPs); TransactionManager.endTransaction(); } catch (InvalidEditingException e) { e.printStackTrace(); TransactionManager.abortTransaction(); } return ps; } |
public INodePresentation createActionPresentation(IDiagram dgm, String name, Point2D location) throws ClassNotFoundException, InvalidUsingException { INodePresentation ps = null; ActivityDiagramEditor ade = AstahAPI.getAstahAPI().getProjectAccessor().getDiagramEditorFactory().getActivityDiagramEditor(); try { TransactionManager.beginTransaction(); // set diagram ade.setDiagram(dgm); // create presentation ps = ade.createAction(name, location); TransactionManager.endTransaction(); } catch (InvalidEditingException e) { e.printStackTrace(); TransactionManager.abortTransaction(); } return ps; } |
public INodePresentation createLifelinePresentation(IDiagram dgm, String name, double locX) throws ClassNotFoundException, InvalidUsingException { INodePresentation ps = null; SequenceDiagramEditor sde = AstahAPI.getAstahAPI().getProjectAccessor().getDiagramEditorFactory().getSequenceDiagramEditor(); try { TransactionManager.beginTransaction(); // set diagram sde.setDiagram(dgm); // create presentation ps = sde.createLifeline(name, locX); TransactionManager.endTransaction(); } catch (InvalidEditingException e) { e.printStackTrace(); TransactionManager.abortTransaction(); } return ps; } |
public INodePresentation createCombinedFragmentPresentation(IDiagram dgm, String name, String interactionOperator, Point2D location, double width, double height) throws ClassNotFoundException, InvalidUsingException { INodePresentation ps = null; SequenceDiagramEditor sde = AstahAPI.getAstahAPI().getProjectAccessor().getDiagramEditorFactory().getSequenceDiagramEditor(); try { TransactionManager.beginTransaction(); // set diagram sde.setDiagram(dgm); // create presentation ps = sde.createCombinedFragment(name, interactionOperator, location, width, height); TransactionManager.endTransaction(); } catch (InvalidEditingException e) { e.printStackTrace(); TransactionManager.abortTransaction(); } return ps; } |
public INodePresentation createClassPresentation(IDiagram dgm, IClass iClass, Point2D location) throws ClassNotFoundException, InvalidEditingException, InvalidUsingException { INodePresentation ps = null; CompositeStructureDiagramEditor cse = AstahAPI.getAstahAPI().getProjectAccessor().getDiagramEditorFactory().getCompositeStructureDiagramEditor(); try { TransactionManager.beginTransaction(); //set diagram cse.setDiagram(dgm); //create presentation ps = cse.createStructuredClassPresentation(iClass, location); TransactionManager.endTransaction(); } catch (InvalidEditingException e) { e.printStackTrace(); TransactionManager.abortTransaction(); } return ps; } |
public INodePresentation createPartPresentation(IDiagram dgm, IClass parentClass, IClass partBaseClass, INodePresentation parentClassPresentation, String partName, Point2D location) throws ClassNotFoundException, InvalidEditingException, InvalidUsingException { INodePresentation ps = null; BasicModelEditor bme = ModelEditorFactory.getBasicModelEditor(); CompositeStructureDiagramEditor cse = AstahAPI.getAstahAPI().getProjectAccessor().getDiagramEditorFactory().getCompositeStructureDiagramEditor(); try { TransactionManager.beginTransaction(); IAssociation asso = bme.createAssociation(parentClass, partBaseClass, "", "", partName); IAttribute[] memberEnds = asso.getMemberEnds(); memberEnds[0].setComposite(); //set diagram cse.setDiagram(dgm); //create presentation ps = cde.createNodePresentation(memberEnds[1], parentClassPresentation, location); TransactionManager.endTransaction(); } catch (InvalidEditingException e) { e.printStackTrace(); TransactionManager.abortTransaction(); } return ps; } |
public INodePresentation createExternalPartPresentation(IDiagram dgm, IClass partBaseClass, INodePresentation parentClassPresentation, IClass externalPartBaseClass, IAttribute part1, String externalPartName, Point2D location) throws ClassNotFoundException, InvalidEditingException, InvalidUsingException { INodePresentation ps = null; BasicModelEditor bme = ModelEditorFactory.getBasicModelEditor(); CompositeStructureDiagramEditor cse = AstahAPI.getAstahAPI().getProjectAccessor().getDiagramEditorFactory().getCompositeStructureDiagramEditor(); try { TransactionManager.beginTransaction(); IAssociation asso = bme.createAssociation(partBaseClass, externalPartBaseClass, "", "", externalPartName); IAttribute[] memberEnds = asso.getMemberEnds(); IConnector connector = csme.createConnector(part1, null, memberEnds[1], null); //set diagram cse.setDiagram(dgm); //create presentation ps = cde.createNodePresentation(memberEnds[1], parentClassPresentation, location); TransactionManager.endTransaction(); } catch (InvalidEditingException e) { e.printStackTrace(); TransactionManager.abortTransaction(); } return ps; } |
public INodePresentation createPortPresentation(IDiagram dgm, INodePresentation parentNode) throws ClassNotFoundException, InvalidEditingException, InvalidUsingException { INodePresentation ps = null; CompositeStructureDiagramEditor cse = AstahAPI.getAstahAPI().getProjectAccessor().getDiagramEditorFactory().getCompositeStructureDiagramEditor(); try { TransactionManager.beginTransaction(); //set diagram cse.setDiagram(dgm); //create presentation ps = cse.createPortPresentation(parentNode); TransactionManager.endTransaction(); } catch (InvalidEditingException e) { e.printStackTrace(); TransactionManager.abortTransaction(); } return ps; } |
public INodePresentation createEREntityPresentation(IDiagram dgm, IEREntity iEREntity, Point2D location) throws ClassNotFoundException, InvalidEditingException, InvalidUsingException { INodePresentation ps = null; ERDiagramEditor ede = AstahAPI.getAstahAPI().getProjectAccessor().getDiagramEditorFactory().getERDiagramEditor(); try { TransactionManager.beginTransaction(); //set diagram ede.setDiagram(dgm); //create presentation ps = ede.createNodePresentation(iEREntity, location); TransactionManager.endTransaction(); } catch (InvalidEditingException e) { e.printStackTrace(); TransactionManager.abortTransaction(); } return ps; } |
public ILinkPresentation createERRelationshipPresentation(IDiagram dgm, IERRelationship iERRelationship, INodePresentation sourcePs, INodePresentation targetPs) throws ClassNotFoundException, InvalidEditingException, InvalidUsingException { ILinkPresentation ps = null; ERDiagramEditor ede = AstahAPI.getAstahAPI().getProjectAccessor().getDiagramEditorFactory().getERDiagramEditor(); try { TransactionManager.beginTransaction(); //set diagram ede.setDiagram(dgm); //create presentation ps = ede.createLinkPresentation(iERRelationship, sourcePs, targetPs); TransactionManager.endTransaction(); } catch (InvalidEditingException e) { e.printStackTrace(); TransactionManager.abortTransaction(); } return ps; } |
public INodePresentation createTopicPresentation(IMindMapDiagram dgm, String topicName) throws InvalidUsingException, ClassNotFoundException { INodePresentation ps = null; MindmapEditor mme = AstahAPI.getAstahAPI().getProjectAccessor().getDiagramEditorFactory().getMindmapEditor(); try { TransactionManager.beginTransaction(); //set diagram mme.setDiagram(dgm); INodePresentation iRootTopic = dgm.getRoot(); //create presentation ps = mme.addChild(iRootTopic, topicName); TransactionManager.endTransaction(); } catch (InvalidEditingException e) { e.printStackTrace(); TransactionManager.abortTransaction(); } return ps; } |
public ILinkPresentation createMMLinkPresentation(IDiagram dgm, INodePresentation sourcePs, INodePresentation targetPs) throws ClassNotFoundException, InvalidUsingException { ILinkPresentation ps = null; MindmapEditor mme = AstahAPI.getAstahAPI().getProjectAccessor().getDiagramEditorFactory().getMindmapEditor(); try { TransactionManager.beginTransaction(); //set diagram mme.setDiagram(dgm); //create presentation ps = mme.createMMLinkPresentation(sourcePs, targetPs); TransactionManager.endTransaction(); } catch (InvalidEditingException e) { e.printStackTrace(); TransactionManager.abortTransaction(); } return ps; } |
public INodePresentation createRequirementPresentation(IDiagram dgm, IRequirement iRequirement, Point2D location) throws ClassNotFoundException, InvalidEditingException, InvalidUsingException { INodePresentation ps = null; RequirementDiagramEditor rde = AstahAPI.getAstahAPI().getProjectAccessor().getDiagramEditorFactory().getRequirementDiagramEditor(); try { TransactionManager.beginTransaction(); //set diagram rde.setDiagram(dgm); //create presentation ps = rde.createNodePresentation(iRequirement, location); TransactionManager.endTransaction(); } catch (InvalidEditingException e) { e.printStackTrace(); TransactionManager.abortTransaction(); } return ps; } |
private void deletePresentation(IDiagram diagram, IPresentation ps) throws ClassNotFoundException, InvalidEditingException, InvalidUsingException { ERDiagramEditor editor = DiagramEditorFactory.getERDiagramEditor(); try { TransactionManager.beginTransaction(); editor.setDiagram(diagram); editor.deletePresentation(ps); TransactionManager.endTransaction(); } catch (InvalidEditingException e) { e.printStackTrace(); TransactionManager.abortTransaction(); } } |