-
Notifications
You must be signed in to change notification settings - Fork 116
Description
I have discovered a bug in some of the recent updates to Phoebus. If you right click on a Boolean Button widget (or a Check Box or a Slide Button widget) you no longer get a context menu and I see the following exception in the log:
WARNING [org.csstudio.display.builder.representation] Context menu failure for Widget 'Boolean Button' (bool_button)
java.lang.ClassCastException: class org.csstudio.display.builder.model.properties.ConfirmDialog cannot be cast to class java.lang.Boolean (org.csstudio.display.builder.model.properties.ConfirmDialog is in unnamed module of loader 'app'; java.lang.Boolean is in module java.base of loader 'bootstrap')
at org.csstudio.display.builder.runtime.app.ContextMenuSupport.fillMenu(ContextMenuSupport.java:138)
at org.csstudio.display.builder.runtime.app.ContextMenuSupport$1.handleContextMenu(ContextMenuSupport.java:95)
at org.csstudio.display.builder.representation.ToolkitRepresentation.fireContextMenu(ToolkitRepresentation.java:666)
at org.csstudio.display.builder.representation.javafx.widgets.JFXBaseRepresentation.lambda$createComponents$1(JFXBaseRepresentation.java:140)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
I had a look at the change made to app/display/runtime/src/main/java/org/csstudio/display/builder/runtime/app/ContextMenuSupport.java and can see that it is assuming that prompt.get().getValue() is a boolean. This is the case for most widgets where the property 'Confirmation Dialog' is true/false (e.g. a Choice Button, Action Button), but is not that case for the 3 widgets highlighted (like the Boolean Button) where 'Confirmation Dialog' is actually an option (e.g. 'None', 'On both', 'On set', 'On clear'). As indicated by the exception, it can't convert this to a Boolean and so fails.