Author: closettop_nightlybuild Date: 2012-09-09 13:31:43-0700 New Revision: 19899
Modified: trunk/src/argouml-app/src/org/argouml/ui/ProjectBrowser.java trunk/src/argouml-app/src/org/argouml/util/JavaRuntimeUtility.java Log: Refactoring code of issue 4989 Java 5 is no longer supported. So refactoring some code, of the issue 4989 ( http://argouml.tigris.org/issues/show_bug.cgi?id=4989 ) Contributed-by: elbedd Modified: trunk/src/argouml-app/src/org/argouml/ui/ProjectBrowser.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/ui/ProjectBrowser.java?view=diff&pathrev=19899&r1=19898&r2=19899 ============================================================================== --- trunk/src/argouml-app/src/org/argouml/ui/ProjectBrowser.java (original) +++ trunk/src/argouml-app/src/org/argouml/ui/ProjectBrowser.java 2012-09-09 13:31:43-0700 @@ -10,6 +10,7 @@ * Luis Sergio Oliveira * Bob Tarling * Michiel van der Wulp + * Laurent Braud ***************************************************************************** * * Some portions of this file was previously release using the BSD License: @@ -57,8 +58,6 @@ import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.net.URI; import java.text.MessageFormat; import java.util.ArrayList; @@ -117,7 +116,6 @@ import org.argouml.uml.diagram.ui.ActionRemoveFromDiagram; import org.argouml.uml.ui.ActionSaveProject; import org.argouml.util.ArgoFrame; -import org.argouml.util.JavaRuntimeUtility; import org.argouml.util.ThreadUtils; import org.tigris.gef.base.Editor; import org.tigris.gef.base.Globals; @@ -363,37 +361,13 @@ final ImageIcon argoImage16x16 = ResourceLoaderWrapper.lookupIconResource("ArgoIcon16x16"); - // JREs pre 1.6.0 cannot handle multiple images using - // setIconImages(), so use reflection to conditionally make the - // call to this.setIconImages(). - // TODO: We can remove all of this reflection code when we go to - // Java 1.6 as a minimum JRE version, see issue 4989. - if (JavaRuntimeUtility.isJre5()) { - // With JRE < 1.6.0, do it the old way using - // javax.swing.JFrame.setIconImage, and accept the blurry icon - setIconImage(argoImage16x16.getImage()); - } else { - final ImageIcon argoImage32x32 = - ResourceLoaderWrapper.lookupIconResource("ArgoIcon32x32"); - final List<Image> argoImages = new ArrayList<Image>(2); - argoImages.add(argoImage16x16.getImage()); - argoImages.add(argoImage32x32.getImage()); - try { - // java.awt.Window.setIconImages is new in Java 6. - // check for it using reflection on current instance - final Method m = - getClass().getMethod("setIconImages", List.class); - m.invoke(this, argoImages); - } catch (InvocationTargetException e) { - LOG.error("Exception", e); - } catch (NoSuchMethodException e) { - LOG.error("Exception", e); - } catch (IllegalArgumentException e) { - LOG.error("Exception", e); - } catch (IllegalAccessException e) { - LOG.error("Exception", e); - } - } + final ImageIcon argoImage32x32 = ResourceLoaderWrapper + .lookupIconResource("ArgoIcon32x32"); + final List<Image> argoImages = new ArrayList<Image>(2); + argoImages.add(argoImage16x16.getImage()); + argoImages.add(argoImage32x32.getImage()); + + setIconImages(argoImages); } /** Modified: trunk/src/argouml-app/src/org/argouml/util/JavaRuntimeUtility.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/util/JavaRuntimeUtility.java?view=diff&pathrev=19899&r1=19898&r2=19899 ============================================================================== --- trunk/src/argouml-app/src/org/argouml/util/JavaRuntimeUtility.java (original) +++ trunk/src/argouml-app/src/org/argouml/util/JavaRuntimeUtility.java 2012-09-09 13:31:43-0700 @@ -60,19 +60,6 @@ } /** - * Determine if the java runtime found is JRE 5 - * <p>Note that plugins should not rely on this method existing in - * it is likely to be removed without deprecation as soon as JRE 5 is - * no longer supported. - * - * @return true if we're running on JRE 5 - */ - public static boolean isJre5() { - String javaVersion = System.getProperty("java.version", ""); - return (javaVersion.startsWith("1.5")); - } - - /** * Get the JRE version described in system properties * @return the JRE version */ ------------------------------------------------------ http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=3004609 To unsubscribe from this discussion, e-mail: [[email protected]].
