Skip to content

Commit

Permalink
Don't replace application Description if it didn't change.
Browse files Browse the repository at this point in the history
  • Loading branch information
danv61 committed Feb 12, 2020
1 parent d53448a commit a6256cf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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){
Expand All @@ -2292,7 +2296,6 @@ private String truncateForDB(String s){
}
return temp.toString();
}

return s;
}

Expand Down

0 comments on commit a6256cf

Please sign in to comment.