Changeset 205 in josm


Ignore:
Timestamp:
2007-04-03T13:49:40+02:00 (17 years ago)
Author:
imi
Message:
  • added "addToggleDialog" to MapFrame to give plugins the chance of providing new toggle dialogs
  • fixed display of <different> in the property dialog when selecting different non-empty values
  • fixed the preferences directory under Windows (JOSM now uses environment variable APPDATA)
  • added LiveGPS plugin to exception detection heuristic
Location:
src/org/openstreetmap/josm
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/org/openstreetmap/josm/data/Preferences.java

    r195 r205  
    6161         */
    6262        public String getPreferencesDir() {
     63                if (System.getenv("APPDATA") != null)
     64                        return System.getenv("APPDATA")+"/JOSM/";
    6365                return System.getProperty("user.home")+"/.josm/";
    6466        }
  • src/org/openstreetmap/josm/gui/MainApplication.java

    r198 r205  
    8484                // get the preferences.
    8585                final File prefDir = new File(Main.pref.getPreferencesDir());
     86
     87                // check if preferences directory has moved (TODO: Update code. Remove this after some time)
     88                File oldPrefDir = new File(System.getProperty("user.home")+"/.josm");
     89                if (!prefDir.isDirectory() && oldPrefDir.isDirectory()) {
     90                        if (oldPrefDir.renameTo(prefDir)) {
     91                                // do not translate this
     92                                JOptionPane.showMessageDialog(null, "The preference directory has been moved to "+prefDir);
     93                        } else {
     94                                JOptionPane.showMessageDialog(null, "The preference directory location has changed. Please move "+oldPrefDir+" to "+prefDir);
     95                        }
     96                }
     97
    8698                if (prefDir.exists() && !prefDir.isDirectory()) {
    8799                        JOptionPane.showMessageDialog(null, "Cannot open preferences directory: "+Main.pref.getPreferencesDir());
     
    105117                if (args.containsKey("default-classloader"))
    106118                        PluginInformation.useJosmClassloader = true;
    107                
     119
    108120                // load the early plugins
    109             if (Main.pref.hasKey("plugins")) {
     121                if (Main.pref.hasKey("plugins")) {
    110122                        for (String pluginName : Main.pref.get("plugins").split(",")) {
    111123                                try {
     
    169181                        public void run() {
    170182                                main.postConstructorProcessCmdLine(args);
    171             }
     183                        }
    172184                });
    173185        }
  • src/org/openstreetmap/josm/gui/MapFrame.java

    r198 r205  
    5151        public MapView mapView;
    5252        /**
    53          * The toolbar with the action icons
     53         * The toolbar with the action icons. To add new toggle dialog actions, use addToggleDialog
     54         * instead of adding directly to this list.
    5455         */
    5556        public JToolBar toolBarActions = new JToolBar(JToolBar.VERTICAL);
     
    6061
    6162        public ConflictDialog conflictDialog;
    62         private JPanel toggleDialogs = new JPanel();
     63        /**
     64         * The panel list of all toggle dialog icons. To add new toggle dialog actions, use addToggleDialog
     65         * instead of adding directly to this list.
     66         */
     67        public JPanel toggleDialogs = new JPanel();
    6368
    6469        public final ButtonGroup toolGroup = new ButtonGroup();
     
    118123                toggleDialogs.setLayout(new BoxLayout(toggleDialogs, BoxLayout.Y_AXIS));
    119124
    120                 addIconToggle(toggleDialogs, new LayerListDialog(this));
    121                 addIconToggle(toggleDialogs, new PropertiesDialog(this));
    122                 addIconToggle(toggleDialogs, new HistoryDialog());
    123                 addIconToggle(toggleDialogs, new SelectionListDialog());
    124                 addIconToggle(toggleDialogs, conflictDialog = new ConflictDialog());
    125                 addIconToggle(toggleDialogs, new CommandStackDialog(this));
     125                addToggleDialog(new LayerListDialog(this));
     126                addToggleDialog(new PropertiesDialog(this));
     127                addToggleDialog(new HistoryDialog());
     128                addToggleDialog(new SelectionListDialog());
     129                addToggleDialog(conflictDialog = new ConflictDialog());
     130                addToggleDialog(new CommandStackDialog(this));
    126131
    127132                // status line below the map
     
    147152        }
    148153
    149         private void addIconToggle(JPanel toggleDialogs, ToggleDialog dlg) {
     154        /**
     155         * Call this to add new toggle dialogs to the left button-list
     156         * @param dlg The toggle dialog. It must not be in the list already.
     157         */
     158        public void addToggleDialog(ToggleDialog dlg) {
    150159                IconToggleButton button = new IconToggleButton(dlg.action);
    151160                dlg.action.button = button;
  • src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java

    r203 r205  
    359359                        JComboBox value = new JComboBox(e.getValue().toArray());
    360360                        value.setEditable(true);
    361                         value.getEditor().setItem(valueCount.get(e.getKey()) != newSelection.size() ? tr("<different>") : e.getValue().iterator().next());
     361                        value.getEditor().setItem(e.getValue().size() > 1 || valueCount.get(e.getKey()) != newSelection.size() ? tr("<different>") : e.getValue().iterator().next());
    362362                        data.addRow(new Object[]{e.getKey(), value});
    363363                }
  • src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java

    r202 r205  
    6565                                                        JOptionPane.YES_NO_OPTION);
    6666                                        if (answer == JOptionPane.OK_OPTION) {
    67                                                 plugins.remove(pluginName);
     67                                                while (plugins.remove(pluginName)) {}
    6868                                                String p = "";
    6969                                                for (String s : plugins)
     
    157157                        if (c.contains("landsat.") || c.contains(".LandsatLayer"))
    158158                                return "landsat";
     159                        if (c.contains("livegps."))
     160                                return "livegps";
    159161                        if (c.contains("mappaint."))
    160162                                return "mappaint";
Note: See TracChangeset for help on using the changeset viewer.