Changeset 6706 in josm


Ignore:
Timestamp:
2014-01-16T23:31:29+01:00 (6 years ago)
Author:
Don-vip
Message:

fix #9401 - Do not create MergeLayerAction several times + fix EDT violation

Location:
trunk/src/org/openstreetmap/josm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/MergeLayerAction.java

    r6084 r6706  
    1919import org.openstreetmap.josm.tools.Shortcut;
    2020
     21/**
     22 * Action that merges two or more OSM data layers.
     23 * @since 1890
     24 */
    2125public class MergeLayerAction extends AbstractMergeAction {
    2226
     27    /**
     28     * Constructs a new {@code MergeLayerAction}.
     29     */
    2330    public MergeLayerAction() {
    2431        super(tr("Merge layer"), "dialogs/mergedown",
     
    5865    }
    5966
     67    /**
     68     * Merges a list of layers together.
     69     * @param sourceLayers The layers to merge
     70     */
    6071    public void merge(List<Layer> sourceLayers) {
    6172        doMerge(sourceLayers, sourceLayers);
    6273    }
    6374
     75    /**
     76     * Merges the given source layer with another one, determined at runtime.
     77     * @param sourceLayer The source layer to merge
     78     */
    6479    public void merge(Layer sourceLayer) {
    6580        if (sourceLayer == null)
     
    96111
    97112    /**
    98      * returns true if the user wants to cancel, false if they want to continue
     113     * Warns about a discouraged merge operation, ask for confirmation.
     114     * @param sourceLayer The source layer
     115     * @param targetLayer The target layer
     116     * @return {@code true} if the user wants to cancel, {@code false} if they want to continue
    99117     */
    100118    public static final boolean warnMergingUploadDiscouragedLayers(Layer sourceLayer, Layer targetLayer) {
  • trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java

    r6362 r6706  
    763763        public void actionPerformed(ActionEvent e) {
    764764            if (layer != null) {
    765                 new MergeLayerAction().merge(layer);
     765                Main.main.menu.merge.merge(layer);
    766766            } else {
    767767                if (getModel().getSelectedLayers().size() == 1) {
    768768                    Layer selectedLayer = getModel().getSelectedLayers().get(0);
    769                     new MergeLayerAction().merge(selectedLayer);
     769                    Main.main.menu.merge.merge(selectedLayer);
    770770                } else {
    771                     new MergeLayerAction().merge(getModel().getSelectedLayers());
     771                    Main.main.menu.merge.merge(getModel().getSelectedLayers());
    772772                }
    773773            }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/validator/ValidatorTreePanel.java

    r6636 r6706  
    3030import org.openstreetmap.josm.data.validation.util.MultipleNameVisitor;
    3131import org.openstreetmap.josm.gui.preferences.validator.ValidatorPreference;
     32import org.openstreetmap.josm.gui.util.GuiHelper;
    3233import org.openstreetmap.josm.tools.Destroyable;
    3334import org.openstreetmap.josm.tools.MultiMap;
     
    127128    public void buildTree() {
    128129        updateCount++;
    129         DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode();
     130        final DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode();
    130131
    131132        if (errors == null || errors.isEmpty()) {
    132             valTreeModel.setRoot(rootNode);
     133            GuiHelper.runInEDTAndWait(new Runnable() {
     134                @Override
     135                public void run() {
     136                    valTreeModel.setRoot(rootNode);
     137                }
     138            });
    133139            return;
    134140        }
Note: See TracChangeset for help on using the changeset viewer.