changeset 104:5877be030593

Show an error dialog on IO error If an IO error happens when extracting information from a bundle, show an error dialog.
author Omair Majid <omajid@redhat.com>
date Fri, 07 Feb 2014 16:11:46 -0500
parents 9cb641d3e236
children 28252d3475bd
files com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/Messages.java com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/editor/NewBundleDialog.java com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/messages.properties
diffstat 3 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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;
--- 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());
+                    }
+                });
             }
         }
     }
--- 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