X-Git-Url: https://gitweb.fperrin.net/?a=blobdiff_plain;f=src%2Ftim%2Fprune%2FApp.java;h=f76edb177d2ffb4f8ba09e3feda928022be052d5;hb=9b2386d166007f68fefcaba8c27a1eefcd67af8b;hp=317064d39984acb566cee90940236c52c32fd58f;hpb=086dcad158175a0b424f277f3cf37f21a2b44241;p=GpsPrune.git diff --git a/src/tim/prune/App.java b/src/tim/prune/App.java index 317064d..f76edb1 100644 --- a/src/tim/prune/App.java +++ b/src/tim/prune/App.java @@ -70,7 +70,7 @@ public class App private AppMode _appMode = AppMode.NORMAL; /** Enum for the app mode - currently only two options but may expand later */ - public enum AppMode {NORMAL, DRAWRECT}; + public enum AppMode {NORMAL, DRAWRECT} /** @@ -667,7 +667,8 @@ public class App loadedTrack.load(inFieldArray, inDataArray, inOptions); if (loadedTrack.getNumPoints() <= 0) { - showErrorMessage("error.load.dialogtitle", "error.load.nopoints"); + String msgKey = (inSourceInfo == null ? "error.load.nopointsintext" : "error.load.nopoints"); + showErrorMessage("error.load.dialogtitle", msgKey); // load next file if there's a queue loadNextFile(); return; @@ -733,9 +734,12 @@ public class App undo.setNumPhotosAudios(_trackInfo.getPhotoList().getNumPhotos(), _trackInfo.getAudioList().getNumAudios()); _undoStack.add(undo); _track.combine(inLoadedTrack); - // set source information - inSourceInfo.populatePointObjects(_track, inLoadedTrack.getNumPoints()); - _trackInfo.getFileInfo().addSource(inSourceInfo); + if (inSourceInfo != null) + { + // set source information + inSourceInfo.populatePointObjects(_track, inLoadedTrack.getNumPoints()); + _trackInfo.getFileInfo().addSource(inSourceInfo); + } } else if (answer == JOptionPane.NO_OPTION) { @@ -750,8 +754,12 @@ public class App _lastSavePosition = _undoStack.size(); _trackInfo.getSelection().clearAll(); _track.load(inLoadedTrack); - inSourceInfo.populatePointObjects(_track, _track.getNumPoints()); - _trackInfo.getFileInfo().replaceSource(inSourceInfo); + if (inSourceInfo != null) + { + // set source information + inSourceInfo.populatePointObjects(_track, _track.getNumPoints()); + _trackInfo.getFileInfo().replaceSource(inSourceInfo); + } _trackInfo.getPhotoList().removeCorrelatedPhotos(); _trackInfo.getAudioList().removeCorrelatedAudios(); } @@ -765,16 +773,22 @@ public class App _lastSavePosition = _undoStack.size(); _trackInfo.getSelection().clearAll(); _track.load(inLoadedTrack); - inSourceInfo.populatePointObjects(_track, _track.getNumPoints()); - _trackInfo.getFileInfo().addSource(inSourceInfo); + if (inSourceInfo != null) + { + inSourceInfo.populatePointObjects(_track, _track.getNumPoints()); + _trackInfo.getFileInfo().addSource(inSourceInfo); + } } // Update config before subscribers are told - boolean isRegularLoad = (inSourceInfo.getFileType() != FILE_TYPE.GPSBABEL); - Config.getRecentFileList().addFile(new RecentFile(inSourceInfo.getFile(), isRegularLoad)); + if (inSourceInfo != null) + { + boolean isRegularLoad = (inSourceInfo.getFileType() != FILE_TYPE.GPSBABEL); + Config.getRecentFileList().addFile(new RecentFile(inSourceInfo.getFile(), isRegularLoad)); + // Update status bar + UpdateMessageBroker.informSubscribers(I18nManager.getText("confirm.loadfile") + + " '" + inSourceInfo.getName() + "'"); + } UpdateMessageBroker.informSubscribers(); - // Update status bar - UpdateMessageBroker.informSubscribers(I18nManager.getText("confirm.loadfile") - + " '" + inSourceInfo.getName() + "'"); // update menu _menuManager.informFileLoaded(); // recentre viewport on new file data