http://git-wip-us.apache.org/repos/asf/cayenne/blob/52ea45b5/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/CustomPreferencesUpdater.java ---------------------------------------------------------------------- diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/CustomPreferencesUpdater.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/CustomPreferencesUpdater.java index 1d8d4f9..a9816e0 100644 --- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/CustomPreferencesUpdater.java +++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/CustomPreferencesUpdater.java @@ -1,209 +1,209 @@ -/***************************************************************** - * 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; - -import org.apache.cayenne.map.DataMap; -import org.apache.cayenne.modeler.pref.DataMapDefaults; - -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -public class CustomPreferencesUpdater { - - enum Property { - SUBCLASS_TEMPLATE, - SUPERCLASS_TEMPLATE, - OVERWRITE, - PAIRS, - USE_PACKAGE_PATH, - MODE, - OUTPUT_PATTERN, - CREATE_PROPERTY_NAMES, - CREATE_PK_PROPERTIES - } - - private static final String OVERWRITE = "overwrite"; - private static final String PAIRS = "pairs"; - private static final String USE_PACKAGE_PATH = "usePackagePath"; - private static final String MODE = "mode"; - private static final String OUTPUT_PATTERN = "outputPattern"; - private static final String CREATE_PROPERTY_NAMES = "createPropertyNames"; - private static final String CREATE_PK_PROPERTIES = "createPKProperties"; - - private Map<DataMap, DataMapDefaults> mapPreferences; - - - public CustomPreferencesUpdater(Map<DataMap, DataMapDefaults> mapPreferences) { - this.mapPreferences = mapPreferences; - } - - public String getMode() { - return (String) getProperty(Property.MODE); - } - - public void setMode(String mode) { - updatePreferences(Property.MODE, mode); - } - - public String getSubclassTemplate() { - return (String) getProperty(Property.SUBCLASS_TEMPLATE); - } - - public void setSubclassTemplate(String subclassTemplate) { - updatePreferences(Property.SUBCLASS_TEMPLATE, subclassTemplate); - } - - public String getSuperclassTemplate() { - return (String) getProperty(Property.SUPERCLASS_TEMPLATE); - } - - public void setSuperclassTemplate(String superclassTemplate) { - updatePreferences(Property.SUPERCLASS_TEMPLATE, superclassTemplate); - } - - public Boolean getOverwrite() { - return (Boolean) getProperty(Property.OVERWRITE); - } - - public void setOverwrite(Boolean overwrite) { - updatePreferences(Property.OVERWRITE, overwrite); - } - - public Boolean getPairs() { - return (Boolean) getProperty(Property.PAIRS); - } - - public void setPairs(Boolean pairs) { - updatePreferences(Property.PAIRS, pairs); - } - - public Boolean getUsePackagePath() { - return (Boolean) getProperty(Property.USE_PACKAGE_PATH); - } - - public void setUsePackagePath(Boolean usePackagePath) { - updatePreferences(Property.USE_PACKAGE_PATH, usePackagePath); - } - - public String getOutputPattern() { - return (String) getProperty(Property.OUTPUT_PATTERN); - } - - public void setOutputPattern(String outputPattern) { - updatePreferences(Property.OUTPUT_PATTERN, outputPattern); - } - - public Boolean getCreatePropertyNames() { - return (Boolean) getProperty(Property.CREATE_PROPERTY_NAMES); - } - - public void setCreatePropertyNames(Boolean createPropertyNames) { - updatePreferences(Property.CREATE_PROPERTY_NAMES, createPropertyNames); - } - - public Boolean getCreatePKProperties() { - return (Boolean) getProperty(Property.CREATE_PK_PROPERTIES); - } - - public void setCreatePKProperties(Boolean createPKProperties) { - updatePreferences(Property.CREATE_PK_PROPERTIES, createPKProperties); - } - - private Object getProperty(Property property) { - Object obj = null; - - Set<Entry<DataMap, DataMapDefaults>> entities = mapPreferences.entrySet(); - for (Entry<DataMap, DataMapDefaults> entry : entities) { - - switch (property) { - case MODE: - obj = entry.getValue().getProperty(MODE); - break; - case OUTPUT_PATTERN: - obj = entry.getValue().getProperty(OUTPUT_PATTERN); - break; - case SUBCLASS_TEMPLATE: - obj = entry.getValue().getSubclassTemplate(); - break; - case SUPERCLASS_TEMPLATE: - obj = entry.getValue().getSuperclassTemplate(); - break; - case OVERWRITE: - obj = entry.getValue().getBooleanProperty(OVERWRITE); - break; - case PAIRS: - obj = entry.getValue().getBooleanProperty(PAIRS); - break; - case USE_PACKAGE_PATH: - obj = entry.getValue().getBooleanProperty(USE_PACKAGE_PATH); - break; - case CREATE_PROPERTY_NAMES: - obj = entry.getValue().getBooleanProperty(CREATE_PROPERTY_NAMES); - break; - case CREATE_PK_PROPERTIES: - obj = entry.getValue().getBooleanProperty(CREATE_PK_PROPERTIES); - break; - default: - throw new IllegalArgumentException("Bad type property: " + property); - } - - } - return obj; - } - - private void updatePreferences(Property property, Object value) { - Set<Entry<DataMap, DataMapDefaults>> entities = mapPreferences.entrySet(); - for (Entry<DataMap, DataMapDefaults> entry : entities) { - - switch (property) { - case MODE: - entry.getValue().setProperty(MODE, (String) value); - break; - case OUTPUT_PATTERN: - entry.getValue().setProperty(OUTPUT_PATTERN, (String) value); - break; - case SUBCLASS_TEMPLATE: - entry.getValue().setSubclassTemplate((String) value); - break; - case SUPERCLASS_TEMPLATE: - entry.getValue().setSuperclassTemplate((String) value); - break; - case OVERWRITE: - entry.getValue().setBooleanProperty(OVERWRITE, (Boolean) value); - break; - case PAIRS: - entry.getValue().setBooleanProperty(PAIRS, (Boolean) value); - break; - case USE_PACKAGE_PATH: - entry.getValue().setBooleanProperty(USE_PACKAGE_PATH, (Boolean) value); - break; - case CREATE_PROPERTY_NAMES: - entry.getValue().setBooleanProperty(CREATE_PROPERTY_NAMES, (Boolean) value); - break; - case CREATE_PK_PROPERTIES: - entry.getValue().setBooleanProperty(CREATE_PK_PROPERTIES, (Boolean) value); - break; - default: - throw new IllegalArgumentException("Bad type property: " + property); - } - } - } -} \ No newline at end of file +///***************************************************************** +// * 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; +// +//import org.apache.cayenne.map.DataMap; +//import org.apache.cayenne.modeler.pref.DataMapDefaults; +// +//import java.util.Map; +//import java.util.Map.Entry; +//import java.util.Set; +// +//public class CustomPreferencesUpdater { +// +// enum Property { +// SUBCLASS_TEMPLATE, +// SUPERCLASS_TEMPLATE, +// OVERWRITE, +// PAIRS, +// USE_PACKAGE_PATH, +// MODE, +// OUTPUT_PATTERN, +// CREATE_PROPERTY_NAMES, +// CREATE_PK_PROPERTIES +// } +// +// private static final String OVERWRITE = "overwrite"; +// private static final String PAIRS = "pairs"; +// private static final String USE_PACKAGE_PATH = "usePackagePath"; +// private static final String MODE = "mode"; +// private static final String OUTPUT_PATTERN = "outputPattern"; +// private static final String CREATE_PROPERTY_NAMES = "createPropertyNames"; +// private static final String CREATE_PK_PROPERTIES = "createPKProperties"; +// +// private Map<DataMap, DataMapDefaults> mapPreferences; +// +// +// public CustomPreferencesUpdater(Map<DataMap, DataMapDefaults> mapPreferences) { +// this.mapPreferences = mapPreferences; +// } +// +// public String getMode() { +// return (String) getProperty(Property.MODE); +// } +// +// public void setMode(String mode) { +// updatePreferences(Property.MODE, mode); +// } +// +// public String getSubclassTemplate() { +// return (String) getProperty(Property.SUBCLASS_TEMPLATE); +// } +// +// public void setSubclassTemplate(String subclassTemplate) { +// updatePreferences(Property.SUBCLASS_TEMPLATE, subclassTemplate); +// } +// +// public String getSuperclassTemplate() { +// return (String) getProperty(Property.SUPERCLASS_TEMPLATE); +// } +// +// public void setSuperclassTemplate(String superclassTemplate) { +// updatePreferences(Property.SUPERCLASS_TEMPLATE, superclassTemplate); +// } +// +// public Boolean getOverwrite() { +// return (Boolean) getProperty(Property.OVERWRITE); +// } +// +// public void setOverwrite(Boolean overwrite) { +// updatePreferences(Property.OVERWRITE, overwrite); +// } +// +// public Boolean getPairs() { +// return (Boolean) getProperty(Property.PAIRS); +// } +// +// public void setPairs(Boolean pairs) { +// updatePreferences(Property.PAIRS, pairs); +// } +// +// public Boolean getUsePackagePath() { +// return (Boolean) getProperty(Property.USE_PACKAGE_PATH); +// } +// +// public void setUsePackagePath(Boolean usePackagePath) { +// updatePreferences(Property.USE_PACKAGE_PATH, usePackagePath); +// } +// +// public String getOutputPattern() { +// return (String) getProperty(Property.OUTPUT_PATTERN); +// } +// +// public void setOutputPattern(String outputPattern) { +// updatePreferences(Property.OUTPUT_PATTERN, outputPattern); +// } +// +// public Boolean getCreatePropertyNames() { +// return (Boolean) getProperty(Property.CREATE_PROPERTY_NAMES); +// } +// +// public void setCreatePropertyNames(Boolean createPropertyNames) { +// updatePreferences(Property.CREATE_PROPERTY_NAMES, createPropertyNames); +// } +// +// public Boolean getCreatePKProperties() { +// return (Boolean) getProperty(Property.CREATE_PK_PROPERTIES); +// } +// +// public void setCreatePKProperties(Boolean createPKProperties) { +// updatePreferences(Property.CREATE_PK_PROPERTIES, createPKProperties); +// } +// +// private Object getProperty(Property property) { +// Object obj = null; +// +// Set<Entry<DataMap, DataMapDefaults>> entities = mapPreferences.entrySet(); +// for (Entry<DataMap, DataMapDefaults> entry : entities) { +// +// switch (property) { +// case MODE: +// obj = entry.getValue().getProperty(MODE); +// break; +// case OUTPUT_PATTERN: +// obj = entry.getValue().getProperty(OUTPUT_PATTERN); +// break; +// case SUBCLASS_TEMPLATE: +// obj = entry.getValue().getSubclassTemplate(); +// break; +// case SUPERCLASS_TEMPLATE: +// obj = entry.getValue().getSuperclassTemplate(); +// break; +// case OVERWRITE: +// obj = entry.getValue().getBooleanProperty(OVERWRITE); +// break; +// case PAIRS: +// obj = entry.getValue().getBooleanProperty(PAIRS); +// break; +// case USE_PACKAGE_PATH: +// obj = entry.getValue().getBooleanProperty(USE_PACKAGE_PATH); +// break; +// case CREATE_PROPERTY_NAMES: +// obj = entry.getValue().getBooleanProperty(CREATE_PROPERTY_NAMES); +// break; +// case CREATE_PK_PROPERTIES: +// obj = entry.getValue().getBooleanProperty(CREATE_PK_PROPERTIES); +// break; +// default: +// throw new IllegalArgumentException("Bad type property: " + property); +// } +// +// } +// return obj; +// } +// +// private void updatePreferences(Property property, Object value) { +// Set<Entry<DataMap, DataMapDefaults>> entities = mapPreferences.entrySet(); +// for (Entry<DataMap, DataMapDefaults> entry : entities) { +// +// switch (property) { +// case MODE: +// entry.getValue().setProperty(MODE, (String) value); +// break; +// case OUTPUT_PATTERN: +// entry.getValue().setProperty(OUTPUT_PATTERN, (String) value); +// break; +// case SUBCLASS_TEMPLATE: +// entry.getValue().setSubclassTemplate((String) value); +// break; +// case SUPERCLASS_TEMPLATE: +// entry.getValue().setSuperclassTemplate((String) value); +// break; +// case OVERWRITE: +// entry.getValue().setBooleanProperty(OVERWRITE, (Boolean) value); +// break; +// case PAIRS: +// entry.getValue().setBooleanProperty(PAIRS, (Boolean) value); +// break; +// case USE_PACKAGE_PATH: +// entry.getValue().setBooleanProperty(USE_PACKAGE_PATH, (Boolean) value); +// break; +// case CREATE_PROPERTY_NAMES: +// entry.getValue().setBooleanProperty(CREATE_PROPERTY_NAMES, (Boolean) value); +// break; +// case CREATE_PK_PROPERTIES: +// entry.getValue().setBooleanProperty(CREATE_PK_PROPERTIES, (Boolean) value); +// break; +// default: +// throw new IllegalArgumentException("Bad type property: " + property); +// } +// } +// } +//} \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cayenne/blob/52ea45b5/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorController.java ---------------------------------------------------------------------- diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorController.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorController.java index db8c872..4a5b5f6 100644 --- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorController.java +++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorController.java @@ -1,562 +1,561 @@ -/***************************************************************** - * 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; - -import org.apache.cayenne.CayenneRuntimeException; -import org.apache.cayenne.gen.ArtifactsGenerationMode; -import org.apache.cayenne.gen.ClassGenerationAction; -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; -import org.apache.cayenne.modeler.pref.FSPath; -import org.apache.cayenne.modeler.util.CayenneController; -import org.apache.cayenne.modeler.util.CodeValidationUtil; -import org.apache.cayenne.swing.BindingBuilder; -import org.apache.cayenne.util.Util; -import org.apache.cayenne.validation.BeanValidationFailure; -import org.apache.cayenne.validation.SimpleValidationFailure; -import org.apache.cayenne.validation.ValidationFailure; -import org.apache.cayenne.validation.ValidationResult; - -import javax.swing.JButton; -import javax.swing.JFileChooser; -import javax.swing.JOptionPane; -import javax.swing.JTextField; -import java.io.File; -import java.util.ArrayList; -import java.util.Collection; -import java.util.LinkedList; -import java.util.Map; -import java.util.Set; -import java.util.function.Predicate; -import java.util.prefs.Preferences; - -/** - * A mode-specific part of the code generation dialog. - * - */ -public abstract class GeneratorController extends CayenneController { - - protected String mode = ArtifactsGenerationMode.ALL.getLabel(); - protected Map<DataMap, DataMapDefaults> mapPreferences; - private String outputPath; - - public GeneratorController(CodeGeneratorControllerBase parent) { - super(parent); - - createDefaults(); - createView(); - initBindings(new BindingBuilder(getApplication().getBindingFactory(), this)); - } - - public String getOutputPath() { - return outputPath; - } - - public void setOutputPath(String path) { - String old = this.outputPath; - this.outputPath = path; - if (this.outputPath != null && !this.outputPath.equals(old)) { - updatePreferences(path); - } - } - - public void updatePreferences(String path) { - if (mapPreferences == null) - return; - Set<DataMap> keys = mapPreferences.keySet(); - for (DataMap key : keys) { - mapPreferences - .get(key) - .setOutputPath(path); - } - } - - public void setMapPreferences(Map<DataMap, DataMapDefaults> mapPreferences) { - this.mapPreferences = mapPreferences; - } - - public Map<DataMap, DataMapDefaults> getMapPreferences() { - return this.mapPreferences; - } - - protected void initBindings(BindingBuilder bindingBuilder) { - - initOutputFolder(); - - JTextField outputFolder = ((GeneratorControllerPanel) getView()).getOutputFolder(); - JButton outputSelect = ((GeneratorControllerPanel) getView()).getSelectOutputFolder(); - - outputFolder.setText(getOutputPath()); - bindingBuilder.bindToAction(outputSelect, "selectOutputFolderAction()"); - bindingBuilder.bindToTextField(outputFolder, "outputPath"); - } - - protected CodeGeneratorControllerBase getParentController() { - return (CodeGeneratorControllerBase) getParent(); - } - - protected abstract GeneratorControllerPanel createView(); - - protected abstract void createDefaults(); - - /** - * Creates an appropriate subclass of {@link ClassGenerationAction}, - * returning it in an unconfigured state. Configuration is performed by - * {@link #createGenerator()} method. - */ - protected abstract ClassGenerationAction newGenerator(); - - /** - * Creates a class generator for provided selections. - */ - public Collection<ClassGenerationAction> createGenerator() { - - File outputDir = getOutputDir(); - - // no destination folder - if (outputDir == null) { - JOptionPane.showMessageDialog(this.getView(), "Select directory for source files."); - return null; - } - - // no such folder - if (!outputDir.exists() && !outputDir.mkdirs()) { - JOptionPane.showMessageDialog(this.getView(), "Can't create directory " + outputDir - + ". Select a different one."); - return null; - } - - // not a directory - if (!outputDir.isDirectory()) { - JOptionPane.showMessageDialog(this.getView(), outputDir + " is not a valid directory."); - return null; - } - - // remove generic entities... - Collection<ObjEntity> selectedEntities = new ArrayList<>(getParentController().getSelectedEntities()); - selectedEntities.removeIf(ObjEntity::isGeneric); - - Collection<ClassGenerationAction> generators = new ArrayList<>(); - for (DataMap map : getParentController().getDataMaps()) { - try { - ClassGenerationAction generator = newGenerator(); - - if(getParentController().getSelectedDataMaps().contains(map)) { - mode = ArtifactsGenerationMode.ALL.getLabel(); - } else { - mode = ArtifactsGenerationMode.ENTITY.getLabel(); - } - - generator.setArtifactsGenerationMode(mode); - generator.setDataMap(map); - - LinkedList<ObjEntity> objEntities = new LinkedList<>(map.getObjEntities()); - objEntities.retainAll(selectedEntities); - generator.addEntities(objEntities); - - LinkedList<Embeddable> embeddables = new LinkedList<>(map.getEmbeddables()); - embeddables.retainAll(getParentController().getSelectedEmbeddables()); - generator.addEmbeddables(embeddables); - - generator.addQueries(map.getQueryDescriptors()); - - Preferences preferences = application.getPreferencesNode(GeneralPreferences.class, ""); - - if (preferences != null) { - generator.setEncoding(preferences.get(GeneralPreferences.ENCODING_PREFERENCE, null)); - - } - -// generator.setDestDir(outputDir); - generator.setMakePairs(true); - generator.setForce(true); - - generators.add(generator); - } catch (CayenneRuntimeException exception) { - JOptionPane.showMessageDialog(this.getView(), exception.getUnlabeledMessage()); - return null; - } - } - - return generators; - } - - public void validateEmbeddable(ValidationResult validationBuffer, Embeddable embeddable) { - ValidationFailure embeddableFailure = validateEmbeddable(embeddable); - if (embeddableFailure != null) { - validationBuffer.addFailure(embeddableFailure); - return; - } - - for (EmbeddableAttribute attribute : embeddable.getAttributes()) { - ValidationFailure failure = validateEmbeddableAttribute(attribute); - if (failure != null) { - validationBuffer.addFailure(failure); - return; - } - } - } - - private ValidationFailure validateEmbeddableAttribute(EmbeddableAttribute attribute) { - String name = attribute.getEmbeddable().getClassName(); - - ValidationFailure emptyName = BeanValidationFailure.validateNotEmpty(name, "attribute.name", - attribute.getName()); - if (emptyName != null) { - return emptyName; - } - - ValidationFailure badName = CodeValidationUtil.validateJavaIdentifier(name, "attribute.name", - attribute.getName()); - if (badName != null) { - return badName; - } - - ValidationFailure emptyType = BeanValidationFailure.validateNotEmpty(name, "attribute.type", - attribute.getType()); - if (emptyType != null) { - return emptyType; - } - - ValidationFailure badType = BeanValidationFailure.validateJavaClassName(name, "attribute.type", - attribute.getType()); - if (badType != null) { - return badType; - } - - return null; - } - - private ValidationFailure validateEmbeddable(Embeddable embeddable) { - - String name = embeddable.getClassName(); - - ValidationFailure emptyClass = BeanValidationFailure.validateNotEmpty(name, "className", - embeddable.getClassName()); - if (emptyClass != null) { - return emptyClass; - } - - ValidationFailure badClass = BeanValidationFailure.validateJavaClassName(name, "className", - embeddable.getClassName()); - if (badClass != null) { - return badClass; - } - - return null; - } - - public void validateEntity(ValidationResult validationBuffer, ObjEntity entity, boolean clientValidation) { - - ValidationFailure entityFailure = validateEntity(clientValidation ? entity.getClientEntity() : entity); - if (entityFailure != null) { - validationBuffer.addFailure(entityFailure); - return; - } - - for (ObjAttribute attribute : entity.getAttributes()) { - if (attribute instanceof EmbeddedAttribute) { - EmbeddedAttribute embeddedAttribute = (EmbeddedAttribute) attribute; - for (ObjAttribute subAttribute : embeddedAttribute.getAttributes()) { - ValidationFailure failure = validateEmbeddedAttribute(subAttribute); - if (failure != null) { - validationBuffer.addFailure(failure); - return; - } - } - } else { - - ValidationFailure failure = validateAttribute(attribute); - if (failure != null) { - validationBuffer.addFailure(failure); - return; - } - } - } - - for (ObjRelationship rel : entity.getRelationships()) { - ValidationFailure failure = validateRelationship(rel, clientValidation); - if (failure != null) { - validationBuffer.addFailure(failure); - return; - } - } - } - - private ValidationFailure validateEntity(ObjEntity entity) { - - String name = entity.getName(); - - if (entity.isGeneric()) { - return new SimpleValidationFailure(name, "Generic class"); - } - - ValidationFailure emptyClass = BeanValidationFailure.validateNotEmpty(name, "className", entity.getClassName()); - if (emptyClass != null) { - return emptyClass; - } - - ValidationFailure badClass = BeanValidationFailure.validateJavaClassName(name, "className", - entity.getClassName()); - if (badClass != null) { - return badClass; - } - - if (entity.getSuperClassName() != null) { - ValidationFailure badSuperClass = BeanValidationFailure.validateJavaClassName(name, "superClassName", - entity.getSuperClassName()); - if (badSuperClass != null) { - return badSuperClass; - } - } - - return null; - } - - private ValidationFailure validateAttribute(ObjAttribute attribute) { - - String name = attribute.getEntity().getName(); - - ValidationFailure emptyName = BeanValidationFailure.validateNotEmpty(name, "attribute.name", - attribute.getName()); - if (emptyName != null) { - return emptyName; - } - - ValidationFailure badName = CodeValidationUtil.validateJavaIdentifier(name, "attribute.name", - attribute.getName()); - if (badName != null) { - return badName; - } - - ValidationFailure emptyType = BeanValidationFailure.validateNotEmpty(name, "attribute.type", - attribute.getType()); - if (emptyType != null) { - return emptyType; - } - - ValidationFailure badType = BeanValidationFailure.validateJavaClassName(name, "attribute.type", - attribute.getType()); - if (badType != null) { - return badType; - } - - return null; - } - - private ValidationFailure validateEmbeddedAttribute(ObjAttribute attribute) { - - String name = attribute.getEntity().getName(); - - // validate embeddedAttribute and attribute names - // embeddedAttribute returned attibute as - // [name_embeddedAttribute].[name_attribute] - String[] attributes = attribute.getName().split("\\."); - String nameEmbeddedAttribute = attributes[0]; - int beginIndex = attributes[0].length(); - String attr = attribute.getName().substring(beginIndex + 1); - - ValidationFailure emptyEmbeddedName = BeanValidationFailure.validateNotEmpty(name, "attribute.name", - nameEmbeddedAttribute); - if (emptyEmbeddedName != null) { - return emptyEmbeddedName; - } - - ValidationFailure badEmbeddedName = CodeValidationUtil.validateJavaIdentifier(name, "attribute.name", - nameEmbeddedAttribute); - if (badEmbeddedName != null) { - return badEmbeddedName; - } - - ValidationFailure emptyName = BeanValidationFailure.validateNotEmpty(name, "attribute.name", attr); - if (emptyName != null) { - return emptyName; - } - - ValidationFailure badName = CodeValidationUtil.validateJavaIdentifier(name, "attribute.name", attr); - if (badName != null) { - return badName; - } - - ValidationFailure emptyType = BeanValidationFailure.validateNotEmpty(name, "attribute.type", - attribute.getType()); - if (emptyType != null) { - return emptyType; - } - - ValidationFailure badType = BeanValidationFailure.validateJavaClassName(name, "attribute.type", - attribute.getType()); - if (badType != null) { - return badType; - } - - return null; - } - - private ValidationFailure validateRelationship(ObjRelationship relationship, boolean clientValidation) { - - String name = relationship.getSourceEntity().getName(); - - ValidationFailure emptyName = BeanValidationFailure.validateNotEmpty(name, "relationship.name", - relationship.getName()); - if (emptyName != null) { - return emptyName; - } - - ValidationFailure badName = CodeValidationUtil.validateJavaIdentifier(name, "relationship.name", - relationship.getName()); - if (badName != null) { - return badName; - } - - if (!relationship.isToMany()) { - - ObjEntity targetEntity = relationship.getTargetEntity(); - - if (clientValidation && targetEntity != null) { - targetEntity = targetEntity.getClientEntity(); - } - - if (targetEntity == null) { - - return new BeanValidationFailure(name, "relationship.targetEntity", "No target entity"); - } else if (!targetEntity.isGeneric()) { - ValidationFailure emptyClass = BeanValidationFailure.validateNotEmpty(name, - "relationship.targetEntity.className", targetEntity.getClassName()); - if (emptyClass != null) { - return emptyClass; - } - - ValidationFailure badClass = BeanValidationFailure.validateJavaClassName(name, - "relationship.targetEntity.className", targetEntity.getClassName()); - if (badClass != null) { - return badClass; - } - } - } - - return null; - } - - /** - * Returns a predicate for default entity selection in a given mode. - */ - public Predicate getDefaultClassFilter() { - return object -> { - if (object instanceof ObjEntity) { - return getParentController().getProblem(((ObjEntity) object).getName()) == null; - } - - if (object instanceof Embeddable) { - return getParentController().getProblem(((Embeddable) object).getClassName()) == null; - } - - return false; - }; - } - - private File getOutputDir() { - String dir = ((GeneratorControllerPanel) getView()).getOutputFolder().getText(); - return dir != null ? new File(dir) : new File(System.getProperty("user.dir")); - } - - /** - * An action method that pops up a file chooser dialog to pick the - * generation directory. - */ - public void selectOutputFolderAction() { - - JTextField outputFolder = ((GeneratorControllerPanel) getView()).getOutputFolder(); - - String currentDir = outputFolder.getText(); - - JFileChooser chooser = new JFileChooser(); - chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); - chooser.setDialogType(JFileChooser.OPEN_DIALOG); - - // guess start directory - if (!Util.isEmptyString(currentDir)) { - chooser.setCurrentDirectory(new File(currentDir)); - } else { - FSPath lastDir = Application.getInstance().getFrameController().getLastDirectory(); - lastDir.updateChooser(chooser); - } - - int result = chooser.showOpenDialog(getView()); - if (result == JFileChooser.APPROVE_OPTION) { - File selected = chooser.getSelectedFile(); - - // update model - String path = selected.getAbsolutePath(); - outputFolder.setText(path); - setOutputPath(path); - } - } - - private void initOutputFolder() { - String path; - if (getOutputPath() == null) { - if (System.getProperty("cayenne.cgen.destdir") != null) { - setOutputPath(System.getProperty("cayenne.cgen.destdir")); - } else { - // init default directory.. - FSPath lastPath = Application.getInstance().getFrameController().getLastDirectory(); - - path = checkDefaultMavenResourceDir(lastPath, "test"); - - if (path != null || (path = checkDefaultMavenResourceDir(lastPath, "main")) != null) { - setOutputPath(path); - } else { - File lastDir = (lastPath != null) ? lastPath.getExistingDirectory(false) : null; - setOutputPath(lastDir != null ? lastDir.getAbsolutePath() : null); - } - } - } - } - - private String checkDefaultMavenResourceDir(FSPath lastPath, String dirType) { - String path = lastPath.getPath(); - String resourcePath = buildFilePath("src", dirType, "resources"); - int idx = path.indexOf(resourcePath); - if (idx < 0) { - return null; - } - return path.substring(0, idx) + buildFilePath("src", dirType, "java"); - } - - private static String buildFilePath(String... pathElements) { - if (pathElements.length == 0) { - return ""; - } - StringBuilder path = new StringBuilder(pathElements[0]); - for (int i = 1; i < pathElements.length; i++) { - path.append(File.separator).append(pathElements[i]); - } - return path.toString(); - } -} \ No newline at end of file +///***************************************************************** +// * 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; +// +//import org.apache.cayenne.CayenneRuntimeException; +//import org.apache.cayenne.gen.ArtifactsGenerationMode; +//import org.apache.cayenne.gen.ClassGenerationAction; +//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; +//import org.apache.cayenne.modeler.pref.FSPath; +//import org.apache.cayenne.modeler.util.CayenneController; +//import org.apache.cayenne.modeler.util.CodeValidationUtil; +//import org.apache.cayenne.swing.BindingBuilder; +//import org.apache.cayenne.util.Util; +//import org.apache.cayenne.validation.BeanValidationFailure; +//import org.apache.cayenne.validation.SimpleValidationFailure; +//import org.apache.cayenne.validation.ValidationFailure; +//import org.apache.cayenne.validation.ValidationResult; +// +//import javax.swing.JButton; +//import javax.swing.JFileChooser; +//import javax.swing.JOptionPane; +//import javax.swing.JTextField; +//import java.io.File; +//import java.util.ArrayList; +//import java.util.Collection; +//import java.util.LinkedList; +//import java.util.Map; +//import java.util.Set; +//import java.util.function.Predicate; +//import java.util.prefs.Preferences; +// +///** +// * A mode-specific part of the code generation dialog. +// * +// */ +//public abstract class GeneratorController extends CayenneController { +// +// protected String mode = ArtifactsGenerationMode.ALL.getLabel(); +// protected Map<DataMap, DataMapDefaults> mapPreferences; +// private String outputPath; +// +// public GeneratorController(CodeGeneratorControllerBase parent) { +// super(parent); +// +// createDefaults(); +// createView(); +// initBindings(new BindingBuilder(getApplication().getBindingFactory(), this)); +// } +// +// public String getOutputPath() { +// return outputPath; +// } +// +// public void setOutputPath(String path) { +// String old = this.outputPath; +// this.outputPath = path; +// if (this.outputPath != null && !this.outputPath.equals(old)) { +// updatePreferences(path); +// } +// } +// +// public void updatePreferences(String path) { +// if (mapPreferences == null) +// return; +// Set<DataMap> keys = mapPreferences.keySet(); +// for (DataMap key : keys) { +// mapPreferences +// .get(key) +// .setOutputPath(path); +// } +// } +// +// public void setMapPreferences(Map<DataMap, DataMapDefaults> mapPreferences) { +// this.mapPreferences = mapPreferences; +// } +// +// public Map<DataMap, DataMapDefaults> getMapPreferences() { +// return this.mapPreferences; +// } +// +// protected void initBindings(BindingBuilder bindingBuilder) { +// +// initOutputFolder(); +// +// JTextField outputFolder = ((GeneratorControllerPanel) getView()).getOutputFolder(); +// JButton outputSelect = ((GeneratorControllerPanel) getView()).getSelectOutputFolder(); +// +// outputFolder.setText(getOutputPath()); +// bindingBuilder.bindToAction(outputSelect, "selectOutputFolderAction()"); +// bindingBuilder.bindToTextField(outputFolder, "outputPath"); +// } +// +// protected CodeGeneratorControllerBase getParentController() { +// return (CodeGeneratorControllerBase) getParent(); +// } +// +// protected abstract GeneratorControllerPanel createView(); +// +// protected abstract void createDefaults(); +// +// /** +// * Creates an appropriate subclass of {@link ClassGenerationAction}, +// * returning it in an unconfigured state. Configuration is performed by +// * {@link #createConfiguration()} method. +// */ +// protected abstract ClassGenerationAction newGenerator(); +// +// /** +// * Creates a class generator for provided selections. +// */ +// public Collection<ClassGenerationAction> createConfiguration() { +// +// File outputDir = getOutputDir(); +// +// // no destination folder +// if (outputDir == null) { +// JOptionPane.showMessageDialog(this.getView(), "Select directory for source files."); +// return null; +// } +// +// // no such folder +// if (!outputDir.exists() && !outputDir.mkdirs()) { +// JOptionPane.showMessageDialog(this.getView(), "Can't create directory " + outputDir +// + ". Select a different one."); +// return null; +// } +// +// // not a directory +// if (!outputDir.isDirectory()) { +// JOptionPane.showMessageDialog(this.getView(), outputDir + " is not a valid directory."); +// return null; +// } +// +// // remove generic entities... +// Collection<ObjEntity> selectedEntities = new ArrayList<>(getParentController().getSelectedEntities()); +// selectedEntities.removeIf(ObjEntity::isGeneric); +// +// Collection<ClassGenerationAction> generators = new ArrayList<>(); +// for (DataMap map : getParentController().getDataMaps()) { +// try { +// ClassGenerationAction generator = newGenerator(); +// +// if(getParentController().getSelectedDataMaps().contains(map)) { +// mode = ArtifactsGenerationMode.ALL.getLabel(); +// } else { +// mode = ArtifactsGenerationMode.ENTITY.getLabel(); +// } +// +// generator.setArtifactsGenerationMode(mode); +// generator.setDataMap(map); +// +// LinkedList<ObjEntity> objEntities = new LinkedList<>(map.getObjEntities()); +// objEntities.retainAll(selectedEntities); +// generator.addEntities(objEntities); +// +// LinkedList<Embeddable> embeddables = new LinkedList<>(map.getEmbeddables()); +// embeddables.retainAll(getParentController().getSelectedEmbeddables()); +// generator.addEmbeddables(embeddables); +// +// generator.addQueries(map.getQueryDescriptors()); +// +// Preferences preferences = application.getPreferencesNode(GeneralPreferences.class, ""); +// +// if (preferences != null) { +// generator.setEncoding(preferences.get(GeneralPreferences.ENCODING_PREFERENCE, null)); +// +// } +// +// generator.setMakePairs(true); +// generator.setForce(true); +// +// generators.add(generator); +// } catch (CayenneRuntimeException exception) { +// JOptionPane.showMessageDialog(this.getView(), exception.getUnlabeledMessage()); +// return null; +// } +// } +// +// return generators; +// } +// +// public void validateEmbeddable(ValidationResult validationBuffer, Embeddable embeddable) { +// ValidationFailure embeddableFailure = validateEmbeddable(embeddable); +// if (embeddableFailure != null) { +// validationBuffer.addFailure(embeddableFailure); +// return; +// } +// +// for (EmbeddableAttribute attribute : embeddable.getAttributes()) { +// ValidationFailure failure = validateEmbeddableAttribute(attribute); +// if (failure != null) { +// validationBuffer.addFailure(failure); +// return; +// } +// } +// } +// +// private ValidationFailure validateEmbeddableAttribute(EmbeddableAttribute attribute) { +// String name = attribute.getEmbeddable().getClassName(); +// +// ValidationFailure emptyName = BeanValidationFailure.validateNotEmpty(name, "attribute.name", +// attribute.getName()); +// if (emptyName != null) { +// return emptyName; +// } +// +// ValidationFailure badName = CodeValidationUtil.validateJavaIdentifier(name, "attribute.name", +// attribute.getName()); +// if (badName != null) { +// return badName; +// } +// +// ValidationFailure emptyType = BeanValidationFailure.validateNotEmpty(name, "attribute.type", +// attribute.getType()); +// if (emptyType != null) { +// return emptyType; +// } +// +// ValidationFailure badType = BeanValidationFailure.validateJavaClassName(name, "attribute.type", +// attribute.getType()); +// if (badType != null) { +// return badType; +// } +// +// return null; +// } +// +// private ValidationFailure validateEmbeddable(Embeddable embeddable) { +// +// String name = embeddable.getClassName(); +// +// ValidationFailure emptyClass = BeanValidationFailure.validateNotEmpty(name, "className", +// embeddable.getClassName()); +// if (emptyClass != null) { +// return emptyClass; +// } +// +// ValidationFailure badClass = BeanValidationFailure.validateJavaClassName(name, "className", +// embeddable.getClassName()); +// if (badClass != null) { +// return badClass; +// } +// +// return null; +// } +// +// public void validateEntity(ValidationResult validationBuffer, ObjEntity entity, boolean clientValidation) { +// +// ValidationFailure entityFailure = validateEntity(clientValidation ? entity.getClientEntity() : entity); +// if (entityFailure != null) { +// validationBuffer.addFailure(entityFailure); +// return; +// } +// +// for (ObjAttribute attribute : entity.getAttributes()) { +// if (attribute instanceof EmbeddedAttribute) { +// EmbeddedAttribute embeddedAttribute = (EmbeddedAttribute) attribute; +// for (ObjAttribute subAttribute : embeddedAttribute.getAttributes()) { +// ValidationFailure failure = validateEmbeddedAttribute(subAttribute); +// if (failure != null) { +// validationBuffer.addFailure(failure); +// return; +// } +// } +// } else { +// +// ValidationFailure failure = validateAttribute(attribute); +// if (failure != null) { +// validationBuffer.addFailure(failure); +// return; +// } +// } +// } +// +// for (ObjRelationship rel : entity.getRelationships()) { +// ValidationFailure failure = validateRelationship(rel, clientValidation); +// if (failure != null) { +// validationBuffer.addFailure(failure); +// return; +// } +// } +// } +// +// private ValidationFailure validateEntity(ObjEntity entity) { +// +// String name = entity.getName(); +// +// if (entity.isGeneric()) { +// return new SimpleValidationFailure(name, "Generic class"); +// } +// +// ValidationFailure emptyClass = BeanValidationFailure.validateNotEmpty(name, "className", entity.getClassName()); +// if (emptyClass != null) { +// return emptyClass; +// } +// +// ValidationFailure badClass = BeanValidationFailure.validateJavaClassName(name, "className", +// entity.getClassName()); +// if (badClass != null) { +// return badClass; +// } +// +// if (entity.getSuperClassName() != null) { +// ValidationFailure badSuperClass = BeanValidationFailure.validateJavaClassName(name, "superClassName", +// entity.getSuperClassName()); +// if (badSuperClass != null) { +// return badSuperClass; +// } +// } +// +// return null; +// } +// +// private ValidationFailure validateAttribute(ObjAttribute attribute) { +// +// String name = attribute.getEntity().getName(); +// +// ValidationFailure emptyName = BeanValidationFailure.validateNotEmpty(name, "attribute.name", +// attribute.getName()); +// if (emptyName != null) { +// return emptyName; +// } +// +// ValidationFailure badName = CodeValidationUtil.validateJavaIdentifier(name, "attribute.name", +// attribute.getName()); +// if (badName != null) { +// return badName; +// } +// +// ValidationFailure emptyType = BeanValidationFailure.validateNotEmpty(name, "attribute.type", +// attribute.getType()); +// if (emptyType != null) { +// return emptyType; +// } +// +// ValidationFailure badType = BeanValidationFailure.validateJavaClassName(name, "attribute.type", +// attribute.getType()); +// if (badType != null) { +// return badType; +// } +// +// return null; +// } +// +// private ValidationFailure validateEmbeddedAttribute(ObjAttribute attribute) { +// +// String name = attribute.getEntity().getName(); +// +// // validate embeddedAttribute and attribute names +// // embeddedAttribute returned attibute as +// // [name_embeddedAttribute].[name_attribute] +// String[] attributes = attribute.getName().split("\\."); +// String nameEmbeddedAttribute = attributes[0]; +// int beginIndex = attributes[0].length(); +// String attr = attribute.getName().substring(beginIndex + 1); +// +// ValidationFailure emptyEmbeddedName = BeanValidationFailure.validateNotEmpty(name, "attribute.name", +// nameEmbeddedAttribute); +// if (emptyEmbeddedName != null) { +// return emptyEmbeddedName; +// } +// +// ValidationFailure badEmbeddedName = CodeValidationUtil.validateJavaIdentifier(name, "attribute.name", +// nameEmbeddedAttribute); +// if (badEmbeddedName != null) { +// return badEmbeddedName; +// } +// +// ValidationFailure emptyName = BeanValidationFailure.validateNotEmpty(name, "attribute.name", attr); +// if (emptyName != null) { +// return emptyName; +// } +// +// ValidationFailure badName = CodeValidationUtil.validateJavaIdentifier(name, "attribute.name", attr); +// if (badName != null) { +// return badName; +// } +// +// ValidationFailure emptyType = BeanValidationFailure.validateNotEmpty(name, "attribute.type", +// attribute.getType()); +// if (emptyType != null) { +// return emptyType; +// } +// +// ValidationFailure badType = BeanValidationFailure.validateJavaClassName(name, "attribute.type", +// attribute.getType()); +// if (badType != null) { +// return badType; +// } +// +// return null; +// } +// +// private ValidationFailure validateRelationship(ObjRelationship relationship, boolean clientValidation) { +// +// String name = relationship.getSourceEntity().getName(); +// +// ValidationFailure emptyName = BeanValidationFailure.validateNotEmpty(name, "relationship.name", +// relationship.getName()); +// if (emptyName != null) { +// return emptyName; +// } +// +// ValidationFailure badName = CodeValidationUtil.validateJavaIdentifier(name, "relationship.name", +// relationship.getName()); +// if (badName != null) { +// return badName; +// } +// +// if (!relationship.isToMany()) { +// +// ObjEntity targetEntity = relationship.getTargetEntity(); +// +// if (clientValidation && targetEntity != null) { +// targetEntity = targetEntity.getClientEntity(); +// } +// +// if (targetEntity == null) { +// +// return new BeanValidationFailure(name, "relationship.targetEntity", "No target entity"); +// } else if (!targetEntity.isGeneric()) { +// ValidationFailure emptyClass = BeanValidationFailure.validateNotEmpty(name, +// "relationship.targetEntity.className", targetEntity.getClassName()); +// if (emptyClass != null) { +// return emptyClass; +// } +// +// ValidationFailure badClass = BeanValidationFailure.validateJavaClassName(name, +// "relationship.targetEntity.className", targetEntity.getClassName()); +// if (badClass != null) { +// return badClass; +// } +// } +// } +// +// return null; +// } +// +// /** +// * Returns a predicate for default entity selection in a given mode. +// */ +// public Predicate getDefaultClassFilter() { +// return object -> { +// if (object instanceof ObjEntity) { +// return getParentController().getProblem(((ObjEntity) object).getName()) == null; +// } +// +// if (object instanceof Embeddable) { +// return getParentController().getProblem(((Embeddable) object).getClassName()) == null; +// } +// +// return false; +// }; +// } +// +// private File getOutputDir() { +// String dir = ((GeneratorControllerPanel) getView()).getOutputFolder().getText(); +// return dir != null ? new File(dir) : new File(System.getProperty("user.dir")); +// } +// +// /** +// * An action method that pops up a file chooser dialog to pick the +// * generation directory. +// */ +// public void selectOutputFolderAction() { +// +// JTextField outputFolder = ((GeneratorControllerPanel) getView()).getOutputFolder(); +// +// String currentDir = outputFolder.getText(); +// +// JFileChooser chooser = new JFileChooser(); +// chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); +// chooser.setDialogType(JFileChooser.OPEN_DIALOG); +// +// // guess start directory +// if (!Util.isEmptyString(currentDir)) { +// chooser.setCurrentDirectory(new File(currentDir)); +// } else { +// FSPath lastDir = Application.getInstance().getFrameController().getLastDirectory(); +// lastDir.updateChooser(chooser); +// } +// +// int result = chooser.showOpenDialog(getView()); +// if (result == JFileChooser.APPROVE_OPTION) { +// File selected = chooser.getSelectedFile(); +// +// // update model +// String path = selected.getAbsolutePath(); +// outputFolder.setText(path); +// setOutputPath(path); +// } +// } +// +// private void initOutputFolder() { +// String path; +// if (getOutputPath() == null) { +// if (System.getProperty("cayenne.cgen.destdir") != null) { +// setOutputPath(System.getProperty("cayenne.cgen.destdir")); +// } else { +// // init default directory.. +// FSPath lastPath = Application.getInstance().getFrameController().getLastDirectory(); +// +// path = checkDefaultMavenResourceDir(lastPath, "test"); +// +// if (path != null || (path = checkDefaultMavenResourceDir(lastPath, "main")) != null) { +// setOutputPath(path); +// } else { +// File lastDir = (lastPath != null) ? lastPath.getExistingDirectory(false) : null; +// setOutputPath(lastDir != null ? lastDir.getAbsolutePath() : null); +// } +// } +// } +// } +// +// private String checkDefaultMavenResourceDir(FSPath lastPath, String dirType) { +// String path = lastPath.getPath(); +// String resourcePath = buildFilePath("src", dirType, "resources"); +// int idx = path.indexOf(resourcePath); +// if (idx < 0) { +// return null; +// } +// return path.substring(0, idx) + buildFilePath("src", dirType, "java"); +// } +// +// private static String buildFilePath(String... pathElements) { +// if (pathElements.length == 0) { +// return ""; +// } +// StringBuilder path = new StringBuilder(pathElements[0]); +// for (int i = 1; i < pathElements.length; i++) { +// path.append(File.separator).append(pathElements[i]); +// } +// return path.toString(); +// } +//} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cayenne/blob/52ea45b5/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorControllerPanel.java ---------------------------------------------------------------------- diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorControllerPanel.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorControllerPanel.java index 49cbc4b..276284f 100644 --- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorControllerPanel.java +++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorControllerPanel.java @@ -1,55 +1,55 @@ -/***************************************************************** - * 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; - -import javax.swing.JButton; -import javax.swing.JPanel; -import javax.swing.JTextField; -import java.util.ArrayList; -import java.util.Collection; - -/** - * A generic panel that is a superclass of generator panels, defining common fields. - * - */ -public class GeneratorControllerPanel extends JPanel { - - protected Collection<StandardPanelComponent> dataMapLines; - protected JTextField outputFolder; - protected JButton selectOutputFolder; - - public GeneratorControllerPanel() { - this.dataMapLines = new ArrayList<>(); - this.outputFolder = new JTextField(); - this.selectOutputFolder = new JButton("Select"); - } - - public JTextField getOutputFolder() { - return outputFolder; - } - - public JButton getSelectOutputFolder() { - return selectOutputFolder; - } - - public Collection<StandardPanelComponent> getDataMapLines() { - return dataMapLines; - } -} \ No newline at end of file +///***************************************************************** +// * 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; +// +//import javax.swing.JButton; +//import javax.swing.JPanel; +//import javax.swing.JTextField; +//import java.util.ArrayList; +//import java.util.Collection; +// +///** +// * A generic panel that is a superclass of generator panels, defining common fields. +// * +// */ +//public class GeneratorControllerPanel extends JPanel { +// +// protected Collection<StandardPanelComponent> dataMapLines; +// protected JTextField outputFolder; +// protected JButton selectOutputFolder; +// +// public GeneratorControllerPanel() { +// this.dataMapLines = new ArrayList<>(); +// this.outputFolder = new JTextField(); +// this.selectOutputFolder = new JButton("Select"); +// } +// +// public JTextField getOutputFolder() { +// return outputFolder; +// } +// +// public JButton getSelectOutputFolder() { +// return selectOutputFolder; +// } +// +// public Collection<StandardPanelComponent> getDataMapLines() { +// return dataMapLines; +// } +//} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cayenne/blob/52ea45b5/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorTabController.java ---------------------------------------------------------------------- diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorTabController.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorTabController.java index 5d7594f..8b915fe 100644 --- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorTabController.java +++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorTabController.java @@ -1,115 +1,115 @@ -/***************************************************************** - * 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; - -import org.apache.cayenne.gen.ClassGenerationAction; -import org.apache.cayenne.modeler.util.CayenneController; -import org.apache.cayenne.pref.CayenneProjectPreferences; -import org.apache.cayenne.pref.PreferenceDetail; -import org.apache.cayenne.swing.BindingBuilder; -import org.apache.cayenne.util.Util; - -import java.awt.Component; -import java.awt.Dimension; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - -/** - */ -public class GeneratorTabController extends CayenneController { - - private static final String STANDARD_OBJECTS_MODE = "Standard Persistent Objects"; - private static final String CLIENT_OBJECTS_MODE = "Client Persistent Objects"; - private static final String ADVANCED_MODE = "Advanced"; - - public static final String GENERATOR_PROPERTY = "generator"; - - private static final String[] GENERATION_MODES = new String[] { - STANDARD_OBJECTS_MODE, CLIENT_OBJECTS_MODE, ADVANCED_MODE - }; - - protected GeneratorTabPanel view; - protected Map controllers; - protected PreferenceDetail preferences; - - public GeneratorTabController(CodeGeneratorControllerBase parent) { - super(parent); - - this.controllers = new HashMap(5); - controllers.put(STANDARD_OBJECTS_MODE, new StandardModeController(parent)); - controllers.put(CLIENT_OBJECTS_MODE, new ClientModeController(parent)); - controllers.put(ADVANCED_MODE, new CustomModeController(parent)); - - Component[] modePanels = new Component[GENERATION_MODES.length]; - for (int i = 0; i < GENERATION_MODES.length; i++) { - modePanels[i] = ((GeneratorController) controllers.get(GENERATION_MODES[i])) - .getView(); - } - - this.view = new GeneratorTabPanel(GENERATION_MODES, modePanels); - initBindings(); - view.setPreferredSize(new Dimension(600, 480)); - } - - public Component getView() { - return view; - } - - protected CodeGeneratorControllerBase getParentController() { - return (CodeGeneratorControllerBase) getParent(); - } - - protected void initBindings() { - - // bind actions - BindingBuilder builder = new BindingBuilder( - getApplication().getBindingFactory(), - this); - - CayenneProjectPreferences cayPrPref = application.getCayenneProjectPreferences(); - - this.preferences = (PreferenceDetail) cayPrPref.getProjectDetailObject( - PreferenceDetail.class, - getViewPreferences().node("controller")); - - if (Util.isEmptyString(preferences.getProperty("mode"))) { - preferences.setProperty("mode", STANDARD_OBJECTS_MODE); - } - - builder.bindToComboSelection( - view.getGenerationMode(), - "preferences.property['mode']").updateView(); - } - - public PreferenceDetail getPreferences() { - return preferences; - } - - public GeneratorController getGeneratorController() { - Object name = view.getGenerationMode().getSelectedItem(); - return (GeneratorController) controllers.get(name); - } - - public Collection<ClassGenerationAction> getGenerator() { - GeneratorController modeController = getGeneratorController(); - return (modeController != null) ? modeController.createGenerator() : null; - } -} \ No newline at end of file +///***************************************************************** +// * 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; +// +//import org.apache.cayenne.gen.ClassGenerationAction; +//import org.apache.cayenne.modeler.util.CayenneController; +//import org.apache.cayenne.pref.CayenneProjectPreferences; +//import org.apache.cayenne.pref.PreferenceDetail; +//import org.apache.cayenne.swing.BindingBuilder; +//import org.apache.cayenne.util.Util; +// +//import java.awt.Component; +//import java.awt.Dimension; +//import java.util.Collection; +//import java.util.HashMap; +//import java.util.Map; +// +///** +// */ +//public class GeneratorTabController extends CayenneController { +// +// private static final String STANDARD_OBJECTS_MODE = "Standard Persistent Objects"; +// private static final String CLIENT_OBJECTS_MODE = "Client Persistent Objects"; +// private static final String ADVANCED_MODE = "Advanced"; +// +// public static final String GENERATOR_PROPERTY = "generator"; +// +// private static final String[] GENERATION_MODES = new String[] { +// STANDARD_OBJECTS_MODE, CLIENT_OBJECTS_MODE, ADVANCED_MODE +// }; +// +// protected GeneratorTabPanel view; +// protected Map controllers; +// protected PreferenceDetail preferences; +// +// public GeneratorTabController(CodeGeneratorControllerBase parent) { +// super(parent); +// +// this.controllers = new HashMap(5); +// controllers.put(STANDARD_OBJECTS_MODE, new StandardModeController(parent)); +// controllers.put(CLIENT_OBJECTS_MODE, new ClientModeController(parent)); +// controllers.put(ADVANCED_MODE, new CustomModeController(parent)); +// +// Component[] modePanels = new Component[GENERATION_MODES.length]; +// for (int i = 0; i < GENERATION_MODES.length; i++) { +// modePanels[i] = ((GeneratorController) controllers.get(GENERATION_MODES[i])) +// .getView(); +// } +// +// this.view = new GeneratorTabPanel(GENERATION_MODES, modePanels); +// initBindings(); +// view.setPreferredSize(new Dimension(600, 480)); +// } +// +// public Component getView() { +// return view; +// } +// +// protected CodeGeneratorControllerBase getParentController() { +// return (CodeGeneratorControllerBase) getParent(); +// } +// +// protected void initBindings() { +// +// // bind actions +// BindingBuilder builder = new BindingBuilder( +// getApplication().getBindingFactory(), +// this); +// +// CayenneProjectPreferences cayPrPref = application.getCayenneProjectPreferences(); +// +// this.preferences = (PreferenceDetail) cayPrPref.getProjectDetailObject( +// PreferenceDetail.class, +// getViewPreferences().node("controller")); +// +// if (Util.isEmptyString(preferences.getProperty("mode"))) { +// preferences.setProperty("mode", STANDARD_OBJECTS_MODE); +// } +// +// builder.bindToComboSelection( +// view.getGenerationMode(), +// "preferences.property['mode']").updateView(); +// } +// +// public PreferenceDetail getPreferences() { +// return preferences; +// } +// +// public GeneratorController getGeneratorController() { +// Object name = view.getGenerationMode().getSelectedItem(); +// return (GeneratorController) controllers.get(name); +// } +// +// public Collection<ClassGenerationAction> getConfiguration() { +// GeneratorController modeController = getGeneratorController(); +// return (modeController != null) ? modeController.createConfiguration() : null; +// } +//} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cayenne/blob/52ea45b5/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorTabPanel.java ---------------------------------------------------------------------- diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorTabPanel.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorTabPanel.java index 854e2d6..c6095ad 100644 --- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorTabPanel.java +++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorTabPanel.java @@ -1,65 +1,65 @@ -/***************************************************************** - * 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; - -import com.jgoodies.forms.builder.DefaultFormBuilder; -import com.jgoodies.forms.layout.FormLayout; - -import javax.swing.JComboBox; -import javax.swing.JPanel; -import java.awt.BorderLayout; -import java.awt.CardLayout; -import java.awt.Component; - -/** - */ -public class GeneratorTabPanel extends JPanel { - - protected JComboBox generationMode; - protected CardLayout modeLayout; - protected JPanel modesPanel; - - public GeneratorTabPanel(String[] modeNames, Component[] modePanels) { - this.generationMode = new JComboBox(modeNames); - this.modeLayout = new CardLayout(); - this.modesPanel = new JPanel(modeLayout); - - generationMode.addItemListener(e -> modeLayout.show(modesPanel, generationMode.getSelectedItem().toString())); - - // assemble - FormLayout layout = new FormLayout("right:70dlu, 3dlu, fill:300, fill:100dlu:grow", ""); - DefaultFormBuilder builder = new DefaultFormBuilder(layout); - builder.setDefaultDialogBorder(); - builder.append("Type:", generationMode, 1); - builder.appendSeparator(); - - for (int i = 0; i < modeNames.length; i++) { - modesPanel.add(modePanels[i], modeNames[i]); - } - - setLayout(new BorderLayout()); - add(builder.getPanel(), BorderLayout.NORTH); - add(modesPanel, BorderLayout.CENTER); - } - - public JComboBox getGenerationMode() { - return generationMode; - } -} \ No newline at end of file +///***************************************************************** +// * 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; +// +//import com.jgoodies.forms.builder.DefaultFormBuilder; +//import com.jgoodies.forms.layout.FormLayout; +// +//import javax.swing.JComboBox; +//import javax.swing.JPanel; +//import java.awt.BorderLayout; +//import java.awt.CardLayout; +//import java.awt.Component; +// +///** +// */ +//public class GeneratorTabPanel extends JPanel { +// +// protected JComboBox generationMode; +// protected CardLayout modeLayout; +// protected JPanel modesPanel; +// +// public GeneratorTabPanel(String[] modeNames, Component[] modePanels) { +// this.generationMode = new JComboBox(modeNames); +// this.modeLayout = new CardLayout(); +// this.modesPanel = new JPanel(modeLayout); +// +// generationMode.addItemListener(e -> modeLayout.show(modesPanel, generationMode.getSelectedItem().toString())); +// +// // assemble +// FormLayout layout = new FormLayout("right:70dlu, 3dlu, fill:300, fill:100dlu:grow", ""); +// DefaultFormBuilder builder = new DefaultFormBuilder(layout); +// builder.setDefaultDialogBorder(); +// builder.append("Type:", generationMode, 1); +// builder.appendSeparator(); +// +// for (int i = 0; i < modeNames.length; i++) { +// modesPanel.add(modePanels[i], modeNames[i]); +// } +// +// setLayout(new BorderLayout()); +// add(builder.getPanel(), BorderLayout.NORTH); +// add(modesPanel, BorderLayout.CENTER); +// } +// +// public JComboBox getGenerationMode() { +// return generationMode; +// } +//} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cayenne/blob/52ea45b5/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/StandardModeController.java ---------------------------------------------------------------------- diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/StandardModeController.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/StandardModeController.java index b0650d8..547f408 100644 --- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/StandardModeController.java +++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/StandardModeController.java @@ -1,82 +1,82 @@ -/***************************************************************** - * 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; - -import org.apache.cayenne.gen.ClassGenerationAction; -import org.apache.cayenne.map.DataMap; -import org.apache.cayenne.modeler.pref.DataMapDefaults; - -import java.awt.Component; -import java.util.ArrayList; -import java.util.Collection; -import java.util.TreeMap; - -public class StandardModeController extends GeneratorController { - - protected StandardModePanel view; - protected DataMapDefaults preferences; - - public StandardModeController(CodeGeneratorControllerBase parent) { - super(parent); - } - - protected void createDefaults() { - TreeMap<DataMap, DataMapDefaults> treeMap = new TreeMap<>(); - ArrayList<DataMap> dataMaps = (ArrayList<DataMap>) getParentController().getDataMaps(); - - for (DataMap dataMap : dataMaps) { - DataMapDefaults preferences = getApplication() - .getFrameController() - .getProjectController() - .getDataMapPreferences(dataMap); - - preferences.setSuperclassPackage(""); - preferences.updateSuperclassPackage(dataMap, false); - - treeMap.put(dataMap, preferences); - if (getOutputPath() == null) { - setOutputPath(preferences.getOutputPath()); - } - } - - setMapPreferences(treeMap); - } - - protected GeneratorControllerPanel createView() { - this.view = new StandardModePanel(); - return view; - } - - public Component getView() { - return view; - } - - @Override - protected ClassGenerationAction newGenerator() { - ClassGenerationAction action = new ClassGenerationAction(); - getApplication().getInjector().injectMembers(action); - return action; - } - - @Override - public Collection<ClassGenerationAction> createGenerator() { - return super.createGenerator(); - } -} \ No newline at end of file +///***************************************************************** +// * 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; +// +//import org.apache.cayenne.gen.ClassGenerationAction; +//import org.apache.cayenne.map.DataMap; +//import org.apache.cayenne.modeler.pref.DataMapDefaults; +// +//import java.awt.Component; +//import java.util.ArrayList; +//import java.util.Collection; +//import java.util.TreeMap; +// +//public class StandardModeController extends GeneratorController { +// +// protected StandardModePanel view; +// protected DataMapDefaults preferences; +// +// public StandardModeController(CodeGeneratorControllerBase parent) { +// super(parent); +// } +// +// protected void createDefaults() { +// TreeMap<DataMap, DataMapDefaults> treeMap = new TreeMap<>(); +// ArrayList<DataMap> dataMaps = (ArrayList<DataMap>) getParentController().getDataMaps(); +// +// for (DataMap dataMap : dataMaps) { +// DataMapDefaults preferences = getApplication() +// .getFrameController() +// .getProjectController() +// .getDataMapPreferences(dataMap); +// +// preferences.setSuperclassPackage(""); +// preferences.updateSuperclassPackage(dataMap, false); +// +// treeMap.put(dataMap, preferences); +// if (getOutputPath() == null) { +// setOutputPath(preferences.getOutputPath()); +// } +// } +// +// setMapPreferences(treeMap); +// } +// +// protected GeneratorControllerPanel createView() { +// this.view = new StandardModePanel(); +// return view; +// } +// +// public Component getView() { +// return view; +// } +// +// @Override +// protected ClassGenerationAction newGenerator() { +// ClassGenerationAction action = new ClassGenerationAction(); +// getApplication().getInjector().injectMembers(action); +// return action; +// } +// +// @Override +// public Collection<ClassGenerationAction> createConfiguration() { +// return super.createConfiguration(); +// } +//} \ No newline at end of file