cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject [08/32] cayenne git commit: Add loading cgen config loading from datamap to maven, ant and gradle plugins
Date Wed, 14 Nov 2018 14:27:39 GMT
Add loading cgen config loading from datamap to maven, ant and gradle plugins


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

Branch: refs/heads/master
Commit: d9db6e3123eae9e2863058c88d455837a244821c
Parents: b10cd80
Author: Arseni Bulatski <ancarseni@gmail.com>
Authored: Thu Jun 28 15:00:26 2018 +0300
Committer: Arseni Bulatski <ancarseni@gmail.com>
Committed: Wed Oct 24 13:44:24 2018 +0300

----------------------------------------------------------------------
 .../cayenne/tools/CayenneGeneratorTask.java     | 73 ++++++++-------
 .../java/org/apache/cayenne/gen/CgenModule.java | 21 +++++
 .../cayenne/gen/ClassGenerationAction.java      | 55 ++++++-----
 .../java/org/apache/cayenne/tools/CgenTask.java | 99 +++++++++++++-------
 .../org/apache/cayenne/tools/CgenTaskTest.java  |  9 +-
 .../cayenne/tools/CayenneGeneratorMojo.java     | 44 +++++----
 .../cayenne/modeler/CayenneModelerFrame.java    | 80 +++++++++++++++-
 .../cayenne/modeler/action/CgenAction.java      | 24 -----
 .../modeler/dialog/codegen/cgen/CgenDialog.java | 36 ++++++-
 .../codegen/cgen/CgenGlobalController.java      | 25 ++++-
 .../dialog/codegen/cgen/CgenGlobalPanel.java    | 77 +++++++++------
 .../codegen/cgen/CgenGlobalPanelController.java | 43 ++++++---
 .../modeler/editor/DataMapTabbedView.java       |  3 +-
 .../editor/cgen/ClassesTabController.java       |  4 +-
 .../modeler/editor/cgen/ClassesTabPanel.java    | 19 +++-
 .../editor/cgen/CodeGeneratorController.java    |  4 +-
 .../modeler/editor/cgen/CodeGeneratorPane.java  | 13 ++-
 .../editor/cgen/CustomModeController.java       | 16 ++--
 .../modeler/editor/cgen/CustomModePanel.java    | 79 ++++++++--------
 .../editor/cgen/GeneratorController.java        | 15 ++-
 .../editor/cgen/GeneratorControllerPanel.java   |  4 +-
 .../editor/cgen/GeneratorTabController.java     |  2 +-
 .../modeler/editor/cgen/GeneratorTabPanel.java  |  5 +-
 .../cayenne/modeler/util/ComboBoxAdapter.java   | 14 +--
 24 files changed, 511 insertions(+), 253 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/d9db6e31/cayenne-ant/src/main/java/org/apache/cayenne/tools/CayenneGeneratorTask.java
----------------------------------------------------------------------
diff --git a/cayenne-ant/src/main/java/org/apache/cayenne/tools/CayenneGeneratorTask.java b/cayenne-ant/src/main/java/org/apache/cayenne/tools/CayenneGeneratorTask.java
index 3d600b1..a82931e 100644
--- a/cayenne-ant/src/main/java/org/apache/cayenne/tools/CayenneGeneratorTask.java
+++ b/cayenne-ant/src/main/java/org/apache/cayenne/tools/CayenneGeneratorTask.java
@@ -19,11 +19,12 @@
 package org.apache.cayenne.tools;
 
 import foundrylogic.vpp.VPPConfig;
+import org.apache.cayenne.configuration.xml.DataChannelMetaData;
 import org.apache.cayenne.dbsync.filter.NamePatternMatcher;
 import org.apache.cayenne.dbsync.reverse.configuration.ToolsModule;
 import org.apache.cayenne.di.DIBootstrap;
 import org.apache.cayenne.di.Injector;
-import org.apache.cayenne.gen.ArtifactsGenerationMode;
+import org.apache.cayenne.gen.CgenModule;
 import org.apache.cayenne.gen.ClassGenerationAction;
 import org.apache.cayenne.gen.ClientClassGenerationAction;
 import org.apache.cayenne.map.DataMap;
