|
23 | 23 | import com.ss.editor.ui.css.CssClasses; |
24 | 24 | import com.ss.editor.ui.util.DynamicIconSupport; |
25 | 25 | import com.ss.rlib.ui.util.FXUtils; |
| 26 | +import com.ss.rlib.util.array.Array; |
26 | 27 | import javafx.collections.ObservableList; |
27 | 28 | import javafx.scene.control.*; |
28 | 29 | import javafx.scene.image.ImageView; |
|
32 | 33 | import org.jetbrains.annotations.NotNull; |
33 | 34 | import org.jetbrains.annotations.Nullable; |
34 | 35 |
|
| 36 | +import java.util.function.Consumer; |
35 | 37 | import java.util.function.Supplier; |
36 | 38 |
|
37 | 39 | /** |
|
42 | 44 | public abstract class BaseMaterialFileEditor<T extends BaseMaterialEditor3DPart, S extends EditorMaterialEditorState, C extends ChangeConsumer> extends |
43 | 45 | Advanced3DFileEditorWithSplitRightTool<T, S> { |
44 | 46 |
|
| 47 | + private static class MaterialSettingsNodeTree<C extends ChangeConsumer> extends NodeTree<C> { |
| 48 | + |
| 49 | + public MaterialSettingsNodeTree(@NotNull final Consumer<Array<Object>> selectionHandler, @Nullable final C consumer) { |
| 50 | + super(selectionHandler, consumer); |
| 51 | + } |
| 52 | + |
| 53 | + @Override |
| 54 | + @FxThread |
| 55 | + protected @NotNull SelectionMode getSelectionMode() { |
| 56 | + return SelectionMode.SINGLE; |
| 57 | + } |
| 58 | + } |
| 59 | + |
45 | 60 | /** |
46 | 61 | * The default state of editor light. |
47 | 62 | */ |
@@ -141,7 +156,7 @@ protected boolean handleKeyActionImpl(@NotNull final KeyCode keyCode, final bool |
141 | 156 | protected void createToolComponents(@NotNull final EditorToolComponent container, @NotNull final StackPane root) { |
142 | 157 | super.createToolComponents(container, root); |
143 | 158 |
|
144 | | - settingsTree = new NodeTree<>(this::selectedFromTree, getChangeConsumer()); |
| 159 | + settingsTree = new MaterialSettingsNodeTree<>(this::selectedFromTree, getChangeConsumer()); |
145 | 160 | propertyEditor = new PropertyEditor<>(getChangeConsumer()); |
146 | 161 | propertyEditor.prefHeightProperty().bind(root.heightProperty()); |
147 | 162 |
|
@@ -177,12 +192,14 @@ protected void createToolComponents(@NotNull final EditorToolComponent container |
177 | 192 | } |
178 | 193 |
|
179 | 194 | /** |
180 | | - * Handle selected object from tree. |
| 195 | + * Handle selected objects from tree. |
181 | 196 | * |
182 | | - * @param object the selected object. |
| 197 | + * @param objects the selected objects. |
183 | 198 | */ |
184 | 199 | @FxThread |
185 | | - private void selectedFromTree(@Nullable final Object object) { |
| 200 | + private void selectedFromTree(@NotNull final Array<Object> objects) { |
| 201 | + |
| 202 | + final Object object = objects.first(); |
186 | 203 |
|
187 | 204 | Object parent = null; |
188 | 205 | Object element; |
|
0 commit comments