Ignore:
Timestamp:
2017-08-28T19:26:47+02:00 (4 years ago)
Author:
Don-vip
Message:

see #15182 - introduce Main.getEditDataSet to avoid unneeded GUI dependence in validator tests and tagging presets

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r12686 r12691  
    397397    }
    398398
     399    @Override
     400    public DataSet getEditDataSet() {
     401        return getLayerManager().getEditDataSet();
     402    }
     403
    399404    /**
    400405     * Returns the command-line arguments used to run the application.
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPreset.java

    r12656 r12691  
    382382            return;
    383383        }
    384         DataSet ds = MainApplication.getLayerManager().getEditDataSet();
     384        DataSet ds = Main.main.getEditDataSet();
    385385        Collection<OsmPrimitive> participants = Collections.emptyList();
    386         if (Main.main != null && ds != null) {
     386        if (ds != null) {
    387387            participants = ds.getSelected();
    388388        }
     
    556556
    557557    protected final void updateEnabledState() {
    558         setEnabled(Main.main != null && MainApplication.getLayerManager().getEditDataSet() != null);
     558        setEnabled(Main.main != null && Main.main.getEditDataSet() != null);
    559559    }
    560560
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetSearchPrimitiveDialog.java

    r12637 r12691  
    8787            TaggingPreset preset = selector.getSelectedPresetAndUpdateClassification();
    8888            if (preset != null) {
    89                 final Set<OsmPrimitive> matching = new HashSet<>(MainApplication.getLayerManager().getEditDataSet().getPrimitives(preset));
    90                 MainApplication.getLayerManager().getEditDataSet().setSelected(matching);
     89                final Set<OsmPrimitive> matching = new HashSet<>(Main.main.getEditDataSet().getPrimitives(preset));
     90                Main.main.getEditDataSet().setSelected(matching);
    9191            }
    9292        }
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetSelector.java

    r12637 r12691  
    236236        boolean inTags = ckSearchInTags != null && ckSearchInTags.isSelected();
    237237
    238         DataSet ds = MainApplication.getLayerManager().getEditDataSet();
     238        DataSet ds = Main.main.getEditDataSet();
    239239        Collection<OsmPrimitive> selected = (ds == null) ? Collections.<OsmPrimitive>emptyList() : ds.getSelected();
    240240        final List<PresetClassification> result = classifications.getMatchingPresets(
     
    356356                typesInSelectionDirty = false;
    357357                typesInSelection.clear();
    358                 if (Main.main == null || MainApplication.getLayerManager().getEditDataSet() == null) return typesInSelection;
    359                 for (OsmPrimitive primitive : MainApplication.getLayerManager().getEditDataSet().getSelected()) {
     358                if (Main.main == null || Main.main.getEditDataSet() == null) return typesInSelection;
     359                for (OsmPrimitive primitive : Main.main.getEditDataSet().getSelected()) {
    360360                    typesInSelection.add(TaggingPresetType.forPrimitive(primitive));
    361361                }
Note: See TracChangeset for help on using the changeset viewer.