Ignore:
Timestamp:
2016-06-24T09:10:57+02:00 (8 years ago)
Author:
donvip
Message:

checkstyle, update to JOSM 10279

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/CreateRelationAction.java

    r27927 r32395  
     1// License: GPL. For details, see LICENSE file.
    12package relcontext.actions;
     3
     4import static org.openstreetmap.josm.tools.I18n.tr;
    25
    36import java.awt.Dialog.ModalityType;
    47import java.awt.GridBagLayout;
    5 import java.util.Collection;
    6 import org.openstreetmap.josm.data.osm.OsmPrimitive;
    7 import static org.openstreetmap.josm.tools.I18n.tr;
    88import java.awt.event.ActionEvent;
    99import java.awt.event.ActionListener;
    1010import java.awt.event.KeyEvent;
    1111import java.util.Arrays;
     12import java.util.Collection;
    1213import java.util.List;
     14
    1315import javax.swing.Box;
    1416import javax.swing.JDialog;
     
    1618import javax.swing.JOptionPane;
    1719import javax.swing.JPanel;
     20
    1821import org.openstreetmap.josm.Main;
    1922import org.openstreetmap.josm.actions.JosmAction;
    2023import org.openstreetmap.josm.command.AddCommand;
     24import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2125import org.openstreetmap.josm.data.osm.Relation;
    2226import org.openstreetmap.josm.data.osm.RelationMember;
     
    2428import org.openstreetmap.josm.tools.GBC;
    2529import org.openstreetmap.josm.tools.Shortcut;
     30
    2631import relcontext.ChosenRelation;
    2732
     
    3641    protected ChosenRelation chRel;
    3742
    38     public CreateRelationAction( ChosenRelation chRel ) {
     43    public CreateRelationAction(ChosenRelation chRel) {
    3944        super(tr("New"), "data/relation", tr("Create a relation from selected objects"),
    4045                Shortcut.registerShortcut("reltoolbox:create", tr("Relation Toolbox: {0}", tr("Create a new relation")),
    41                 KeyEvent.VK_N, Shortcut.ALT_CTRL), false);
     46                        KeyEvent.VK_N, Shortcut.ALT_CTRL), false);
    4247        this.chRel = chRel;
    4348        updateEnabledState();
     
    4853    }
    4954
    50     public void actionPerformed( ActionEvent e ) {
     55    @Override
     56    public void actionPerformed(ActionEvent e) {
    5157        String type = askForType();
    52         if( type == null )
     58        if (type == null )
    5359            return;
    5460
    5561        Relation rel = new Relation();
    56         if( type.length() > 0 )
     62        if (type.length() > 0 ) {
    5763            rel.put("type", type);
    58         for( OsmPrimitive selected : getCurrentDataSet().getSelected() )
     64        }
     65        for (OsmPrimitive selected : getCurrentDataSet().getSelected() ) {
    5966            rel.addMember(new RelationMember("", selected));
     67        }
    6068
    6169        Main.main.undoRedo.add(new AddCommand(rel));
    6270
    63         if( chRel != null ) {
     71        if (chRel != null) {
    6472            chRel.set(rel);
    6573        }
     
    6876    @Override
    6977    protected void updateEnabledState() {
    70         if( getCurrentDataSet() == null ) {
     78        if (getCurrentDataSet() == null) {
    7179            setEnabled(false);
    7280        } else {
     
    7684
    7785    @Override
    78     protected void updateEnabledState( Collection<? extends OsmPrimitive> selection ) {
     86    protected void updateEnabledState(Collection<? extends OsmPrimitive> selection) {
    7987        setEnabled(selection != null && !selection.isEmpty());
    8088    }
     
    8290    // Thanks to TagInfo for the list
    8391    private static final List<String> RELATION_TYPES = Arrays.asList(new String[] {
    84         "multipolygon", "boundary", "route", "site", "restriction", "associatedStreet", "public_transport",
    85         "street", "collection", "address", "enforcement", "destination_sign", "route_master", "junction",
    86         "waterway", "bridge", "tunnel", "surveillance"
     92            "multipolygon", "boundary", "route", "site", "restriction", "associatedStreet", "public_transport",
     93            "street", "collection", "address", "enforcement", "destination_sign", "route_master", "junction",
     94            "waterway", "bridge", "tunnel", "surveillance"
    8795    });
    8896
     
    111119
    112120        keys.getEditor().addActionListener(new ActionListener() {
    113             public void actionPerformed( ActionEvent e ) {
     121            @Override
     122            public void actionPerformed(ActionEvent e) {
    114123                dlg.setVisible(false);
    115124                optionPane.setValue(JOptionPane.OK_OPTION);
     
    120129
    121130        Object answer = optionPane.getValue();
    122         if( answer == null || answer == JOptionPane.UNINITIALIZED_VALUE
    123                 || (answer instanceof Integer && (Integer)answer != JOptionPane.OK_OPTION) ) {
     131        if (answer == null || answer == JOptionPane.UNINITIALIZED_VALUE
     132                || (answer instanceof Integer && (Integer)answer != JOptionPane.OK_OPTION))
    124133            return null;
    125         }
    126134
    127135        String result = keys.getEditor().getItem().toString().trim();
Note: See TracChangeset for help on using the changeset viewer.