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 * @since  3262 (creation)
015 * @since 10599 (functional interface)
016 */
017public interface PseudoCommand {
018
019    /**
020     * Provides a description text representing this command.
021     * @return description text representing this command
022     */
023    String getDescriptionText();
024
025    /**
026     * Provides a descriptive icon of this command.
027     * @return descriptive icon of this command
028     */
029    default Icon getDescriptionIcon() {
030        return null;
031    }
032
033    /**
034     * Return the primitives that take part in this command.
035     * @return primitives that take part in this command
036     */
037    Collection<? extends OsmPrimitive> getParticipatingPrimitives();
038
039    /**
040     * Returns the subcommands of this command.
041     * Override for subclasses that have child commands.
042     * @return the subcommands, null if there are no child commands
043     */
044    default Collection<PseudoCommand> getChildren() {
045        return null;
046    }
047}