Changeset 28693 in osm for applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/AddRemoveMemberAction.java
- Timestamp:
- 2012-09-07T16:40:13+02:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/AddRemoveMemberAction.java
r27927 r28693 1 1 package relcontext.actions; 2 2 3 import java.util.*;4 import org.openstreetmap.josm.data.osm.OsmPrimitive;5 3 import static org.openstreetmap.josm.tools.I18n.tr; 4 6 5 import java.awt.event.ActionEvent; 7 6 import java.awt.event.KeyEvent; 7 import java.util.ArrayList; 8 import java.util.Collection; 9 8 10 import org.openstreetmap.josm.Main; 9 11 import org.openstreetmap.josm.actions.JosmAction; … … 11 13 import org.openstreetmap.josm.command.Command; 12 14 import org.openstreetmap.josm.data.osm.Node; 15 import org.openstreetmap.josm.data.osm.OsmPrimitive; 13 16 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 14 17 import org.openstreetmap.josm.data.osm.Relation; … … 17 20 import org.openstreetmap.josm.tools.ImageProvider; 18 21 import org.openstreetmap.josm.tools.Shortcut; 22 19 23 import relcontext.ChosenRelation; 20 24 import relcontext.ChosenRelationListener; … … 30 34 private static final String ACTION_NAME = "Add/remove member"; 31 35 private ChosenRelation rel; 36 private SortAndFixAction sortAndFix; 32 37 33 public AddRemoveMemberAction( ChosenRelation rel ) { 38 public AddRemoveMemberAction( ChosenRelation rel, SortAndFixAction sortAndFix ) { 34 39 super(null, "relcontext/addremove", tr("Add/remove members from the chosen relation"), 35 40 Shortcut.registerShortcut("reltoolbox:addremove", tr("Relation Toolbox: {0}", tr("Add/remove members from the chosen relation")), 36 41 KeyEvent.VK_EQUALS, Shortcut.DIRECT), false); 37 42 this.rel = rel; 43 this.sortAndFix = sortAndFix; 38 44 rel.addChosenRelationListener(this); 39 45 updateEnabledState(); … … 51 57 52 58 // 0. check if relation is broken (temporary) 53 boolean isBroken = !toAdd.isEmpty() && SortAndFixAction.needsFixing(r);59 boolean isBroken = !toAdd.isEmpty() && sortAndFix.needsFixing(r); 54 60 55 61 // 1. remove all present members … … 66 72 67 73 // 3. check for roles again (temporary) 68 Command roleFix = !isBroken && SortAndFixAction.needsFixing(r) ?SortAndFixAction.fixRelation(r) : null;74 Command roleFix = !isBroken && sortAndFix.needsFixing(r) ? sortAndFix.fixRelation(r) : null; 69 75 if( roleFix != null ) 70 76 roleFix.executeCommand();
Note:
See TracChangeset
for help on using the changeset viewer.