mattcasters commented on code in PR #8532:
URL: https://github.com/apache/hop/pull/8532#discussion_r4083671449
##########
ui/src/main/java/org/apache/hop/ui/hopgui/file/shared/HopGuiAbstractGraph.java:
##########
@@ -172,6 +172,28 @@ protected boolean useContextMenu(boolean emptyCanvas) {
return !emptyCanvas || GraphPalette.isVisible();
}
+ /** Whether the user left this kind of canvas tooltip on in the Look &
Feel options. */
+ protected boolean isToolTipShown(CanvasToolTip toolTip) {
+ return hopGui.getProps().isCanvasToolTipShown(toolTip);
Review Comment:
**[bug]** `isToolTipShown` only reads the per-kind preference, so it does
not implement the new contract that `PropsUi.showToolTips()` turns every canvas
tooltip off.
Hover text still disappears when the general option is off, because both
`setToolTip` methods return before they build a tip. The selection-cleared
notice does not. `HopGuiPipelineGraph` (around line 1706) and
`HopGuiWorkflowGraph` (around line 1424) call
`isToolTipShown(CanvasToolTip.NOTICE)` directly. With the general option off
and the notice checkbox left at its default (on), that balloon is still shown.
The new javadoc on `isCanvasToolTipShown`, the Tooltips group help, and the
user manual all say the general switch turns every kind off at once.
**Suggestion:** Make `isToolTipShown` return
`hopGui.getProps().showToolTips() &&
hopGui.getProps().isCanvasToolTipShown(toolTip)`. Do not put that check in
`isCanvasToolTipShown`: the Look & Feel checkboxes use it for their selection,
and a save would then persist every kind as off. Cover the notice with the same
hover test once the general option is off.
##########
ui/src/main/resources/org/apache/hop/ui/core/dialog/messages/messages_en_US.properties:
##########
@@ -228,6 +228,24 @@ EnterOptionsDialog.UseRightClickForContextDialog.Label=Use
right click for the c
EnterOptionsDialog.UseRightClickForContextDialog.ToolTip=A right click opens
the context dialog of whatever is under the pointer and a left click only
selects. Off: a left click opens the context dialog.
EnterOptionsDialog.UseMenusInsteadOfContextDialog.Label=Use menus instead of
the context dialog
EnterOptionsDialog.UseMenusInsteadOfContextDialog.ToolTip=Transforms, actions,
hops and notes show their actions in a pop-up menu with a submenu per category.
A click on the empty canvas keeps the context dialog while the design palette
is hidden, since that is where new transforms and actions are searched for.
+EnterOptionsDialog.CanvasToolTips.Label=Tooltips
+EnterOptionsDialog.CanvasToolTips.ToolTip=Which tooltips the pipeline and
workflow canvas shows when the mouse rests on something. "Show tool tips?" on
the General tab switches all of them off at once.
Review Comment:
**[suggestion]** This help text, and the same sentence in
`perspective-configuration.adoc`, tell the user to use a General-tab checkbox
named "Show tool tips?". That label does not exist.
The master switch is `EnterOptionsDialog.ToolTipsEnabled.Label` ("Show
tooltip when hovering over a hop or Action/Transform") in the Tooltips section
of the General tab. Quote that label, and the section name, so the master
switch can actually be found. The subject-verb slip ("tooltips ... shows") can
be fixed in the same string.
##########
ui/src/main/java/org/apache/hop/ui/hopgui/file/shared/CanvasToolTip.java:
##########
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hop.ui.hopgui.file.shared;
+
+import java.util.EnumSet;
+import java.util.Set;
+import lombok.Getter;
+import org.apache.hop.core.gui.AreaOwner.AreaType;
+
+/**
+ * The kinds of tooltip the pipeline and workflow canvas can show. Each one
can be switched off on
+ * its own in the Look & Feel options; the global "Show tool tips" option
still switches all of
+ * them off at once.
+ */
+@Getter
+public enum CanvasToolTip {
+ /** "Click to edit" on a transform or action name. */
+ EDIT_HINT("EditHint"),
+ /**
+ * The description of a transform or action on its icon and info badge,
along with the transform
+ * partitioning and the "can start a pipeline" note.
+ */
+ DESCRIPTION("Description"),
+ /** The warning on the icon of a deprecated transform or action. */
+ DEPRECATION("Deprecation"),
+ /** Hop lines and every badge on a hop: info, error, copies, row
distribution, targets. */
+ HOP("Hop"),
+ /** What a run left behind: failure logs, output row buffers, action results
and checkpoints. */
+ EXECUTION_RESULT("ExecutionResult"),
+ /** The link target of a hyperlink in a note. */
+ NOTE_LINK("NoteLink"),
+ /** Tooltips that plugins add through the area-hover extension points. */
+ PLUGIN("Plugin"),
+ /** The "Selection cleared" notice after a click on the empty canvas. */
+ NOTICE("Notice");
+
+ private final String code;
+
+ CanvasToolTip(String code) {
+ this.code = code;
+ }
+
+ /** The key of the checkbox label in the options dialog bundle. */
+ public String getLabelKey() {
+ return "EnterOptionsDialog.CanvasToolTip." + code + ".Label";
+ }
+
+ /** The key of the checkbox tooltip in the options dialog bundle. */
+ public String getToolTipKey() {
+ return "EnterOptionsDialog.CanvasToolTip." + code + ".ToolTip";
+ }
+
+ /**
+ * The kinds of tooltip an area of the canvas can put up. Usually one; an
icon can carry either a
+ * deprecation warning or a description, so it lists both.
+ */
+ public static Set<CanvasToolTip> forAreaType(AreaType areaType) {
+ if (areaType == null) {
+ return EnumSet.noneOf(CanvasToolTip.class);
+ }
+ return switch (areaType) {
+ case TRANSFORM_NAME, ACTION_NAME -> EnumSet.of(EDIT_HINT);
+ case TRANSFORM_ICON, TRANSFORM_INFO_ICON, ACTION_ICON, ACTION_INFO_ICON
->
+ EnumSet.of(DESCRIPTION, DEPRECATION);
+ case TRANSFORM_PARTITIONING -> EnumSet.of(DESCRIPTION);
+ case HOP_COPY_ICON,
+ HOP_ERROR_ICON,
+ HOP_INFO_ICON,
+ HOP_INFO_TRANSFORM_COPIES_ERROR,
+ HOP_INFO_TRANSFORMS_PARTITIONED,
+ TRANSFORM_TARGET_HOP_ICON,
+ ROW_DISTRIBUTION_ICON,
+ WORKFLOW_HOP_ICON,
+ WORKFLOW_HOP_PARALLEL_ICON ->
+ EnumSet.of(HOP);
+ case TRANSFORM_FAILURE_ICON,
+ TRANSFORM_OUTPUT_DATA,
+ HOP_OUTPUT_DATA,
+ ACTION_RESULT_SUCCESS,
+ ACTION_RESULT_FAILURE,
+ ACTION_RESULT_CHECKPOINT ->
+ EnumSet.of(EXECUTION_RESULT);
+ case NOTE_LINK -> EnumSet.of(NOTE_LINK);
+ // CUSTOM and every area the graphs do not describe themselves go to
the plugin extension
+ // points.
+ default -> EnumSet.of(PLUGIN);
Review Comment:
**[suggestion]** This default, and the comment above it, say `CUSTOM` and
every undescribed area go to the plugin area-hover extension. That is true for
the pipeline graph (`default` calls `HopGuiPipelineGraphAreaHover`). It is not
true for the workflow graph.
`HopGuiWorkflowGraph.setToolTip` still has `case CUSTOM` (around line 3992)
that casts `areaOwner.getOwner()` to `String` and never calls
`HopGuiWorkflowGraphAreaHover`. Action debug-level bees, the example in
`EnterOptionsDialog.CanvasToolTip.Plugin.ToolTip`, store an `ActionDebugLevel`
as the owner. With plugin tooltips left on, hovering that bee still throws
`ClassCastException` and never shows the debug-level tip. Pipeline bees work
because they fall through to the extension.
**Suggestion:** Handle workflow `CUSTOM` the way the pipeline graph does:
call the area-hover extension, and append the owner only when it is a `String`.
Otherwise the new Plugin tooltips checkbox does not control the tooltip it
documents.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]