Ignore:
Timestamp:
2021-09-11T17:50:57+02:00 (3 years ago)
Author:
Don-vip
Message:

global use of Utils.isEmpty/isBlank

Location:
trunk/src/org/openstreetmap/josm/actions
Files:
10 edited

Legend:

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

    r17594 r18208  
    4747import org.openstreetmap.josm.tools.ImageProvider;
    4848import org.openstreetmap.josm.tools.Logging;
     49import org.openstreetmap.josm.tools.Utils;
    4950import org.openstreetmap.josm.tools.bugreport.ReportedException;
    5051
     
    115116            case WMS_ENDPOINT:
    116117                // convert to WMS type
    117                 if (info.getDefaultLayers() == null || info.getDefaultLayers().isEmpty()) {
     118                if (Utils.isEmpty(info.getDefaultLayers())) {
    118119                    return getWMSLayerInfo(info);
    119120                } else {
     
    122123            case WMTS:
    123124                // specify which layer to use
    124                 if (info.getDefaultLayers() == null || info.getDefaultLayers().isEmpty()) {
     125                if (Utils.isEmpty(info.getDefaultLayers())) {
    125126                    WMTSTileSource tileSource = new WMTSTileSource(info);
    126127                    DefaultLayer layerId = tileSource.userSelectLayer();
     
    169170            }
    170171        } catch (IllegalArgumentException | ReportedException ex) {
    171             if (ex.getMessage() == null || ex.getMessage().isEmpty() || GraphicsEnvironment.isHeadless()) {
     172            if (Utils.isEmpty(ex.getMessage()) || GraphicsEnvironment.isHeadless()) {
    172173                throw ex;
    173174            } else {
  • trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java

    r17200 r18208  
    5050import org.openstreetmap.josm.tools.Shortcut;
    5151import org.openstreetmap.josm.tools.UserCancelException;
     52import org.openstreetmap.josm.tools.Utils;
    5253
    5354/**
     
    113114        // prepare and clean the list of ways to combine
    114115        //
    115         if (ways == null || ways.isEmpty())
     116        if (Utils.isEmpty(ways))
    116117            return null;
    117118        ways.remove(null); // just in case -  remove all null ways from the collection
  • trunk/src/org/openstreetmap/josm/actions/CreateMultipolygonAction.java

    r17585 r18208  
    387387    protected void updateEnabledState(Collection<? extends OsmPrimitive> selection) {
    388388        DataSet ds = getLayerManager().getEditDataSet();
    389         if (ds == null || selection.isEmpty()) {
     389        if (ds == null || Utils.isEmpty(selection)) {
    390390            setEnabled(false);
    391391        } else if (update) {
  • trunk/src/org/openstreetmap/josm/actions/DownloadReferrersAction.java

    r14397 r18208  
    1515import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1616import org.openstreetmap.josm.tools.Shortcut;
     17import org.openstreetmap.josm.tools.Utils;
    1718
    1819/**
     
    4445     */
    4546    public static void downloadReferrers(OsmDataLayer targetLayer, Collection<OsmPrimitive> children) {
    46         if (children == null || children.isEmpty())
     47        if (Utils.isEmpty(children))
    4748            return;
    4849        MainApplication.worker.submit(new DownloadReferrersTask(targetLayer, children));
  • trunk/src/org/openstreetmap/josm/actions/OpenFileAction.java

    r18014 r18208  
    261261        @Override
    262262        protected void realRun() throws SAXException, IOException, OsmTransferException {
    263             if (files == null || files.isEmpty()) return;
     263            if (Utils.isEmpty(files)) return;
    264264
    265265            /**
  • trunk/src/org/openstreetmap/josm/actions/UpdateSelectionAction.java

    r14397 r18208  
    2828import org.openstreetmap.josm.io.OsmTransferException;
    2929import org.openstreetmap.josm.tools.Shortcut;
     30import org.openstreetmap.josm.tools.Utils;
    3031
    3132/**
     
    120121    @Override
    121122    protected void updateEnabledState(Collection<? extends OsmPrimitive> selection) {
    122         if (selection == null || selection.isEmpty()) {
     123        if (Utils.isEmpty(selection)) {
    123124            setEnabled(false);
    124125        } else {
  • trunk/src/org/openstreetmap/josm/actions/UploadSelectionAction.java

    r15513 r18208  
    3434import org.openstreetmap.josm.tools.ExceptionUtil;
    3535import org.openstreetmap.josm.tools.Shortcut;
     36import org.openstreetmap.josm.tools.Utils;
    3637import org.xml.sax.SAXException;
    3738
     
    138139     */
    139140    public void uploadPrimitives(OsmDataLayer layer, Collection<OsmPrimitive> toUpload) {
    140         if (toUpload == null || toUpload.isEmpty()) return;
     141        if (Utils.isEmpty(toUpload)) return;
    141142        UploadHullBuilder builder = new UploadHullBuilder();
    142143        toUpload = builder.build(toUpload);
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java

    r18017 r18208  
    188188    protected final void extractOsmFilename(DownloadParams settings, String pattern, String url) {
    189189        newLayerName = settings.getLayerName();
    190         if (newLayerName == null || newLayerName.isEmpty()) {
     190        if (Utils.isEmpty(newLayerName)) {
    191191            Matcher matcher = Pattern.compile(pattern).matcher(url);
    192192            newLayerName = matcher.matches() && matcher.groupCount() > 0 ? Utils.decodeUrl(matcher.group(1)) : null;
  • trunk/src/org/openstreetmap/josm/actions/relation/AbstractRelationAction.java

    r17458 r18208  
    3636     */
    3737    protected static final Collection<IRelation<?>> getRelations(Collection<? extends IPrimitive> primitives) {
    38         if (primitives == null || primitives.isEmpty()) {
     38        if (Utils.isEmpty(primitives)) {
    3939            return Collections.<IRelation<?>>emptySet();
    4040        } else {
  • trunk/src/org/openstreetmap/josm/actions/relation/RecentRelationsAction.java

    r16438 r18208  
    2929import org.openstreetmap.josm.tools.ImageProvider;
    3030import org.openstreetmap.josm.tools.Shortcut;
     31import org.openstreetmap.josm.tools.Utils;
    3132
    3233/**
     
    7374    public static Relation getLastRelation() {
    7475        List<Relation> recentRelations = getRecentRelationsOnActiveLayer();
    75         if (recentRelations == null || recentRelations.isEmpty())
     76        if (Utils.isEmpty(recentRelations))
    7677            return null;
    7778        return recentRelations.stream().filter(RecentRelationsAction::isRelationListable)
Note: See TracChangeset for help on using the changeset viewer.