Ignore:
Timestamp:
2013-09-23T16:47:50+02:00 (13 years ago)
Author:
Don-vip
Message:

Rework console output:

  • new log level "error"
  • Replace nearly all calls to system.out and system.err to Main.(error|warn|info|debug)
  • Remove some unnecessary debug output
  • Some messages are modified (removal of "Info", "Warning", "Error" from the message itself -> notable i18n impact but limited to console error messages not seen by the majority of users, so that's ok)
Location:
trunk/src/org/openstreetmap/josm/gui
Files:
66 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/BookmarkList.java

    r6203 r6248  
    112112                    bookmarks.add(new Bookmark(entry));
    113113                }
    114                 catch(Exception e) {
    115                     System.err.println(tr("Error reading bookmark entry: %s", e.getMessage()));
     114                catch (Exception e) {
     115                    Main.error(tr("Error reading bookmark entry: %s", e.getMessage()));
    116116                }
    117117            }
     
    126126                LinkedList<Bookmark> bookmarks = new LinkedList<Bookmark>();
    127127                if (bookmarkFile.exists()) {
    128                     System.out.println("Try loading obsolete bookmarks file");
     128                    Main.info("Try loading obsolete bookmarks file");
    129129                    BufferedReader in = new BufferedReader(new InputStreamReader(
    130130                            new FileInputStream(bookmarkFile), "utf-8"));
     
    133133                        Matcher m = Pattern.compile("^(.+)[,\u001e](-?\\d+.\\d+)[,\u001e](-?\\d+.\\d+)[,\u001e](-?\\d+.\\d+)[,\u001e](-?\\d+.\\d+)$").matcher(line);
    134134                        if (!m.matches() || m.groupCount() != 5) {
    135                             System.err.println(tr("Error: Unexpected line ''{0}'' in bookmark file ''{1}''",line, bookmarkFile.toString()));
     135                            Main.error(tr("Unexpected line ''{0}'' in bookmark file ''{1}''",line, bookmarkFile.toString()));
    136136                            continue;
    137137                        }
     
    142142                            try {
    143143                                values[i] = Double.parseDouble(m.group(i+2));
    144                             } catch(NumberFormatException e) {
    145                                 System.err.println(tr("Error: Illegal double value ''{0}'' on line ''{1}'' in bookmark file ''{2}''",m.group(i+2),line, bookmarkFile.toString()));
     144                            } catch (NumberFormatException e) {
     145                                Main.error(tr("Illegal double value ''{0}'' on line ''{1}'' in bookmark file ''{2}''",m.group(i+2),line, bookmarkFile.toString()));
    146146                                continue;
    147147                            }
     
    156156                    }
    157157                    save();
    158                     System.out.println("Removing obsolete bookmarks file");
     158                    Main.info("Removing obsolete bookmarks file");
    159159                    bookmarkFile.delete();
    160160                }
  • trunk/src/org/openstreetmap/josm/gui/GettingStarted.java

    r6143 r6248  
    130130                        content = new MotdContent().updateIfRequiredString();
    131131                    } catch (IOException ex) {
    132                         System.out.println(tr("Warning: failed to read MOTD. Exception was: {0}", ex.toString()));
     132                        Main.warn(tr("Failed to read MOTD. Exception was: {0}", ex.toString()));
    133133                        content = "<html>" + STYLE + "<h1>" + "JOSM - " + tr("Java OpenStreetMap Editor")
    134134                                + "</h1>\n<h2 align=\"center\">(" + tr("Message of the day not available") + ")</h2></html>";
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r6246 r6248  
    320320            CustomConfigurator.XMLCommandProcessor config = new CustomConfigurator.XMLCommandProcessor(Main.pref);
    321321            for (String i : args.get(Option.LOAD_PREFERENCES)) {
    322                 System.out.println("Reading preferences from " + i);
     322                info("Reading preferences from " + i);
    323323                try {
    324324                    config.openAndReadXML(Utils.openURL(new URL(i)));
     
    446446        if (Main.pref.getBoolean("debug.edt-checker.enable", Version.getInstance().isLocalBuild())) {
    447447            // Repaint manager is registered so late for a reason - there is lots of violation during startup process but they don't seem to break anything and are difficult to fix
    448             System.out.println("Enabled EDT checker, wrongful access to gui from non EDT thread will be printed to console");
     448            info("Enabled EDT checker, wrongful access to gui from non EDT thread will be printed to console");
    449449            RepaintManager.setCurrentManager(new CheckThreadViolationRepaintManager());
    450450        }
  • trunk/src/org/openstreetmap/josm/gui/MapStatus.java

    r6106 r6248  
    130130        public void appendLogMessage(String message) {
    131131            if (message != null && !message.isEmpty()) {
    132                 System.out.println("appendLogMessage not implemented for background tasks. Message was: " + message);
     132                Main.info("appendLogMessage not implemented for background tasks. Message was: " + message);
    133133            }
    134134        }
  • trunk/src/org/openstreetmap/josm/gui/MultiSplitLayout.java

    r6093 r6248  
    3131import java.beans.PropertyChangeListener;
    3232import java.beans.PropertyChangeSupport;
    33 import java.io.IOException;
    3433import java.io.Reader;
    3534import java.io.StreamTokenizer;
     
    4544import javax.swing.UIManager;
    4645
     46import org.openstreetmap.josm.Main;
    4747import org.openstreetmap.josm.tools.Utils;
    4848
     
    12631263        }
    12641264        catch (Exception e) {
    1265             System.err.println(e);
     1265            Main.error(e);
    12661266        }
    12671267        finally {
     
    13201320        return parseModel(new StringReader(s));
    13211321    }
    1322 
    1323     private static void printModel(String indent, Node root) {
    1324         if (root instanceof Split) {
    1325             Split split = (Split)root;
    1326             System.out.println(indent + split);
    1327             for(Node child : split.getChildren()) {
    1328                 printModel(indent + "  ", child);
    1329             }
    1330         }
    1331         else {
    1332             System.out.println(indent + root);
    1333         }
    1334     }
    1335 
    1336     /**
    1337      * Print the tree with enough detail for simple debugging.
    1338      */
    1339     public static void printModel(Node root) {
    1340         printModel("", root);
    1341     }
    13421322}
  • trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java

    r6203 r6248  
    860860
    861861                    if (perDistSq < snapDistanceSq && a < c + snapDistanceSq && b < c + snapDistanceSq) {
    862                         //System.err.println(Double.toHexString(perDistSq));
    863 
    864862                        List<WaySegment> wslist;
    865863                        if (nearestMap.containsKey(perDistSq)) {
  • trunk/src/org/openstreetmap/josm/gui/bbox/TileSelectionBBoxChooser.java

    r6246 r6248  
    6969 *            // listen for BBOX events
    7070 *            if (evt.getPropertyName().equals(BBoxChooser.BBOX_PROP)) {
    71  *               System.out.println("new bbox based on OSM tiles selected: " + (Bounds)evt.getNewValue());
     71 *               Main.info("new bbox based on OSM tiles selected: " + (Bounds)evt.getNewValue());
    7272 *            }
    7373 *        }
  • trunk/src/org/openstreetmap/josm/gui/conflict/pair/ListMergeModel.java

    r6084 r6248  
    719719                return ((RelationMember)value).getMember();
    720720            } else {
    721                 System.err.println("Unknown object type: "+value);
     721                Main.error("Unknown object type: "+value);
    722722                return null;
    723723            }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java

    r6104 r6248  
    317317    @Override
    318318    public void onConflictsRemoved(ConflictCollection conflicts) {
    319         System.err.println("1 conflict has been resolved.");
     319        Main.info("1 conflict has been resolved.");
    320320        refreshView();
    321321    }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/MapPaintDialog.java

    r6084 r6248  
    204204        }
    205205        if (!toReload.isEmpty()) {
    206             System.out.println(trn("Reloading {0} map style.", "Reloading {0} map styles.", toReload.size(), toReload.size()));
     206            Main.info(trn("Reloading {0} map style.", "Reloading {0} map styles.", toReload.size(), toReload.size()));
    207207            Main.worker.submit(new MapPaintStyleLoader(toReload));
    208208        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java

    r6246 r6248  
    846846                        buttonActions.add(action);
    847847                    } else {
    848                         System.err.println("Button " + button + " doesn't have action defined");
     848                        Main.warn("Button " + button + " doesn't have action defined");
    849849                        new Exception().printStackTrace();
    850850                    }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/UserListDialog.java

    r6085 r6248  
    203203            if (users.isEmpty()) return;
    204204            if (users.size() > 10) {
    205                 System.out.println(tr("Warning: only launching info browsers for the first {0} of {1} selected users", 10, users.size()));
     205                Main.warn(tr("Only launching info browsers for the first {0} of {1} selected users", 10, users.size()));
    206206            }
    207207            int num = Math.min(10, users.size());
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/BasicChangesetQueryPanel.java

    r6084 r6248  
    191191                q = BasicQuery.valueOf(BasicQuery.class, value);
    192192            } catch(IllegalArgumentException e) {
    193                 System.err.println(tr("Warning: unexpected value for preference ''{0}'', got ''{1}''. Resetting to default query.","changeset-query.basic.query", value));
     193                Main.warn(tr("Unexpected value for preference ''{0}'', got ''{1}''. Resetting to default query.","changeset-query.basic.query", value));
    194194                q = BasicQuery.MOST_RECENT_CHANGESETS;
    195195            }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ChildRelationBrowser.java

    r6084 r6248  
    428428            } catch (Exception e) {
    429429                if (canceled) {
    430                     System.out.println(tr("Warning: Ignoring exception because task was canceled. Exception: {0}", e
    431                             .toString()));
     430                    Main.warn(tr("Ignoring exception because task was canceled. Exception: {0}", e.toString()));
    432431                    return;
    433432                }
     
    521520            } catch (Exception e) {
    522521                if (canceled) {
    523                     System.out.println(tr("Warning: Ignoring exception because task was canceled. Exception: {0}", e
    524                             .toString()));
     522                    Main.warn(tr("Ignoring exception because task was canceled. Exception: {0}", e.toString()));
    525523                    return;
    526524                }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/DownloadRelationMemberTask.java

    r6093 r6248  
    145145        } catch (Exception e) {
    146146            if (canceled) {
    147                 System.out.println(tr("Warning: Ignoring exception because task was canceled. Exception: {0}", e
    148                         .toString()));
     147                Main.warn(tr("Ignoring exception because task was canceled. Exception: {0}", e.toString()));
    149148                return;
    150149            }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/DownloadRelationTask.java

    r6084 r6248  
    108108        } catch (Exception e) {
    109109            if (canceled) {
    110                 System.out.println(tr("Warning: Ignoring exception because task was canceled. Exception: {0}", e
    111                         .toString()));
     110                Main.warn(tr("Ignoring exception because task was canceled. Exception: {0}", e.toString()));
    112111                return;
    113112            }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ParentRelationLoadingTask.java

    r6084 r6248  
    193193        } catch(Exception e) {
    194194            if (canceled) {
    195                 System.out.println(tr("Warning: Ignoring exception because task was canceled. Exception: {0}", e.toString()));
     195                Main.warn(tr("Ignoring exception because task was canceled. Exception: {0}", e.toString()));
    196196                return;
    197197            }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationTree.java

    r6084 r6248  
    159159            } catch(Exception e) {
    160160                if (canceled) {
    161                     System.out.println(tr("Warning: Ignoring exception because task was canceled. Exception: {0}", e.toString()));
     161                    Main.warn(tr("Ignoring exception because task was canceled. Exception: {0}", e.toString()));
    162162                    return;
    163163                }
  • trunk/src/org/openstreetmap/josm/gui/help/HelpBrowser.java

    r6105 r6248  
    145145            }
    146146        } catch(Exception e) {
    147             System.err.println(tr("Failed to read CSS file ''help-browser.css''. Exception is: {0}", e.toString()));
     147            Main.error(tr("Failed to read CSS file ''help-browser.css''. Exception is: {0}", e.toString()));
    148148            e.printStackTrace();
    149149            return ss;
     
    499499        @Override
    500500        public void update(Observable o, Object arg) {
    501             //System.out.println("BackAction: canGoBoack=" + history.canGoBack() );
    502501            setEnabled(history.canGoBack());
    503502        }
     
    559558                        return true;
    560559                    }
    561                 } catch(BadLocationException e) {
    562                     System.err.println(tr("Warning: bad location in HTML document. Exception was: {0}", e.toString()));
     560                } catch (BadLocationException e) {
     561                    Main.warn(tr("Bad location in HTML document. Exception was: {0}", e.toString()));
    563562                    e.printStackTrace();
    564563                }
  • trunk/src/org/openstreetmap/josm/gui/io/AbstractUploadTask.java

    r6199 r6248  
    265265            }
    266266        }
    267         System.out.println(tr("Warning: error header \"{0}\" did not match with an expected pattern", errorHeader));
     267        Main.warn(tr("Error header \"{0}\" did not match with an expected pattern", errorHeader));
    268268        handleUploadConflictForUnknownConflict();
    269269    }
     
    280280            handleUploadPreconditionFailedConflict(e, conflict);
    281281        } else {
    282             System.out.println(tr("Warning: error header \"{0}\" did not match with an expected pattern", e.getErrorHeader()));
     282            Main.warn(tr("Error header \"{0}\" did not match with an expected pattern", e.getErrorHeader()));
    283283            ExceptionDialogUtil.explainPreconditionFailed(e);
    284284        }
  • trunk/src/org/openstreetmap/josm/gui/io/CredentialDialog.java

    r6087 r6248  
    106106            setAlwaysOnTop(true);
    107107        } catch(SecurityException e) {
    108             System.out.println(tr("Warning: failed to put Credential Dialog always on top. Caught security exception."));
     108            Main.warn(tr("Failed to put Credential Dialog always on top. Caught security exception."));
    109109        }
    110110        build();
  • trunk/src/org/openstreetmap/josm/gui/io/DownloadFileTask.java

    r6070 r6248  
    1818import java.util.zip.ZipFile;
    1919
     20import org.openstreetmap.josm.Main;
    2021import org.openstreetmap.josm.gui.PleaseWaitDialog;
    2122import org.openstreetmap.josm.gui.PleaseWaitRunnable;
     
    121122            Utils.close(out);
    122123            if (!canceled) {
    123                 System.out.println(tr("Download finished"));
     124                Main.info(tr("Download finished"));
    124125                if (unpack) {
    125                     System.out.println(tr("Unpacking {0} into {1}", file.getAbsolutePath(), file.getParent()));
     126                    Main.info(tr("Unpacking {0} into {1}", file.getAbsolutePath(), file.getParent()));
    126127                    unzipFileRecursively(file, file.getParent());
    127128                    file.delete();
     
    129130            }
    130131        } catch(MalformedURLException e) {
    131             String msg = tr("Warning: Cannot download file ''{0}''. Its download link ''{1}'' is not a valid URL. Skipping download.", file.getName(), address);
    132             System.err.println(msg);
     132            String msg = tr("Cannot download file ''{0}''. Its download link ''{1}'' is not a valid URL. Skipping download.", file.getName(), address);
     133            Main.warn(msg);
    133134            throw new DownloadException(msg);
    134135        } catch (IOException e) {
  • trunk/src/org/openstreetmap/josm/gui/io/DownloadOpenChangesetsTask.java

    r5890 r6248  
    117117                im.setPartiallyIdentified(im.getUserName());
    118118            }
    119             System.err.println(tr("Warning: Failed to retrieve user infos for the current JOSM user. Exception was: {0}", e.toString()));
     119            Main.warn(tr("Failed to retrieve user infos for the current JOSM user. Exception was: {0}", e.toString()));
    120120        }
    121121    }
  • trunk/src/org/openstreetmap/josm/gui/io/UploadLayerTask.java

    r5266 r6248  
    77import java.util.HashSet;
    88
     9import org.openstreetmap.josm.Main;
    910import org.openstreetmap.josm.actions.upload.CyclicUploadDependencyException;
    1011import org.openstreetmap.josm.data.APIDataSet;
     
    9394            // we tried to delete an already deleted primitive.
    9495            //
    95             System.out.println(tr("Warning: object ''{0}'' is already deleted on the server. Skipping this object and retrying to upload.", p.getDisplayName(DefaultNameFormatter.getInstance())));
     96            Main.warn(tr("Object ''{0}'' is already deleted on the server. Skipping this object and retrying to upload.", p.getDisplayName(DefaultNameFormatter.getInstance())));
    9697            processedPrimitives.addAll(writer.getProcessedPrimitives());
    9798            processedPrimitives.add(p);
     
    138139        } catch (Exception sxe) {
    139140            if (isCanceled()) {
    140                 System.out.println("Ignoring exception caught because upload is canceled. Exception is: " + sxe.toString());
     141                Main.info("Ignoring exception caught because upload is canceled. Exception is: " + sxe.toString());
    141142                return;
    142143            }
  • trunk/src/org/openstreetmap/josm/gui/io/UploadPrimitivesTask.java

    r6132 r6248  
    2626import org.openstreetmap.josm.gui.HelpAwareOptionPane;
    2727import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec;
     28import org.openstreetmap.josm.gui.Notification;
    2829import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    2930import org.openstreetmap.josm.gui.progress.ProgressMonitor;
     
    3738import org.openstreetmap.josm.tools.ImageProvider;
    3839import org.xml.sax.SAXException;
    39 
    40 import org.openstreetmap.josm.gui.Notification;
    4140
    4241/**
     
    206205            }
    207206            monitor.appendLogMessage(msg);
    208             System.out.println(tr("Warning: {0}", msg));
     207            Main.warn(msg);
    209208            processedPrimitives.addAll(writer.getProcessedPrimitives());
    210209            processedPrimitives.add(p);
     
    301300        } catch (Exception e) {
    302301            if (uploadCanceled) {
    303                 System.out.println(tr("Ignoring caught exception because upload is canceled. Exception is: {0}", e.toString()));
     302                Main.info(tr("Ignoring caught exception because upload is canceled. Exception is: {0}", e.toString()));
    304303            } else {
    305304                lastException = e;
  • trunk/src/org/openstreetmap/josm/gui/io/UploadSelectionDialog.java

    r6084 r6248  
    151151    public List<OsmPrimitive> getSelectedPrimitives() {
    152152        ArrayList<OsmPrimitive> ret  = new ArrayList<OsmPrimitive>();
    153         System.out.println("selected length:" +lstSelectedPrimitives.getSelectedIndices().length);
    154         for (int i=0; i< lstSelectedPrimitives.getSelectedIndices().length;i++) {
    155             System.out.println("selected:" +lstSelectedPrimitives.getSelectedIndices()[i]);
    156         }
    157153        ret.addAll(lstSelectedPrimitives.getOsmPrimitiveListModel().getPrimitives(lstSelectedPrimitives.getSelectedIndices()));
    158154        ret.addAll(lstDeletedPrimitives.getOsmPrimitiveListModel().getPrimitives(lstDeletedPrimitives.getSelectedIndices()));
  • trunk/src/org/openstreetmap/josm/gui/io/UploadStrategy.java

    r5266 r6248  
    8686        UploadStrategy strategy = fromPreference(v);
    8787        if (strategy == null) {
    88             System.err.println(tr("Warning: unexpected value for key ''{0}'' in preferences, got ''{1}''", "osm-server.upload-strategy", v ));
     88            Main.warn(tr("Unexpected value for key ''{0}'' in preferences, got ''{1}''", "osm-server.upload-strategy", v ));
    8989            return DEFAULT_UPLOAD_STRATEGY;
    9090        }
  • trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java

    r6232 r6248  
    135135            }
    136136        }
    137         //System.out.println("scanning "+data.tracks.size()+" tracks, found min,max"+min+"--"+max);
    138137        if (min==1e100 || max==-1e100) return null;
    139138        return new Date[]{new Date((long) (min * 1000)), new Date((long) (max * 1000)), };
     
    425424         ********** STEP 1 - GET CONFIG VALUES **************************
    426425         ****************************************************************/
    427         // Long startTime = System.currentTimeMillis();
    428426        Color neutralColor = getColor(true);
    429427        String spec="layer "+getName();
     
    788786            g.setStroke(storedStroke);
    789787        }
    790         // Long duration = System.currentTimeMillis() - startTime;
    791         // System.out.println(duration);
    792788    } // end paint
    793789
  • trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java

    r6084 r6248  
    396396            data.setVersion(from.getVersion());
    397397        } else if ("0.5".equals(data.getVersion()) ^ "0.5".equals(from.getVersion())) {
    398             System.err.println(tr("Warning: mixing 0.6 and 0.5 data results in version 0.5"));
     398            Main.warn(tr("Mixing 0.6 and 0.5 data results in version 0.5"));
    399399            data.setVersion("0.5");
    400400        }
  • trunk/src/org/openstreetmap/josm/gui/layer/TMSLayer.java

    r6093 r6248  
    329329                String r = new Scanner(in).useDelimiter("\\A").next();
    330330                Utils.close(in);
    331                 System.out.println("Successfully loaded Bing attribution data.");
     331                Main.info("Successfully loaded Bing attribution data.");
    332332                return r.getBytes("utf-8");
    333333            }
     
    347347                            return parseAttributionText(new InputSource(new StringReader((xml))));
    348348                        } catch (IOException ex) {
    349                             System.err.println("Could not connect to Bing API. Will retry in " + waitTimeSec + " seconds.");
     349                            Main.warn("Could not connect to Bing API. Will retry in " + waitTimeSec + " seconds.");
    350350                            Thread.sleep(waitTimeSec * 1000L);
    351351                            waitTimeSec *= 2;
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java

    r6246 r6248  
    10521052            delta = Math.round(diff - timezone*60*60); // seconds
    10531053
    1054             /*System.out.println("phto " + firstExifDate);
    1055             System.out.println("gpx  " + firstGPXDate);
    1056             System.out.println("diff " + diff);
    1057             System.out.println("difh " + diffInH);
    1058             System.out.println("days " + dayOffset);
    1059             System.out.println("time " + tz);
    1060             System.out.println("fix  " + timezone);
    1061             System.out.println("offt " + delta);*/
     1054            /*Main.debug("phto " + firstExifDate);
     1055            Main.debug("gpx  " + firstGPXDate);
     1056            Main.debug("diff " + diff);
     1057            Main.debug("difh " + diffInH);
     1058            Main.debug("days " + dayOffset);
     1059            Main.debug("time " + tz);
     1060            Main.debug("fix  " + timezone);
     1061            Main.debug("offt " + delta);*/
    10621062
    10631063            tfTimezone.getDocument().removeDocumentListener(statusBarUpdater);
     
    11601160
    11611161                        } catch(ParseException e) {
    1162                             System.err.println("Error while parsing date \"" + curWpTimeStr + '"');
     1162                            Main.error("Error while parsing date \"" + curWpTimeStr + '"');
    11631163                            e.printStackTrace();
    11641164                            prevWp = null;
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java

    r6209 r6248  
    558558
    559559        } catch (Exception ex) { // (other exceptions, e.g. #5271)
    560             System.err.println("Error reading EXIF from file: "+ex);
     560            Main.error("Error reading EXIF from file: "+ex);
    561561            e.setExifCoor(null);
    562562            e.setPos(null);
     
    651651
    652652                if (toDelete.getFile().delete()) {
    653                     System.out.println("File "+toDelete.getFile().toString()+" deleted. ");
     653                    Main.info("File "+toDelete.getFile().toString()+" deleted. ");
    654654                } else {
    655655                    JOptionPane.showMessageDialog(
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ThumbsLoader.java

    r6084 r6248  
    3737    @Override
    3838    public void run() {
    39         System.err.println("Load Thumbnails");
     39        Main.debug("Load Thumbnails");
    4040        tracker = new MediaTracker(Main.map.mapView);
    4141        for (int i = 0; i < data.size(); i++) {
     
    7171        if (!cacheOff) {
    7272            BufferedImage cached = cache.getImg(cacheIdent);
    73             if(cached != null) {
    74                 System.err.println(" from cache");
     73            if (cached != null) {
     74                Main.debug(" from cache");
    7575                return cached;
    7676            }
     
    8282            tracker.waitForID(0);
    8383        } catch (InterruptedException e) {
    84             System.err.println(" InterruptedException");
     84            Main.error(" InterruptedException");
    8585            return null;
    8686        }
    8787        if (tracker.isErrorID(1) || img.getWidth(null) <= 0 || img.getHeight(null) <= 0) {
    88             System.err.println(" Invalid image");
     88            Main.error(" Invalid image");
    8989            return null;
    9090        }
     
    104104
    105105        if (scaledBI.getWidth() <= 0 || scaledBI.getHeight() <= 0) {
    106             System.err.println(" Invalid image");
     106            Main.error(" Invalid image");
    107107            return null;
    108108        }
     
    112112        }
    113113
    114         System.err.println("");
    115114        return scaledBI;
    116115    }
  • trunk/src/org/openstreetmap/josm/gui/layer/gpx/ImportAudioAction.java

    r6104 r6248  
    131131            url = wavFile.toURI().toURL();
    132132        } catch (MalformedURLException e) {
    133             System.err.println("Unable to convert filename " + wavFile.getAbsolutePath() + " to URL");
     133            Main.error("Unable to convert filename " + wavFile.getAbsolutePath() + " to URL");
    134134        }
    135135        Collection<WayPoint> waypoints = new ArrayList<WayPoint>();
  • trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java

    r6242 r6248  
    291291            }
    292292        } catch (URISyntaxException e) {
    293             Main.warn("URISyntaxException: "+e.getMessage());
     293            Main.warn(e);
    294294        }
    295295        return true;
  • trunk/src/org/openstreetmap/josm/gui/mappaint/Cascade.java

    r6142 r6248  
    1111import java.util.regex.Pattern;
    1212
     13import org.openstreetmap.josm.Main;
    1314import org.openstreetmap.josm.gui.mappaint.mapcss.CSSColors;
    1415import org.openstreetmap.josm.tools.Utils;
     
    4950        if (res == null) {
    5051            if (!suppressWarnings) {
    51                 System.err.println(String.format("Warning: unable to convert property %s to type %s: found %s of type %s!", key, klass, o, o.getClass()));
     52                Main.warn(String.format("Unable to convert property %s to type %s: found %s of type %s!", key, klass, o, o.getClass()));
    5253            }
    5354            return def;
  • trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java

    r6174 r6248  
    100100                .setHeight(height)
    101101                .setOptional(true).get();
    102         if(i == null)
    103         {
    104             System.out.println("Mappaint style \""+namespace+"\" ("+ref.source.getDisplayString()+") icon \"" + ref.iconName + "\" not found.");
     102        if (i == null) {
     103            Main.warn("Mappaint style \""+namespace+"\" ("+ref.source.getDisplayString()+") icon \"" + ref.iconName + "\" not found.");
    105104            return null;
    106105        }
     
    243242                    }
    244243                }
    245                 System.err.println("Warning: Could not detect style type. Using default (xml).");
     244                Main.warn("Could not detect style type. Using default (xml).");
    246245                return new XmlStyleSource(entry);
    247246            }
    248247        } catch (IOException e) {
    249             System.err.println(tr("Warning: failed to load Mappaint styles from ''{0}''. Exception was: {1}", entry.url, e.toString()));
     248            Main.warn(tr("Failed to load Mappaint styles from ''{0}''. Exception was: {1}", entry.url, e.toString()));
    250249            e.printStackTrace();
    251250        } finally {
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java

    r6142 r6248  
    525525                throw new RuntimeException(ex);
    526526            } catch (InvocationTargetException ex) {
    527                 System.err.println(ex);
     527                Main.error(ex);
    528528                return null;
    529529            }
     
    574574                throw new RuntimeException(ex);
    575575            } catch (InvocationTargetException ex) {
    576                 System.err.println(ex);
     576                Main.error(ex);
    577577                return null;
    578578            }
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParser.jj

    r5705 r6248  
    2727import org.openstreetmap.josm.tools.Pair;
    2828import org.openstreetmap.josm.tools.Utils;
     29import org.openstreetmap.josm.Main;
    2930
    3031public class MapCSSParser {
     
    573574    }
    574575   
    575     System.err.println("Skipping to the next rule, because of an error:");
    576     System.err.println(e);
     576    Main.error("Skipping to the next rule, because of an error:");
     577    Main.error(e);
    577578    if (sheet != null) {
    578579        sheet.logError(e);
     
    598599                t.image.contains("\n")) {
    599600            ParseException e = new ParseException(String.format("Warning: end of line while reading an unquoted string at line %s column %s.", t.beginLine, t.beginColumn));
    600             System.err.println(e);
     601            Main.error(e);
    601602            if (sheet != null) {
    602603                sheet.logError(e);
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java

    r6175 r6248  
    1515import java.util.zip.ZipFile;
    1616
     17import org.openstreetmap.josm.Main;
    1718import org.openstreetmap.josm.data.osm.Node;
    1819import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    7071            loadMeta();
    7172            loadCanvas();
    72         } catch(IOException e) {
    73             System.err.println(tr("Warning: failed to load Mappaint styles from ''{0}''. Exception was: {1}", url, e.toString()));
     73        } catch (IOException e) {
     74            Main.warn(tr("Failed to load Mappaint styles from ''{0}''. Exception was: {1}", url, e.toString()));
    7475            e.printStackTrace();
    7576            logError(e);
    7677        } catch (TokenMgrError e) {
    77             System.err.println(tr("Warning: failed to parse Mappaint styles from ''{0}''. Error was: {1}", url, e.getMessage()));
     78            Main.warn(tr("Failed to parse Mappaint styles from ''{0}''. Error was: {1}", url, e.getMessage()));
    7879            e.printStackTrace();
    7980            logError(e);
    8081        } catch (ParseException e) {
    81             System.err.println(tr("Warning: failed to parse Mappaint styles from ''{0}''. Error was: {1}", url, e.getMessage()));
     82            Main.warn(tr("Failed to parse Mappaint styles from ''{0}''. Error was: {1}", url, e.getMessage()));
    8283            e.printStackTrace();
    8384            logError(new ParseException(e.getMessage())); // allow e to be garbage collected, it links to the entire token stream
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java

    r6175 r6248  
    55import java.util.regex.PatternSyntaxException;
    66
     7import org.openstreetmap.josm.Main;
    78import org.openstreetmap.josm.data.osm.Node;
    89import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    224225                    if (!c.applies(env)) return false;
    225226                } catch (PatternSyntaxException e) {
    226                     System.err.println("PatternSyntaxException while applying condition" + c +": "+e.getMessage());
     227                    Main.error("PatternSyntaxException while applying condition" + c +": "+e.getMessage());
    227228                    return false;
    228229                }
  • trunk/src/org/openstreetmap/josm/gui/mappaint/xml/LinePrototype.java

    r3856 r6248  
    55import java.util.List;
    66
     7import org.openstreetmap.josm.Main;
    78import org.openstreetmap.josm.data.osm.visitor.paint.MapPaintSettings;
    89import org.openstreetmap.josm.data.osm.visitor.paint.PaintColors;
     
    6263            }
    6364            if (f < 0) {
    64                 System.err.println(I18n.tr("Illegal dash pattern, values must be positive"));
     65                Main.error(I18n.tr("Illegal dash pattern, values must be positive"));
    6566                this.dashed = null;
    6667                return;
     
    7071            this.dashed = dashed;
    7172        } else {
    72             System.err.println(I18n.tr("Illegal dash pattern, at least one value must be > 0"));
     73            Main.error(I18n.tr("Illegal dash pattern, at least one value must be > 0"));
    7374        }
    7475    }
  • trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSource.java

    r6148 r6248  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
     6import java.io.IOException;
    67import java.io.InputStream;
    78import java.io.InputStreamReader;
    8 import java.io.IOException;
    99import java.util.Collection;
    1010import java.util.Collections;
     
    7676            }
    7777
    78         } catch(IOException e) {
    79             System.err.println(tr("Warning: failed to load Mappaint styles from ''{0}''. Exception was: {1}", url, e.toString()));
     78        } catch (IOException e) {
     79            Main.warn(tr("Failed to load Mappaint styles from ''{0}''. Exception was: {1}", url, e.toString()));
    8080            e.printStackTrace();
    8181            logError(e);
    82         } catch(SAXParseException e) {
    83             System.err.println(tr("Warning: failed to parse Mappaint styles from ''{0}''. Error was: [{1}:{2}] {3}", url, e.getLineNumber(), e.getColumnNumber(), e.getMessage()));
     82        } catch (SAXParseException e) {
     83            Main.warn(tr("Failed to parse Mappaint styles from ''{0}''. Error was: [{1}:{2}] {3}", url, e.getLineNumber(), e.getColumnNumber(), e.getMessage()));
    8484            e.printStackTrace();
    8585            logError(e);
    86         } catch(SAXException e) {
    87             System.err.println(tr("Warning: failed to parse Mappaint styles from ''{0}''. Error was: {1}", url, e.getMessage()));
     86        } catch (SAXException e) {
     87            Main.warn(tr("Failed to parse Mappaint styles from ''{0}''. Error was: {1}", url, e.getMessage()));
    8888            e.printStackTrace();
    8989            logError(e);
  • trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSourceHandler.java

    r6246 r6248  
    7373    private void error(String message) {
    7474        String warning = style.getDisplayString() + " (" + rule.cond.key + "=" + rule.cond.value + "): " + message;
    75         System.err.println(warning);
     75        Main.warn(warning);
    7676        style.logError(new Exception(warning));
    7777    }
  • trunk/src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java

    r6070 r6248  
    110110                    con.disconnect();
    111111                }
    112             } catch(NoSuchFieldException e) {
     112            } catch (NoSuchFieldException e) {
    113113                e.printStackTrace();
    114                 System.err.println(tr("Warning: failed to cancel running OAuth operation"));
    115             } catch(SecurityException e) {
     114                Main.warn(tr("Failed to cancel running OAuth operation"));
     115            } catch (SecurityException e) {
    116116                e.printStackTrace();
    117                 System.err.println(tr("Warning: failed to cancel running OAuth operation"));
    118             } catch(IllegalAccessException e) {
     117                Main.warn(tr("Failed to cancel running OAuth operation"));
     118            } catch (IllegalAccessException e) {
    119119                e.printStackTrace();
    120                 System.err.println(tr("Warning: failed to cancel running OAuth operation"));
     120                Main.warn(tr("Failed to cancel running OAuth operation"));
    121121            }
    122122        }
  • trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java

    r6106 r6248  
    12471247                        Matcher m = Pattern.compile("^\t([^:]+): *(.+)$").matcher(line);
    12481248                        if (! m.matches()) {
    1249                             System.err.println(tr(getStr(I18nString.ILLEGAL_FORMAT_OF_ENTRY), url, line));
     1249                            Main.error(tr(getStr(I18nString.ILLEGAL_FORMAT_OF_ENTRY), url, line));
    12501250                            continue;
    12511251                        }
     
    12911291                            sources.add(last = new ExtendedSourceEntry(m.group(1), m.group(2)));
    12921292                        } else {
    1293                             System.err.println(tr(getStr(I18nString.ILLEGAL_FORMAT_OF_ENTRY), url, line));
     1293                            Main.error(tr(getStr(I18nString.ILLEGAL_FORMAT_OF_ENTRY), url, line));
    12941294                        }
    12951295                    }
  • trunk/src/org/openstreetmap/josm/gui/preferences/SourceEntry.java

    r6152 r6248  
    77import java.util.regex.Matcher;
    88import java.util.regex.Pattern;
     9
     10import org.openstreetmap.josm.Main;
    911
    1012/**
     
    127129            return m.group(1);
    128130        } else {
    129             System.err.println("Warning: Unexpected URL format: "+url);
     131            Main.warn("Unexpected URL format: "+url);
    130132            return url;
    131133        }
  • trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java

    r6070 r6248  
    904904                    Object tb = action.getValue("toolbar");
    905905                    if(tb == null) {
    906                         System.out.println(tr("Toolbar action without name: {0}",
     906                        Main.info(tr("Toolbar action without name: {0}",
    907907                        action.getClass().getName()));
    908908                        continue;
    909909                    } else if (!(tb instanceof String)) {
    910910                        if(!(tb instanceof Boolean) || (Boolean)tb) {
    911                             System.out.println(tr("Strange toolbar value: {0}",
     911                            Main.info(tr("Strange toolbar value: {0}",
    912912                            action.getClass().getName()));
    913913                        }
     
    917917                        Action r = actions.get(toolbar);
    918918                        if(r != null && r != action && !toolbar.startsWith("imagery_")) {
    919                             System.out.println(tr("Toolbar action {0} overwritten: {1} gets {2}",
     919                            Main.info(tr("Toolbar action {0} overwritten: {1} gets {2}",
    920920                            toolbar, r.getClass().getName(), action.getClass().getName()));
    921921                        }
     
    988988                    result.add(a);
    989989                } else {
    990                     System.out.println("Could not load tool definition "+s);
     990                    Main.info("Could not load tool definition "+s);
    991991                }
    992992            }
     
    10011001    public Action register(Action action) {
    10021002        String toolbar = (String) action.getValue("toolbar");
    1003         if(toolbar == null) {
    1004             System.out.println(tr("Registered toolbar action without name: {0}",
     1003        if (toolbar == null) {
     1004            Main.info(tr("Registered toolbar action without name: {0}",
    10051005            action.getClass().getName()));
    10061006        } else {
    10071007            Action r = regactions.get(toolbar);
    1008             if(r != null) {
    1009                 System.out.println(tr("Registered toolbar action {0} overwritten: {1} gets {2}",
     1008            if (r != null) {
     1009                Main.info(tr("Registered toolbar action {0} overwritten: {1} gets {2}",
    10101010                toolbar, r.getClass().getName(), action.getClass().getName()));
    10111011            }
  • trunk/src/org/openstreetmap/josm/gui/preferences/advanced/AdvancedPreference.java

    r6246 r6248  
    22package org.openstreetmap.josm.gui.preferences.advanced;
    33
     4import static org.openstreetmap.josm.tools.I18n.marktr;
    45import static org.openstreetmap.josm.tools.I18n.tr;
    5 import static org.openstreetmap.josm.tools.I18n.marktr;
    66
    77import java.awt.Dimension;
     
    1717import java.util.Map;
    1818import java.util.Map.Entry;
     19
    1920import javax.swing.AbstractAction;
    20 
    2121import javax.swing.Box;
    2222import javax.swing.JButton;
     
    356356                   if (idx>=0) {
    357357                        String t=s.substring(0,idx);
    358                         System.out.println(t);
    359                         if (profileTypes.containsKey(t))
     358                        if (profileTypes.containsKey(t)) {
    360359                            p.add(new ImportProfileAction(s, f, t));
     360                        }
    361361                   }
    362362                }
     
    366366                   if (idx>=0) {
    367367                        String t=s.substring(0,idx);
    368                         if (profileTypes.containsKey(t))
     368                        if (profileTypes.containsKey(t)) {
    369369                            p.add(new ImportProfileAction(s, f, t));
     370                        }
    370371                   }
    371372                }
  • trunk/src/org/openstreetmap/josm/gui/preferences/advanced/ExportProfileAction.java

    r6023 r6248  
    11// License: GPL. See LICENSE file for details.
    22package org.openstreetmap.josm.gui.preferences.advanced;
     3
     4import static org.openstreetmap.josm.tools.I18n.tr;
    35
    46import java.awt.event.ActionEvent;
     
    68import java.util.ArrayList;
    79import java.util.Map;
     10
    811import javax.swing.AbstractAction;
    912import javax.swing.JFileChooser;
    1013import javax.swing.JOptionPane;
    1114import javax.swing.filechooser.FileFilter;
     15
    1216import org.openstreetmap.josm.Main;
    1317import org.openstreetmap.josm.actions.DiskAccessAction;
     
    1519import org.openstreetmap.josm.data.Preferences;
    1620import org.openstreetmap.josm.data.Preferences.Setting;
    17 
    18 import static org.openstreetmap.josm.tools.I18n.tr;
    1921
    2022/**
     
    7072            if (!sel.getName().endsWith(".xml")) sel=new File(sel.getAbsolutePath()+".xml");
    7173            if (!sel.getName().startsWith(schemaKey)) {
    72                 System.out.println(sel.getParentFile().getAbsolutePath()+"/"+schemaKey+"_"+sel.getName());
    73                 sel =new File(sel.getParentFile().getAbsolutePath()+"/"+schemaKey+"_"+sel.getName());
     74                sel = new File(sel.getParentFile().getAbsolutePath()+"/"+schemaKey+"_"+sel.getName());
    7475            }
    7576            return sel;
  • trunk/src/org/openstreetmap/josm/gui/preferences/imagery/AddWMSLayerPanel.java

    r6084 r6248  
    2222import javax.swing.JScrollPane;
    2323
     24import org.openstreetmap.josm.Main;
    2425import org.openstreetmap.josm.data.imagery.ImageryInfo;
    2526import org.openstreetmap.josm.gui.bbox.SlippyMapBBoxChooser;
     
    8384                    JOptionPane.showMessageDialog(getParent(), tr("Could not parse WMS layer list."),
    8485                            tr("WMS Error"), JOptionPane.ERROR_MESSAGE);
    85                     System.err.println("Could not parse WMS layer list. Incoming data:");
    86                     System.err.println(ex.getIncomingData());
     86                    Main.error("Could not parse WMS layer list. Incoming data:\n"+ex.getIncomingData());
    8787                }
    8888            }
  • trunk/src/org/openstreetmap/josm/gui/preferences/map/TaggingPresetPreference.java

    r6246 r6248  
    8484                            canLoad = true;
    8585                        } catch (IOException e) {
    86                             System.err.println(tr("Warning: Could not read tagging preset source: {0}", source));
     86                            Main.warn(tr("Could not read tagging preset source: {0}", source));
    8787                            ExtendedDialog ed = new ExtendedDialog(Main.parent, tr("Error"),
    8888                                    new String[] {tr("Yes"), tr("No"), tr("Cancel")});
     
    108108                            // Should not happen, but at least show message
    109109                            String msg = tr("Could not read tagging preset source {0}", source);
    110                             System.err.println(msg);
     110                            Main.error(msg);
    111111                            JOptionPane.showMessageDialog(Main.parent, msg);
    112112                            return false;
     
    135135
    136136                        if (errorMessage != null) {
    137                             System.err.println("Error: "+errorMessage);
     137                            Main.error(errorMessage);
    138138                            int result = JOptionPane.showConfirmDialog(Main.parent, new JLabel(errorMessage), tr("Error"),
    139139                                    JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.ERROR_MESSAGE);
  • trunk/src/org/openstreetmap/josm/gui/preferences/server/AuthenticationPreferencesPanel.java

    r6084 r6248  
    104104            rbOAuth.setSelected(true);
    105105        } else {
    106             System.err.println(tr("Warning: Unsupported value in preference ''{0}'', got ''{1}''. Using authentication method ''Basic Authentication''.", "osm-server.auth-method", authMethod));
     106            Main.warn(tr("Unsupported value in preference ''{0}'', got ''{1}''. Using authentication method ''Basic Authentication''.", "osm-server.auth-method", authMethod));
    107107            rbBasicAuthentication.setSelected(true);
    108108        }
  • trunk/src/org/openstreetmap/josm/gui/preferences/server/BasicAuthenticationPreferencesPanel.java

    r5886 r6248  
    1515import javax.swing.JPanel;
    1616
     17import org.openstreetmap.josm.Main;
    1718import org.openstreetmap.josm.gui.widgets.JosmPasswordField;
    1819import org.openstreetmap.josm.gui.widgets.JosmTextField;
     
    103104        } catch(CredentialsAgentException e) {
    104105            e.printStackTrace();
    105             System.err.println(tr("Warning: failed to retrieve OSM credentials from credential manager."));
    106             System.err.println(tr("Current credential manager is of type ''{0}''", cm.getClass().getName()));
     106            Main.warn(tr("Failed to retrieve OSM credentials from credential manager."));
     107            Main.warn(tr("Current credential manager is of type ''{0}''", cm.getClass().getName()));
    107108            tfOsmUserName.setText("");
    108109            tfOsmPassword.setText("");
     
    118119            );
    119120            cm.store(RequestorType.SERVER, OsmApi.getOsmApi().getHost(), pa);
    120         } catch(CredentialsAgentException e) {
     121        } catch (CredentialsAgentException e) {
    121122            e.printStackTrace();
    122             System.err.println(tr("Warning: failed to save OSM credentials to credential manager."));
    123             System.err.println(tr("Current credential manager is of type ''{0}''", cm.getClass().getName()));
     123            Main.warn(tr("Failed to save OSM credentials to credential manager."));
     124            Main.warn(tr("Current credential manager is of type ''{0}''", cm.getClass().getName()));
    124125        }
    125126    }
  • trunk/src/org/openstreetmap/josm/gui/preferences/server/OAuthAccessTokenHolder.java

    r4245 r6248  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
     6import org.openstreetmap.josm.Main;
    67import org.openstreetmap.josm.data.Preferences;
    78import org.openstreetmap.josm.data.oauth.OAuthToken;
     
    144145        } catch(CredentialsAgentException e) {
    145146            e.printStackTrace();
    146             System.err.println(tr("Warning: Failed to retrieve OAuth Access Token from credential manager"));
    147             System.err.println(tr("Current credential manager is of type ''{0}''", cm.getClass().getName()));
     147            Main.warn(tr("Failed to retrieve OAuth Access Token from credential manager"));
     148            Main.warn(tr("Current credential manager is of type ''{0}''", cm.getClass().getName()));
    148149        }
    149150        saveToPreferences = pref.getBoolean("oauth.access-token.save-to-preferences", true);
     
    175176        } catch(CredentialsAgentException e){
    176177            e.printStackTrace();
    177             System.err.println(tr("Warning: Failed to store OAuth Access Token to credentials manager"));
    178             System.err.println(tr("Current credential manager is of type ''{0}''", cm.getClass().getName()));
     178            Main.warn(tr("Failed to store OAuth Access Token to credentials manager"));
     179            Main.warn(tr("Current credential manager is of type ''{0}''", cm.getClass().getName()));
    179180        }
    180181    }
  • trunk/src/org/openstreetmap/josm/gui/preferences/server/ProxyPreferencesPanel.java

    r5899 r6248  
    316316
    317317        if (pp.equals(ProxyPolicy.USE_SYSTEM_SETTINGS) && ! DefaultProxySelector.willJvmRetrieveSystemProxies()) {
    318             System.err.println(tr("Warning: JOSM is configured to use proxies from the system setting, but the JVM is not configured to retrieve them. Resetting preferences to ''No proxy''"));
     318            Main.warn(tr("JOSM is configured to use proxies from the system setting, but the JVM is not configured to retrieve them. Resetting preferences to ''No proxy''"));
    319319            pp = ProxyPolicy.NO_PROXY;
    320320            rbProxyPolicy.get(pp).setSelected(true);
  • trunk/src/org/openstreetmap/josm/gui/preferences/shortcut/PrefJPanel.java

    r6070 r6248  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.gui.preferences.shortcut;
     3
     4import static org.openstreetmap.josm.tools.I18n.marktr;
     5import static org.openstreetmap.josm.tools.I18n.tr;
    36
    47import java.awt.Color;
     
    912import java.awt.Insets;
    1013import java.awt.Toolkit;
    11 
    12 import static org.openstreetmap.josm.tools.I18n.marktr;
    13 import static org.openstreetmap.josm.tools.I18n.tr;
    14 
    1514import java.awt.event.KeyEvent;
    1615import java.lang.reflect.Field;
     
    1817import java.util.LinkedHashMap;
    1918import java.util.Map;
    20 
    2119import java.util.regex.PatternSyntaxException;
     20
    2221import javax.swing.AbstractAction;
    2322import javax.swing.BorderFactory;
     
    3837import javax.swing.event.ListSelectionListener;
    3938import javax.swing.table.AbstractTableModel;
    40 import javax.swing.table.TableModel;
    4139import javax.swing.table.DefaultTableCellRenderer;
    4240import javax.swing.table.TableColumnModel;
    43 
     41import javax.swing.table.TableModel;
    4442import javax.swing.table.TableRowSorter;
     43
    4544import org.openstreetmap.josm.Main;
    4645import org.openstreetmap.josm.gui.widgets.JosmComboBox;
     46import org.openstreetmap.josm.gui.widgets.JosmTextField;
    4747import org.openstreetmap.josm.gui.widgets.SelectAllOnFocusGainedDecorator;
    4848import org.openstreetmap.josm.tools.Shortcut;
    49 import org.openstreetmap.josm.gui.widgets.JosmTextField;
    5049
    5150/**
     
    117116                    if (s != null && s.length() > 0 && !s.contains(unknown)) {
    118117                        list.put(Integer.valueOf(i), s);
    119                         //System.out.println(i+": "+s);
    120118                    }
    121119                } catch (Exception e) {
  • trunk/src/org/openstreetmap/josm/gui/tagging/TagTable.java

    r6092 r6248  
    1717import java.util.Collections;
    1818import java.util.EventObject;
    19 import java.util.HashMap;
    20 import java.util.List;
    21 import java.util.Map;
    2219import java.util.concurrent.CopyOnWriteArrayList;
    2320
    2421import javax.swing.AbstractAction;
    25 import static javax.swing.Action.SHORT_DESCRIPTION;
    26 import static javax.swing.Action.SMALL_ICON;
    2722import javax.swing.CellEditor;
    2823import javax.swing.DefaultListSelectionModel;
     
    3833import javax.swing.table.TableColumn;
    3934import javax.swing.text.JTextComponent;
     35
    4036import org.openstreetmap.josm.Main;
    4137import org.openstreetmap.josm.actions.PasteTagsAction.TagPaster;
    4238import org.openstreetmap.josm.data.osm.OsmPrimitive;
    4339import org.openstreetmap.josm.data.osm.Relation;
    44 
    4540import org.openstreetmap.josm.gui.dialogs.relation.RunnableAction;
     41import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionList;
    4642import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionManager;
    47 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionList;
    4843import org.openstreetmap.josm.tools.ImageProvider;
    4944
     
    464459    public void setAutoCompletionManager(AutoCompletionManager autocomplete) {
    465460        if (autocomplete == null) {
    466             System.out.println("argument autocomplete should not be null. Aborting.");
     461            Main.warn("argument autocomplete should not be null. Aborting.");
    467462            Thread.dumpStack();
    468463            return;
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java

    r6101 r6248  
    150150                    });
    151151                } else {
    152                     System.out.println("Could not get presets icon " + iconName);
     152                    Main.warn("Could not get presets icon " + iconName);
    153153                }
    154154            }
     
    167167            this.nameTemplate = new TemplateParser(pattern).parse();
    168168        } catch (ParseError e) {
    169             System.err.println("Error while parsing " + pattern + ": " + e.getMessage());
     169            Main.error("Error while parsing " + pattern + ": " + e.getMessage());
    170170            throw new SAXException(e);
    171171        }
     
    176176            this.nameTemplateFilter = SearchCompiler.compile(filter, false, false);
    177177        } catch (org.openstreetmap.josm.actions.search.SearchCompiler.ParseError e) {
    178             System.err.println("Error while parsing" + filter + ": " + e.getMessage());
     178            Main.error("Error while parsing" + filter + ": " + e.getMessage());
    179179            throw new SAXException(e);
    180180        }
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetItems.java

    r6246 r6248  
    626626                        pnl.add(aibutton, GBC.std());
    627627                    } catch (ParseException x) {
    628                         System.err.println("Cannot parse auto-increment value of '" + ai + "' into an integer");
     628                        Main.error("Cannot parse auto-increment value of '" + ai + "' into an integer");
    629629                    }
    630630                }
     
    673673            String v = getValue(value);
    674674            if (v == null) {
    675                 System.err.println("No 'last value' support for component " + value);
     675                Main.error("No 'last value' support for component " + value);
    676676                return;
    677677            }
     
    921921            } else {
    922922                if (values != null) {
    923                     System.err.println(tr("Warning in tagging preset \"{0}-{1}\": "
     923                    Main.warn(tr("Warning in tagging preset \"{0}-{1}\": "
    924924                            + "Ignoring ''{2}'' attribute as ''{3}'' elements are given.",
    925925                            key, text, "values", "list_entry"));
    926926                }
    927927                if (display_values != null || locale_display_values != null) {
    928                     System.err.println(tr("Warning in tagging preset \"{0}-{1}\": "
     928                    Main.warn(tr("Warning in tagging preset \"{0}-{1}\": "
    929929                            + "Ignoring ''{2}'' attribute as ''{3}'' elements are given.",
    930930                            key, text, "display_values", "list_entry"));
    931931                }
    932932                if (short_descriptions != null || locale_short_descriptions != null) {
    933                     System.err.println(tr("Warning in tagging preset \"{0}-{1}\": "
     933                    Main.warn(tr("Warning in tagging preset \"{0}-{1}\": "
    934934                            + "Ignoring ''{2}'' attribute as ''{3}'' elements are given.",
    935935                            key, text, "short_descriptions", "list_entry"));
     
    963963                            value_array = (String[]) method.invoke(null);
    964964                        } else {
    965                             System.err.println(tr("Broken tagging preset \"{0}-{1}\" - Java method given in ''values_from'' is not \"{2}\"", key, text,
     965                            Main.error(tr("Broken tagging preset \"{0}-{1}\" - Java method given in ''values_from'' is not \"{2}\"", key, text,
    966966                                    "public static String[] methodName()"));
    967967                        }
    968968                    } catch (Exception e) {
    969                         System.err.println(tr("Broken tagging preset \"{0}-{1}\" - Java method given in ''values_from'' threw {2} ({3})", key, text,
     969                        Main.error(tr("Broken tagging preset \"{0}-{1}\" - Java method given in ''values_from'' threw {2} ({3})", key, text,
    970970                                e.getClass().getName(), e.getMessage()));
    971971                    }
     
    984984
    985985            if (display_array.length != value_array.length) {
    986                 System.err.println(tr("Broken tagging preset \"{0}-{1}\" - number of items in ''display_values'' must be the same as in ''values''", key, text));
     986                Main.error(tr("Broken tagging preset \"{0}-{1}\" - number of items in ''display_values'' must be the same as in ''values''", key, text));
    987987                display_array = value_array;
    988988            }
    989989
    990990            if (short_descriptions_array != null && short_descriptions_array.length != value_array.length) {
    991                 System.err.println(tr("Broken tagging preset \"{0}-{1}\" - number of items in ''short_descriptions'' must be the same as in ''values''", key, text));
     991                Main.error(tr("Broken tagging preset \"{0}-{1}\" - number of items in ''short_descriptions'' must be the same as in ''values''", key, text));
    992992                short_descriptions_array = null;
    993993            }
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetReader.java

    r6198 r6248  
    187187                allPresets.addAll(readAll(source, validate));
    188188            } catch (IOException e) {
    189                 System.err.println(e.getClass().getName()+": "+e.getMessage());
    190                 System.err.println(source);
     189                Main.error(e);
     190                Main.error(source);
    191191                JOptionPane.showMessageDialog(
    192192                        Main.parent,
     
    196196                        );
    197197            } catch (SAXException e) {
    198                 System.err.println(e.getClass().getName()+": "+e.getMessage());
    199                 System.err.println(source);
     198                Main.error(e);
     199                Main.error(source);
    200200                JOptionPane.showMessageDialog(
    201201                        Main.parent,
  • trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionList.java

    r6084 r6248  
    291291        return list == null ? null : getFilteredItem(rowIndex);
    292292    }
    293 
    294     public void dump() {
    295         System.out.println("---------------------------------");
    296         for (AutoCompletionListItem item: list) {
    297             System.out.println(item);
    298         }
    299         System.out.println("---------------------------------");
    300     }
    301293}
  • trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionManager.java

    r6068 r6248  
    1212import java.util.Set;
    1313
     14import org.openstreetmap.josm.Main;
    1415import org.openstreetmap.josm.data.osm.DataSet;
    1516import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    156157                            presetTagCache.putAll(ki.key, ki.getValues());
    157158                        } catch (NullPointerException e) {
    158                             System.err.println(p+": Unable to cache "+ki);
     159                            Main.error(p+": Unable to cache "+ki);
    159160                        }
    160161                    }
  • trunk/src/org/openstreetmap/josm/gui/util/GuiHelper.java

    r6232 r6248  
    22package org.openstreetmap.josm.gui.util;
    33
     4import static org.openstreetmap.josm.tools.I18n.tr;
     5
    46import java.awt.BasicStroke;
    5 import static org.openstreetmap.josm.tools.I18n.tr;
    6 
    77import java.awt.Component;
    88import java.awt.Container;
     
    196196                }
    197197            } catch (NumberFormatException ex) {
    198                 System.err.println("Error in stroke preference format: "+code);
     198                Main.error("Error in stroke preference format: "+code);
    199199                dash = new float[]{5.0f};
    200200            }
    201201            if (sumAbs < 1e-1) {
    202                 System.err.println("Error in stroke dash fomat (all zeros): "+code);
     202                Main.error("Error in stroke dash fomat (all zeros): "+code);
    203203                return new BasicStroke(w);
    204204            }
  • trunk/src/org/openstreetmap/josm/gui/widgets/AbstractIdTextField.java

    r5899 r6248  
    44import javax.swing.text.JTextComponent;
    55
    6 import org.openstreetmap.josm.gui.widgets.JosmTextField;
     6import org.openstreetmap.josm.Main;
    77import org.openstreetmap.josm.tools.Utils;
    88
     
    3939            }
    4040        } catch (Exception e) {
    41             System.err.println(e.getClass().getName()+": "+e.getMessage());
     41            Main.error(e);
    4242        } finally {
    4343            this.validator = validator;
  • trunk/src/org/openstreetmap/josm/gui/widgets/JosmPasswordField.java

    r5927 r6248  
    1010import javax.swing.text.Document;
    1111import javax.swing.text.JTextComponent;
     12
     13import org.openstreetmap.josm.Main;
    1214
    1315/**
     
    103105                        pasteAction.actionPerformed(e);
    104106                    } catch (NullPointerException npe) {
    105                         System.err.println("NullPointerException occured because of JDK bug 6322854. "
     107                        Main.error("NullPointerException occured because of JDK bug 6322854. "
    106108                                +"Copy/Paste operation has not been performed. Please complain to Oracle: "+
    107109                                "http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6322854");
Note: See TracChangeset for help on using the changeset viewer.