Example #1
0
 public void actionPerformed(ActionEvent e) {
   if (!isEnabled()) return;
   if (getEditLayer().isUploadDiscouraged()) {
     if (UploadAction.warnUploadDiscouraged(getEditLayer())) {
       return;
     }
   }
   UploadHullBuilder builder = new UploadHullBuilder();
   UploadSelectionDialog dialog = new UploadSelectionDialog();
   Collection<OsmPrimitive> modifiedCandidates =
       getModifiedPrimitives(getEditLayer().data.getAllSelected());
   Collection<OsmPrimitive> deletedCandidates = getDeletedPrimitives(getEditLayer().data);
   if (modifiedCandidates.isEmpty() && deletedCandidates.isEmpty()) {
     JOptionPane.showMessageDialog(
         Main.parent, tr("No changes to upload."), tr("Warning"), JOptionPane.INFORMATION_MESSAGE);
     return;
   }
   dialog.populate(modifiedCandidates, deletedCandidates);
   dialog.setVisible(true);
   if (dialog.isCanceled()) return;
   Collection<OsmPrimitive> toUpload = builder.build(dialog.getSelectedPrimitives());
   if (toUpload.isEmpty()) {
     JOptionPane.showMessageDialog(
         Main.parent, tr("No changes to upload."), tr("Warning"), JOptionPane.INFORMATION_MESSAGE);
     return;
   }
   uploadPrimitives(getEditLayer(), toUpload);
 }
Example #2
0
 protected void processPostParentChecker(OsmDataLayer layer, Collection<OsmPrimitive> toUpload) {
   APIDataSet ds = new APIDataSet(toUpload);
   UploadAction action = new UploadAction();
   action.uploadData(layer, ds);
 }