Changeset 2983 in josm for trunk


Ignore:
Timestamp:
2010-02-14T15:05:08+01:00 (10 years ago)
Author:
Gubaer
Message:

see #4054: Improving user feedback when trying to merge a deleted relation member.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/conflict/pair/ListMergeModel.java

    r2949 r2983  
    2424import javax.swing.table.TableModel;
    2525
     26import org.openstreetmap.josm.Main;
    2627import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2728import org.openstreetmap.josm.data.osm.PrimitiveId;
     29import org.openstreetmap.josm.gui.HelpAwareOptionPane;
     30import org.openstreetmap.josm.gui.help.HelpUtil;
    2831
    2932/**
     
    310313    }
    311314
     315    protected void alertCopyFailedForDeletedPrimitives(List<PrimitiveId> deletedIds) {
     316        List<String> items = new ArrayList<String>();
     317        for (int i=0; i<Math.min(MAX_DELETED_PRIMITIVE_IN_DIALOG, deletedIds.size()); i++) {
     318            items.add(deletedIds.get(i).toString());
     319        }
     320        if (deletedIds.size() > MAX_DELETED_PRIMITIVE_IN_DIALOG) {
     321            items.add(tr("{0} more...", deletedIds.size() - MAX_DELETED_PRIMITIVE_IN_DIALOG));
     322        }
     323        StringBuffer sb = new StringBuffer();
     324        sb.append("<html>");
     325        sb.append(tr("The following primitives could not be copied to the target primitive<br>because they are deleted in the target dataset:"));
     326        sb.append("<ul>");
     327        for (String item: items) {
     328            sb.append("<li>").append(item).append("</li>");
     329        }
     330        sb.append("</ul>");
     331        sb.append("</html>");
     332        HelpAwareOptionPane.showOptionDialog(
     333                Main.parent,
     334                sb.toString(),
     335                tr("Merging deleted primitives failed"),
     336                JOptionPane.WARNING_MESSAGE,
     337                HelpUtil.ht("/Dialog/ConflictResolution#MergingDeletedPrimitivesFailed")
     338        );
     339    }
     340
    312341    private void copy(ListRole sourceRole, int[] rows, int position) {
    313342        List<T> newItems = new ArrayList<T>(rows.length);
     
    327356        fireModelDataChanged();
    328357        if (!deletedIds.isEmpty()) {
    329             List<String> items = new ArrayList<String>();
    330             for (int i=0; i<Math.min(MAX_DELETED_PRIMITIVE_IN_DIALOG, deletedIds.size()); i++) {
    331                 items.add(deletedIds.get(i).toString());
    332             }
    333             if (deletedIds.size() > MAX_DELETED_PRIMITIVE_IN_DIALOG) {
    334                 items.add(tr("{0} more...", deletedIds.size() - MAX_DELETED_PRIMITIVE_IN_DIALOG));
    335             }
    336             JOptionPane.showMessageDialog(null, tr("Following primitives could not be added because they are deleted: {0}", items));
     358            alertCopyFailedForDeletedPrimitives(deletedIds);
    337359        }
    338360    }
Note: See TracChangeset for help on using the changeset viewer.