Ignore:
Timestamp:
2009-09-20T11:46:08+02:00 (17 years ago)
Author:
Gubaer
Message:

fixed #3304: Upload failed - Placeholder Relation not found
fixed #2353: Wrong relation upload order results in 512 Precondition Failed
Warning: this is going to break plugins which register Upload Hooks. These plugins will be fixed shortly.

Location:
trunk/src/org/openstreetmap/josm/actions
Files:
5 added
1 edited
1 moved

Legend:

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

    r2153 r2168  
    1919
    2020import org.openstreetmap.josm.Main;
     21import org.openstreetmap.josm.actions.upload.ApiPreconditionCheckerHook;
     22import org.openstreetmap.josm.actions.upload.RelationUploadOrderHook;
     23import org.openstreetmap.josm.actions.upload.UploadHook;
     24import org.openstreetmap.josm.actions.upload.UploadParameterHook;
    2125import org.openstreetmap.josm.data.APIDataSet;
    2226import org.openstreetmap.josm.data.conflict.ConflictCollection;
     
    6771         * Checks server capabilities before upload.
    6872         */
    69         uploadHooks.add(new ApiPreconditionChecker());
     73        uploadHooks.add(new ApiPreconditionCheckerHook());
     74
     75        /**
     76         * Adjusts the upload order of new relations
     77         */
     78        uploadHooks.add(new RelationUploadOrderHook());
    7079
    7180        /**
     
    7382         * give the user the possibility to cancel the upload.
    7483         */
    75         uploadHooks.add(new UploadConfirmationHook());
     84        uploadHooks.add(new UploadParameterHook());
    7685    }
    7786
     
    99108        }
    100109    }
    101 
    102     /** Upload Hook */
    103     public interface UploadHook {
    104         /**
    105          * Checks the upload.
    106          * @param apiDataSet the data to upload
    107          */
    108         public boolean checkUpload(APIDataSet apiDataSet);
    109     }
    110 
    111110
    112111    public UploadAction() {
     
    483482    }
    484483
    485 
    486     static public class UploadConfirmationHook implements UploadHook {
    487 
    488         public boolean checkUpload(APIDataSet apiData) {
    489             final UploadDialog dialog = UploadDialog.getUploadDialog();
    490             dialog.setUploadedPrimitives(apiData.getPrimitivesToAdd(),apiData.getPrimitivesToUpdate(), apiData.getPrimitivesToDelete());
    491             dialog.setVisible(true);
    492             if (dialog.isCanceled())
    493                 return false;
    494             dialog.rememberUserInput();
    495             return true;
    496         }
    497     }
    498 
    499484    public UploadDiffTask createUploadTask(OsmDataLayer layer, Collection<OsmPrimitive> toUpload, Changeset changeset, boolean closeChangesetAfterUpload) {
    500485        return new UploadDiffTask(layer, toUpload, changeset, closeChangesetAfterUpload);
  • trunk/src/org/openstreetmap/josm/actions/upload/ApiPreconditionCheckerHook.java

    r2156 r2168  
    1 package org.openstreetmap.josm.actions;
     1package org.openstreetmap.josm.actions.upload;
    22
    33import static org.openstreetmap.josm.tools.I18n.tr;
     
    1010
    1111import org.openstreetmap.josm.Main;
    12 import org.openstreetmap.josm.actions.UploadAction.UploadHook;
    1312import org.openstreetmap.josm.data.APIDataSet;
    1413import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    1918import org.openstreetmap.josm.io.OsmApiInitializationException;
    2019
    21 public class ApiPreconditionChecker implements UploadHook {
     20public class ApiPreconditionCheckerHook implements UploadHook {
    2221
    2322    public boolean checkUpload(APIDataSet apiData) {
Note: See TracChangeset for help on using the changeset viewer.