Commit 1e897d19 authored by legoc's avatar legoc
Browse files

Do not regroup components before the modification of an axis

parent 58afe4b4
......@@ -183,50 +183,19 @@ public class EditorMenuBar extends MenuBar {
}
Component modifiedComponent = null;
if(selectRoots.size() > 1) {
Alert alert = new Alert(AlertType.CONFIRMATION);
Alert alert = new Alert(AlertType.INFORMATION);
alert.setTitle(addAxisItem.getText());
alert.setContentText("Several components are selected, do you want to regroup them ?");
Optional<ButtonType> res = alert.showAndWait();
if (res.isPresent()) {
if (res.get() == ButtonType.OK) {
boolean sameParent = true;
Iterator<Component> it = selectRoots.iterator();
Component curComp = it.next();
Component parent = curComp.getParent();
while (it.hasNext()) {
curComp = it.next();
sameParent &= (curComp.getParent() == parent);
}
if (!sameParent) {
Alert depthAlert = new Alert(AlertType.ERROR);
depthAlert.setTitle(addAxisItem.getText());
depthAlert.setContentText("The selected components do not have the same parent.");
depthAlert.showAndWait();
return;
}
if (parent == null) {
Logger.getLogger("nomad-3d").severe("Several roots selected when modifying axis");
return;
}
modifiedComponent = parent.insertBlock(selectRoots, false);
// Visual update
updateScene();
Nomad3DEditor.getInstance().getModel().addToSelection(modifiedComponent);
} else {
return;
}
}
alert.setContentText("Select only one component.");
alert.showAndWait();
} else {
modifiedComponent = selectRoots.iterator().next();
}
if (modifiedComponent == null) {
Alert alert = new Alert(AlertType.ERROR);
alert.setTitle(addAxisItem.getText());
alert.setContentText("Unable to get the targeted component.");
alert.showAndWait();
return;
}
final Component selectedComponent = modifiedComponent;
Axis modifiedAxis = null;
if (selectedComponent != null) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment