From 41556fc4716ad986593ed453bfaf21318a75edff Mon Sep 17 00:00:00 2001 From: Simon Barner <barner@fortiss.org> Date: Thu, 12 Oct 2023 16:23:03 +0200 Subject: [PATCH] createTreeContextMenu(): receive items as list. The order is relevant. Issue-Ref: 4322 Issue-URL: https://git.fortiss.org/af3/af3/-/issues/4322 Signed-off-by: Simon Barner <barner@fortiss.org> --- .../common/ui/javafx/control/treetableview/.ratings | 2 +- .../control/treetableview/TreeContextMenuItem.java | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/.ratings b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/.ratings index 1446064c3..42056ffcc 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/.ratings +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/.ratings @@ -13,4 +13,4 @@ DynamicTreeViewerBase.java a2013538b62d86f6a09efdf2cd78babac2072484 GREEN EmptyChildrenContentProvider.java 51b4468f9df8423abeea5ac6aa2f6cf99c2eb512 GREEN IDoubleClickHandler.java 447f7769dead9a106b3ea3139ef0da51eb0b9a89 GREEN IDynamicItem.java 083d02459e7ec33542d9910c04abe2581e0b5422 GREEN -TreeContextMenuItem.java bcd64e201b0ad678662aaec485a407092291382e RED +TreeContextMenuItem.java 893b1ca2535bb581e192b0f351429957de6766da YELLOW diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/TreeContextMenuItem.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/TreeContextMenuItem.java index bcd64e201..893b1ca25 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/TreeContextMenuItem.java +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/TreeContextMenuItem.java @@ -18,7 +18,7 @@ package org.fortiss.tooling.common.ui.javafx.control.treetableview; import static javafx.embed.swt.SWTFXUtils.toFXImage; import java.lang.reflect.Constructor; -import java.util.Collection; +import java.util.List; import org.eclipse.jface.resource.ImageDescriptor; @@ -38,7 +38,7 @@ import javafx.scene.image.ImageView; * <li>Subclasses must provide exactly one public constructor that takes the underlying tree element * as single argument.</li> * <li>Instances must be created using factory method - * {@link #createTreeContextMenu(Collection, Object)}.</li> + * {@link #createTreeContextMenu(List, Object)}.</li> * </ul> */ public abstract class TreeContextMenuItem<T> extends MenuItem { @@ -97,11 +97,8 @@ public abstract class TreeContextMenuItem<T> extends MenuItem { * Factory method for a {@link ContextMenu} defined based on {@link TreeContextMenuItem}s. * {@code null} may be used to denote menu separators. */ - // TODO (TM) While this works with sets as well, especially the fact that separators are - // supported indicates that the order of entries is relevant. Hence, it might be better to - // restrict the method to lists rather than collections. public static <T> ContextMenu createTreeContextMenu( - Collection<Class<? extends TreeContextMenuItem<T>>> contextMenuEntryTypes, T element) { + List<Class<? extends TreeContextMenuItem<T>>> contextMenuEntryTypes, T element) { boolean previousWasItem = false; boolean needSeparator = false; -- GitLab