@@ -385,35 +385,13 @@ private void updateConnectToSecondaryEditingPathMenuItem() {
385385 }
386386
387387 private JMenuItem helpOnConnectingMenuItem () {
388- final String msg = "<HTML>To connect two paths in <i>Edit Mode</i>:<ol>" +
389- " <li>Press <tt>Shift+E</tt> to enter Edit Mode</li>" +
390- " <li>Select the <b>parent</b> path using <tt>G</tt> (<u>G</u>roup paths around cursor)</li>" +
391- " <li>Hover over the node where the child should branch from</li>" +
392- " <li>Press <tt>G</tt> to switch to the <b>child</b> path</li>" +
393- " <li>Select the child's connection node (typically a start or end node)</li>" +
394- " <li>Press <tt>C</tt> to <u>C</u>onnect</li>" +
395- "</ol>Notes:<ul>" +
396- " <li>A confirmation dialog shows the parent/child assignment with option to swap roles</li>" +
397- " <li>Child paths are automatically re-oriented to maintain proper tree structure</li>" +
398- " <li>If connection points are distant, a bridging segment is created automatically</li>" +
399- " <li>If child's selected node is mid-path, a T-junction is created</li>" +
400- " <li>Loop-forming connections are not allowed</li>" +
401- " <li>To concatenate or combine paths end-to-end, use Path Manager's Edit menu</li>" +
402- "</ul>" ;
403- final JMenuItem helpItem = new JMenuItem (AListener .NODE_CONNECT_HELP );
404- helpItem .addActionListener (e -> {
405- final boolean canvasActivationState = tracerPlugin .getPrefs ().isCanvasAutoActivationEnabled ();
406- tracerPlugin .getPrefs ().setCanvasAutoActivation (false ); // this will not update the checkbox state in SNTUI, but
407- // ensures the help dialog will maintain its frontmost state
408- getGuiUtils ().showHTMLDialog (msg , AListener .NODE_CONNECT_HELP , false )
409- .addWindowListener (new WindowAdapter () {
410- @ Override
411- public void windowClosing (final WindowEvent e ) {
412- tracerPlugin .getPrefs ().setCanvasAutoActivation (canvasActivationState );
413- }
414- });
415- });
416- return helpItem ;
388+ final boolean [] canvasActivationState = new boolean [1 ];
389+ return GuiUtils .MenuItems .connectHelp (this ::getGuiUtils , () -> {
390+ canvasActivationState [0 ] = tracerPlugin .getPrefs ().isCanvasAutoActivationEnabled ();
391+ // this will not update the checkbox state in SNTUI, but ensures the help dialog will maintain its
392+ // frontmost state
393+ tracerPlugin .getPrefs ().setCanvasAutoActivation (false );
394+ }, () -> tracerPlugin .getPrefs ().setCanvasAutoActivation (canvasActivationState [0 ]));
417395 }
418396
419397 /** Menu item for a command shared with the Bdv/Bvv context menu: label and icon come from the enum */
@@ -1454,7 +1432,6 @@ protected void toggleEditMode() {
14541432 toggleEditModeMenuItem .doClick ();
14551433 }
14561434
1457-
14581435 private void toggleKeyWarning (final String key , final String msg ) {
14591436 final Timer timer = new Timer (500 , ae -> {
14601437 // Restore state after delay
@@ -1473,12 +1450,7 @@ private void toggleKeyWarning(final String key, final String msg) {
14731450 PathNodeCanvas .setShowDirectionArrows (true );
14741451 tracerPlugin .repaintAllPanes ();
14751452 }
1476- // Show tip if not suppressed
1477- if (!tracerPlugin .getPrefs ().getTemp ("key-skipnag" + key , false )) {
1478- final Boolean skipNag = getGuiUtils ().getPersistentWarning (
1479- "Tip: Hold \" " + key + "\" to " + msg + "." , "Keyboard Operation" );
1480- if (skipNag != null ) tracerPlugin .getPrefs ().setTemp ("key-skipnag" + key , skipNag );
1481- }
1453+ getGuiUtils ().showKeyTip (tracerPlugin .getPrefs (), key , msg );
14821454
14831455 timer .start ();
14841456 }
@@ -1522,7 +1494,7 @@ private class AListener implements ActionListener, ItemListener {
15221494 private final static String INDENT = NodeEditCommand .MENU_INDENT ;
15231495 private final static String NODE_MOVE_Z = INDENT + "Bring Active Node to Current Z-plane" ;
15241496 private final static String NODE_PAINT = INDENT + "Paint Mode" ;
1525- private final static String NODE_CONNECT_HELP = INDENT + "Connect to Help..." ;
1497+ private final static String NODE_CONNECT_HELP = GuiUtils . MenuItems . CONNECT_HELP_LABEL ;
15261498 private final static String NODE_CONNECT_TO_PREV_EDITING_PATH_PREFIX = INDENT + "Connect to " ;
15271499 private final static String NODE_CONNECT_TO_PREV_EDITING_PATH_PLACEHOLDER = NODE_CONNECT_TO_PREV_EDITING_PATH_PREFIX
15281500 + "..." ;
@@ -1604,10 +1576,10 @@ private void handleExtendPath() {
16041576 private boolean handleGeneralCommands (final String command , final ActionEvent e ) {
16051577 switch (command ) {
16061578 case SHOW_ARROWS :
1607- toggleKeyWarning ("O" , "show path orientation (start → end)" );
1579+ toggleKeyWarning ("O" , ContextMenuCommand . ORIENTATION_KEY_TIP );
16081580 return true ;
16091581 case HIDE_ALL :
1610- toggleKeyWarning ("H" , "temporarily hide paths" );
1582+ toggleKeyWarning ("H" , ContextMenuCommand . HIDE_KEY_TIP );
16111583 return true ;
16121584 case BOOKMARK_CURSOR :
16131585 bookmarkCursorLocation ();
0 commit comments