# HG changeset patch # User Omair Majid # Date 1391807506 18000 # Node ID 5877be030593aefec7fe3d9cd4d04fb2b3e58f43 # Parent 9cb641d3e236cfa33f36df2413f9c3b587e7ec6e Show an error dialog on IO error If an IO error happens when extracting information from a bundle, show an error dialog. diff -r 9cb641d3e236 -r 5877be030593 com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/Messages.java --- a/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/Messages.java Fri Feb 07 16:08:24 2014 -0500 +++ b/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/Messages.java Fri Feb 07 16:11:46 2014 -0500 @@ -29,6 +29,7 @@ public static String ExtensionsMasterDetailsBlock_description; public static String ExtensionsMasterDetailsBlock_title; public static String ExtensionsPage_title; + public static String NewBundleDialog_errorExtractingInformationFromJarFile; public static String NewBundleDialog_findOnDisk; public static String NewBundleDialog_fromJarSectionTitle; public static String NewBundleDialog_manualSectionTitle; diff -r 9cb641d3e236 -r 5877be030593 com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/editor/NewBundleDialog.java --- a/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/editor/NewBundleDialog.java Fri Feb 07 16:08:24 2014 -0500 +++ b/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/editor/NewBundleDialog.java Fri Feb 07 16:11:46 2014 -0500 @@ -2,6 +2,7 @@ import java.io.IOException; +import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.dialogs.TitleAreaDialog; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; @@ -148,9 +149,13 @@ BundleInformation extractedInfo = extractor.extract(fileLocationText.getText()); bundleInfo.setName(extractedInfo.getName()); bundleInfo.setVersion(extractedInfo.getVersion()); - } catch (IOException e) { - // FIXME doing something saner with this exception - e.printStackTrace(); + } catch (final IOException e) { + getShell().getDisplay().asyncExec(new Runnable() { + @Override + public void run() { + MessageDialog.openError(getShell(), Messages.NewBundleDialog_errorExtractingInformationFromJarFile, e.getMessage()); + } + }); } } } diff -r 9cb641d3e236 -r 5877be030593 com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/messages.properties --- a/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/messages.properties Fri Feb 07 16:08:24 2014 -0500 +++ b/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/messages.properties Fri Feb 07 16:11:46 2014 -0500 @@ -21,6 +21,7 @@ ExtensionsMasterDetailsBlock_description=Extensions modify existing commands to load new bundles. These existing command might be provided by thermostat or other plugins ExtensionsMasterDetailsBlock_title=Commands extended by the plugin ExtensionsPage_title=Extensions +NewBundleDialog_errorExtractingInformationFromJarFile=Error extracting information from jar file NewBundleDialog_findOnDisk=... NewBundleDialog_fromJarSectionTitle=Extract from Jar/Bundle on disk NewBundleDialog_manualSectionTitle=Specify Manually