From 7e2192e2630dfa5e4ab279d4d7a58c828f7ffc69 Mon Sep 17 00:00:00 2001 From: Damian Minkov Date: Wed, 19 Mar 2008 12:45:32 +0000 Subject: [PATCH] UpdateCheck for every installer --- build.xml | 4 +- resources/config/updatecheck.properties | 1 - resources/install/build.xml | 24 +++++++- resources/install/debian/rules.tmpl | 1 + .../install/debian/versionupdate.properties | 2 + .../install/generic/installer-generic.xml | 1 + .../install/generic/versionupdate.properties | 2 + resources/install/linux/installer-linux.xml | 1 + .../install/linux/versionupdate.properties | 2 + .../install/macosx/versionupdate.properties | 2 + .../install/windows/installer-windows.xml | 1 + .../install/windows/versionupdate.properties | 2 + .../plugin/updatechecker/resources.properties | 8 ++- .../plugin/updatechecker/Resources.java | 19 +++--- .../updatechecker/UpdateCheckActivator.java | 58 ++++++++----------- 15 files changed, 78 insertions(+), 50 deletions(-) delete mode 100644 resources/config/updatecheck.properties create mode 100644 resources/install/debian/versionupdate.properties create mode 100644 resources/install/generic/versionupdate.properties create mode 100644 resources/install/linux/versionupdate.properties create mode 100644 resources/install/macosx/versionupdate.properties create mode 100644 resources/install/windows/versionupdate.properties diff --git a/build.xml b/build.xml index eae30c3b4..e458a5075 100644 --- a/build.xml +++ b/build.xml @@ -1613,11 +1613,9 @@ javax.swing.event, javax.swing.border"/> + manifest="${src}/net/java/sip/communicator/plugin/updatechecker/updatecheck.manifest.mf"> - diff --git a/resources/config/updatecheck.properties b/resources/config/updatecheck.properties deleted file mode 100644 index d255b1331..000000000 --- a/resources/config/updatecheck.properties +++ /dev/null @@ -1 +0,0 @@ -destinationPath=http://download.sip-communicator.org/nightly diff --git a/resources/install/build.xml b/resources/install/build.xml index a59f0e76f..dda760c0e 100644 --- a/resources/install/build.xml +++ b/resources/install/build.xml @@ -97,6 +97,13 @@ + + + + + @@ -146,6 +153,8 @@ + @@ -226,7 +235,7 @@ comment="Last Build Version"> + value="http://download.sip-communicator.org/nightly/windows/${package.name}-${sip-communicator.version}.exe"/> @@ -346,7 +355,7 @@ felix.auto.start.70= reference:file:sc-bundles/growlnotification.jar - + @@ -402,6 +411,8 @@ files="logging.properties"/> + @@ -415,7 +426,7 @@ comment="Last Build Version"> + value="http://download.sip-communicator.org/nightly/macosx/${package.name}-${sip-communicator.version}.dmg"/> + + + + + Exceutable + diff --git a/resources/install/generic/versionupdate.properties b/resources/install/generic/versionupdate.properties new file mode 100644 index 000000000..0baf9f6b5 --- /dev/null +++ b/resources/install/generic/versionupdate.properties @@ -0,0 +1,2 @@ +# Check Update Link +update_link=http://download.sip-communicator.org/nightly/generic/versionupdate.properties \ No newline at end of file diff --git a/resources/install/linux/installer-linux.xml b/resources/install/linux/installer-linux.xml index f57d80ec3..68f4bf778 100755 --- a/resources/install/linux/installer-linux.xml +++ b/resources/install/linux/installer-linux.xml @@ -106,6 +106,7 @@ Executable + diff --git a/resources/install/linux/versionupdate.properties b/resources/install/linux/versionupdate.properties new file mode 100644 index 000000000..0206001d4 --- /dev/null +++ b/resources/install/linux/versionupdate.properties @@ -0,0 +1,2 @@ +# Check Update Link +update_link=http://download.sip-communicator.org/nightly/linux/versionupdate.properties \ No newline at end of file diff --git a/resources/install/macosx/versionupdate.properties b/resources/install/macosx/versionupdate.properties new file mode 100644 index 000000000..0a44c8c3c --- /dev/null +++ b/resources/install/macosx/versionupdate.properties @@ -0,0 +1,2 @@ +# Check Update Link +update_link=http://download.sip-communicator.org/nightly/macosx/versionupdate.properties \ No newline at end of file diff --git a/resources/install/windows/installer-windows.xml b/resources/install/windows/installer-windows.xml index b1964f1ff..6633de1e0 100755 --- a/resources/install/windows/installer-windows.xml +++ b/resources/install/windows/installer-windows.xml @@ -110,6 +110,7 @@ Exceutable + diff --git a/resources/install/windows/versionupdate.properties b/resources/install/windows/versionupdate.properties new file mode 100644 index 000000000..39791124c --- /dev/null +++ b/resources/install/windows/versionupdate.properties @@ -0,0 +1,2 @@ +# Check Update Link +update_link=http://download.sip-communicator.org/nightly/windows/versionupdate.properties \ No newline at end of file diff --git a/resources/languages/plugin/updatechecker/resources.properties b/resources/languages/plugin/updatechecker/resources.properties index 8f8c28c06..7db006505 100644 --- a/resources/languages/plugin/updatechecker/resources.properties +++ b/resources/languages/plugin/updatechecker/resources.properties @@ -1,3 +1,7 @@ dialogTitle=New version available -dialogMessage1=There is new version of {0} ! -dialogMessage2=
You can download it at :
+dialogMessage1=A new version of {0} is available for download. +dialogMessage2=
{0} ({1}):
+dialogMessageDebian= +buttonDownload=Download +buttonClose=Close + diff --git a/src/net/java/sip/communicator/plugin/updatechecker/Resources.java b/src/net/java/sip/communicator/plugin/updatechecker/Resources.java index 4b5476c12..41a7629d7 100644 --- a/src/net/java/sip/communicator/plugin/updatechecker/Resources.java +++ b/src/net/java/sip/communicator/plugin/updatechecker/Resources.java @@ -22,11 +22,10 @@ public class Resources { private static Logger logger = Logger.getLogger(Resources.class); - private static final String CONFIG_BUNDLE_NAME - = "resources.config.updatecheck"; + private static final String CONFIG_PROP_FILE_NAME + = "versionupdate.properties"; - private static final ResourceBundle configBundle = ResourceBundle - .getBundle(CONFIG_BUNDLE_NAME); + private static Properties configProps = null; private static final String LANG_BUNDLE_NAME = "resources.languages.plugin.updatechecker.resources"; @@ -44,11 +43,17 @@ public static String getConfigString(String key) { try { - return configBundle.getString(key); + if(configProps == null) + { + configProps = new Properties(); + configProps.load(new FileInputStream(CONFIG_PROP_FILE_NAME)); + } + + return configProps.getProperty(key); } - catch (MissingResourceException e) + catch (IOException e) { - logger.error("Missing resources.", e); + logger.error("Cannot open config file.", e); return null; } diff --git a/src/net/java/sip/communicator/plugin/updatechecker/UpdateCheckActivator.java b/src/net/java/sip/communicator/plugin/updatechecker/UpdateCheckActivator.java index 8d09081e3..2f16d51e1 100644 --- a/src/net/java/sip/communicator/plugin/updatechecker/UpdateCheckActivator.java +++ b/src/net/java/sip/communicator/plugin/updatechecker/UpdateCheckActivator.java @@ -88,35 +88,20 @@ public void start(BundleContext bundleContext) throws Exception String dialogMsg = MessageFormat.format( Resources.getLangString("dialogMessage1"), ver.getApplicationName()); - - if(downloadLink != null) - { - dialogMsg += Resources.getLangString("dialogMessage2") + - "" + - downloadLink + " "; - } + dialogMsg += MessageFormat.format( + Resources.getLangString("dialogMessage2"), + ver.getApplicationName(), ver.toString()); contentMessage.setText(dialogMsg); - contentMessage.addHyperlinkListener(new HyperlinkListener() { - - public void hyperlinkUpdate(HyperlinkEvent e) - { - if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) - { - getBrowserLauncher().openURL(e.getDescription()); - } - } - }); - JPanel contentPane = new JPanel(new BorderLayout(5,5)); contentPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); contentPane.add(contentMessage, BorderLayout.CENTER); - JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); - JButton okButton = new JButton("OK"); + JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 10)); + JButton closeButton = new JButton(Resources.getLangString("buttonClose")); - okButton.addActionListener(new ActionListener() { + closeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -124,7 +109,23 @@ public void actionPerformed(ActionEvent e) } }); - buttonPanel.add(okButton); + if(downloadLink != null) + { + JButton downloadButton = + new JButton(Resources.getLangString("buttonDownload")); + + downloadButton.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) + { + getBrowserLauncher().openURL(downloadLink); + } + }); + + buttonPanel.add(downloadButton); + } + + buttonPanel.add(closeButton); contentPane.add(buttonPanel, BorderLayout.SOUTH); @@ -178,18 +179,7 @@ private boolean isNewestVersion(String currentVersionStr) { try { - String osName = System.getProperty("os.name"); - String osDir = null; - - if (osName.startsWith("Mac")) - osDir = "/macosx"; - else if (osName.startsWith("Linux")) - osDir = "/linux"; - else if (osName.startsWith("Windows")) - osDir = "/windows"; - - URL url = new URL(Resources.getConfigString("destinationPath") + - osDir + "/versionupdate.properties"); + URL url = new URL(Resources.getConfigString("update_link")); Properties props = new Properties(); props.load(url.openStream());