Commit 2562c7a9 authored by legoc's avatar legoc
Browse files

Filter parent selection

parent 8af67b42
......@@ -1074,6 +1074,15 @@ public class EditorMenuBar extends MenuBar {
// Parent
Label parentLabel = new Label("Parent : ");
ObservableList<String> assemblyComponents = FXCollections.observableArrayList(getAssemblyComponentPathNames());
if (assemblyComponents.isEmpty()) {
Alert emptyAlert = new Alert(AlertType.WARNING);
emptyAlert.setTitle("Error");
emptyAlert.setContentText("Rename the root node, the components can only be added to renamed or added components.");
emptyAlert.showAndWait();
return;
}
ComboBox<String> parentBox = new ComboBox<String>(assemblyComponents);
parentBox.getSelectionModel().select(0);
......@@ -1337,6 +1346,7 @@ public class EditorMenuBar extends MenuBar {
// Set the new name of the component.
component.setName(newComponentName);
component.setRenamed();
// Update the scene.
updateScene();
......@@ -1378,6 +1388,15 @@ public class EditorMenuBar extends MenuBar {
// Parent
Label parentLabel = new Label("New Parent : ");
ObservableList<String> assemblyComponents = FXCollections.observableArrayList(getAssemblyComponentPathNames());
if (assemblyComponents.isEmpty()) {
Alert emptyAlert = new Alert(AlertType.WARNING);
emptyAlert.setTitle("Error");
emptyAlert.setContentText("Rename the root node, the components can only be moved to renamed or added components.");
emptyAlert.showAndWait();
return;
}
ComboBox<String> parentBox = new ComboBox<String>(assemblyComponents);
parentBox.getSelectionModel().select(0);
......@@ -2768,7 +2787,7 @@ public class EditorMenuBar extends MenuBar {
private void getAssemblyComponentPathNames(ArrayList<String> result, Component component) {
// Get the lead component and those that were added.
if (!component.isLeaf() || component.isAdded()) {
if (component.isRenamed() || component.isAdded()) {
result.add(new PathName(component).toString());
}
......
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