Changeset 9845 in josm for trunk/src/org


Ignore:
Timestamp:
2016-02-21T06:04:15+01:00 (8 years ago)
Author:
Don-vip
Message:

add more unit tests

File:
1 edited

Legend:

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

    r9759 r9845  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
     6import java.awt.GraphicsEnvironment;
    67import java.awt.event.ActionEvent;
    78import java.io.File;
     
    5556        }
    5657        if (keys.isEmpty()) {
    57             JOptionPane.showMessageDialog(Main.parent,
    58                     tr("All the preferences of this group are default, nothing to save"), tr("Warning"), JOptionPane.WARNING_MESSAGE);
     58            if (!GraphicsEnvironment.isHeadless()) {
     59                JOptionPane.showMessageDialog(Main.parent,
     60                        tr("All the preferences of this group are default, nothing to save"), tr("Warning"), JOptionPane.WARNING_MESSAGE);
     61            }
    5962            return;
    6063        }
     
    7881            }
    7982        };
    80         AbstractFileChooser fc = DiskAccessAction.createAndOpenFileChooser(false, false, title, filter,
    81                 JFileChooser.FILES_ONLY, "customsettings.lastDirectory");
    82         if (fc != null) {
    83             File sel = fc.getSelectedFile();
    84             if (!sel.getName().endsWith(".xml")) sel = new File(sel.getAbsolutePath()+".xml");
    85             if (!sel.getName().startsWith(schemaKey)) {
    86                 sel = new File(sel.getParentFile().getAbsolutePath()+'/'+schemaKey+'_'+sel.getName());
     83        if (!GraphicsEnvironment.isHeadless()) {
     84            AbstractFileChooser fc = DiskAccessAction.createAndOpenFileChooser(false, false, title, filter,
     85                    JFileChooser.FILES_ONLY, "customsettings.lastDirectory");
     86            if (fc != null) {
     87                File sel = fc.getSelectedFile();
     88                if (!sel.getName().endsWith(".xml"))
     89                    sel = new File(sel.getAbsolutePath()+".xml");
     90                if (!sel.getName().startsWith(schemaKey)) {
     91                    sel = new File(sel.getParentFile().getAbsolutePath()+'/'+schemaKey+'_'+sel.getName());
     92                }
     93                return sel;
    8794            }
    88             return sel;
    8995        }
    9096        return null;
Note: See TracChangeset for help on using the changeset viewer.