Ignore:
Timestamp:
2008-12-23T15:07:05+01:00 (15 years ago)
Author:
stoecker
Message:

removed usage of tab stops

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/command/AddCommand.java

    r655 r1169  
    2222 * A command that adds an osm primitive to a dataset. Keys cannot be added this
    2323 * way.
    24  * 
     24 *
    2525 * See {@link ChangeCommand ChangeCommand} for comments on relation back references.
    26  * 
     26 *
    2727 * @author imi
    2828 */
    2929public class AddCommand extends Command {
    3030
    31         /**
    32          * The primitive to add to the dataset.
    33          */
    34         private final OsmPrimitive osm;
    35        
    36         private DataSet ds;
     31    /**
     32     * The primitive to add to the dataset.
     33     */
     34    private final OsmPrimitive osm;
    3735
    38         /**
    39          * Create the command and specify the element to add.
    40          */
    41         public AddCommand(OsmPrimitive osm) {
    42                 this.osm = osm;
    43                 this.ds = Main.main.editLayer().data;
    44         }
     36    private DataSet ds;
    4537
    46         @Override public boolean executeCommand() {
    47                 osm.visit(new AddVisitor(ds));
    48                 return true;
    49         }
    50 
    51         @Override public void undoCommand() {
    52                 osm.visit(new DeleteVisitor(ds));
    53         }
    54 
    55         @Override public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted, Collection<OsmPrimitive> added) {
    56                 added.add(osm);
    57         }
    58 
    59         // faster implementation
    60         @Override public boolean invalidBecauselayerRemoved(Layer oldLayer) {
    61             return oldLayer instanceof OsmDataLayer && ((OsmDataLayer)oldLayer).data == ds;
     38    /**
     39     * Create the command and specify the element to add.
     40     */
     41    public AddCommand(OsmPrimitive osm) {
     42        this.osm = osm;
     43        this.ds = Main.main.editLayer().data;
    6244    }
    6345
    64         @Override public MutableTreeNode description() {
    65                 NameVisitor v = new NameVisitor();
    66                 osm.visit(v);
    67                 return new DefaultMutableTreeNode(new JLabel(tr("Add")+" "+tr(v.className)+" "+v.name, v.icon, JLabel.HORIZONTAL));
     46    @Override public boolean executeCommand() {
     47        osm.visit(new AddVisitor(ds));
     48        return true;
     49    }
     50
     51    @Override public void undoCommand() {
     52        osm.visit(new DeleteVisitor(ds));
     53    }
     54
     55    @Override public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted, Collection<OsmPrimitive> added) {
     56        added.add(osm);
     57    }
     58
     59    // faster implementation
     60    @Override public boolean invalidBecauselayerRemoved(Layer oldLayer) {
     61        return oldLayer instanceof OsmDataLayer && ((OsmDataLayer)oldLayer).data == ds;
     62    }
     63
     64    @Override public MutableTreeNode description() {
     65        NameVisitor v = new NameVisitor();
     66        osm.visit(v);
     67        return new DefaultMutableTreeNode(new JLabel(tr("Add")+" "+tr(v.className)+" "+v.name, v.icon, JLabel.HORIZONTAL));
    6868    }
    6969}
Note: See TracChangeset for help on using the changeset viewer.