use of com.archimatetool.editor.diagram.dialog.NewNestedRelationDialog in project archi by archimatetool.
the class CreateNestedArchimateConnectionsWithDialogCommand method createConnectionDialogCommands.
/**
* Child Objects that don't have a relationship set with parent - ask user if they want one
*/
void createConnectionDialogCommands() {
// Gather suitable child objects
List<IDiagramModelArchimateObject> childObjectsForDialog = new ArrayList<IDiagramModelArchimateObject>();
for (IDiagramModelArchimateObject childObject : fChildObjects) {
if (canAddNewRelationship(fParentObject, childObject)) {
childObjectsForDialog.add(childObject);
}
}
// One child object
if (childObjectsForDialog.size() == 1) {
NewNestedRelationDialog dialog = new NewNestedRelationDialog(fParentObject, childObjectsForDialog.get(0));
if (dialog.open() == Window.OK) {
EClass eClass = dialog.getSelectedType();
if (eClass != null) {
Command cmd = new CreateRelationshipAndDiagramArchimateConnectionCommand(fParentObject, childObjectsForDialog.get(0), eClass);
add(cmd);
}
}
} else // More than one child object
if (childObjectsForDialog.size() > 1) {
NewNestedRelationsDialog dialog = new NewNestedRelationsDialog(fParentObject, childObjectsForDialog);
if (dialog.open() == Window.OK) {
List<SelectedRelationshipType> selectedTypes = dialog.getSelectedTypes();
for (SelectedRelationshipType selType : selectedTypes) {
Command cmd = new CreateRelationshipAndDiagramArchimateConnectionCommand(fParentObject, selType.childObject, selType.relationshipType);
add(cmd);
}
}
}
}
Aggregations