### Eclipse Workspace Patch 1.0 #P org.hibernate.eclipse.console Index: src/org/hibernate/eclipse/launch/CodeGenerationSettingsTab.java =================================================================== --- src/org/hibernate/eclipse/launch/CodeGenerationSettingsTab.java (revision 21144) +++ src/org/hibernate/eclipse/launch/CodeGenerationSettingsTab.java (working copy) @@ -33,6 +33,7 @@ import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; import org.eclipse.jdt.core.JavaConventions; +import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; import org.eclipse.jdt.internal.ui.wizards.dialogfields.ComboDialogField; import org.eclipse.jdt.internal.ui.wizards.dialogfields.DialogField; import org.eclipse.jdt.internal.ui.wizards.dialogfields.IDialogFieldListener; @@ -75,6 +76,8 @@ private SelectionButtonDialogField reverseengineer; private StringButtonDialogField outputdir; + + private ComboDialogField mergeMethod; private StringButtonDialogField reverseEngineeringSettings; @@ -142,6 +145,13 @@ outputdir.setLabelText(HibernateConsoleMessages.CodeGenerationSettingsTab_output_dir); outputdir.setButtonLabel(HibernateConsoleMessages.CodeGenerationSettingsTab_browse); + String[] mergeItems = new String[]{"Overwrite"/*Default*/, "Merge", "Skip", }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + mergeMethod = new ComboDialogField(SWT.READ_ONLY); + mergeMethod.setItems(mergeItems); + mergeMethod.selectItem(0); + mergeMethod.setLabelText("Merge method:"); //$NON-NLS-1$ + mergeMethod.setDialogFieldListener(fieldlistener); + templatedir = new DirectoryBrowseField(null, null, HibernateConsoleMessages.CodeGenerationSettingsTab_select_template_dir, HibernateConsoleMessages.CodeGenerationSettingsTab_choose_dir_custom_templates); templatedir.setDialogFieldListener(fieldlistener); templatedir.setLabelText(HibernateConsoleMessages.CodeGenerationSettingsTab_template_directory); @@ -243,6 +253,7 @@ Control[] controls = outputdir.doFillIntoGrid(container, 4); // Hack to tell the text field to stretch! ( (GridData)controls[1].getLayoutData() ).grabExcessHorizontalSpace=true; + mergeMethod.doFillIntoGrid(container, 2); reverseengineer.doFillIntoGrid(container, 4); packageName.doFillIntoGrid(container, 4); reverseEngineeringSettings.doFillIntoGrid(container, 4); @@ -291,7 +302,7 @@ } if(packageName.isEnabled() && getOutputPackage().length()>0) { - IStatus val= JavaConventions.validatePackageName(getOutputPackage() ); + IStatus val= JavaConventions.validatePackageName(getOutputPackage(), CompilerOptions.VERSION_1_3,CompilerOptions.VERSION_1_3 ); if (val.getSeverity() == IStatus.ERROR || val.getSeverity() == IStatus.WARNING) { updateStatus(val.getMessage() ); return; @@ -401,6 +412,10 @@ String getOutputPackage() { return packageName.getText(); } + + String getMergeMethod() { + return mergeMethod.getText(); + } private IPath getReverseEngineeringSettingsFile() { @@ -428,6 +443,7 @@ autoVersioning.setSelection( attributes.detectOptimisticLock() ); autoOneToOne.setSelection( attributes.detectOneToOne()); outputdir.setText(safeText(attributes.getOutputPath())); + mergeMethod.setText(safeText(attributes.getMergeMethod())); reverseengineer.setSelection(attributes.isReverseEngineer()); reverseEngineeringSettings.setText(safeText(attributes.getRevengSettings())); reverseEngineeringStrategy.setText(safeText(attributes.getRevengStrategy())); @@ -466,7 +482,7 @@ configuration.setAttribute(HibernateLaunchConstants.ATTR_TEMPLATE_DIR, strOrNull(templatedir.getText())); configuration.setAttribute(HibernateLaunchConstants.ATTR_CONSOLE_CONFIGURATION_NAME, getConfigurationName()); - configuration.setAttribute(HibernateLaunchConstants.ATTR_PACKAGE_NAME, getOutputPackage()); + configuration.setAttribute(HibernateLaunchConstants.ATTR_MERGE_METHOD, getMergeMethod()); } Index: src/org/hibernate/eclipse/launch/CodeGenerationLaunchDelegate.java =================================================================== --- src/org/hibernate/eclipse/launch/CodeGenerationLaunchDelegate.java (revision 21144) +++ src/org/hibernate/eclipse/launch/CodeGenerationLaunchDelegate.java (working copy) @@ -238,6 +238,7 @@ Exporter exporter; try { exporter = exporterFactories[i].createConfiguredExporter(cfg, attributes.getOutputPath(), attributes.getTemplatePath(), globalProperties, outputDirectories, artifactCollector); + exporter.setMergeMethod(attributes.getMergeMethod()); } catch (CoreException e) { throw new HibernateConsoleRuntimeException(HibernateConsoleMessages.CodeGenerationLaunchDelegate_error_while_setting_up + exporterFactories[i].getExporterDefinition(), e); } Index: src/org/hibernate/eclipse/launch/HibernateLaunchConstants.java =================================================================== --- src/org/hibernate/eclipse/launch/HibernateLaunchConstants.java (revision 21144) +++ src/org/hibernate/eclipse/launch/HibernateLaunchConstants.java (working copy) @@ -58,10 +58,11 @@ public static final String ATTR_PACKAGE_NAME = ATTR_PREFIX + "package"; //$NON-NLS-1$ public static final String ATTR_ENABLE_TEMPLATE_DIR = ATTR_PREFIX + "templatepathenabled"; //$NON-NLS-1$ public static final String ATTR_TEMPLATE_DIR = ATTR_PREFIX + "templatepath"; //$NON-NLS-1$ + public static final String ATTR_MERGE_METHOD = "mergeMethod"; //$NON-NLS-1$ public static final String ATTR_PREFER_BASIC_COMPOSITE_IDS = ATTR_PREFIX + "prefercompositeids"; //$NON-NLS-1$ public static final String ATTR_AUTOMATIC_MANY_TO_MANY = ATTR_PREFIX + "reveng.detect_many_to_many"; //$NON-NLS-1$ public static final String ATTR_AUTOMATIC_VERSIONING = ATTR_PREFIX + "reveng.detect_optimistc_lock"; //$NON-NLS-1$ public static final String ATTR_AUTOMATIC_ONE_TO_ONE = ATTR_PREFIX + "reveng.detect_one_to_one"; //$NON-NLS-1$ public static final String ATTR_REVENG_TABLES = ATTR_PREFIX + "reveng.tables";//$NON-NLS-1$ - + } Index: src/org/hibernate/eclipse/launch/ExporterAttributes.java =================================================================== --- src/org/hibernate/eclipse/launch/ExporterAttributes.java (revision 21144) +++ src/org/hibernate/eclipse/launch/ExporterAttributes.java (working copy) @@ -69,6 +69,7 @@ private String packageName; private String outputPath; private String templatePath; + private String mergeMethod = "Overwrite"; private List exporterFactories; private boolean autoManyToManyDetection; @@ -97,6 +98,7 @@ enableEJB3 = configuration.getAttribute(HibernateLaunchConstants.ATTR_ENABLE_EJB3_ANNOTATIONS,false); packageName = configuration.getAttribute(HibernateLaunchConstants.ATTR_PACKAGE_NAME,""); //$NON-NLS-1$ templatePath = configuration.getAttribute(HibernateLaunchConstants.ATTR_TEMPLATE_DIR,""); //$NON-NLS-1$ + mergeMethod = configuration.getAttribute(HibernateLaunchConstants.ATTR_MERGE_METHOD, ""); //$NON-NLS-1$ preferBasicCompositeIds = configuration.getAttribute(HibernateLaunchConstants.ATTR_PREFER_BASIC_COMPOSITE_IDS, true); autoManyToManyDetection = configuration.getAttribute( HibernateLaunchConstants.ATTR_AUTOMATIC_MANY_TO_MANY, true); autoOneToOneDetection = configuration.getAttribute( HibernateLaunchConstants.ATTR_AUTOMATIC_ONE_TO_ONE, true); @@ -274,7 +276,17 @@ { this.templatePath = templatePath; } + + public String getMergeMethod() + { + return mergeMethod; + } + public void setMergeMethod(String mergeMethod) + { + this.mergeMethod = mergeMethod; + } + public String getConsoleConfigurationName() { return consoleConfigurationName; #P org.jboss.tools.hibernate.jpt.ui Index: src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java =================================================================== --- src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java (revision 21144) +++ src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java (working copy) @@ -74,6 +74,8 @@ private ComboDialogField dialectName; + private ComboDialogField mergeMethod; + private Button selectMethod; private Group dbGroup; @@ -125,6 +127,14 @@ createChildControls(container); + String[] mergeItems = new String[]{"Overwrite"/*Default*/, "Merge", "Skip", }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + mergeMethod = new ComboDialogField(SWT.READ_ONLY); + mergeMethod.setItems(mergeItems); + mergeMethod.selectItem(0); + mergeMethod.setLabelText("Merge method:"); //$NON-NLS-1$ + mergeMethod.setDialogFieldListener(fieldlistener); + mergeMethod.doFillIntoGrid(container, 3); + selectMethod = new Button(container, SWT.CHECK); selectMethod.setText(Messages.GenerateInitWizardPage_use_console_configuration); selectMethod.setSelection(true); @@ -167,6 +177,10 @@ } } + public String getMergeMethod() { + return mergeMethod.getText(); + } + /** * @param parent */ Index: src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java =================================================================== --- src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java (revision 21144) +++ src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java (working copy) @@ -57,7 +57,8 @@ String concoleConfigurationName = initPage.getConfigurationName(); wc.setAttribute(HibernateLaunchConstants.ATTR_CONSOLE_CONFIGURATION_NAME, concoleConfigurationName); wc.setAttribute(HibernateLaunchConstants.ATTR_OUTPUT_DIR, initPage.getOutputDir()); - + wc.setAttribute(HibernateLaunchConstants.ATTR_MERGE_METHOD, initPage.getMergeMethod()); + Map prop = new HashMap(); prop.put("outputFileName", initPage.getFilename()); //$NON-NLS-1$ prop.put("format", "true"); //$NON-NLS-1$ //$NON-NLS-2$ Index: src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java =================================================================== --- src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java (revision 21144) +++ src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java (working copy) @@ -55,8 +55,8 @@ // SHOULD PRESENT THE CONFIGURATION!!! String concoleConfigurationName = initPage.getConfigurationName(); wc.setAttribute(HibernateLaunchConstants.ATTR_CONSOLE_CONFIGURATION_NAME, concoleConfigurationName); - wc.setAttribute(HibernateLaunchConstants.ATTR_OUTPUT_DIR, initPage.getOutputDir()); + wc.setAttribute(HibernateLaunchConstants.ATTR_MERGE_METHOD, initPage.getMergeMethod()); wc.setAttribute(HibernateLaunchConstants.ATTR_REVERSE_ENGINEER, true); wc.setAttribute(HibernateLaunchConstants.ATTR_PACKAGE_NAME, initPage.getPackageName());