From 33984e02c5687dc011d13da4b17cb0815970e0f5 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Thu, 6 Apr 2017 16:52:23 +0100 Subject: [PATCH] JAL-2361 make a modified saved scheme the backout checkpoint for Cancel --- src/jalview/gui/UserDefinedColours.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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; } /** -- 1.7.10.2