diff --git a/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java b/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
index 7ef09d6..f5fac0f 100644
a
|
b
|
|
25 | 25 | import javax.swing.Action; |
26 | 26 | import javax.swing.ImageIcon; |
27 | 27 | import javax.swing.JLabel; |
| 28 | import javax.swing.JOptionPane; |
28 | 29 | import javax.swing.JPanel; |
29 | 30 | import javax.swing.JToggleButton; |
30 | 31 | import javax.swing.SwingUtilities; |
… |
… |
|
42 | 43 | import org.openstreetmap.josm.data.osm.Tag; |
43 | 44 | import org.openstreetmap.josm.gui.ExtendedDialog; |
44 | 45 | import org.openstreetmap.josm.gui.MapView; |
| 46 | import org.openstreetmap.josm.gui.Notification; |
45 | 47 | import org.openstreetmap.josm.gui.dialogs.relation.RelationEditor; |
46 | 48 | import org.openstreetmap.josm.gui.layer.Layer; |
47 | 49 | import org.openstreetmap.josm.gui.preferences.ToolbarPreferences; |
… |
… |
public int showDialog(Collection<OsmPrimitive> sel, boolean showNewRelation) {
|
376 | 378 | return DIALOG_ANSWER_CANCEL; |
377 | 379 | |
378 | 380 | int answer = 1; |
379 | | if (p.getComponentCount() != 0 && (sel.isEmpty() || p.hasElements)) { |
| 381 | boolean canCreateRelation = types == null || types.contains(TaggingPresetType.RELATION); |
| 382 | if (originalSelectionEmpty && !canCreateRelation) { |
| 383 | new Notification( |
| 384 | tr("The preset <i>{0}</i> cannot be applied since nothing has been selected!", getLocaleName())) |
| 385 | .setIcon(JOptionPane.WARNING_MESSAGE) |
| 386 | .show(); |
| 387 | return DIALOG_ANSWER_CANCEL; |
| 388 | } else if (sel.isEmpty() && !canCreateRelation) { |
| 389 | new Notification( |
| 390 | tr("The preset <i>{0}</i> cannot be applied since the selection is unsuitable!", getLocaleName())) |
| 391 | .setIcon(JOptionPane.WARNING_MESSAGE) |
| 392 | .show(); |
| 393 | return DIALOG_ANSWER_CANCEL; |
| 394 | } else if (p.getComponentCount() != 0 && (sel.isEmpty() || p.hasElements)) { |
380 | 395 | String title = trn("Change {0} object", "Change {0} objects", sel.size(), sel.size()); |
381 | 396 | if (sel.isEmpty()) { |
382 | 397 | if (originalSelectionEmpty) { |