From a6256cfcb558ce5dc73e5e962ef9403b6e2c659e Mon Sep 17 00:00:00 2001 From: Dan Vasilescu Date: Wed, 12 Feb 2020 15:46:39 -0500 Subject: [PATCH] Don't replace application Description if it didn't change. --- .../desktop/biomodel/ApplicationPropertiesPanel.java | 5 +++-- .../main/java/cbit/vcell/mapping/SimulationContext.java | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/vcell-client/src/main/java/cbit/vcell/client/desktop/biomodel/ApplicationPropertiesPanel.java b/vcell-client/src/main/java/cbit/vcell/client/desktop/biomodel/ApplicationPropertiesPanel.java index c0be0e0880..e42fc42fe7 100644 --- a/vcell-client/src/main/java/cbit/vcell/client/desktop/biomodel/ApplicationPropertiesPanel.java +++ b/vcell-client/src/main/java/cbit/vcell/client/desktop/biomodel/ApplicationPropertiesPanel.java @@ -233,8 +233,9 @@ private void changeAnnotation() { if (simulationContext == null) { return; } - simulationContext.setDescription(annotationTextArea.getText()); - } catch(Exception e){ + String description = annotationTextArea.getText(); + simulationContext.setDescription(description); + } catch(Exception e) { e.printStackTrace(System.out); PopupGenerator.showErrorDialog(this, e.getMessage(), e); } diff --git a/vcell-core/src/main/java/cbit/vcell/mapping/SimulationContext.java b/vcell-core/src/main/java/cbit/vcell/mapping/SimulationContext.java index 1e294edd14..89caddbfb7 100644 --- a/vcell-core/src/main/java/cbit/vcell/mapping/SimulationContext.java +++ b/vcell-core/src/main/java/cbit/vcell/mapping/SimulationContext.java @@ -2267,6 +2267,9 @@ public void setCharacteristicSize(Double size) throws java.beans.PropertyVetoExc */ public void setDescription(java.lang.String description) throws java.beans.PropertyVetoException { String oldValue = getFieldDescription(); + if(description != null && description.contentEquals(oldValue)) { + return; + } fireVetoableChange(PROPERTY_NAME_DESCRIPTION, oldValue, description); setFieldDescription(description); firePropertyChange(PROPERTY_NAME_DESCRIPTION, oldValue, description); @@ -2278,7 +2281,8 @@ private java.lang.String getFieldDescription() { } private void setFieldDescription(java.lang.String newFieldDescription) { - this.fieldDescription = truncateForDB(newFieldDescription); + String ret = truncateForDB(newFieldDescription); + this.fieldDescription = ret; } private String truncateForDB(String s){ @@ -2292,7 +2296,6 @@ private String truncateForDB(String s){ } return temp.toString(); } - return s; }