Changeset 13776 in josm for trunk/src/org


Ignore:
Timestamp:
2018-05-15T23:50:34+02:00 (6 years ago)
Author:
Don-vip
Message:

don't display error dialog when loading preferences in headless mode

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/preferences/JosmBaseDirectories.java

    r13647 r13776  
    55import static org.openstreetmap.josm.tools.Utils.getSystemProperty;
    66
     7import java.awt.GraphicsEnvironment;
    78import java.io.File;
    89
     
    6970            if (createIfMissing && !preferencesDir.exists() && !preferencesDir.mkdirs()) {
    7071                Logging.warn(tr("Failed to create missing preferences directory: {0}", preferencesDir.getAbsoluteFile()));
    71                 JOptionPane.showMessageDialog(
    72                         Main.parent,
    73                         tr("<html>Failed to create missing preferences directory: {0}</html>", preferencesDir.getAbsoluteFile()),
    74                         tr("Error"),
    75                         JOptionPane.ERROR_MESSAGE
    76                 );
     72                if (!GraphicsEnvironment.isHeadless()) {
     73                    JOptionPane.showMessageDialog(
     74                            Main.parent,
     75                            tr("<html>Failed to create missing preferences directory: {0}</html>", preferencesDir.getAbsoluteFile()),
     76                            tr("Error"),
     77                            JOptionPane.ERROR_MESSAGE
     78                    );
     79                }
    7780            }
    7881        } catch (SecurityException e) {
     
    100103            if (createIfMissing && !userdataDir.exists() && !userdataDir.mkdirs()) {
    101104                Logging.warn(tr("Failed to create missing user data directory: {0}", userdataDir.getAbsoluteFile()));
    102                 JOptionPane.showMessageDialog(
    103                         Main.parent,
    104                         tr("<html>Failed to create missing user data directory: {0}</html>", userdataDir.getAbsoluteFile()),
    105                         tr("Error"),
    106                         JOptionPane.ERROR_MESSAGE
    107                 );
     105                if (!GraphicsEnvironment.isHeadless()) {
     106                    JOptionPane.showMessageDialog(
     107                            Main.parent,
     108                            tr("<html>Failed to create missing user data directory: {0}</html>", userdataDir.getAbsoluteFile()),
     109                            tr("Error"),
     110                            JOptionPane.ERROR_MESSAGE
     111                    );
     112                }
    108113            }
    109114        } catch (SecurityException e) {
     
    136141            if (createIfMissing && !cacheDir.exists() && !cacheDir.mkdirs()) {
    137142                Logging.warn(tr("Failed to create missing cache directory: {0}", cacheDir.getAbsoluteFile()));
    138                 JOptionPane.showMessageDialog(
    139                         Main.parent,
    140                         tr("<html>Failed to create missing cache directory: {0}</html>", cacheDir.getAbsoluteFile()),
    141                         tr("Error"),
    142                         JOptionPane.ERROR_MESSAGE
    143                 );
     143                if (!GraphicsEnvironment.isHeadless()) {
     144                    JOptionPane.showMessageDialog(
     145                            Main.parent,
     146                            tr("<html>Failed to create missing cache directory: {0}</html>", cacheDir.getAbsoluteFile()),
     147                            tr("Error"),
     148                            JOptionPane.ERROR_MESSAGE
     149                    );
     150                }
    144151            }
    145152        } catch (SecurityException e) {
Note: See TracChangeset for help on using the changeset viewer.