@@ -50,10 +51,10 @@ public class CayenneGeneratorTask extends CayenneTask {
     protected boolean client;
     protected File destDir;
     protected String encoding;
-    protected boolean makepairs;
+    protected Boolean makepairs;
     protected String mode;
     protected String outputPattern;
-    protected boolean overwrite;
+    protected Boolean overwrite;
     protected String superpkg;
     protected String supertemplate;
     protected String template;
@@ -61,8 +62,10 @@ public class CayenneGeneratorTask extends CayenneTask {
     protected String embeddablesupertemplate;
     protected String querytemplate;
     protected String querysupertemplate;
-    protected boolean usepkgpath;
-    protected boolean createpropertynames;
+    protected Boolean usepkgpath;
+    protected Boolean createpropertynames;
+
+    private transient Injector injector;
 
     /**
      * Create PK attributes as Properties
@@ -72,10 +75,6 @@ public class CayenneGeneratorTask extends CayenneTask {
     protected boolean createpkproperties;
 
     public CayenneGeneratorTask() {
-        this.makepairs = true;
-        this.mode = ArtifactsGenerationMode.ENTITY.getLabel();
-        this.outputPattern = "*.java";
-        this.usepkgpath = true;
     }
 
     protected VelocityContext getVppContext() {
@@ -83,27 +82,33 @@ public class CayenneGeneratorTask extends CayenneTask {
         return vppConfig.getVelocityContext();
     }
 
-    protected ClassGenerationAction createGeneratorAction() {
-        ClassGenerationAction action = client ? new ClientClassGenerationAction() : new ClassGenerationAction();
+    protected ClassGenerationAction createGeneratorAction(DataMap dataMap) {
+        ClassGenerationAction action = injector.getInstance(DataChannelMetaData.class).get(dataMap, ClassGenerationAction.class);
+
+        if (client) {
+            action = new ClientClassGenerationAction();
+        } else {
+            if(action == null) {
+                action = new ClassGenerationAction();
+            }
+        }
 
         action.setContext(getVppContext());
         action.setDestDir(destDir);
-        action.setEncoding(encoding);
-        action.setMakePairs(makepairs);
-        action.setArtifactsGenerationMode(mode);
-        action.setOutputPattern(outputPattern);
-        action.setOverwrite(overwrite);
-        action.setSuperPkg(superpkg);
-        action.setSuperTemplate(supertemplate);
-        action.setTemplate(template);
-        action.setEmbeddableSuperTemplate(embeddablesupertemplate);
-        action.setEmbeddableTemplate(embeddabletemplate);
-        action.setQueryTemplate(querytemplate);
-        action.setQuerySuperTemplate(querysupertemplate);
-        action.setUsePkgPath(usepkgpath);
-        action.setCreatePropertyNames(createpropertynames);
-        action.setCreatePKProperties(createpkproperties);
-
+        action.setEncoding(encoding != null ? encoding : action.getEncoding());
+        action.setMakePairs(makepairs != null ? makepairs : action.isMakePairs());
+        action.setArtifactsGenerationMode(mode != null ? mode : action.getArtifactsGenerationMode());
+        action.setOutputPattern(outputPattern != null ? outputPattern : action.getOutputPattern());
+        action.setOverwrite(overwrite != null ? overwrite : action.isOverwrite());
+        action.setSuperPkg(superpkg != null ? superpkg : action.getSuperPkg());
+        action.setSuperTemplate(supertemplate != null ? supertemplate : action.getSuperclassTemplate());
+        action.setTemplate(template != null ? template : action.getTemplate());
+        action.setEmbeddableSuperTemplate(embeddablesupertemplate != null ? embeddablesupertemplate : action.getEmbeddableSuperTemplate());
+        action.setEmbeddableTemplate(embeddabletemplate != null ? embeddabletemplate : action.getEmbeddableTemplate());
+        action.setUsePkgPath(usepkgpath != null ? usepkgpath : action.isUsePkgPath());
+        action.setCreatePropertyNames(createpropertynames != null ? createpropertynames : action.isCreatePropertyNames());
+        action.setQueryTemplate(querytemplate != null ? querytemplate : action.getQueryTemplate());
+        action.setQuerySuperTemplate(querysupertemplate != null ? querysupertemplate : action.getQuerySuperTemplate());
         return action;
     }
 
@@ -114,7 +119,7 @@ public class CayenneGeneratorTask extends CayenneTask {
     public void execute() throws BuildException {
         validateAttributes();
 
-        Injector injector = DIBootstrap.createInjector(new ToolsModule(LoggerFactory.getLogger(CayenneGeneratorTask.class)));
+        injector = DIBootstrap.createInjector(new CgenModule(), new ToolsModule(LoggerFactory.getLogger(CayenneGeneratorTask.class)));
 
         AntLogger logger = new AntLogger(this);
         CayenneGeneratorMapLoaderAction loadAction = new CayenneGeneratorMapLoaderAction(injector);
@@ -130,13 +135,17 @@ public class CayenneGeneratorTask extends CayenneTask {
 
             DataMap dataMap = loadAction.getMainDataMap();
 
-            ClassGenerationAction generatorAction = createGeneratorAction();
+            ClassGenerationAction generatorAction = createGeneratorAction(dataMap);
             generatorAction.setLogger(logger);
             generatorAction.setTimestamp(map.lastModified());
             generatorAction.setDataMap(dataMap);
-            generatorAction.addEntities(filterAction.getFilteredEntities(dataMap));
-            generatorAction.addEmbeddables(filterAction.getFilteredEmbeddables(dataMap));
-            generatorAction.addQueries(dataMap.getQueryDescriptors());
+            if(!generatorAction.getEntities().isEmpty() || !generatorAction.getEmbeddables().isEmpty()){
+                generatorAction.prepareArtifacts();
+            } else {
+                generatorAction.addEntities(filterAction.getFilteredEntities(dataMap));
+                generatorAction.addEmbeddables(filterAction.getFilteredEmbeddables(dataMap));
+                generatorAction.addQueries(dataMap.getQueryDescriptors());
+            }
             generatorAction.execute();
         }
         catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/cayenne/blob/d9db6e31/cayenne-cgen/src/main/java/org/apache/cayenne/gen/CgenModule.java
----------------------------------------------------------------------
diff --git a/cayenne-cgen/src/main/java/org/apache/cayenne/gen/CgenModule.java b/cayenne-cgen/src/main/java/org/apache/cayenne/gen/CgenModule.java
index 79e411e..44b6cd7 100644
--- a/cayenne-cgen/src/main/java/org/apache/cayenne/gen/CgenModule.java
+++ b/cayenne-cgen/src/main/java/org/apache/cayenne/gen/CgenModule.java
@@ -1,3 +1,21 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
 package org.apache.cayenne.gen;
 
 import org.apache.cayenne.di.Binder;
@@ -5,6 +23,9 @@ import org.apache.cayenne.di.Module;
 import org.apache.cayenne.gen.xml.CgenExtension;
 import org.apache.cayenne.project.ProjectModule;
 
+/**
+ * @since 4.1
+ */
 public class CgenModule implements Module{
     @Override
     public void configure(Binder binder) {

http://git-wip-us.apache.org/repos/asf/cayenne/blob/d9db6e31/cayenne-cgen/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java
----------------------------------------------------------------------
diff --git a/cayenne-cgen/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java b/cayenne-cgen/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java
index afd58e0..f74ca21 100644
--- a/cayenne-cgen/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java
+++ b/cayenne-cgen/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java
@@ -33,8 +33,16 @@ import org.apache.velocity.VelocityContext;
 import org.apache.velocity.app.VelocityEngine;
 import org.slf4j.Logger;
 
-import java.io.*;
-import java.util.*;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Serializable;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
 
 public class ClassGenerationAction implements Serializable, XMLSerializable {
 	static final String TEMPLATES_DIR_NAME = "templates/v4_1/";
@@ -56,8 +64,8 @@ public class ClassGenerationAction implements Serializable, XMLSerializable {
 
 	protected Collection<Artifact> artifacts;
 
-	protected Collection<String> entityArtifacts;
-	protected Collection<String> embeddableArtifacts;
+	private Collection<String> entityArtifacts;
+	private Collection<String> embeddableArtifacts;
 
 	protected String superPkg;
 	protected DataMap dataMap;
@@ -103,16 +111,12 @@ public class ClassGenerationAction implements Serializable, XMLSerializable {
         this.artifacts = new ArrayList<>();
         this.entityArtifacts = new ArrayList<>();
         this.embeddableArtifacts = new ArrayList<>();
+        this.artifactsGenerationMode = ArtifactsGenerationMode.ENTITY;
+
+        this.overwrite = false;
 	}
 
 	public void setDefaults() {
-        this.outputPattern = "*.java";
-        this.timestamp = 0L;
-        this.usePkgPath = true;
-        this.makePairs = true;
-        this.context = new VelocityContext();
-        this.templateCache = new HashMap<>(5);
-
         this.template = SUBCLASS_TEMPLATE;
         this.superTemplate = SUPERCLASS_TEMPLATE;
 
@@ -121,8 +125,6 @@ public class ClassGenerationAction implements Serializable, XMLSerializable {
 
         this.queryTemplate = DATAMAP_SUBCLASS_TEMPLATE;
         this.querySuperTemplate = DATAMAP_SUPERCLASS_TEMPLATE;
-
-        this.artifactsGenerationMode = ArtifactsGenerationMode.ENTITY;
     }
 
 	protected String defaultTemplateName(TemplateType type) {
@@ -150,7 +152,7 @@ public class ClassGenerationAction implements Serializable, XMLSerializable {
 		}
 	}
 
-	protected String customTemplateName(TemplateType type) {
+	private String customTemplateName(TemplateType type) {
 		switch (type) {
 		case ENTITY_SINGLE_CLASS:
 			return template;
@@ -575,7 +577,10 @@ public class ClassGenerationAction implements Serializable, XMLSerializable {
 			// TODO: andrus 10.12.2010 - why not also check for empty query list??
 			// Or create a better API for enabling DataMapArtifact
 			if (queries != null) {
-				artifacts.add(new DataMapArtifact(dataMap, queries));
+				Artifact artifact = new DataMapArtifact(dataMap, queries);
+				if(!artifacts.contains(artifact)) {
+					artifacts.add(new DataMapArtifact(dataMap, queries));
+				}
 			}
 		}
 	}
@@ -583,16 +588,24 @@ public class ClassGenerationAction implements Serializable, XMLSerializable {
     private void addAllEntities() {
 		if(artifactsGenerationMode == ArtifactsGenerationMode.ENTITY
 				|| artifactsGenerationMode == ArtifactsGenerationMode.ALL) {
-            entityArtifacts.forEach(val ->
-                artifacts.add(new EntityArtifact(dataMap.getObjEntity(val))));
+            entityArtifacts.forEach(val -> {
+            	Artifact artifact = new EntityArtifact(dataMap.getObjEntity(val));
+            	if(!artifacts.contains(artifact)) {
+					artifacts.add(artifact);
+				}
+			});
 		}
 	}
 
     private void addAllEmbeddables() {
 		if(artifactsGenerationMode == ArtifactsGenerationMode.ENTITY
 				|| artifactsGenerationMode == ArtifactsGenerationMode.ALL) {
-		    embeddableArtifacts.forEach(val ->
-                    artifacts.add(new EmbeddableArtifact(dataMap.getEmbeddable(val))));
+		    embeddableArtifacts.forEach(val -> {
+		    	Artifact artifact = new EmbeddableArtifact(dataMap.getEmbeddable(val));
+				if(!artifacts.contains(artifact)) {
+		    		artifacts.add(artifact);
+		    	}
+			});
 		}
 	}
 
@@ -711,7 +724,7 @@ public class ClassGenerationAction implements Serializable, XMLSerializable {
 	}
 
 	public String getDir(){
-		return destDir.getAbsolutePath();
+		return destDir != null ? destDir.getAbsolutePath() : null;
 	}
 
 	public File getDestDir() { return destDir; }
@@ -779,7 +792,7 @@ public class ClassGenerationAction implements Serializable, XMLSerializable {
 				.attribute("xmlns", CgenExtension.NAMESPACE)
 				.nested(this.getEntityArtifacts(), delegate)
 				.nested(this.getEmbeddableArtifacts(), delegate)
-				.simpleTag("outputDirectory", this.destDir.getAbsolutePath())
+				.simpleTag("outputDirectory", this.destDir != null ? this.destDir.getAbsolutePath() : null)
 				.simpleTag("generationMode", this.artifactsGenerationMode.getLabel())
                 .simpleTag("dataMapTemplate", this.queryTemplate)
                 .simpleTag("dataMapSuperclassTemplate", this.querySuperTemplate)

http://git-wip-us.apache.org/repos/asf/cayenne/blob/d9db6e31/cayenne-gradle-plugin/src/main/java/org/apache/cayenne/tools/CgenTask.java
----------------------------------------------------------------------
diff --git a/cayenne-gradle-plugin/src/main/java/org/apache/cayenne/tools/CgenTask.java b/cayenne-gradle-plugin/src/main/java/org/apache/cayenne/tools/CgenTask.java
index eae85b8..384d366 100644
--- a/cayenne-gradle-plugin/src/main/java/org/apache/cayenne/tools/CgenTask.java
+++ b/cayenne-gradle-plugin/src/main/java/org/apache/cayenne/tools/CgenTask.java
@@ -22,11 +22,14 @@ package org.apache.cayenne.tools;
 import java.io.File;
 import java.util.Set;
 
+import com.sun.org.apache.xpath.internal.operations.Bool;
 import groovy.lang.Reference;
+import org.apache.cayenne.configuration.xml.DataChannelMetaData;
 import org.apache.cayenne.dbsync.filter.NamePatternMatcher;
 import org.apache.cayenne.dbsync.reverse.configuration.ToolsModule;
 import org.apache.cayenne.di.DIBootstrap;
 import org.apache.cayenne.di.Injector;
+import org.apache.cayenne.gen.CgenModule;
 import org.apache.cayenne.gen.ClassGenerationAction;
 import org.apache.cayenne.gen.ClientClassGenerationAction;
 import org.apache.cayenne.map.DataMap;
@@ -70,16 +73,20 @@ public class CgenTask extends BaseCayenneTask {
     private String includeEntities;
 
     @Input
-    private boolean makePairs = true;
+    @Optional
+    private String makePairs;
 
     @Input
-    private String mode = "entity";
+    @Optional
+    private String mode;
 
     @Input
-    private String outputPattern = "*.java";
+    @Optional
+    private String outputPattern;
 
     @Input
-    private boolean overwrite;
+    @Optional
+    private String overwrite;
 
     @Input
     @Optional
@@ -102,10 +109,12 @@ public class CgenTask extends BaseCayenneTask {
     private String embeddableTemplate;
 
     @Input
-    private boolean usePkgPath = true;
+    @Optional
+    private String usePkgPath;
 
     @Input
-    private boolean createPropertyNames;
+    @Optional
+    private String createPropertyNames;
 
     /**
      * Force run (skip check for files modification time)
@@ -114,6 +123,14 @@ public class CgenTask extends BaseCayenneTask {
     @Input
     private boolean force;
 
+    @Input
+    @Optional
+    private String queryTemplate;
+
+    @Input
+    @Optional
+    private String querySuperTemplate;
+
     /**
      * If set to <code>true</code>, will generate PK attributes as Properties.
      * Default is <code>false</code>.
@@ -123,11 +140,14 @@ public class CgenTask extends BaseCayenneTask {
 
     private String destDirName;
 
+    private DataChannelMetaData metaData;
+
     @TaskAction
     public void generate() {
         File dataMapFile = getDataMapFile();
 
-        Injector injector = DIBootstrap.createInjector(new ToolsModule(LoggerFactory.getLogger(CgenTask.class)));
+        final Injector injector = DIBootstrap.createInjector(new CgenModule(), new ToolsModule(LoggerFactory.getLogger(CgenTask.class)));
+        metaData = injector.getInstance(DataChannelMetaData.class);
 
         CayenneGeneratorMapLoaderAction loaderAction = new CayenneGeneratorMapLoaderAction(injector);
         loaderAction.setMainDataMapFile(dataMapFile);
@@ -139,8 +159,8 @@ public class CgenTask extends BaseCayenneTask {
         try {
             loaderAction.setAdditionalDataMapFiles(convertAdditionalDataMaps());
 
-            ClassGenerationAction generator = this.createGenerator();
             DataMap dataMap = loaderAction.getMainDataMap();
+            ClassGenerationAction generator = this.createGenerator(dataMap);
 
             generator.setLogger(getLogger());
 
@@ -149,9 +169,13 @@ public class CgenTask extends BaseCayenneTask {
             }
             generator.setTimestamp(dataMapFile.lastModified());
             generator.setDataMap(dataMap);
-            generator.addEntities(filterAction.getFilteredEntities(dataMap));
-            generator.addEmbeddables(dataMap.getEmbeddables());
-            generator.addQueries(dataMap.getQueryDescriptors());
+            if(generator.getEntities().isEmpty() && generator.getEmbeddables().isEmpty()) {
+                generator.addEntities(filterAction.getFilteredEntities(dataMap));
+                generator.addEmbeddables(dataMap.getEmbeddables());
+                generator.addQueries(dataMap.getQueryDescriptors());
+            } else {
+                generator.prepareArtifacts();
+            }
             generator.execute();
         } catch (Exception exception) {
             throw new GradleException("Error generating classes: ", exception);
@@ -176,27 +200,32 @@ public class CgenTask extends BaseCayenneTask {
         return client ? new ClientClassGenerationAction() : new ClassGenerationAction();
     }
 
-    ClassGenerationAction createGenerator() {
-        ClassGenerationAction action = newGeneratorInstance();
+    ClassGenerationAction createGenerator(DataMap dataMap) {
+        ClassGenerationAction action = this.newGeneratorInstance();
 
-        action.setDestDir(getDestDirFile());
-        action.setEncoding(encoding);
-        action.setMakePairs(makePairs);
-        action.setArtifactsGenerationMode(mode);
-        action.setOutputPattern(outputPattern);
-        action.setOverwrite(overwrite);
-        action.setSuperPkg(superPkg);
-        action.setSuperTemplate(superTemplate);
-        action.setTemplate(template);
-        action.setEmbeddableSuperTemplate(embeddableSuperTemplate);
-        action.setEmbeddableTemplate(embeddableTemplate);
-        action.setUsePkgPath(usePkgPath);
-        action.setCreatePropertyNames(createPropertyNames);
-        action.setCreatePKProperties(createPKProperties);
+        if(metaData != null && metaData.get(dataMap, ClassGenerationAction.class) != null){
+            action = metaData.get(dataMap, ClassGenerationAction.class);
+        }
 
+        action.setDestDir(getDestDirFile());
+        action.setEncoding(encoding != null ? encoding : action.getEncoding());
+        action.setMakePairs(makePairs != null ? Boolean.valueOf(makePairs) : action.isMakePairs());
+        action.setArtifactsGenerationMode(mode != null ? mode : action.getArtifactsGenerationMode());
+        action.setOutputPattern(outputPattern != null ? outputPattern : action.getOutputPattern());
+        action.setOverwrite(overwrite != null ? Boolean.valueOf(overwrite) : action.isOverwrite());
+        action.setSuperPkg(superPkg != null ? superPkg : action.getSuperPkg());
+        action.setSuperTemplate(superTemplate != null ? superTemplate : action.getSuperclassTemplate());
+        action.setTemplate(template != null ? template : action.getTemplate());
+        action.setEmbeddableSuperTemplate(embeddableSuperTemplate != null ? embeddableSuperTemplate : action.getEmbeddableSuperTemplate());
+        action.setEmbeddableTemplate(embeddableTemplate != null ? embeddableTemplate : action.getEmbeddableTemplate());
+        action.setUsePkgPath(usePkgPath != null ? Boolean.valueOf(usePkgPath) : action.isUsePkgPath());
+        action.setCreatePropertyNames(createPropertyNames != null ? Boolean.valueOf(createPropertyNames) : action.isCreatePropertyNames());
+        action.setQueryTemplate(queryTemplate != null ? queryTemplate : action.getQueryTemplate());
+        action.setQuerySuperTemplate(querySuperTemplate != null ? querySuperTemplate : action.getQuerySuperTemplate());
         return action;
     }
 
+
     @OutputDirectory
     protected File getDestDirFile() {
         final Reference<File> javaSourceDir = new Reference<>(null);
@@ -330,11 +359,11 @@ public class CgenTask extends BaseCayenneTask {
     }
 
     public boolean isMakePairs() {
-        return makePairs;
+        return Boolean.valueOf(makePairs);
     }
 
     public void setMakePairs(boolean makePairs) {
-        this.makePairs = makePairs;
+        this.makePairs = String.valueOf(makePairs);
     }
 
     public void makePairs(boolean makePairs) {
@@ -366,11 +395,11 @@ public class CgenTask extends BaseCayenneTask {
     }
 
     public boolean isOverwrite() {
-        return overwrite;
+        return Boolean.valueOf(overwrite);
     }
 
     public void setOverwrite(boolean overwrite) {
-        this.overwrite = overwrite;
+        this.overwrite = String.valueOf(overwrite);
     }
 
     public void overwrite(boolean overwrite) {
@@ -438,11 +467,11 @@ public class CgenTask extends BaseCayenneTask {
     }
 
     public boolean isUsePkgPath() {
-        return usePkgPath;
+        return Boolean.valueOf(usePkgPath);
     }
 
     public void setUsePkgPath(boolean usePkgPath) {
-        this.usePkgPath = usePkgPath;
+        this.usePkgPath = String.valueOf(usePkgPath);
     }
 
     public void usePkgPath(boolean usePkgPath) {
@@ -450,11 +479,11 @@ public class CgenTask extends BaseCayenneTask {
     }
 
     public boolean isCreatePropertyNames() {
-        return createPropertyNames;
+        return Boolean.valueOf(createPropertyNames);
     }
 
     public void setCreatePropertyNames(boolean createPropertyNames) {
-        this.createPropertyNames = createPropertyNames;
+        this.createPropertyNames = String.valueOf(createPropertyNames);
     }
 
     public void createPropertyNames(boolean createPropertyNames) {

http://git-wip-us.apache.org/repos/asf/cayenne/blob/d9db6e31/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/CgenTaskTest.java
----------------------------------------------------------------------
diff --git a/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/CgenTaskTest.java b/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/CgenTaskTest.java
index 8259d21..478ac5c 100644
--- a/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/CgenTaskTest.java
+++ b/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/CgenTaskTest.java
@@ -20,13 +20,14 @@
 package org.apache.cayenne.tools;
 
 import org.apache.cayenne.gen.ClassGenerationAction;
+import org.apache.cayenne.map.DataMap;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
 
 import java.io.File;
 
-import static org.junit.Assert.*;
+import static junit.framework.TestCase.assertSame;
 import static org.mockito.Mockito.*;
 
 /**
@@ -37,6 +38,8 @@ public class CgenTaskTest {
     @Rule
     public TemporaryFolder temp = new TemporaryFolder();
 
+    DataMap dataMap = new DataMap();
+
     private CgenTask createCgenTaskMock(ClassGenerationAction action) {
         CgenTask mock = mock(CgenTask.class);
 
@@ -57,7 +60,7 @@ public class CgenTaskTest {
         doCallRealMethod().when(mock).setUsePkgPath(anyBoolean());
         doCallRealMethod().when(mock).setTemplate(anyString());
         when(mock.newGeneratorInstance()).thenReturn(action);
-        when(mock.createGenerator()).thenCallRealMethod();
+        when(mock.createGenerator(dataMap)).thenCallRealMethod();
 
         return mock;
     }
@@ -82,7 +85,7 @@ public class CgenTaskTest {
         task.setOverwrite(true);
         task.setUsePkgPath(true);
 
-        ClassGenerationAction createdAction = task.createGenerator();
+        ClassGenerationAction createdAction = task.createGenerator(dataMap);
         assertSame(action, createdAction);
 
         verify(action).setCreatePropertyNames(true);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/d9db6e31/maven-plugins/cayenne-maven-plugin/src/main/java/org/apache/cayenne/tools/CayenneGeneratorMojo.java
----------------------------------------------------------------------
diff --git a/maven-plugins/cayenne-maven-plugin/src/main/java/org/apache/cayenne/tools/CayenneGeneratorMojo.java b/maven-plugins/cayenne-maven-plugin/src/main/java/org/apache/cayenne/tools/CayenneGeneratorMojo.java
index 42a2e8d..e57d306 100644
--- a/maven-plugins/cayenne-maven-plugin/src/main/java/org/apache/cayenne/tools/CayenneGeneratorMojo.java
+++ b/maven-plugins/cayenne-maven-plugin/src/main/java/org/apache/cayenne/tools/CayenneGeneratorMojo.java
@@ -99,7 +99,7 @@ public class CayenneGeneratorMojo extends AbstractMojo {
 	 * <code>true</code>).
 	 */
 	@Parameter
-	private String makePairs;
+	private Boolean makePairs;
 
 	/**
 	 * DataMap XML file to use as a base for class generation.
@@ -113,7 +113,7 @@ public class CayenneGeneratorMojo extends AbstractMojo {
 	 * iteration per datamap (This is always one iteration since cgen currently
 	 * supports specifying one-and-only-one datamap). (Default is &quot;entity&quot;)
 	 */
-	@Parameter(defaultValue = "entity")
+	@Parameter
 	private String mode;
 
 	/**
@@ -127,7 +127,7 @@ public class CayenneGeneratorMojo extends AbstractMojo {
 	 * classes. Ignored unless makepairs is set to <code>false</code>.
 	 */
 	@Parameter
-	private String overwrite;
+	private Boolean overwrite;
 
 	/**
 	 * Java package name of generated superclasses. Ignored unless
@@ -177,14 +177,14 @@ public class CayenneGeneratorMojo extends AbstractMojo {
 	 * ignoring their package.
 	 */
 	@Parameter
-	private String usePkgPath;
+	private Boolean usePkgPath;
 
     /**
      * If set to <code>true</code>, will generate String Property names.
      * Default is <code>false</code>.
      */
     @Parameter
-    private String createPropertyNames;
+    private Boolean createPropertyNames;
 
 	/**
 	 * If set to <code>true</code>, will skip file modification time validation and regenerate all.
@@ -195,15 +195,21 @@ public class CayenneGeneratorMojo extends AbstractMojo {
 	@Parameter(defaultValue = "false", property = "force")
 	private boolean force;
 
-	/**
-	 * If set to <code>true</code>, will generate PK attributes as Properties.
-	 * Default is <code>false</code>.
-	 * @since 4.1
-	 */
-	@Parameter(defaultValue = "false")
-	private boolean createPKProperties;
+	@Parameter
+	private String queryTemplate;
+
+	@Parameter
+	private String querySuperTemplate;
+
+    /**
+     * If set to <code>true</code>, will generate PK attributes as Properties.
+     * Default is <code>false</code>.
+     * @since 4.1
+     */
+    @Parameter(defaultValue = "false")
+    private boolean createPKProperties;
 
-	private transient Injector injector;
+    private transient Injector injector;
 
     private static final Logger logger = LoggerFactory.getLogger(CayenneGeneratorMojo.class);
 
@@ -289,17 +295,19 @@ public class CayenneGeneratorMojo extends AbstractMojo {
 
 		action.setDestDir(destDir);
 		action.setEncoding(encoding != null ? encoding : action.getEncoding());
-		action.setMakePairs(makePairs != null ? Boolean.valueOf(makePairs) : action.isMakePairs());
-		action.setArtifactsGenerationMode(mode);
+		action.setMakePairs(makePairs != null ? makePairs : action.isMakePairs());
+		action.setArtifactsGenerationMode(mode != null ? mode : action.getArtifactsGenerationMode());
 		action.setOutputPattern(outputPattern != null ? outputPattern : action.getOutputPattern());
-		action.setOverwrite(overwrite != null ? Boolean.valueOf(overwrite) : action.isOverwrite());
+		action.setOverwrite(overwrite != null ? overwrite : action.isOverwrite());
 		action.setSuperPkg(superPkg != null ? superPkg : action.getSuperPkg());
 		action.setSuperTemplate(superTemplate != null ? superTemplate : action.getSuperclassTemplate());
 		action.setTemplate(template != null ? template : action.getTemplate());
 		action.setEmbeddableSuperTemplate(embeddableSuperTemplate != null ? embeddableSuperTemplate : action.getEmbeddableSuperTemplate());
 		action.setEmbeddableTemplate(embeddableTemplate != null ? embeddableTemplate : action.getEmbeddableTemplate());
-		action.setUsePkgPath(usePkgPath != null ? Boolean.valueOf(usePkgPath) : action.isUsePkgPath());
-		action.setCreatePropertyNames(createPropertyNames != null ? Boolean.valueOf(createPropertyNames) : action.isCreatePropertyNames());
+		action.setUsePkgPath(usePkgPath != null ? usePkgPath : action.isUsePkgPath());
+		action.setCreatePropertyNames(createPropertyNames != null ? createPropertyNames : action.isCreatePropertyNames());
+		action.setQueryTemplate(queryTemplate != null ? queryTemplate : action.getQueryTemplate());
+		action.setQuerySuperTemplate(querySuperTemplate != null ? querySuperTemplate : action.getQuerySuperTemplate());
 		return action;
 	}
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/d9db6e31/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/CayenneModelerFrame.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/CayenneModelerFrame.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/CayenneModelerFrame.java
index 0b12dcd..97772de 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/CayenneModelerFrame.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/CayenneModelerFrame.java
@@ -19,12 +19,64 @@
 
 package org.apache.cayenne.modeler;
 
-import org.apache.cayenne.modeler.action.*;
+import org.apache.cayenne.modeler.action.AboutAction;
+import org.apache.cayenne.modeler.action.ActionManager;
+import org.apache.cayenne.modeler.action.CgenAction;
+import org.apache.cayenne.modeler.action.ConfigurePreferencesAction;
+import org.apache.cayenne.modeler.action.CopyAction;
+import org.apache.cayenne.modeler.action.CreateDataMapAction;
+import org.apache.cayenne.modeler.action.CreateDbEntityAction;
+import org.apache.cayenne.modeler.action.CreateEmbeddableAction;
+import org.apache.cayenne.modeler.action.CreateNodeAction;
+import org.apache.cayenne.modeler.action.CreateObjEntityAction;
+import org.apache.cayenne.modeler.action.CreateProcedureAction;
+import org.apache.cayenne.modeler.action.CreateQueryAction;
+import org.apache.cayenne.modeler.action.CutAction;
+import org.apache.cayenne.modeler.action.DbEntitySyncAction;
+import org.apache.cayenne.modeler.action.DocumentationAction;
+import org.apache.cayenne.modeler.action.ExitAction;
+import org.apache.cayenne.modeler.action.FindAction;
+import org.apache.cayenne.modeler.action.GenerateCodeAction;
+import org.apache.cayenne.modeler.action.GenerateDBAction;
+import org.apache.cayenne.modeler.action.ImportDataMapAction;
+import org.apache.cayenne.modeler.action.ImportEOModelAction;
+import org.apache.cayenne.modeler.action.InferRelationshipsAction;
+import org.apache.cayenne.modeler.action.MigrateAction;
+import org.apache.cayenne.modeler.action.NavigateBackwardAction;
+import org.apache.cayenne.modeler.action.NavigateForwardAction;
+import org.apache.cayenne.modeler.action.NewProjectAction;
+import org.apache.cayenne.modeler.action.ObjEntitySyncAction;
+import org.apache.cayenne.modeler.action.OpenProjectAction;
+import org.apache.cayenne.modeler.action.PasteAction;
+import org.apache.cayenne.modeler.action.ProjectAction;
+import org.apache.cayenne.modeler.action.RedoAction;
+import org.apache.cayenne.modeler.action.RemoveAction;
+import org.apache.cayenne.modeler.action.RevertAction;
+import org.apache.cayenne.modeler.action.SaveAction;
+import org.apache.cayenne.modeler.action.SaveAsAction;
+import org.apache.cayenne.modeler.action.ShowLogConsoleAction;
+import org.apache.cayenne.modeler.action.UndoAction;
+import org.apache.cayenne.modeler.action.ValidateAction;
 import org.apache.cayenne.modeler.action.dbimport.ReverseEngineeringToolMenuAction;
 import org.apache.cayenne.modeler.dialog.LogConsole;
 import org.apache.cayenne.modeler.dialog.welcome.WelcomeScreen;
 import org.apache.cayenne.modeler.editor.EditorView;
-import org.apache.cayenne.modeler.event.*;
+import org.apache.cayenne.modeler.event.DataMapDisplayEvent;
+import org.apache.cayenne.modeler.event.DataMapDisplayListener;
+import org.apache.cayenne.modeler.event.DataNodeDisplayEvent;
+import org.apache.cayenne.modeler.event.DataNodeDisplayListener;
+import org.apache.cayenne.modeler.event.DbEntityDisplayListener;
+import org.apache.cayenne.modeler.event.EmbeddableDisplayEvent;
+import org.apache.cayenne.modeler.event.EmbeddableDisplayListener;
+import org.apache.cayenne.modeler.event.EntityDisplayEvent;
+import org.apache.cayenne.modeler.event.MultipleObjectsDisplayEvent;
+import org.apache.cayenne.modeler.event.MultipleObjectsDisplayListener;
+import org.apache.cayenne.modeler.event.ObjEntityDisplayListener;
+import org.apache.cayenne.modeler.event.ProcedureDisplayEvent;
+import org.apache.cayenne.modeler.event.ProcedureDisplayListener;
+import org.apache.cayenne.modeler.event.QueryDisplayEvent;
+import org.apache.cayenne.modeler.event.QueryDisplayListener;
+import org.apache.cayenne.modeler.event.RecentFileListListener;
 import org.apache.cayenne.modeler.pref.ComponentGeometry;
 import org.apache.cayenne.modeler.util.ModelerUtil;
 import org.apache.cayenne.modeler.util.RecentFileMenu;
@@ -32,8 +84,28 @@ import org.apache.cayenne.swing.components.MainToolBar;
 import org.apache.cayenne.swing.components.TopBorder;
 import org.slf4j.LoggerFactory;
 
-import javax.swing.*;
-import java.awt.*;
+import javax.swing.Action;
+import javax.swing.BorderFactory;
+import javax.swing.Box;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JPanel;
+import javax.swing.JSplitPane;
+import javax.swing.JTextField;
+import javax.swing.JToolBar;
+import java.awt.AWTEvent;
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Font;
+import java.awt.Toolkit;
 import java.awt.event.ComponentAdapter;
 import java.awt.event.ComponentEvent;
 import java.awt.event.KeyEvent;

http://git-wip-us.apache.org/repos/asf/cayenne/blob/d9db6e31/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CgenAction.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CgenAction.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CgenAction.java
index b197991..9dbd71d 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CgenAction.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CgenAction.java
@@ -22,30 +22,6 @@ public class CgenAction extends CayenneAction{
 
     @Override
     public void performAction(ActionEvent e) {
-
         new CgenGlobalController(getApplication().getFrameController()).startup();
-
-//        Collection<DataMap> dataMaps;
-//        DataChannelMetaData metaData = getApplication().getMetaData();
-//
-//        try {
-//            Project project = getProjectController().getProject();
-//            dataMaps = ((DataChannelDescriptor) project.getRootNode()).getDataMaps();
-//            for (DataMap dataMap : dataMaps) {
-//                ClassGenerationAction classGenerationAction = metaData.get(dataMap, ClassGenerationAction.class);
-//                if (classGenerationAction != null) {
-//                    classGenerationAction.prepareArtifacts();
-//                    classGenerationAction.execute();
-//                }
-//            }
-//            JOptionPane.showMessageDialog(
-//                    this.getApplication().getFrameController().getView(),
-//                    "Class generation finished");
-//        } catch (Exception ex) {
-//            logObj.error("Error generating classes", e);
-//            JOptionPane.showMessageDialog(
-//                    this.getApplication().getFrameController().getView(),
-//                    "Error generating classes - " + ex.getMessage());
-//        }
     }
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/d9db6e31/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/cgen/CgenDialog.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/cgen/CgenDialog.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/cgen/CgenDialog.java
index 9db205b..b81cc73 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/cgen/CgenDialog.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/cgen/CgenDialog.java
@@ -1,17 +1,47 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
 package org.apache.cayenne.modeler.dialog.codegen.cgen;
 
 import org.apache.cayenne.modeler.Application;
 import org.apache.cayenne.swing.components.TopBorder;
 
-import javax.swing.*;
-import java.awt.*;
+import javax.swing.Box;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.ScrollPaneConstants;
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
 
+/**
+ * @since 4.1
+ */
 public class CgenDialog extends JDialog {
 
     protected JPanel panel;
     protected JButton cancelButton;
 
-    public CgenDialog(Component generatorPanel) {
+    CgenDialog(Component generatorPanel) {
         super(Application.getFrame());
 
         this.panel = new JPanel();

http://git-wip-us.apache.org/repos/asf/cayenne/blob/d9db6e31/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/cgen/CgenGlobalController.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/cgen/CgenGlobalController.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/cgen/CgenGlobalController.java
index 4b88697..9242f21 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/cgen/CgenGlobalController.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/cgen/CgenGlobalController.java
@@ -1,15 +1,36 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
 package org.apache.cayenne.modeler.dialog.codegen.cgen;
 
 import org.apache.cayenne.modeler.util.CayenneController;
 import org.apache.cayenne.swing.BindingBuilder;
 
-import java.awt.*;
+import java.awt.Component;
 
+/**
+ * @since 4.1
+ */
 public class CgenGlobalController extends CayenneController{
 
     protected CgenDialog view;
 
-    protected CgenGlobalPanelController globalPanelController;
+    private CgenGlobalPanelController globalPanelController;
 
     public CgenGlobalController(CayenneController parent){
         super(parent);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/d9db6e31/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/cgen/CgenGlobalPanel.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/cgen/CgenGlobalPanel.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/cgen/CgenGlobalPanel.java
index 3c9b68a..c234d70 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/cgen/CgenGlobalPanel.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/cgen/CgenGlobalPanel.java
@@ -1,25 +1,50 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
 package org.apache.cayenne.modeler.dialog.codegen.cgen;
 
 import com.jgoodies.forms.builder.DefaultFormBuilder;
 import com.jgoodies.forms.layout.FormLayout;
 import org.apache.cayenne.modeler.ProjectController;
 
-import javax.swing.*;
-import java.awt.*;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import java.awt.BorderLayout;
 
+/**
+ * @since 4.1
+ */
 public class CgenGlobalPanel extends JPanel {
 
     private JButton generateButton;
 
     private JTextField outputFolder;
     private JButton selectOutputFolder;
-    private JComboBox generationMode;
-    private JComboBox subclassTemplate;
-    private JComboBox superclassTemplate;
-    private JComboBox embeddableTemplate;
-    private JComboBox embeddableSuperTemplate;
-    private JComboBox dataMapTemplate;
-    private JComboBox dataMapSuperTemplate;
+    private JComboBox<String> generationMode;
+    private JComboBox<String> subclassTemplate;
+    private JComboBox<String> superclassTemplate;
+    private JComboBox<String> embeddableTemplate;
+    private JComboBox<String> embeddableSuperTemplate;
+    private JComboBox<String> dataMapTemplate;
+    private JComboBox<String> dataMapSuperTemplate;
     private JCheckBox pairs;
     private JCheckBox overwrite;
     private JCheckBox usePackagePath;
@@ -44,21 +69,17 @@ public class CgenGlobalPanel extends JPanel {
     private JButton resetNames;
     private JButton resetPackage;
 
-    private ProjectController projectController;
-
     CgenGlobalPanel(ProjectController projectController) {
-        this.projectController = projectController;
-
         this.generateButton = new JButton("Generate All classes");
         this.outputFolder = new JTextField();
         this.selectOutputFolder = new JButton("Select");
-        this.generationMode = new JComboBox();
-        this.subclassTemplate = new JComboBox();
-        this.superclassTemplate = new JComboBox();
-        this.embeddableTemplate = new JComboBox();
-        this.embeddableSuperTemplate = new JComboBox();
-        this.dataMapTemplate = new JComboBox();
-        this.dataMapSuperTemplate = new JComboBox();
+        this.generationMode = new JComboBox<>();
+        this.subclassTemplate = new JComboBox<>();
+        this.superclassTemplate = new JComboBox<>();
+        this.embeddableTemplate = new JComboBox<>();
+        this.embeddableSuperTemplate = new JComboBox<>();
+        this.dataMapTemplate = new JComboBox<>();
+        this.dataMapSuperTemplate = new JComboBox<>();
         this.pairs = new JCheckBox();
         this.overwrite = new JCheckBox();
         this.usePackagePath = new JCheckBox();
@@ -156,31 +177,29 @@ public class CgenGlobalPanel extends JPanel {
         return selectOutputFolder;
     }
 
-    public JComboBox getGenerationMode() {
-        return generationMode;
-    }
+    public JComboBox<String> getGenerationMode() { return generationMode; }
 
-    public JComboBox getSubclassTemplate() {
+    public JComboBox<String> getSubclassTemplate() {
         return subclassTemplate;
     }
 
-    public JComboBox getSuperclassTemplate() {
+    public JComboBox<String> getSuperclassTemplate() {
         return superclassTemplate;
     }
 
-    public JComboBox getEmbeddableTemplate() {
+    public JComboBox<String> getEmbeddableTemplate() {
         return embeddableTemplate;
     }
 
-    public JComboBox getEmbeddableSuperTemplate() {
+    public JComboBox<String> getEmbeddableSuperTemplate() {
         return embeddableSuperTemplate;
     }
 
-    public JComboBox getDataMapTemplate() {
+    public JComboBox<String> getDataMapTemplate() {
         return dataMapTemplate;
     }
 
-    public JComboBox getDataMapSuperTemplate() {
+    public JComboBox<String> getDataMapSuperTemplate() {
         return dataMapSuperTemplate;
     }
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/d9db6e31/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/cgen/CgenGlobalPanelController.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/cgen/CgenGlobalPanelController.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/cgen/CgenGlobalPanelController.java
index b07bdd2..f694b73 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/cgen/CgenGlobalPanelController.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/cgen/CgenGlobalPanelController.java
@@ -1,3 +1,21 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
 package org.apache.cayenne.modeler.dialog.codegen.cgen;
 
 import org.apache.cayenne.configuration.DataChannelDescriptor;
@@ -21,10 +39,13 @@ import java.io.File;
 import java.util.*;
 import java.util.List;
 
+/**
+ * @since 4.1
+ */
 public class CgenGlobalPanelController extends CayenneController{
 
-    static final String ALL_MODE_LABEL = "Generate all";
-    static final Map<String, String> modesByLabel = new HashMap<>();
+    private static final String ALL_MODE_LABEL = "Generate all";
+    private static final Map<String, String> modesByLabel = new HashMap<>();
     // correspond to non-public constants on MapClassGenerator.
     private static final String MODE_DATAMAP = "datamap";
     private static final String MODE_ENTITY = "entity";
@@ -48,7 +69,7 @@ public class CgenGlobalPanelController extends CayenneController{
 
     private Collection<ClassGenerationAction> generators;
 
-    public CgenGlobalPanelController(CayenneController parent) {
+    CgenGlobalPanelController(CayenneController parent) {
         super(parent);
         this.projectController = Application.getInstance().getFrameController().getProjectController();
 
@@ -61,8 +82,8 @@ public class CgenGlobalPanelController extends CayenneController{
     }
 
     private void updateTemplates() {
-        Object[] modeChoices = new Object[]{ENTITY_MODE_LABEL, DATA_MAP_MODE_LABEL, ALL_MODE_LABEL};
-        view.getGenerationMode().setModel(new DefaultComboBoxModel(modeChoices));
+        String[] modeChoices = new String[]{ENTITY_MODE_LABEL, DATA_MAP_MODE_LABEL, ALL_MODE_LABEL};
+        view.getGenerationMode().setModel(new DefaultComboBoxModel<>(modeChoices));
 
         CodeTemplateManager templateManager = getApplication().getCodeTemplateManager();
 
@@ -93,14 +114,14 @@ public class CgenGlobalPanelController extends CayenneController{
         Collections.sort(dataMapSuperTemplates);
         dataMapSuperTemplates.addAll(customTemplates);
 
-        this.view.getSubclassTemplate().setModel(new DefaultComboBoxModel(subTemplates.toArray()));
-        this.view.getSuperclassTemplate().setModel(new DefaultComboBoxModel(superTemplates.toArray()));
+        this.view.getSubclassTemplate().setModel(new DefaultComboBoxModel<>(subTemplates.toArray(new String[0])));
+        this.view.getSuperclassTemplate().setModel(new DefaultComboBoxModel<>(superTemplates.toArray(new String[0])));
 
-        this.view.getEmbeddableTemplate().setModel(new DefaultComboBoxModel(embeddableTemplates.toArray()));
-        this.view.getEmbeddableSuperTemplate().setModel(new DefaultComboBoxModel(embeddableSuperTemplates.toArray()));
+        this.view.getEmbeddableTemplate().setModel(new DefaultComboBoxModel<>(embeddableTemplates.toArray(new String[0])));
+        this.view.getEmbeddableSuperTemplate().setModel(new DefaultComboBoxModel<>(embeddableSuperTemplates.toArray(new String[0])));
 
-        this.view.getDataMapTemplate().setModel(new DefaultComboBoxModel(dataMapTemplates.toArray()));
-        this.view.getDataMapSuperTemplate().setModel(new DefaultComboBoxModel(dataMapSuperTemplates.toArray()));
+        this.view.getDataMapTemplate().setModel(new DefaultComboBoxModel<>(dataMapTemplates.toArray(new String[0])));
+        this.view.getDataMapSuperTemplate().setModel(new DefaultComboBoxModel<>(dataMapSuperTemplates.toArray(new String[0])));
 
         this.view.getOutputPattern().setText("*.java");
         this.view.getPairs().setSelected(true);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/d9db6e31/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/DataMapTabbedView.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/DataMapTabbedView.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/DataMapTabbedView.java
index bd9afc5..770c713 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/DataMapTabbedView.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/DataMapTabbedView.java
@@ -23,7 +23,8 @@ import org.apache.cayenne.modeler.ProjectController;
 import org.apache.cayenne.modeler.editor.cgen.CodeGeneratorController;
 import org.apache.cayenne.modeler.editor.dbimport.DbImportView;
 
-import javax.swing.*;
+import javax.swing.JScrollPane;
+import javax.swing.JTabbedPane;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/cayenne/blob/d9db6e31/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/ClassesTabController.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/ClassesTabController.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/ClassesTabController.java
index 704e851..a83ef3d 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/ClassesTabController.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/ClassesTabController.java
@@ -25,8 +25,8 @@ import org.apache.cayenne.swing.ImageRendererColumn;
 import org.apache.cayenne.swing.ObjectBinding;
 import org.apache.cayenne.swing.TableBindingBuilder;
 
-import javax.swing.*;
-import java.awt.*;
+import javax.swing.JLabel;
+import java.awt.Component;
 
 public class ClassesTabController extends CayenneController {
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/d9db6e31/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/ClassesTabPanel.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/ClassesTabPanel.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/ClassesTabPanel.java
index f6cad0b..7b5776c 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/ClassesTabPanel.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/ClassesTabPanel.java
@@ -19,18 +19,27 @@
 
 package org.apache.cayenne.modeler.editor.cgen;
 
-import javax.swing.*;
-import java.awt.*;
+import javax.swing.JCheckBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.ScrollPaneConstants;
+import javax.swing.UIManager;
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
 
 /**
+ * @since 4.1
  */
 public class ClassesTabPanel extends JPanel {
 
     protected JTable table;
-    protected JCheckBox checkAll;
-    protected JLabel checkAllLabel;
+    private JCheckBox checkAll;
+    private JLabel checkAllLabel;
 
-    public ClassesTabPanel() {
+    ClassesTabPanel() {
 
         this.table = new JTable();
         this.table.setRowHeight(22);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/d9db6e31/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/CodeGeneratorController.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/CodeGeneratorController.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/CodeGeneratorController.java
index 2ee1034..35aa8d6 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/CodeGeneratorController.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/CodeGeneratorController.java
@@ -27,8 +27,8 @@ import org.apache.cayenne.swing.BindingBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.swing.*;
-import java.awt.*;
+import javax.swing.JOptionPane;
+import java.awt.Component;
 import java.util.function.Predicate;
 
 /**

http://git-wip-us.apache.org/repos/asf/cayenne/blob/d9db6e31/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/CodeGeneratorPane.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/CodeGeneratorPane.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/CodeGeneratorPane.java
index 334931a..cac063c 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/CodeGeneratorPane.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/CodeGeneratorPane.java
@@ -21,8 +21,17 @@ package org.apache.cayenne.modeler.editor.cgen;
 
 import org.apache.cayenne.swing.components.TopBorder;
 
-import javax.swing.*;
-import java.awt.*;
+import javax.swing.Box;
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JSplitPane;
+import javax.swing.ScrollPaneConstants;
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
 
 /**
  */

http://git-wip-us.apache.org/repos/asf/cayenne/blob/d9db6e31/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/CustomModeController.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/CustomModeController.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/CustomModeController.java
index 5666355..029f92e 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/CustomModeController.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/CustomModeController.java
@@ -76,8 +76,8 @@ public class CustomModeController extends GeneratorController {
     }
 
     protected void updateTemplates() {
-        Object[] modeChoices = new Object[]{ENTITY_MODE_LABEL, DATA_MAP_MODE_LABEL, ALL_MODE_LABEL};
-        view.getGenerationMode().getComboBox().setModel(new DefaultComboBoxModel(modeChoices));
+        String[] modeChoices = new String[]{ENTITY_MODE_LABEL, DATA_MAP_MODE_LABEL, ALL_MODE_LABEL};
+        view.getGenerationMode().getComboBox().setModel(new DefaultComboBoxModel<>(modeChoices));
 
         CodeTemplateManager templateManager = getApplication().getCodeTemplateManager();
 
@@ -108,14 +108,14 @@ public class CustomModeController extends GeneratorController {
         Collections.sort(dataMapSuperTemplates);
         dataMapSuperTemplates.addAll(customTemplates);
 
-        this.view.getSubclassTemplate().getComboBox().setModel(new DefaultComboBoxModel(subTemplates.toArray()));
-        this.view.getSuperclassTemplate().getComboBox().setModel(new DefaultComboBoxModel(superTemplates.toArray()));
+        this.view.getSubclassTemplate().getComboBox().setModel(new DefaultComboBoxModel<>(subTemplates.toArray(new String[0])));
+        this.view.getSuperclassTemplate().getComboBox().setModel(new DefaultComboBoxModel<>(superTemplates.toArray(new String[0])));
 
-        this.view.getEmbeddableTemplate().getComboBox().setModel(new DefaultComboBoxModel(embeddableTemplates.toArray()));
-        this.view.getEmbeddableSuperTemplate().getComboBox().setModel(new DefaultComboBoxModel(embeddableSuperTemplates.toArray()));
+        this.view.getEmbeddableTemplate().getComboBox().setModel(new DefaultComboBoxModel<>(embeddableTemplates.toArray(new String[0])));
+        this.view.getEmbeddableSuperTemplate().getComboBox().setModel(new DefaultComboBoxModel<>(embeddableSuperTemplates.toArray(new String[0])));
 
-        this.view.getDataMapTemplate().getComboBox().setModel(new DefaultComboBoxModel(dataMapTemplates.toArray()));
-        this.view.getDataMapSuperTemplate().getComboBox().setModel(new DefaultComboBoxModel(dataMapSuperTemplates.toArray()));
+        this.view.getDataMapTemplate().getComboBox().setModel(new DefaultComboBoxModel<>(dataMapTemplates.toArray(new String[0])));
+        this.view.getDataMapSuperTemplate().getComboBox().setModel(new DefaultComboBoxModel<>(dataMapSuperTemplates.toArray(new String[0])));
     }
 
     public Component getView() {

http://git-wip-us.apache.org/repos/asf/cayenne/blob/d9db6e31/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/CustomModePanel.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/CustomModePanel.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/CustomModePanel.java
index ca4b50f..9213a86 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/CustomModePanel.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/CustomModePanel.java
@@ -29,18 +29,23 @@ import org.apache.cayenne.swing.components.JCayenneCheckBox;
 import org.apache.cayenne.swing.control.ActionLink;
 import org.apache.cayenne.validation.ValidationException;
 
-import javax.swing.*;
-import java.awt.*;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
 
 public class CustomModePanel extends GeneratorControllerPanel {
 
-    private ComboBoxAdapter generationMode;
-    private ComboBoxAdapter subclassTemplate;
-    private ComboBoxAdapter superclassTemplate;
-    private ComboBoxAdapter embeddableTemplate;
-    private ComboBoxAdapter embeddableSuperTemplate;
-    private ComboBoxAdapter dataMapTemplate;
-    private ComboBoxAdapter dataMapSuperTemplate;
+    private ComboBoxAdapter<String> generationMode;
+    private ComboBoxAdapter<String> subclassTemplate;
+    private ComboBoxAdapter<String> superclassTemplate;
+    private ComboBoxAdapter<String> embeddableTemplate;
+    private ComboBoxAdapter<String> embeddableSuperTemplate;
+    private ComboBoxAdapter<String> dataMapTemplate;
+    private ComboBoxAdapter<String> dataMapSuperTemplate;
     private JCheckBox pairs;
     private JCheckBox overwrite;
     private JCheckBox usePackagePath;
@@ -57,46 +62,46 @@ public class CustomModePanel extends GeneratorControllerPanel {
     CustomModePanel(ProjectController projectController) {
         super(projectController);
 
-        JComboBox modeField = new JComboBox();
-        this.generationMode = new ComboBoxAdapter(modeField) {
+        JComboBox<String> modeField = new JComboBox<>();
+        this.generationMode = new ComboBoxAdapter<String>(modeField) {
             @Override
-            protected void updateModel(Object item) throws ValidationException {
+            protected void updateModel(String item) throws ValidationException {
                 getCgenByDataMap().setArtifactsGenerationMode(CustomModeController.modesByLabel.get(item));
                 projectController.setDirty(true);
             }
         };
 
-        JComboBox superclassField = new JComboBox();
-        this.superclassTemplate = new ComboBoxAdapter(superclassField) {
+        JComboBox<String> superclassField = new JComboBox<>();
+        this.superclassTemplate = new ComboBoxAdapter<String>(superclassField) {
             @Override
-            protected void updateModel(Object item) throws ValidationException {
+            protected void updateModel(String item) throws ValidationException {
                 getCgenByDataMap().setSuperTemplate(Application.getInstance().getCodeTemplateManager().getTemplatePath(String.valueOf(item)));
                 projectController.setDirty(true);
             }
         };
 
-        JComboBox subclassField = new JComboBox();
-        this.subclassTemplate = new ComboBoxAdapter(subclassField) {
+        JComboBox<String> subclassField = new JComboBox<>();
+        this.subclassTemplate = new ComboBoxAdapter<String>(subclassField) {
             @Override
-            protected void updateModel(Object item) throws ValidationException {
+            protected void updateModel(String item) throws ValidationException {
                 getCgenByDataMap().setTemplate(Application.getInstance().getCodeTemplateManager().getTemplatePath(String.valueOf(item)));
                 projectController.setDirty(true);
             }
         };
 
-        JComboBox dataMapField = new JComboBox();
-        this.dataMapTemplate = new ComboBoxAdapter(dataMapField) {
+        JComboBox<String> dataMapField = new JComboBox<>();
+        this.dataMapTemplate = new ComboBoxAdapter<String>(dataMapField) {
             @Override
-            protected void updateModel(Object item) throws ValidationException {
+            protected void updateModel(String item) throws ValidationException {
                 getCgenByDataMap().setQueryTemplate(Application.getInstance().getCodeTemplateManager().getTemplatePath(String.valueOf(item)));
                 projectController.setDirty(true);
             }
         };
 
-        JComboBox dataMapSuperField = new JComboBox();
-        this.dataMapSuperTemplate = new ComboBoxAdapter(dataMapSuperField) {
+        JComboBox<String> dataMapSuperField = new JComboBox<>();
+        this.dataMapSuperTemplate = new ComboBoxAdapter<String>(dataMapSuperField) {
             @Override
-            protected void updateModel(Object item) throws ValidationException {
+            protected void updateModel(String item) throws ValidationException {
                 getCgenByDataMap().setQuerySuperTemplate(Application.getInstance().getCodeTemplateManager().getTemplatePath(String.valueOf(item)));
                 projectController.setDirty(true);
             }
@@ -134,19 +139,19 @@ public class CustomModePanel extends GeneratorControllerPanel {
             }
         };
 
-        JComboBox embeddableField = new JComboBox();
-        this.embeddableTemplate = new ComboBoxAdapter(embeddableField) {
+        JComboBox<String> embeddableField = new JComboBox<>();
+        this.embeddableTemplate = new ComboBoxAdapter<String>(embeddableField) {
             @Override
-            protected void updateModel(Object item) throws ValidationException {
+            protected void updateModel(String item) throws ValidationException {
                 getCgenByDataMap().setEmbeddableTemplate(Application.getInstance().getCodeTemplateManager().getTemplatePath(String.valueOf(item)));
                 projectController.setDirty(true);
             }
         };
 
-        JComboBox embeddableSuperclassField = new JComboBox();
-        this.embeddableSuperTemplate = new ComboBoxAdapter(embeddableSuperclassField) {
+        JComboBox<String> embeddableSuperclassField = new JComboBox<>();
+        this.embeddableSuperTemplate = new ComboBoxAdapter<String>(embeddableSuperclassField) {
             @Override
-            protected void updateModel(Object item) throws ValidationException {
+            protected void updateModel(String item) throws ValidationException {
                 getCgenByDataMap().setEmbeddableSuperTemplate(Application.getInstance().getCodeTemplateManager().getTemplatePath(String.valueOf(item)));
                 projectController.setDirty(true);
             }
@@ -229,7 +234,7 @@ public class CustomModePanel extends GeneratorControllerPanel {
         dataMapSuperTemplate.getComboBox().setEnabled(val);
     }
 
-    public ComboBoxAdapter getGenerationMode() {
+    public ComboBoxAdapter<String> getGenerationMode() {
         return generationMode;
     }
 
@@ -237,19 +242,19 @@ public class CustomModePanel extends GeneratorControllerPanel {
         return manageTemplatesLink;
     }
 
-    public ComboBoxAdapter getSubclassTemplate() { return subclassTemplate; }
+    public ComboBoxAdapter<String> getSubclassTemplate() { return subclassTemplate; }
 
-    public ComboBoxAdapter getEmbeddableTemplate() { return embeddableTemplate; }
+    public ComboBoxAdapter<String> getEmbeddableTemplate() { return embeddableTemplate; }
 
-    public ComboBoxAdapter getEmbeddableSuperTemplate() { return embeddableSuperTemplate; }
+    public ComboBoxAdapter<String> getEmbeddableSuperTemplate() { return embeddableSuperTemplate; }
 
-    public ComboBoxAdapter getSuperclassTemplate() {
+    public ComboBoxAdapter<String> getSuperclassTemplate() {
         return superclassTemplate;
     }
 
-    public ComboBoxAdapter getDataMapTemplate() { return dataMapTemplate; }
+    public ComboBoxAdapter<String> getDataMapTemplate() { return dataMapTemplate; }
 
-    public ComboBoxAdapter getDataMapSuperTemplate() { return dataMapSuperTemplate; }
+    public ComboBoxAdapter<String> getDataMapSuperTemplate() { return dataMapSuperTemplate; }
 
     public JCheckBox getOverwrite() {
         return overwrite;

http://git-wip-us.apache.org/repos/asf/cayenne/blob/d9db6e31/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/GeneratorController.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/GeneratorController.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/GeneratorController.java
index 7e8087f..7a8b5cb 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/GeneratorController.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/GeneratorController.java
@@ -22,7 +22,13 @@ package org.apache.cayenne.modeler.editor.cgen;
 import org.apache.cayenne.CayenneRuntimeException;
 import org.apache.cayenne.gen.ArtifactsGenerationMode;
 import org.apache.cayenne.gen.ClassGenerationAction;
-import org.apache.cayenne.map.*;
+import org.apache.cayenne.map.DataMap;
+import org.apache.cayenne.map.Embeddable;
+import org.apache.cayenne.map.EmbeddableAttribute;
+import org.apache.cayenne.map.EmbeddedAttribute;
+import org.apache.cayenne.map.ObjAttribute;
+import org.apache.cayenne.map.ObjEntity;
+import org.apache.cayenne.map.ObjRelationship;
 import org.apache.cayenne.modeler.Application;
 import org.apache.cayenne.modeler.dialog.pref.GeneralPreferences;
 import org.apache.cayenne.modeler.pref.DataMapDefaults;
@@ -37,9 +43,12 @@ import org.apache.cayenne.validation.SimpleValidationFailure;
 import org.apache.cayenne.validation.ValidationFailure;
 import org.apache.cayenne.validation.ValidationResult;
 
-import javax.swing.*;
+import javax.swing.JButton;
+import javax.swing.JFileChooser;
+import javax.swing.JOptionPane;
 import java.io.File;
-import java.util.*;
+import java.util.Map;
+import java.util.Set;
 import java.util.function.Predicate;
 import java.util.prefs.Preferences;
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/d9db6e31/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/GeneratorControllerPanel.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/GeneratorControllerPanel.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/GeneratorControllerPanel.java
index 7536a01..281046d 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/GeneratorControllerPanel.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/GeneratorControllerPanel.java
@@ -24,7 +24,9 @@ import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.modeler.ProjectController;
 import org.apache.cayenne.modeler.util.TextAdapter;
 
-import javax.swing.*;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
 import java.io.File;
 
 /**

http://git-wip-us.apache.org/repos/asf/cayenne/blob/d9db6e31/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/GeneratorTabController.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/GeneratorTabController.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/GeneratorTabController.java
index 53000da..2824685 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/GeneratorTabController.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/GeneratorTabController.java
@@ -23,7 +23,7 @@ import org.apache.cayenne.gen.ClassGenerationAction;
 import org.apache.cayenne.modeler.util.CayenneController;
 import org.apache.cayenne.pref.PreferenceDetail;
 
-import java.awt.*;
+import java.awt.Component;
 
 /**
  */

http://git-wip-us.apache.org/repos/asf/cayenne/blob/d9db6e31/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/GeneratorTabPanel.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/GeneratorTabPanel.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/GeneratorTabPanel.java
index 4082f36..ab25218 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/GeneratorTabPanel.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/cgen/GeneratorTabPanel.java
@@ -19,8 +19,9 @@
 
 package org.apache.cayenne.modeler.editor.cgen;
 
-import javax.swing.*;
-import java.awt.*;
+import javax.swing.JPanel;
+import java.awt.BorderLayout;
+import java.awt.Component;
 
 /**
  * @since 4.1

http://git-wip-us.apache.org/repos/asf/cayenne/blob/d9db6e31/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/ComboBoxAdapter.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/ComboBoxAdapter.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/ComboBoxAdapter.java
index 2a7fd79..8d4eaeb 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/ComboBoxAdapter.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/ComboBoxAdapter.java
@@ -21,20 +21,20 @@ package org.apache.cayenne.modeler.util;
 import org.apache.cayenne.modeler.undo.JComboBoxUndoListener;
 import org.apache.cayenne.validation.ValidationException;
 
-import javax.swing.*;
+import javax.swing.JComboBox;
 import java.awt.event.ActionListener;
 
 /**
  * @since 4.1
  */
-public abstract class ComboBoxAdapter {
+public abstract class ComboBoxAdapter<T> {
 
-    private JComboBox comboBox;
+    private JComboBox<T> comboBox;
     private ActionListener listener;
 
     private JComboBoxUndoListener undoListener;
 
-    protected ComboBoxAdapter(JComboBox comboBox) {
+    protected ComboBoxAdapter(JComboBox<T> comboBox) {
         this.comboBox = comboBox;
         listener = e -> updateModel();
 
@@ -57,16 +57,16 @@ public abstract class ComboBoxAdapter {
         }
     }
 
-    public JComboBox getComboBox() {
+    public JComboBox<T> getComboBox() {
         return comboBox;
     }
 
     /**
      * Updates bound model with document text.
      */
-    protected abstract void updateModel(Object item) throws ValidationException;
+    protected abstract void updateModel(T item) throws ValidationException;
 
     public void updateModel() {
-        updateModel(comboBox.getSelectedItem());
+        updateModel((T)comboBox.getSelectedItem());
     }
 }


Mime
View raw message