You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by nt...@apache.org on 2022/11/25 15:21:20 UTC

[cayenne] branch STABLE-4.2 updated: added check is comment field changing

This is an automated email from the ASF dual-hosted git repository.

ntimofeev pushed a commit to branch STABLE-4.2
in repository https://gitbox.apache.org/repos/asf/cayenne.git


The following commit(s) were added to refs/heads/STABLE-4.2 by this push:
     new 00252a4ea added check is comment field changing
     new 36bcebafc Merge pull request #545 from Ivan-nikitko/CAY-2782_Comment_field_in_datamap
00252a4ea is described below

commit 00252a4ea4c2bd61bc4606eb7bd3484bceb146d1
Author: Ivan Nikitka <70...@users.noreply.github.com>
AuthorDate: Fri Nov 25 11:47:10 2022 +0100

    added check is comment field changing
---
 .../java/org/apache/cayenne/modeler/editor/DataMapView.java   | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/DataMapView.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/DataMapView.java
index 2bc3459a0..91fa495fe 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/DataMapView.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/DataMapView.java
@@ -606,9 +606,14 @@ public class DataMapView extends JPanel {
         if (dataMap == null) {
             return;
         }
-
-        ObjectInfo.putToMetaData(eventController.getApplication().getMetaData(), dataMap, ObjectInfo.COMMENT, comment);
-        eventController.fireDataMapEvent(new DataMapEvent(this, dataMap));
+        String currentComment = getComment(dataMap);
+        if (currentComment == null) {
+            currentComment = "";
+        }
+            if (!comment.equals(currentComment)) {
+                ObjectInfo.putToMetaData(eventController.getApplication().getMetaData(), dataMap, ObjectInfo.COMMENT, comment);
+                eventController.fireDataMapEvent(new DataMapEvent(this, dataMap));
+            }
     }
 
     private String getComment(DataMap dataMap) {