Exemplo n.º 1
0
 private Set<OsmPrimitiveType> getTypesToDelete() {
   Set<OsmPrimitiveType> typesToDelete = EnumSet.noneOf(OsmPrimitiveType.class);
   for (OsmPrimitive osm : toDelete) {
     typesToDelete.add(OsmPrimitiveType.from(osm));
   }
   return typesToDelete;
 }
Exemplo n.º 2
0
 @Override
 public String getDescriptionText() {
   String msg;
   switch (OsmPrimitiveType.from(osm)) {
     case NODE:
       msg = marktr("Add node {0}");
       break;
     case WAY:
       msg = marktr("Add way {0}");
       break;
     case RELATION:
       msg = marktr("Add relation {0}");
       break;
     default: /* should not happen */
       msg = "";
       break;
   }
   return tr(msg, osm.getDisplayName(DefaultNameFormatter.getInstance()));
 }
Exemplo n.º 3
0
  @Override
  public String getDescriptionText() {
    if (toDelete.size() == 1) {
      OsmPrimitive primitive = toDelete.iterator().next();
      String msg = "";
      switch (OsmPrimitiveType.from(primitive)) {
        case NODE:
          msg = marktr("Delete node {0}");
          break;
        case WAY:
          msg = marktr("Delete way {0}");
          break;
        case RELATION:
          msg = marktr("Delete relation {0}");
          break;
      }

      return tr(msg, primitive.getDisplayName(DefaultNameFormatter.getInstance()));
    } else {
      Set<OsmPrimitiveType> typesToDelete = getTypesToDelete();
      String msg = "";
      if (typesToDelete.size() > 1) {
        msg = trn("Delete {0} object", "Delete {0} objects", toDelete.size(), toDelete.size());
      } else {
        OsmPrimitiveType t = typesToDelete.iterator().next();
        switch (t) {
          case NODE:
            msg = trn("Delete {0} node", "Delete {0} nodes", toDelete.size(), toDelete.size());
            break;
          case WAY:
            msg = trn("Delete {0} way", "Delete {0} ways", toDelete.size(), toDelete.size());
            break;
          case RELATION:
            msg =
                trn(
                    "Delete {0} relation",
                    "Delete {0} relations", toDelete.size(), toDelete.size());
            break;
        }
      }
      return msg;
    }
  }