Ignore:
Timestamp:
2009-09-04T08:31:03+02:00 (15 years ago)
Author:
Gubaer
Message:

fixed #3324: Loading a File -> status message

File:
1 edited

Legend:

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

    r2039 r2047  
    1111import java.awt.event.KeyEvent;
    1212import java.io.File;
     13import java.io.IOException;
    1314import java.net.URI;
    1415import java.net.URISyntaxException;
     
    3031import javax.swing.UIManager;
    3132
     33import org.openstreetmap.josm.actions.OpenFileAction;
    3234import org.openstreetmap.josm.actions.SaveAction;
    3335import org.openstreetmap.josm.actions.downloadtasks.DownloadGpsTask;
     
    412414            dialog.setVisible(true);
    413415            switch(dialog.getUserAction()) {
    414             case CANCEL: return false;
    415             case PROCEED: return true;
    416             default: return false;
     416                case CANCEL: return false;
     417                case PROCEED: return true;
     418                default: return false;
    417419            }
    418420        }
     
    455457
    456458        switch(ed.getValue()) {
    457         case 2: /* discard and exit */ return true;
    458         case 3: /* cancel */ return false;
     459            case 2: /* discard and exit */ return true;
     460            case 3: /* cancel */ return false;
    459461        }
    460462        boolean savefailed = false;
     
    486488
    487489        if (s.startsWith("file:")) {
     490            File f = null;
    488491            try {
    489                 main.menu.openFile.openFile(new File(new URI(s)));
     492                f = new File(new URI(s));
    490493            } catch (URISyntaxException e) {
    491494                JOptionPane.showMessageDialog(
     
    496499                );
    497500            }
     501            try {
     502                if (f!=null) {
     503                    OpenFileAction.openFile(f);
     504                }
     505            }catch(IOException e) {
     506                e.printStackTrace();
     507                JOptionPane.showMessageDialog(
     508                        Main.parent,
     509                        tr("<html>Could not read file ''{0}\''.<br> Error is: <br>{1}</html>", f.getName(), e.getMessage()),
     510                        tr("Error"),
     511                        JOptionPane.ERROR_MESSAGE
     512                );
     513            }
    498514            return;
    499515        }
     
    508524            }
    509525        }
    510 
    511         main.menu.openFile.openFile(new File(s));
     526        File f = new File(s);
     527        try {
     528            OpenFileAction.openFile(f);
     529        }catch(IOException e) {
     530            e.printStackTrace();
     531            JOptionPane.showMessageDialog(
     532                    Main.parent,
     533                    tr("<html>Could not read file ''{0}\''.<br> Error is: <br>{1}</html>", f.getName(), e.getMessage()),
     534                    tr("Error"),
     535                    JOptionPane.ERROR_MESSAGE
     536            );
     537        }
    512538    }
    513539
Note: See TracChangeset for help on using the changeset viewer.