use of com.archimatetool.model.IDiagramModelNote in project archi by archimatetool.
the class ArchimateDiagramModelFactory method getNewObject.
public Object getNewObject() {
if (fTemplate == null) {
return null;
}
Object object = IArchimateFactory.eINSTANCE.create(fTemplate);
// Connection created from Relationship Template
if (object instanceof IArchimateRelationship) {
return createDiagramModelArchimateConnection((IArchimateRelationship) object);
} else // Archimate Diagram Object created from Archimate Element Template
if (object instanceof IArchimateElement) {
IArchimateElement element = (IArchimateElement) object;
element.setName(ArchiLabelProvider.INSTANCE.getDefaultName(fTemplate));
return createDiagramModelArchimateObject(element);
} else // Group
if (object instanceof IDiagramModelGroup) {
IDiagramModelGroup group = (IDiagramModelGroup) object;
group.setName(ArchiLabelProvider.INSTANCE.getDefaultName(fTemplate));
ColorFactory.setDefaultColors(group);
((IDiagramModelGroup) object).setTextAlignment(ITextAlignment.TEXT_ALIGNMENT_LEFT);
} else // Note
if (object instanceof IDiagramModelNote) {
ColorFactory.setDefaultColors((IDiagramModelObject) object);
((IDiagramModelNote) object).setTextAlignment(ITextAlignment.TEXT_ALIGNMENT_LEFT);
} else // Connection
if (object instanceof IDiagramModelConnection) {
ColorFactory.setDefaultColors((IDiagramModelConnection) object);
}
return object;
}
use of com.archimatetool.model.IDiagramModelNote in project archi by archimatetool.
the class PropertiesLabelProviderTests method testGetTextNote.
@Test
public void testGetTextNote() {
// Text for diagram model
IDiagramModelNote note = IArchimateFactory.eINSTANCE.createDiagramModelNote();
String text = provider.getText(new StructuredSelection(note));
assertEquals("Note", text);
// Text for EditPart
NoteEditPart editPart = new NoteEditPart();
editPart.setModel(note);
text = provider.getText(new StructuredSelection(editPart));
assertEquals("Note", text);
}
Aggregations