cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From abulat...@apache.org
Subject [cayenne] branch master updated: CAY-2530 DB Import and Class Generation from Project is performed for removed datamaps
Date Wed, 06 Mar 2019 08:32:29 GMT
This is an automated email from the ASF dual-hosted git repository.

abulatski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cayenne.git


The following commit(s) were added to refs/heads/master by this push:
     new e7338cc  CAY-2530 DB Import and Class Generation from Project is performed for removed
datamaps
e7338cc is described below

commit e7338cc9d1aabab9adbd2266a7d9433b2b18bd8e
Author: Arseni Bulatski <ancarseni@gmail.com>
AuthorDate: Mon Feb 11 15:54:28 2019 +0300

    CAY-2530 DB Import and Class Generation from Project is performed for removed datamaps
---
 RELEASE-NOTES.txt                                  |  1 +
 .../modeler/editor/GeneratorsTabController.java    | 22 ++++++++++++++--------
 .../editor/cgen/domain/CgenTabController.java      |  5 ++---
 .../dbimport/domain/DbImportTabController.java     |  7 +++----
 4 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index 62aad0a..796ddb2 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -29,6 +29,7 @@ Bug Fixes:
 
 CAY-2332 Property API: unable to use eq() and in() methods for toMany relationships
 CAY-2509 Result of resolving lazily faulted relationships can be out-of-date
+CAY-2530 DB Import and Class Generation from Project is performed for removed datamaps
 CAY-2544 Possible name clash of ivar and property name in generated class
 CAY-2547 CayenneDataObject serialization issue
 
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/GeneratorsTabController.java
b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/GeneratorsTabController.java
index a257643..8219d2c 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/GeneratorsTabController.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/GeneratorsTabController.java
@@ -18,6 +18,13 @@
  ****************************************************************/
 package org.apache.cayenne.modeler.editor;
 
+import java.awt.event.ItemEvent;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
 import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.modeler.ProjectController;
@@ -26,13 +33,6 @@ import org.apache.cayenne.project.Project;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.awt.event.ItemEvent;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
 /**
  * @since 4.1
  */
@@ -46,10 +46,11 @@ public abstract class GeneratorsTabController {
     public ConcurrentMap<DataMap, GeneratorsPanel> generatorsPanels;
     public Set<DataMap> selectedDataMaps;
 
-    public GeneratorsTabController(Class type) {
+    public GeneratorsTabController(Class type, ProjectController projectController) {
         this.type = type;
         this.generatorsPanels = new ConcurrentHashMap<>();
         this.selectedDataMaps = new HashSet<>();
+        this.projectController = projectController;
     }
 
     public String icon;
@@ -58,6 +59,7 @@ public abstract class GeneratorsTabController {
 
     public void createPanels(){
         Collection<DataMap> dataMaps = getDataMaps();
+        refreshSelectedMaps(dataMaps);
         generatorsPanels.clear();
         for(DataMap dataMap : dataMaps) {
             GeneratorsPanel generatorPanel = new GeneratorsPanel(dataMap, "icon-datamap.png",
type);
@@ -132,4 +134,8 @@ public abstract class GeneratorsTabController {
     Set<DataMap> getSelectedDataMaps() {
         return selectedDataMaps;
     }
+
+    private void refreshSelectedMaps(Collection<DataMap> dataMaps) {
+        selectedDataMaps.removeIf(dataMap -> !dataMaps.contains(dataMap));
+    }
 }
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/domain/CgenTabController.java
b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/domain/CgenTabController.java
index af1505b..62d9d55 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/domain/CgenTabController.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/domain/CgenTabController.java
@@ -19,7 +19,7 @@
 
 package org.apache.cayenne.modeler.editor.cgen.domain;
 
-import javax.swing.*;
+import javax.swing.JOptionPane;
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -46,8 +46,7 @@ import org.apache.cayenne.tools.ToolsInjectorBuilder;
 public class CgenTabController extends GeneratorsTabController {
 
     public CgenTabController(ProjectController projectController) {
-        super(CgenConfiguration.class);
-        this.projectController = projectController;
+        super(CgenConfiguration.class, projectController);
         this.view = new CgenTab(projectController, this);
     }
 
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbimport/domain/DbImportTabController.java
b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbimport/domain/DbImportTabController.java
index 08b765c..b2514b0 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbimport/domain/DbImportTabController.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbimport/domain/DbImportTabController.java
@@ -18,6 +18,8 @@
  ****************************************************************/
 package org.apache.cayenne.modeler.editor.dbimport.domain;
 
+import java.util.Set;
+
 import org.apache.cayenne.dbsync.reverse.dbimport.ReverseEngineering;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.modeler.Application;
@@ -26,16 +28,13 @@ import org.apache.cayenne.modeler.action.ReverseEngineeringAction;
 import org.apache.cayenne.modeler.editor.GeneratorsTabController;
 import org.apache.cayenne.modeler.event.DataMapDisplayEvent;
 
-import java.util.Set;
-
 /**
  * @since 4.1
  */
 public class DbImportTabController extends GeneratorsTabController {
 
     public DbImportTabController(ProjectController projectController) {
-        super(ReverseEngineering.class);
-        this.projectController = projectController;
+        super(ReverseEngineering.class, projectController);
         this.view = new DbImportTab(projectController, this);
     }
 


Mime
View raw message