Changeset 19279 in josm


Ignore:
Timestamp:
2025-01-10T07:16:23+01:00 (2 weeks ago)
Author:
GerdP
Message:

fix #24037

  • revert the changes from r17423 in GenericRelationEditor
  • use GuiHelper.runInEDT() to avoid the EDT violations reported in #20228
Location:
trunk/src/org/openstreetmap/josm/gui/dialogs/relation
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java

    r19050 r19279  
    66
    77import java.awt.BorderLayout;
    8 import java.awt.Component;
    98import java.awt.Dimension;
    109import java.awt.FlowLayout;
     
    162161    private final ArrayList<FlavorListener> clipboardListeners = new ArrayList<>();
    163162
    164     private Component selectedTabPane;
    165     private final JTabbedPane tabbedPane;
    166 
    167163    /**
    168164     * Creates a new relation editor for the given relation. The relation will be saved if the user
     
    236232
    237233        getContentPane().setLayout(new BorderLayout());
     234        final JTabbedPane tabbedPane;
    238235        tabbedPane = new JTabbedPane();
    239236        tabbedPane.add(tr("Tags and Members"), pnl);
     
    241238        tabbedPane.add(tr("Parent Relations"), referrerBrowser);
    242239        tabbedPane.add(tr("Child Relations"), new ChildRelationBrowser(getLayer(), relation));
    243         selectedTabPane = tabbedPane.getSelectedComponent();
    244240        tabbedPane.addChangeListener(e -> {
    245241            JTabbedPane sourceTabbedPane = (JTabbedPane) e.getSource();
     
    249245                referrerBrowser.init();
    250246            }
    251             // see #20228
    252             boolean selIsTagsAndMembers = sourceTabbedPane.getSelectedComponent() == pnl;
    253             if (selectedTabPane == pnl && !selIsTagsAndMembers) {
    254                 unregisterMain();
    255             } else if (selectedTabPane != pnl && selIsTagsAndMembers) {
    256                 registerMain();
    257             }
    258             selectedTabPane = sourceTabbedPane.getSelectedComponent();
    259247        });
    260248
     
    329317        HelpUtil.setHelpContext(getRootPane(), ht("/Dialog/RelationEditor"));
    330318        UndoRedoHandler.getInstance().addCommandQueueListener(this);
    331     }
    332 
    333     private void registerMain() {
    334         selectionTableModel.register();
    335         memberTableModel.register();
    336         memberTable.registerListeners();
    337     }
    338 
    339     private void unregisterMain() {
    340         selectionTableModel.unregister();
    341         memberTableModel.unregister();
    342         memberTable.unregisterListeners();
    343319    }
    344320
     
    789765            //
    790766            memberTable.stopHighlighting();
    791             if (tabbedPane != null && tr("Tags and Members").equals(tabbedPane.getTitleAt(tabbedPane.getSelectedIndex()))) {
    792                 unregisterMain();
    793             }
     767            selectionTableModel.unregister();
     768            memberTableModel.unregister();
     769            memberTable.unregisterListeners();
     770
    794771            if (windowMenuItem != null) {
    795772                MainApplication.getMenu().windowMenu.remove(windowMenuItem);
     
    898875        super.dispose(); // call before setting relation to null, see #20304
    899876        setRelation(null);
    900         selectedTabPane = null;
    901877    }
    902878
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java

    r18801 r19279  
    133133        // just trigger a repaint - the display name of the relation members may have changed
    134134        Collection<RelationMember> sel = getSelectedMembers();
    135         GuiHelper.runInEDT(this::fireTableDataChanged);
    136         setSelectedMembers(sel);
     135        GuiHelper.runInEDT(() -> {
     136            fireTableDataChanged();
     137            setSelectedMembers(sel);
     138        });
    137139    }
    138140
Note: See TracChangeset for help on using the changeset viewer.