From: gmungoc Date: Thu, 6 Apr 2017 15:52:23 +0000 (+0100) Subject: JAL-2361 make a modified saved scheme the backout checkpoint for Cancel X-Git-Tag: Release_2_10_2~3^2~135 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=33984e02c5687dc011d13da4b17cb0815970e0f5;p=jalview.git JAL-2361 make a modified saved scheme the backout checkpoint for Cancel --- diff --git a/src/jalview/gui/UserDefinedColours.java b/src/jalview/gui/UserDefinedColours.java index 369dde6..0187aa3 100755 --- a/src/jalview/gui/UserDefinedColours.java +++ b/src/jalview/gui/UserDefinedColours.java @@ -685,16 +685,18 @@ public class UserDefinedColours extends GUserDefinedColours implements if (value == JalviewFileChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); - addNewColourScheme(file.getPath()); + UserColourScheme updatedScheme = addNewColourScheme(file.getPath()); saveToFile(file); /* * changes saved - apply to alignment if we are changing - * the currently selected colour scheme + * the currently selected colour scheme; also make the updated + * colours the 'backout' scheme on Cancel */ if (oldColourScheme != null && name.equals(oldColourScheme.getSchemeName())) { + oldColourScheme = updatedScheme; applyButton_actionPerformed(); } } @@ -707,8 +709,9 @@ public class UserDefinedColours extends GUserDefinedColours implements * the colour scheme. * * @param filePath + * @return */ - protected void addNewColourScheme(String filePath) + protected UserColourScheme addNewColourScheme(String filePath) { /* * update the delimited list of user defined colour files in @@ -739,6 +742,8 @@ public class UserDefinedColours extends GUserDefinedColours implements { ap.alignFrame.buildColourMenu(); } + + return ucs; } /**