Ignore:
Timestamp:
2015-06-20T23:42:21+02:00 (9 years ago)
Author:
Don-vip
Message:

checkstyle: enable relevant whitespace checks and fix them

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/preferences/advanced/AdvancedPreference.java

    r8469 r8510  
    9090        p.add(lbFilter);
    9191        p.add(txtFilter, GBC.eol().fill(GBC.HORIZONTAL));
    92         txtFilter.getDocument().addDocumentListener(new DocumentListener(){
    93             @Override public void changedUpdate(DocumentEvent e) {
     92        txtFilter.getDocument().addDocumentListener(new DocumentListener() {
     93            @Override
     94            public void changedUpdate(DocumentEvent e) {
    9495                action();
    9596            }
    96             @Override public void insertUpdate(DocumentEvent e) {
     97
     98            @Override
     99            public void insertUpdate(DocumentEvent e) {
    97100                action();
    98101            }
    99             @Override public void removeUpdate(DocumentEvent e) {
     102
     103            @Override
     104            public void removeUpdate(DocumentEvent e) {
    100105                action();
    101106            }
     107
    102108            private void action() {
    103109                applyFilter();
     
    110116        JScrollPane scroll = new JScrollPane(table);
    111117        p.add(scroll, GBC.eol().fill(GBC.BOTH));
    112         scroll.setPreferredSize(new Dimension(400,200));
     118        scroll.setPreferredSize(new Dimension(400, 200));
    113119
    114120        JButton add = new JButton(tr("Add"));
    115121        p.add(Box.createHorizontalGlue(), GBC.std().fill(GBC.HORIZONTAL));
    116         p.add(add, GBC.std().insets(0,5,0,0));
    117         add.addActionListener(new ActionListener(){
     122        p.add(add, GBC.std().insets(0, 5, 0, 0));
     123        add.addActionListener(new ActionListener() {
    118124            @Override public void actionPerformed(ActionEvent e) {
    119125                PrefEntry pe = table.addPreference(gui);
    120                 if (pe!=null) {
     126                if (pe != null) {
    121127                    allData.add(pe);
    122128                    Collections.sort(allData);
     
    127133
    128134        JButton edit = new JButton(tr("Edit"));
    129         p.add(edit, GBC.std().insets(5,5,5,0));
    130         edit.addActionListener(new ActionListener(){
     135        p.add(edit, GBC.std().insets(5, 5, 5, 0));
     136        edit.addActionListener(new ActionListener() {
    131137            @Override public void actionPerformed(ActionEvent e) {
    132138                boolean ok = table.editPreference(gui);
     
    136142
    137143        JButton reset = new JButton(tr("Reset"));
    138         p.add(reset, GBC.std().insets(0,5,0,0));
    139         reset.addActionListener(new ActionListener(){
     144        p.add(reset, GBC.std().insets(0, 5, 0, 0));
     145        reset.addActionListener(new ActionListener() {
    140146            @Override public void actionPerformed(ActionEvent e) {
    141147                table.resetPreferences(gui);
     
    144150
    145151        JButton read = new JButton(tr("Read from file"));
    146         p.add(read, GBC.std().insets(5,5,0,0));
    147         read.addActionListener(new ActionListener(){
     152        p.add(read, GBC.std().insets(5, 5, 0, 0));
     153        read.addActionListener(new ActionListener() {
    148154            @Override public void actionPerformed(ActionEvent e) {
    149155                readPreferencesFromXML();
     
    152158
    153159        JButton export = new JButton(tr("Export selected items"));
    154         p.add(export, GBC.std().insets(5,5,0,0));
    155         export.addActionListener(new ActionListener(){
     160        p.add(export, GBC.std().insets(5, 5, 0, 0));
     161        export.addActionListener(new ActionListener() {
    156162            @Override public void actionPerformed(ActionEvent e) {
    157163                exportSelectedToXML();
     
    160166
    161167        final JButton more = new JButton(tr("More..."));
    162         p.add(more, GBC.std().insets(5,5,0,0));
     168        p.add(more, GBC.std().insets(5, 5, 0, 0));
    163169        more.addActionListener(new ActionListener() {
    164170            private JPopupMenu menu = buildPopupMenu();
     
    180186            // so we do not want to show it in the table as "changed" now
    181187            Setting<?> pluginSetting = orig.get("plugins");
    182             if (pluginSetting!=null) {
     188            if (pluginSetting != null) {
    183189                loaded.put("plugins", pluginSetting);
    184190            }
     
    195201                return f.isDirectory() || Utils.hasExtension(f, "xml");
    196202            }
     203
    197204            @Override
    198205            public String getDescription() {
     
    204211        if (fc != null) {
    205212            File[] sel = fc.isMultiSelectionEnabled() ? fc.getSelectedFiles() : (new File[]{fc.getSelectedFile()});
    206             if (sel.length==1 && !sel[0].getName().contains(".")) sel[0]=new File(sel[0].getAbsolutePath()+".xml");
     213            if (sel.length == 1 && !sel[0].getName().contains(".")) sel[0] = new File(sel[0].getAbsolutePath()+".xml");
    207214            return sel;
    208215        }
     
    314321    }
    315322
    316     private Map<String,String> profileTypes = new LinkedHashMap<>();
     323    private Map<String, String> profileTypes = new LinkedHashMap<>();
    317324
    318325    private JPopupMenu buildPopupMenu() {
     
    323330        profileTypes.put(marktr("imagery"), "imagery.*");
    324331
    325         for (Entry<String,String> e: profileTypes.entrySet()) {
     332        for (Entry<String, String> e: profileTypes.entrySet()) {
    326333            menu.add(new ExportProfileAction(Main.pref, e.getKey(), e.getValue()));
    327334        }
     
    354361
    355362    private JMenu getProfileMenu() {
    356         final JMenu p =new JMenu(tr("Load profile"));
     363        final JMenu p = new JMenu(tr("Load profile"));
    357364        p.addMenuListener(new MenuListener() {
    358365            @Override
     
    364371                       String s = f.getName();
    365372                       int idx = s.indexOf('_');
    366                        if (idx>=0) {
    367                             String t=s.substring(0,idx);
     373                       if (idx >= 0) {
     374                            String t = s.substring(0, idx);
    368375                            if (profileTypes.containsKey(t)) {
    369376                                p.add(new ImportProfileAction(s, f, t));
     
    377384                       String s = f.getName();
    378385                       int idx = s.indexOf('_');
    379                        if (idx>=0) {
    380                             String t=s.substring(0,idx);
     386                       if (idx >= 0) {
     387                            String t = s.substring(0, idx);
    381388                            if (profileTypes.containsKey(t)) {
    382389                                p.add(new ImportProfileAction(s, f, t));
     
    386393                }
    387394            }
     395
    388396            @Override
    389397            public void menuDeselected(MenuEvent me) {
    390398                // Not implemented
    391399            }
     400
    392401            @Override
    393402            public void menuCanceled(MenuEvent me) {
     
    450459            }
    451460        }
    452         if (table!=null) table.fireDataChanged();
     461        if (table != null) table.fireDataChanged();
    453462    }
    454463
Note: See TracChangeset for help on using the changeset viewer.