cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject [7/9] cayenne git commit: CAY-2462 Modeler: Clipboard holds old content after application was reloaded
Date Wed, 29 Aug 2018 11:39:35 GMT
CAY-2462 Modeler: Clipboard holds old content after application was reloaded


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/48fe22c5
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/48fe22c5
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/48fe22c5

Branch: refs/heads/STABLE-4.0
Commit: 48fe22c5fbf6a1227eb399013772b1c7353b0565
Parents: 6f8513c
Author: Nikita Timofeev <stariy95@gmail.com>
Authored: Wed Aug 29 14:19:51 2018 +0300
Committer: Nikita Timofeev <stariy95@gmail.com>
Committed: Wed Aug 29 14:19:51 2018 +0300

----------------------------------------------------------------------
 RELEASE-NOTES.txt                               |  1 +
 .../modeler/action/OpenProjectAction.java       | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/48fe22c5/RELEASE-NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index 181b90b..bcdeef0 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -19,6 +19,7 @@ CAY-2450 Modeler: Impossible to update Attribute title after syncing ObjEntity
 CAY-2451 Modeler: ObjEntity "Edit" button doesn't open editor for Relationship
 CAY-2454 Modeler: Unable to read validation message if it's truncated
 CAY-2459 Modeler: DataMap Paste function is not working
+CAY-2462 Modeler: Clipboard holds old content after application was reloaded
 CAY-2464 ClassCastException when returning PRUNED_NODE in expression transformer
 
 ----------------------------------

http://git-wip-us.apache.org/repos/asf/cayenne/blob/48fe22c5/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/OpenProjectAction.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/OpenProjectAction.java
b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/OpenProjectAction.java
index e7fcb56..de8e555 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/OpenProjectAction.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/OpenProjectAction.java
@@ -20,6 +20,9 @@
 package org.apache.cayenne.modeler.action;
 
 import java.awt.Toolkit;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.UnsupportedFlavorException;
 import java.awt.event.ActionEvent;
 import java.awt.event.KeyEvent;
 import java.io.File;
@@ -56,6 +59,7 @@ public class OpenProjectAction extends ProjectAction {
     public OpenProjectAction(Application application) {
         super(getActionName(), application);
         this.fileChooser = new ProjectOpener();
+        resetClipboard();
     }
 
     @Override
@@ -193,4 +197,20 @@ public class OpenProjectAction extends ProjectAction {
                 JOptionPane.YES_NO_OPTION);
         return returnCode != JOptionPane.NO_OPTION;
     }
+
+    private void resetClipboard() {
+        Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new Transferable() {
+            public DataFlavor[] getTransferDataFlavors() {
+                return new DataFlavor[0];
+            }
+
+            public boolean isDataFlavorSupported(DataFlavor flavor) {
+                return false;
+            }
+
+            public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException
{
+                throw new UnsupportedFlavorException(flavor);
+            }
+        }, null);
+    }
 }


Mime
View raw message