From 8cfbcaf2a50aa790dad1dc43c4cbceb678f3224f Mon Sep 17 00:00:00 2001 From: gmungoc Date: Tue, 30 Apr 2019 11:57:49 +0100 Subject: [PATCH] JAL-3241 simplified enum constructors for classloadability in Java 11 --- src/jalview/util/ImageMaker.java | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/jalview/util/ImageMaker.java b/src/jalview/util/ImageMaker.java index 7840261..7232042 100755 --- a/src/jalview/util/ImageMaker.java +++ b/src/jalview/util/ImageMaker.java @@ -78,22 +78,26 @@ public class ImageMaker public enum TYPE { - EPS("EPS", MessageManager.getString("label.eps_file"), getEPSChooser()), + EPS("EPS", MessageManager.getString("label.eps_file"), EPS_EXTENSION, + EPS_DESCRIPTION), PNG("PNG", MessageManager.getString("label.png_image"), - getPNGChooser()), - SVG("SVG", "SVG", getSVGChooser()); - - private JalviewFileChooser chooser; + PNG_EXTENSION, PNG_DESCRIPTION), + SVG("SVG", "SVG", SVG_EXTENSION, SVG_DESCRIPTION); private String name; private String label; - TYPE(String name, String label, JalviewFileChooser chooser) + private String extension; + + private String description; + + TYPE(String name, String label, String ext, String desc) { this.name = name; this.label = label; - this.chooser = chooser; + this.extension = ext; + this.description = desc; } public String getName() @@ -101,9 +105,9 @@ public class ImageMaker return name; } - public JalviewFileChooser getChooser() + public JalviewFileChooser getFileChooser() { - return chooser; + return new JalviewFileChooser(extension, description); } public String getLabel() @@ -126,7 +130,7 @@ public class ImageMaker setProgressMessage(MessageManager.formatMessage( "status.waiting_for_user_to_select_output_file", type.name)); JalviewFileChooser chooser; - chooser = type.getChooser(); + chooser = type.getFileChooser(); chooser.setFileView(new jalview.io.JalviewFileView()); chooser.setDialogTitle(title); chooser.setToolTipText(MessageManager.getString("action.save")); -- 1.7.10.2