001// License: GPL. For details, see LICENSE file.
002package org.openstreetmap.josm.command;
003
004import java.util.Collection;
005
006import javax.swing.Icon;
007
008import org.openstreetmap.josm.data.osm.OsmPrimitive;
009
010/**
011 * PseudoCommand is a reduced form of a command. It can be presented in a tree view
012 * as subcommand of real commands but it is just an empty shell and can not be
013 * executed or undone.
014 */
015abstract public class PseudoCommand {
016    /**
017     * Provides a description text representing this command.
018     */
019    abstract public String getDescriptionText();
020
021    /**
022     * Provides a descriptive icon of this command.
023     */
024    public Icon getDescriptionIcon() {
025        return null;
026    }
027
028    /**
029     * Return the primitives that take part in this command.
030     */
031    abstract public Collection<? extends OsmPrimitive> getParticipatingPrimitives();
032
033    /**
034     * Returns the subcommands of this command.
035     * Override for subclasses that have child commands.
036     * @return the subcommands, null if there are no child commands
037     */
038    public Collection<PseudoCommand> getChildren() {
039        return null;
040    }
041}