Changeset 33011 in osm for applications/editors/josm


Ignore:
Timestamp:
2016-09-24T14:18:41+02:00 (8 years ago)
Author:
donvip
Message:

checkstyle

Location:
applications/editors/josm/plugins/surveyor
Files:
1 added
29 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/surveyor/.project

    r32286 r33011  
    1616                        </arguments>
    1717                </buildCommand>
     18                <buildCommand>
     19                        <name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
     20                        <arguments>
     21                        </arguments>
     22                </buildCommand>
    1823        </buildSpec>
    1924        <natures>
    2025                <nature>org.eclipse.jdt.core.javanature</nature>
     26                <nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
    2127        </natures>
    2228</projectDescription>
  • applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/ActionConstants.java

    r13497 r33011  
    1 /**
    2  * Copyright by Christof Dallermassl
    3  * This program is free software and licensed under GPL.
    4  */
     1// License: GPL. For details, see LICENSE file.
    52package at.dallermassl.josm.plugin.surveyor;
    63
  • applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/AutoSaveAction.java

    r30646 r33011  
    1 /**
    2  * Copyright by Christof Dallermassl
    3  * This program is free software and licensed under GPL.
    4  */
     1// License: GPL. For details, see LICENSE file.
    52package at.dallermassl.josm.plugin.surveyor;
    63
     
    4239    public void actionPerformed(ActionEvent e) {
    4340        if (e.getSource() instanceof AbstractButton) {
    44             autoSave = ((AbstractButton)e.getSource()).isSelected();
     41            autoSave = ((AbstractButton) e.getSource()).isSelected();
    4542        }
    4643
    47         if(autoSave) {
    48             if(gpsDataTimer == null) {
     44        if (autoSave) {
     45            if (gpsDataTimer == null) {
    4946                gpsDataTimer = new Timer();
    5047            }
  • applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/AutoSaveEditLayerTimerTask.java

    r32464 r33011  
    1 /**
    2  * Copyright by Christof Dallermassl
    3  * This program is free software and licensed under GPL.
    4  */
     1// License: GPL. For details, see LICENSE file.
    52package at.dallermassl.josm.plugin.surveyor;
    63
     
    4441            File tmpFile = new File(file.getAbsoluteFile()+".tmp");
    4542            System.out.println("AutoSaving osm data to file " + file.getAbsolutePath());
    46             synchronized(SurveyorLock.class) {
     43            synchronized (SurveyorLock.class) {
    4744                OsmWriter w = OsmWriterFactory.createOsmWriter(new PrintWriter(new FileOutputStream(tmpFile)), false, dataset.getVersion());
    4845                w.header();
  • applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/AutoSaveGpsLayerTimerTask.java

    r30738 r33011  
    1 /**
    2  * Copyright by Christof Dallermassl
    3  * This program is free software and licensed under GPL.
    4  */
     1// License: GPL. For details, see LICENSE file.
    52package at.dallermassl.josm.plugin.surveyor;
    63
     
    5855        try {
    5956            GpxLayer gpsLayer = LayerUtil.findGpsLayer(gpsLayerName, GpxLayer.class);
    60             if(gpsLayer == null) {
     57            if (gpsLayer == null) {
    6158                return;
    6259            }
     
    6966            PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(tmpFile)));
    7067            try (GpxWriter gpxWriter = new GpxWriter(out)) {
    71                 gpxWriter.write(gpsLayer.data);
     68                gpxWriter.write(gpsLayer.data);
    7269            }
    7370            tmpFile.renameTo(file);
  • applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/ButtonDescription.java

    r30737 r33011  
    1 /**
    2  * Copyright by Christof Dallermassl
    3  * This program is free software and licensed under GPL.
    4  */
     1// License: GPL. For details, see LICENSE file.
    52package at.dallermassl.josm.plugin.surveyor;
    63
     
    4946        super();
    5047    }
    51     /**
    52      * @param hotkey
     48   
     49    /**
    5350     * @param actions a list of actions to be performed.
    5451     * @param type if <code>null</code> {@link ButtonType#SINGLE} is used.
     
    5956
    6057    /**
    61      * @param hotkey
    6258     * @param actions a list of actions to be performed.
    6359     * @param type if <code>null</code> {@link ButtonType#SINGLE} is used.
     
    7975
    8076    /**
    81      * @param hotkey
    8277     * @param actions a list of actions to be performed.
    8378     * @param type if <code>null</code> {@link ButtonType#SINGLE} is used.
     
    8883        this.hotkey = hotkey;
    8984        this.iconName = iconName;
    90         if(type == null) {
     85        if (type == null) {
    9186            this.type = ButtonType.SINGLE;
    9287        } else {
     
    10297        return this.actions;
    10398    }
     99   
    104100    /**
    105101     * @param actions the actions to set
     
    108104        this.actions = actions;
    109105    }
     106   
    110107    /**
    111108     * @return the hotkey
     
    114111        return this.hotkey;
    115112    }
     113   
    116114    /**
    117115     * @param hotkey the hotkey to set
     
    120118        this.hotkey = hotkey;
    121119    }
     120   
    122121    /**
    123122     * @return the label
     
    153152        }
    154153    }
     154   
    155155    /**
    156156     * @param type the type to set
     
    162162    /**
    163163     * Sets the name of the icon.
    164      * @param icon
    165164     */
    166165    public void setIcon(String icon) {
     
    176175        String actionName = tr(getLabel()) + " (" + hotkey + ")";
    177176
    178         Icon icon = ImageProvider.getIfAvailable(null,iconName);
     177        Icon icon = ImageProvider.getIfAvailable(null, iconName);
    179178        if (icon == null)
    180             icon = ImageProvider.getIfAvailable("markers",iconName);
     179            icon = ImageProvider.getIfAvailable("markers", iconName);
    181180        if (icon == null)
    182             icon = ImageProvider.getIfAvailable("symbols",iconName);
     181            icon = ImageProvider.getIfAvailable("symbols", iconName);
    183182        if (icon == null)
    184             icon = ImageProvider.getIfAvailable("nodes",iconName);
     183            icon = ImageProvider.getIfAvailable("nodes", iconName);
    185184
    186185        MetaAction action = new MetaAction(actionName, icon);
     
    189188
    190189        AbstractButton button;
    191         if(type == ButtonType.TOGGLE) {
     190        if (type == ButtonType.TOGGLE) {
    192191            button = new JToggleButton(action);
    193192            connectActionAndButton(action, button);
     
    223222        private Action action;
    224223        private AbstractButton button;
    225         public SelectionStateAdapter(Action theAction, AbstractButton theButton) {
     224       
     225        SelectionStateAdapter(Action theAction, AbstractButton theButton) {
    226226            action = theAction;
    227227            button = theButton;
    228228        }
     229       
    229230        protected void configure() {
    230231            action.addPropertyChangeListener(this);
    231232            button.addItemListener(this);
    232233        }
     234       
    233235        public void itemStateChanged(ItemEvent e) {
    234236            boolean value = e.getStateChange() == ItemEvent.SELECTED;
     
    238240
    239241        public void propertyChange(PropertyChangeEvent evt) {
    240             if(evt.getPropertyName().equals(ActionConstants.SELECTED_KEY)) {
    241                 Boolean newSelectedState = (Boolean)evt.getNewValue();
     242            if (evt.getPropertyName().equals(ActionConstants.SELECTED_KEY)) {
     243                Boolean newSelectedState = (Boolean) evt.getNewValue();
    242244                button.setSelected(newSelectedState.booleanValue());
    243245            }
  • applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/ButtonType.java

    r13497 r33011  
    1 /**
    2  * Copyright by Christof Dallermassl
    3  * This program is free software and licensed under GPL.
    4  */
     1// License: GPL. For details, see LICENSE file.
    52package at.dallermassl.josm.plugin.surveyor;
    63
  • applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/GpsActionEvent.java

    r13497 r33011  
    1 /**
    2  * Copyright by Christof Dallermassl
    3  * This program is free software and licensed under GPL.
    4  */
     1// License: GPL. For details, see LICENSE file.
    52package at.dallermassl.josm.plugin.surveyor;
    63
     
    1714    private LatLon coordinates;
    1815
    19 
    20     /**
    21      * @param e
    22      * @param latitude
    23      * @param longitude
    24      */
    2516    public GpsActionEvent(ActionEvent e, double latitude, double longitude) {
    2617        super(e.getSource(), e.getID(), e.getActionCommand(), e.getWhen(), e.getModifiers());
    2718        coordinates = new LatLon(latitude, longitude);
    2819    }
    29 
    3020
    3121    /**
     
    3525        return this.coordinates;
    3626    }
    37 
    38 
    39 
    4027}
  • applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/GpsDataSource.java

    r13497 r33011  
    1 /**
    2  * Copyright by Christof Dallermassl
    3  * This program is free software and licensed under GPL.
    4  */
     1// License: GPL. For details, see LICENSE file.
    52package at.dallermassl.josm.plugin.surveyor;
    63
     
    1613     * @return gps data.
    1714     */
    18     public LiveGpsData getGpsData();
    19 
     15    LiveGpsData getGpsData();
    2016}
  • applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/MetaAction.java

    r30646 r33011  
    1 /**
    2  * Copyright by Christof Dallermassl
    3  * This program is free software and licensed under GPL.
    4  */
     1// License: GPL. For details, see LICENSE file.
    52package at.dallermassl.josm.plugin.surveyor;
    63
     
    3532    }
    3633
    37     /**
    38      * @param name
    39      */
    4034    public MetaAction(String name) {
    4135        super(name);
    4236    }
    4337
    44     /**
    45      * @param name
    46      * @param icon
    47      */
    4838    public MetaAction(String name, Icon icon) {
    4939        super(name, icon);
    50         // TODO Auto-generated constructor stub
    5140    }
    5241
     
    9685            System.out.println("Surveyor: no gps data available!");
    9786            // TEST for offline test only:
    98             if(Main.pref.getBoolean("surveyor.debug")) {
     87            if (Main.pref.getBoolean("surveyor.debug")) {
    9988                for (SurveyorActionDescription action : actions) {
    10089                    action.actionPerformed(new GpsActionEvent(e, 0, 0));
     
    10392        }
    10493        JFrame frame = SurveyorPlugin.getSurveyorFrame();
    105         if(frame != null && frame.isVisible()) {
     94        if (frame != null && frame.isVisible()) {
    10695            frame.toFront();
    10796        }
    10897    }
    10998
    110     /**
    111      * @param gpsDataSource
    112      */
    11399    public void setGpsDataSource(GpsDataSource gpsDataSource) {
    114100        this.gpsDataSource = gpsDataSource;
  • applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorAction.java

    r13497 r33011  
    1 /**
    2  * Copyright by Christof Dallermassl
    3  * This program is free software and licensed under GPL.
    4  */
     1// License: GPL. For details, see LICENSE file.
    52package at.dallermassl.josm.plugin.surveyor;
    63
     
    1714     * @param event the event.
    1815     */
    19     public void actionPerformed(GpsActionEvent event);
     16    void actionPerformed(GpsActionEvent event);
    2017
    2118    /**
     
    2320     * @param parameters the parameters.
    2421     */
    25     public void setParameters(List<String> parameters);
     22    void setParameters(List<String> parameters);
    2623}
  • applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorActionDescription.java

    r30737 r33011  
    1 /**
    2  * Copyright by Christof Dallermassl
    3  * This program is free software and licensed under GPL.
    4  */
     1// License: GPL. For details, see LICENSE file.
    52package at.dallermassl.josm.plugin.surveyor;
    63
     
    107
    118import org.dinopolis.util.io.Tokenizer;
     9import org.openstreetmap.josm.Main;
    1210
    1311/**
     
    2018    private SurveyorAction action;
    2119
    22 
    2320    /**
    2421     * Default Constructor
     
    2724        super();
    2825    }
    29     /**
    30      * @param actionClass
    31      * @param params
    32      */
     26   
    3327    public SurveyorActionDescription(String actionClass) {
    3428        super();
    3529        this.actionClass = actionClass;
    3630    }
    37     /**
    38      * @param actionClass
    39      * @param params
    40      */
     31   
    4132    public SurveyorActionDescription(String actionClass, List<String> params) {
    4233        super();
     
    4435        this.params = params;
    4536    }
    46     /**
    47      * @param actionClass
    48      * @param params
    49      */
     37   
    5038    public SurveyorActionDescription(String actionClass, String[] params) {
    5139        super();
     
    5644        }
    5745    }
     46   
    5847    /**
    5948     * @return the actionClass
     
    6251        return this.actionClass;
    6352    }
     53   
    6454    /**
    6555     * @param actionClass the actionClass to set
     
    6858        this.actionClass = actionClass;
    6959    }
     60   
    7061    /**
    7162     * @return the params
     
    7465        return this.params;
    7566    }
     67   
    7668    /**
    7769     * @param params the params to set
     
    8274
    8375    public void actionPerformed(GpsActionEvent e) {
    84         if(action == null) {
     76        if (action == null) {
    8577            action = SurveyorActionFactory.getInstance(actionClass);
    8678            action.setParameters(getParameterList());
     
    10698            params = tokenizer.nextLine();
    10799        } catch (IOException ignore) {
     100            Main.debug(ignore);
    108101        }
    109102    }
  • applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorActionFactory.java

    r30737 r33011  
    1 /**
    2  * Copyright by Christof Dallermassl
    3  * This program is free software and licensed under GPL.
    4  */
     1// License: GPL. For details, see LICENSE file.
    52package at.dallermassl.josm.plugin.surveyor;
    63
     
    1714 *
    1815 */
    19 public class SurveyorActionFactory {
    20     private static Map<String, SurveyorAction>actionCache = new HashMap<>();
     16public final class SurveyorActionFactory {
     17    private static Map<String, SurveyorAction> actionCache = new HashMap<>();
    2118    public static final String DEFAULT_PACKAGE = SurveyorActionFactory.class.getPackage().getName() + ".action";
    2219
    23     /**
    24      * @param actionClass
    25      * @return
    26      */
     20    private SurveyorActionFactory() {
     21        // Hide default contructir for utilities classes
     22    }
     23   
    2724    public static SurveyorAction getInstance(String actionClass) {
    2825        try {
    2926            SurveyorAction action = actionCache.get(actionClass);
    30             if(action == null) {
     27            if (action == null) {
    3128                try {
    32                     action = (SurveyorAction)Class.forName(actionClass).newInstance();
     29                    action = (SurveyorAction) Class.forName(actionClass).newInstance();
    3330                } catch (ClassNotFoundException e) {
    3431                    actionClass = DEFAULT_PACKAGE + "." + actionClass;
    35                     action = (SurveyorAction)Class.forName(actionClass).newInstance();
     32                    action = (SurveyorAction) Class.forName(actionClass).newInstance();
    3633                }
    3734                actionCache.put(actionClass, action);
  • applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorComponent.java

    r30737 r33011  
    1 /**
    2  * Copyright by Christof Dallermassl
    3  * This program is free software and licensed under GPL.
    4  */
     1// License: GPL. For details, see LICENSE file.
    52package at.dallermassl.josm.plugin.surveyor;
    63
     
    4441    private JLabel streetLabel;
    4542    private JPanel buttonPanel;
    46     private Set<String>hotKeys;
     43    private Set<String> hotKeys;
    4744
    4845    public SurveyorComponent() {
     
    8481    public void setWidth(String widthString) {
    8582        width = Integer.parseInt(widthString);
    86         if(width > 0 && height > 0) {
     83        if (width > 0 && height > 0) {
    8784            super.setPreferredSize(new Dimension(width, height));
    8885        }
     
    9592    public void setHeight(String heightString) {
    9693        height = Integer.parseInt(heightString);
    97         if(width > 0 && height > 0) {
     94        if (width > 0 && height > 0) {
    9895            super.setPreferredSize(new Dimension(width, height));
    9996        }
     
    105102
    106103    public void addButton(ButtonDescription description) {
    107         if(description.getHotkey() != "" &&  hotKeys.contains(description.getHotkey())) {
    108             JOptionPane.showMessageDialog(Main.parent, tr("Duplicate hotkey for button ''{0}'' - button will be ignored!",description.getLabel()));
     104        if (description.getHotkey() != "" && hotKeys.contains(description.getHotkey())) {
     105            JOptionPane.showMessageDialog(Main.parent,
     106                    tr("Duplicate hotkey for button ''{0}'' - button will be ignored!", description.getLabel()));
    109107        } else {
    110             if(rows == 0 && columns == 0) {
     108            if (rows == 0 && columns == 0) {
    111109                setColumns("4");
    112110            }
     
    129127        try {
    130128            parser.start(in);
    131         } catch(SAXException e) {
     129        } catch (SAXException e) {
    132130            e.printStackTrace();
    133131        }
    134132        List<SurveyorActionDescription> actions = new ArrayList<>();
    135         while(parser.hasNext()) {
     133        while (parser.hasNext()) {
    136134            Object object = parser.next();
    137135            if (object instanceof SurveyorComponent) {
     
    140138            } else if (object instanceof ButtonDescription) {
    141139                System.out.println("ButtonDescription " + object);
    142                 ((ButtonDescription)object).setActions(actions);
    143                 surveyorComponent.addButton(((ButtonDescription)object));
     140                ((ButtonDescription) object).setActions(actions);
     141                surveyorComponent.addButton(((ButtonDescription) object));
    144142                actions.clear();
    145143            } else if (object instanceof SurveyorActionDescription) {
    146144                System.out.println("SurveyorActionDescription " + object);
    147                 actions.add((SurveyorActionDescription)object);
     145                actions.add((SurveyorActionDescription) object);
    148146            } else {
    149147                System.err.println("unknown " + object);
     
    160158    @Override
    161159    public void propertyChange(PropertyChangeEvent evt) {
    162         if("gpsdata".equals(evt.getPropertyName())) {
     160        if ("gpsdata".equals(evt.getPropertyName())) {
    163161            gpsData = (LiveGpsData) evt.getNewValue();
    164162            streetLabel.setText(tr("Way: ") + gpsData.getWayInfo());
    165163        }
    166 
    167164    }
    168165
  • applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorLock.java

    r19681 r33011  
     1// License: GPL. For details, see LICENSE file.
    12package at.dallermassl.josm.plugin.surveyor;
    23
  • applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorPlugin.java

    r19479 r33011  
    1 /**
    2  * Copyright by Christof Dallermassl
    3  * This program is free software and licensed under GPL.
    4  */
     1// License: GPL. For details, see LICENSE file.
    52package at.dallermassl.josm.plugin.surveyor;
    63
     
    1714import org.openstreetmap.josm.plugins.PluginInformation;
    1815
     16// CHECKSTYLE.OFF: HideUtilityClassConstructorCheck
     17
    1918/**
    2019 * Plugin that uses live gps data and a button panel to add nodes/waypoints etc at the current
     
    2625 *
    2726 */
    28 public class SurveyorPlugin {
     27public final class SurveyorPlugin {
    2928
    3029    private static JFrame surveyorFrame;
    3130    public static final String PREF_KEY_STREET_NAME_FONT_SIZE = "surveyor.way.fontsize";
    32 
     31   
    3332    /**
    34      *
     33     * Constructs a new {@code SurveyorPlugin}.
     34     * @param info plugin information
    3535     */
    3636    public SurveyorPlugin(PluginInformation info) {
    3737
    3838        LiveGpsPlugin gpsPlugin = (LiveGpsPlugin) PluginHandler.getPlugin("livegps");
    39         if(gpsPlugin == null)
     39        if (gpsPlugin == null)
    4040            throw new IllegalStateException(tr("SurveyorPlugin needs LiveGpsPlugin, but could not find it!"));
    4141
     
    6464    }
    6565
     66    // CHECKSTYLE.ON: HideUtilityClassConstructorCheck
    6667}
  • applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorShowAction.java

    r30738 r33011  
    1 /**
    2  * Copyright by Christof Dallermassl
    3  * This program is free software and licensed under GPL.
    4  */
     1// License: GPL. For details, see LICENSE file.
    52package at.dallermassl.josm.plugin.surveyor;
    63
     
    5148
    5249    @Override
    53         public void actionPerformed(ActionEvent e) {
    54         if(surveyorFrame == null) {
     50    public void actionPerformed(ActionEvent e) {
     51        if (surveyorFrame == null) {
    5552            surveyorFrame = new JFrame();
    5653
     
    6663            actionMap.put("zoomout", new AbstractAction() {
    6764                @Override
    68                                 public void actionPerformed(ActionEvent e) {
    69                     if(Main.map != null && Main.map.mapView != null) {
     65                public void actionPerformed(ActionEvent e) {
     66                    if (Main.map != null && Main.map.mapView != null) {
    7067                        Main.map.mapView.zoomToFactor(2);
    7168                    }
     
    7673            actionMap.put("zoomin", new AbstractAction() {
    7774                @Override
    78                                 public void actionPerformed(ActionEvent e) {
    79                     if(Main.map != null && Main.map.mapView != null) {
     75                public void actionPerformed(ActionEvent e) {
     76                    if (Main.map != null && Main.map.mapView != null) {
    8077                        Main.map.mapView.zoomToFactor(1/2);
    8178                    }
     
    8683            actionMap.put("autocenter", new AbstractAction() {
    8784                @Override
    88                                 public void actionPerformed(ActionEvent e) {
     85                public void actionPerformed(ActionEvent e) {
    8986                    // toggle autocenter
    9087                    gpsPlugin.setAutoCenter(!gpsPlugin.isAutoCenter());
     
    110107    public SurveyorComponent createComponent() {
    111108        String source = Main.pref.get("surveyor.source");
    112         if(source == null || source.length() == 0) {
     109        if (source == null || source.length() == 0) {
    113110            source = DEFAULT_SOURCE;
    114111            Main.pref.put("surveyor.source", DEFAULT_SOURCE);
     
    121118        } catch (IOException e) {
    122119            Main.error(e);
    123             JOptionPane.showMessageDialog(Main.parent, tr("Could not read surveyor definition: {0}",source));
     120            JOptionPane.showMessageDialog(Main.parent, tr("Could not read surveyor definition: {0}", source));
    124121        } catch (SAXException e) {
    125122            Main.error(e);
     
    144141        parser.start(new BufferedReader(new InputStreamReader(in)));
    145142        List<SurveyorActionDescription> actions = new ArrayList<>();
    146         while(parser.hasNext()) {
     143        while (parser.hasNext()) {
    147144            Object object = parser.next();
    148145            if (object instanceof SurveyorComponent) {
     
    151148            } else if (object instanceof ButtonDescription) {
    152149                //System.out.println("ButtonDescription " + object);
    153                 ((ButtonDescription)object).setActions(actions);
    154                 surveyorComponent.addButton(((ButtonDescription)object));
     150                ((ButtonDescription) object).setActions(actions);
     151                surveyorComponent.addButton(((ButtonDescription) object));
    155152                actions = new ArrayList<>();
    156153            } else if (object instanceof SurveyorActionDescription) {
    157154                //System.out.println("SurveyorActionDescription " + object);
    158                 actions.add((SurveyorActionDescription)object);
     155                actions.add((SurveyorActionDescription) object);
    159156            } else {
    160157                Main.error("surveyor: unknown xml element: " + object);
  • applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/AbstractSurveyorAction.java

    r30646 r33011  
    1 /**
    2  * Copyright by Christof Dallermassl
    3  * This program is free software and licensed under GPL.
    4  */
     1// License: GPL. For details, see LICENSE file.
    52package at.dallermassl.josm.plugin.surveyor.action;
    63
  • applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/BeepAction.java

    r30646 r33011  
    1 /**
    2  * Copyright by Christof Dallermassl
    3  * This program is free software and licensed under GPL.
    4  */
     1// License: GPL. For details, see LICENSE file.
    52package at.dallermassl.josm.plugin.surveyor.action;
    63
     
    2522        Main.worker.execute(new Runnable() {
    2623            public void run() {
    27                 for(int index = 0; index < beepNumber; ++index) {
     24                for (int index = 0; index < beepNumber; ++index) {
    2825                    Toolkit.getDefaultToolkit().beep();
    2926                    try {
    3027                        Thread.sleep(200);
    3128                    } catch (InterruptedException ignore) {
     29                        Main.debug(ignore);
    3230                    }
    3331                }
     
    4038        try {
    4139            beepNumber = Integer.parseInt(parameters.get(0));
    42         } catch(NumberFormatException e) {
     40        } catch (NumberFormatException e) {
    4341            // print but recover
    44             e.printStackTrace();
     42            Main.warn(e);
    4543        }
    4644    }
  • applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/ConsolePrinterAction.java

    r30646 r33011  
    1 /**
    2  * Copyright by Christof Dallermassl
    3  * This program is free software and licensed under GPL.
    4  */
     1// License: GPL. For details, see LICENSE file.
    52package at.dallermassl.josm.plugin.surveyor.action;
    63
  • applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/PlayAudioAction.java

    r30646 r33011  
    1 /**
    2  * Copyright by Christof Dallermassl
    3  * This program is free software and licensed under GPL.
    4  */
     1// License: GPL. For details, see LICENSE file.
    52package at.dallermassl.josm.plugin.surveyor.action;
    63
     
    3835            public void run() {
    3936                try {
    40                     if(audioSource == null) {
     37                    if (audioSource == null) {
    4138                        audioSource = getParameters().get(0);
    4239                    }
     
    6158                    // Create the clip
    6259                    DataLine.Info info = new DataLine.Info(
    63                         Clip.class, stream.getFormat(), ((int)stream.getFrameLength()*format.getFrameSize()));
     60                        Clip.class, stream.getFormat(), ((int) stream.getFrameLength()*format.getFrameSize()));
    6461                    Clip clip = (Clip) AudioSystem.getLine(info);
    6562
  • applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/SetNodeAction.java

    r32464 r33011  
    1 /**
    2  * Copyright by Christof Dallermassl
    3  * This program is free software and licensed under GPL.
    4  */
     1// License: GPL. For details, see LICENSE file.
    52package at.dallermassl.josm.plugin.surveyor.action;
    63
     
    4441        for (String keyValuePair : parameters) {
    4542            pos = keyValuePair.indexOf('=');
    46             if(pos > 0) {
     43            if (pos > 0) {
    4744                key = keyValuePair.substring(0, pos);
    4845                value = keyValuePair.substring(pos + 1);
     
    5956        //System.out.println(getClass().getSimpleName() + " KOORD: " + coordinates.lat() + ", " + coordinates.lon() + " params: " + keyValues);
    6057        Node node = new Node(coordinates);
    61         for(Pair<String, String> entry : keyValues) {
     58        for (Pair<String, String> entry : keyValues) {
    6259            node.put(entry.a, entry.b);
    6360        }
    64         synchronized(SurveyorLock.class) {
     61        synchronized (SurveyorLock.class) {
    6562            DataSet ds = Main.getLayerManager().getEditDataSet();
    66             if(ds != null)
    67             {
     63            if (ds != null) {
    6864                ds.addPrimitive(node);
    6965                ds.setSelected(node);
  • applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/SetWaypointAction.java

    r32464 r33011  
    1 /**
    2  * Copyright by Christof Dallermassl
    3  * This program is free software and licensed under GPL.
    4  */
     1// License: GPL. For details, see LICENSE file.
    52package at.dallermassl.josm.plugin.surveyor.action;
    63
     
    5148        String markerTitle = getParameters().get(0);
    5249        Object source = event.getSource();
    53         if(source instanceof JToggleButton) {
    54             if(((JToggleButton)source).isSelected()) {
     50        if (source instanceof JToggleButton) {
     51            if (((JToggleButton) source).isSelected()) {
    5552                markerTitle = tr("{0} start", markerTitle);
    5653            } else {
     
    7875   
    7976            String inputText = dialog.openDialog(SurveyorPlugin.getSurveyorFrame(), tr("Waypoint Description"), timeout*1000);
    80             if(inputText != null && inputText.length() > 0) {
     77            if (inputText != null && inputText.length() > 0) {
    8178                inputText = inputText.replaceAll("<", "_"); // otherwise the gpx file is ruined
    8279                markerText = markerText + " " + inputText;
     
    9087        WayPoint waypoint = new WayPoint(event.getCoordinates());
    9188        waypoint.attr.put("name", markerText);
    92         if(iconName != null && !iconName.isEmpty())
     89        if (iconName != null && !iconName.isEmpty())
    9390            waypoint.attr.put("sym", iconName);
    94         synchronized(SurveyorLock.class) {
     91        synchronized (SurveyorLock.class) {
    9592            layer.data.add(new Marker(event.getCoordinates(), markerText, iconName, null, -1.0, 0.0));
    96             if(gpsLayer != null) {
     93            if (gpsLayer != null) {
    9794                gpsLayer.data.waypoints.add(waypoint);
    9895            }
     
    107104     */
    108105    public MarkerLayer getMarkerLayer() {
    109         if(markerLayer == null) {
     106        if (markerLayer == null) {
    110107            markerLayer = LayerUtil.findGpsLayer(MARKER_LAYER_NAME, MarkerLayer.class);
    111108
    112             if(markerLayer == null) {
     109            if (markerLayer == null) {
    113110                // not found, add a new one
    114111                markerLayer = new MarkerLayer(new GpxData(), MARKER_LAYER_NAME, null, null);
     
    124121     */
    125122    public GpxLayer getGpxLayer() {
    126         if(liveGpsLayer == null) {
     123        if (liveGpsLayer == null) {
    127124            Collection<Layer> layers = Main.getLayerManager().getLayers();
    128125            for (Layer layer : layers) {
    129                 if(layer instanceof LiveGpsLayer) {
     126                if (layer instanceof LiveGpsLayer) {
    130127                    liveGpsLayer = (LiveGpsLayer) layer;
    131128                    break;
  • applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/SystemExecuteAction.java

    r30722 r33011  
    1 /**
    2  * Copyright by Christof Dallermassl
    3  * This program is free software and licensed under GPL.
    4  */
     1// License: GPL. For details, see LICENSE file.
    52package at.dallermassl.josm.plugin.surveyor.action;
    63
     
    3835
    3936                    while ((line = br.readLine()) != null) {
    40                         Main.info(getClass().getSimpleName() + ": " +  line);
     37                        Main.info(getClass().getSimpleName() + ": " + line);
    4138                    }
    4239
  • applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/TaggingPresetAction.java

    r31615 r33011  
    1 /**
    2  * Copyright by Christof Dallermassl
    3  * This program is free software and licensed under GPL.
    4  */
     1// License: GPL. For details, see LICENSE file.
    52package at.dallermassl.josm.plugin.surveyor.action;
    63
     
    2623    @Override
    2724    public void actionPerformed(GpsActionEvent event) {
    28         if(preset == null) {
     25        if (preset == null) {
    2926            return;
    3027        }
     
    4744    @Override
    4845    public void setParameters(List<String> parameters) {
    49         if(parameters.size() == 0) {
     46        if (parameters.size() == 0) {
    5047            throw new IllegalArgumentException("No annotation preset name given!");
    5148        }
  • applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/gui/DialogClosingThread.java

    r30646 r33011  
    1 /**
    2  * Copyright by Christof Dallermassl
    3  * This program is free software and licensed under GPL.
    4  */
     1// License: GPL. For details, see LICENSE file.
    52package at.dallermassl.josm.plugin.surveyor.action.gui;
    63
     
    2926    /**
    3027     * Using the given dialog and the default timeout.
    31      * @param dialog
    3228     */
    3329    public DialogClosingThread(JDialog dialog) {
     
    3531    }
    3632
    37     /**
    38      * @param dialog
    39      * @param timeout
    40      */
    4133    public DialogClosingThread(JDialog dialog, long timeout) {
    4234        super();
     
    4941    public void run() {
    5042        String title = dialog.getTitle();
    51         while(loopCount > 0) {
     43        while (loopCount > 0) {
    5244            dialog.setTitle(title + " (" + loopCount + "sec)");
    5345            --loopCount;
    5446            try {
    5547                sleep(1000);
    56             } catch(InterruptedException ignore) {}
     48            } catch (InterruptedException ignore) {
     49                Main.debug(ignore);
     50            }
    5751        }
    5852
     
    8377    }
    8478
    85     /**
    86      * @param optionPane
    87      */
    8879    public void observe(Container container) {
    89         for(Component component : container.getComponents()) {
    90             if(component instanceof JTextField) {
    91                 observe((JTextField)component);
     80        for (Component component : container.getComponents()) {
     81            if (component instanceof JTextField) {
     82                observe((JTextField) component);
    9283            } else {
    9384                observe(component);
  • applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/gui/WaypointDialog.java

    r30646 r33011  
    1 /**
    2  * Copyright by Christof Dallermassl
    3  * This program is free software and licensed under GPL.
    4  */
     1// License: GPL. For details, see LICENSE file.
    52package at.dallermassl.josm.plugin.surveyor.action.gui;
    63
  • applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/util/LayerUtil.java

    r32329 r33011  
    1 /**
    2  *
    3  */
     1// License: GPL. For details, see LICENSE file.
    42package at.dallermassl.josm.plugin.surveyor.util;
    53
     
    119 *
    1210 */
    13 public class LayerUtil {
     11public final class LayerUtil {
    1412
     13    private LayerUtil() {
     14        // Hide default contructir for utilities classes
     15    }
     16   
    1517    /**
    1618     * Returns the layer with the given name and type from the map view or <code>null</code>.
     
    2325    public static <LayerType extends Layer> LayerType findGpsLayer(String layerName, Class<LayerType> layerType) {
    2426        Layer result = null;
    25         if(Main.map != null && Main.map.mapView != null) {
    26             for(Layer layer : Main.getLayerManager().getLayers()) {
    27                 if(layerName.equals(layer.getName()) && layerType.isAssignableFrom(layer.getClass())) {
     27        if (Main.map != null && Main.map.mapView != null) {
     28            for (Layer layer : Main.getLayerManager().getLayers()) {
     29                if (layerName.equals(layer.getName()) && layerType.isAssignableFrom(layer.getClass())) {
    2830                    result = layer;
    2931                    break;
  • applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/util/ResourceLoader.java

    r30738 r33011  
    1 /**
    2  * Copyright by Christof Dallermassl
    3  * This program is free software and licensed under GPL.
    4  */
     1// License: GPL. For details, see LICENSE file.
    52package at.dallermassl.josm.plugin.surveyor.util;
    63
     
    1411 *
    1512 */
    16 public class ResourceLoader {
     13public final class ResourceLoader {
    1714
    1815    private ResourceLoader() {
     
    2926     */
    3027    @SuppressWarnings("resource")
    31         public static InputStream getInputStream(String source) throws IOException {
     28    public static InputStream getInputStream(String source) throws IOException {
    3229        InputStream in = null;
    3330        if (source.startsWith("http://") || source.startsWith("https://") || source.startsWith("ftp://") || source.startsWith("file:")) {
Note: See TracChangeset for help on using the changeset viewer.