use of com.archimatetool.model.IDiagramModelConnection in project archi by archimatetool.
the class DiagramConnectionSection method createTextPositionComboControl.
private void createTextPositionComboControl(Composite parent) {
createLabel(parent, Messages.DiagramConnectionSection_6, ITabbedLayoutConstants.STANDARD_LABEL_WIDTH, SWT.CENTER);
fComboTextPosition = new Combo(parent, SWT.READ_ONLY);
fComboTextPosition.setItems(comboTextPositionItems);
GridData gd = new GridData(SWT.NONE, SWT.NONE, true, false);
gd.minimumWidth = ITabbedLayoutConstants.COMBO_WIDTH;
fComboTextPosition.setLayoutData(gd);
fComboTextPosition.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
CompoundCommand result = new CompoundCommand();
for (EObject connection : getEObjects()) {
if (isAlive(connection)) {
Command cmd = new ConnectionTextPositionCommand((IDiagramModelConnection) connection, fComboTextPosition.getSelectionIndex());
if (cmd.canExecute()) {
result.add(cmd);
}
}
}
executeCommand(result.unwrap());
}
});
}
use of com.archimatetool.model.IDiagramModelConnection in project archi by archimatetool.
the class DiagramConnectionSection method refreshTextPositionCombo.
protected void refreshTextPositionCombo() {
if (fIsExecutingCommand) {
return;
}
IDiagramModelConnection lastSelectedConnection = (IDiagramModelConnection) getFirstSelectedObject();
int pos = lastSelectedConnection.getTextPosition();
fComboTextPosition.select(pos);
fComboTextPosition.setEnabled(!isLocked(lastSelectedConnection));
}
use of com.archimatetool.model.IDiagramModelConnection in project archi by archimatetool.
the class SketchModelFactory method getNewObject.
public Object getNewObject() {
Object object = IArchimateFactory.eINSTANCE.create(fTemplate);
// Actor
if (object instanceof ISketchModelActor) {
((ISketchModelActor) object).setName(ArchiLabelProvider.INSTANCE.getDefaultName(fTemplate));
} else // Sticky
if (object instanceof ISketchModelSticky) {
ISketchModelSticky sticky = (ISketchModelSticky) object;
sticky.setName(ArchiLabelProvider.INSTANCE.getDefaultName(fTemplate));
sticky.setTextPosition(ITextPosition.TEXT_POSITION_TOP);
sticky.setTextAlignment(ITextAlignment.TEXT_ALIGNMENT_LEFT);
if (fParam instanceof Color) {
String color = ColorFactory.convertColorToString((Color) fParam);
sticky.setFillColor(color);
Color lineColor = ColorFactory.getDefaultLineColor(sticky);
if (lineColor != null) {
sticky.setLineColor(ColorFactory.convertColorToString(lineColor));
}
}
} else // Group
if (object instanceof IDiagramModelGroup) {
IDiagramModelGroup group = (IDiagramModelGroup) object;
group.setName(ArchiLabelProvider.INSTANCE.getDefaultName(fTemplate));
ColorFactory.setDefaultColors(group);
} else // Connection
if (object instanceof IDiagramModelConnection) {
IDiagramModelConnection connection = (IDiagramModelConnection) object;
if (fParam instanceof Integer) {
connection.setType((Integer) fParam);
}
ColorFactory.setDefaultColors(connection);
}
return object;
}
use of com.archimatetool.model.IDiagramModelConnection in project archi by archimatetool.
the class SketchModelFactoryTests method testGetNewObjectConnection.
@Test
public void testGetNewObjectConnection() {
ICreationFactory factory = new SketchModelFactory(IArchimatePackage.eINSTANCE.getDiagramModelConnection(), 2);
IDiagramModelConnection connection = (IDiagramModelConnection) factory.getNewObject();
assertEquals("", connection.getName());
assertEquals(2, connection.getType());
}
use of com.archimatetool.model.IDiagramModelConnection in project archi by archimatetool.
the class ArchimateDiagramModelFactoryTests method testGetNewObjectConnection.
@Test
public void testGetNewObjectConnection() {
ICreationFactory factory = new ArchimateDiagramModelFactory(IArchimatePackage.eINSTANCE.getDiagramModelConnection());
IDiagramModelConnection connection = (IDiagramModelConnection) factory.getNewObject();
assertEquals("", connection.getName());
}
Aggregations