# HG changeset patch # User haismail # Date 1265877433 -7200 # Node ID 9b808d6f55bef18e8d5eee4c76dd4685ae587a28 # Parent a91cb670dd8e6caf72ab47b444b7a745956e4782 Fixed invalid imp file selection problem diff -r a91cb670dd8e -r 9b808d6f55be imakerplugin/com.nokia.s60tools.imaker/src/com/nokia/s60tools/imaker/internal/viewers/IMakerTabsViewer.java --- a/imakerplugin/com.nokia.s60tools.imaker/src/com/nokia/s60tools/imaker/internal/viewers/IMakerTabsViewer.java Tue Feb 09 17:10:58 2010 +0200 +++ b/imakerplugin/com.nokia.s60tools.imaker/src/com/nokia/s60tools/imaker/internal/viewers/IMakerTabsViewer.java Thu Feb 11 10:37:13 2010 +0200 @@ -413,5 +413,10 @@ public Button getFRevertButton() { return fRevertButton; } + + public void restoreSelection() + { + fConfigWidget.select(0); + } } diff -r a91cb670dd8e -r 9b808d6f55be imakerplugin/com.nokia.s60tools.imaker/src/com/nokia/s60tools/imaker/internal/viewers/PreferencesTab.java --- a/imakerplugin/com.nokia.s60tools.imaker/src/com/nokia/s60tools/imaker/internal/viewers/PreferencesTab.java Tue Feb 09 17:10:58 2010 +0200 +++ b/imakerplugin/com.nokia.s60tools.imaker/src/com/nokia/s60tools/imaker/internal/viewers/PreferencesTab.java Thu Feb 11 10:37:13 2010 +0200 @@ -699,8 +699,12 @@ } if (!found) { - IStatus status = new Status(Status.WARNING,IMakerPlugin.PLUGIN_ID,"Unable to fill dialog ui, because product: "+targetProduct+" not found!"); + IStatus status = new Status(Status.ERROR,IMakerPlugin.PLUGIN_ID,"Unable to fill dialog ui, because product: "+targetProduct+" not found!"); IMakerPlugin.getDefault().getLog().log(status); + clearWidgets(); + StatusHandler.handle(IStatus.ERROR,"Unable to fill dialog ui, because product: "+targetProduct+" not found!",null); + tabsViewer.restoreSelection(); + loadImakerFile(ProjectManager.NEW_ITEM); return; } @@ -900,6 +904,28 @@ if(file!=null) { ImakerProperties prop = null; prop = ImakerProperties.createFromFile(file); + + if (prop.isEmpty()) + { + StatusHandler.handle(IStatus.ERROR,"Unable to load preferences from file "+file.getName()+". Invalid or corrupted IMP file.",null); + tabsViewer.restoreSelection(); + loadImakerFile(ProjectManager.NEW_ITEM); + return; + } + if (!prop.containsKey(IMakerKeyConstants.PRODUCT)) + { + StatusHandler.handle(IStatus.ERROR,"Unable to load product from file "+file.getName()+". Invalid or corrupted IMP file.",null); + tabsViewer.restoreSelection(); + loadImakerFile(ProjectManager.NEW_ITEM); + return; + } + if (!prop.containsKey(IMakerKeyConstants.TYPE)) + { + StatusHandler.handle(IStatus.ERROR,"Unable to load image type from file "+file.getName()+". Invalid or corrupted IMP file.",null); + tabsViewer.restoreSelection(); + loadImakerFile(ProjectManager.NEW_ITEM); + return; + } fillUIForm(prop); } } else {