Author: vyemialyanchyk
Date: 2010-07-30 13:41:49 -0400 (Fri, 30 Jul 2010)
New Revision: 23843
Added:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterFactoryStrings.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationStrings.java
Removed:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/EFS.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CGS.java
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/codegen/ExportAntCodeGenWizardPage.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.properties
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterFactory.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterProperty.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenXMLFactory.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationLaunchDelegate.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ExporterSettingsTab.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/HibernateLaunchConstants.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/core/refactoring/HibernateRefactoringUtil.java
Log:
https://jira.jboss.org/browse/JBIDE-6518 - adjust code (different names in code) after
code review
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/codegen/ExportAntCodeGenWizardPage.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/codegen/ExportAntCodeGenWizardPage.java 2010-07-30
17:41:10 UTC (rev 23842)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/codegen/ExportAntCodeGenWizardPage.java 2010-07-30
17:41:49 UTC (rev 23843)
@@ -143,13 +143,12 @@
if (lc == null) {
return null;
}
- CodeGenXMLFactory cgfXML = new CodeGenXMLFactory(lc);
- Element rootBuildXml = cgfXML.createRoot();
+ final CodeGenXMLFactory codeGenXMLFactory = new CodeGenXMLFactory(lc);
+ Element rootBuildXml = codeGenXMLFactory.createRoot();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ConfigurationXMLFactory.dump(baos, rootBuildXml);
- String baosResult = CodeGenXMLFactory.replaceString(baos.toString(),
- cgfXML.getPropFileContentStubUID(), cgfXML.getPropFileContentPreSave());
- //
+ String baosResult = baos.toString().replace(
+ codeGenXMLFactory.getPropFileContentStubUID(),
codeGenXMLFactory.getPropFileContentPreSave());
ByteArrayInputStream bais = null;
try {
bais = new ByteArrayInputStream(baosResult.getBytes("UTF-8"));
//$NON-NLS-1$
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.properties
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.properties 2010-07-30
17:41:10 UTC (rev 23842)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.properties 2010-07-30
17:41:49 UTC (rev 23843)
@@ -517,7 +517,7 @@
AddRemoveTableComposite_control_depth_level=depth control
ExportAntCodeGenWizard_title=Export Hibernate Code Generation Configuration to Ant
Script
-ExportAntCodeGenWizard_description=Export Hibernate Code Generation Configuration to Ant
Script \n(create Ant build.xml)
+ExportAntCodeGenWizard_description=Export Hibernate Code Generation Configuration to Ant
Script \n(create Ant build file)
ExportAntCodeGenWizard_page_name=Export Hibernate Code Generation Configuration to Ant
Script
ExportAntCodeGenWizardPage_hibernate_code_generation_configurations=Hibernate Code
Generation Configurations:
ExportAntCodeGenWizardPage_empty_hibernate_code_generation_configuration=Hibernate Code
Generation Configuration is empty
Deleted:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/EFS.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/EFS.java 2010-07-30
17:41:10 UTC (rev 23842)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/EFS.java 2010-07-30
17:41:49 UTC (rev 23843)
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.hibernate.eclipse.console.model.impl;
-
-/**
- * ExporterFactory strings
- *
- * @author vitali
- */
-public class EFS {
- //
- public static final String OUTPUTDIR = "outputdir"; //$NON-NLS-1$
- public static final String TEMPLATE_PATH = "template_path"; //$NON-NLS-1$
- public static final String FILE_PATTERN = "file_pattern"; //$NON-NLS-1$
- public static final String TEMPLATE_NAME = "template_name"; //$NON-NLS-1$
- public static final String FOR_EACH = "for_each"; //$NON-NLS-1$
- public static final String EXPORTTODATABASE = "exportToDatabase";
//$NON-NLS-1$
-}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterFactory.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterFactory.java 2010-07-30
17:41:10 UTC (rev 23842)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterFactory.java 2010-07-30
17:41:49 UTC (rev 23843)
@@ -184,8 +184,8 @@
extractExporterProperties(exporterId, props, extract);
String outputPath = defaultOutputDirectory;
- if (extract.containsKey(EFS.OUTPUTDIR)) {
- outputPath = extract.getProperty(EFS.OUTPUTDIR);
+ if (extract.containsKey(ExporterFactoryStrings.OUTPUTDIR)) {
+ outputPath = extract.getProperty(ExporterFactoryStrings.OUTPUTDIR);
}
String resolvedOutputDir = resolve(outputPath);
@@ -204,8 +204,8 @@
exporter.setConfiguration(cfg);
List<String> templatePathList = new ArrayList<String>();
- if (extract.containsKey(EFS.TEMPLATE_PATH)) {
- String resolveTemplatePath = resolve(extract.getProperty(EFS.TEMPLATE_PATH));
+ if (extract.containsKey(ExporterFactoryStrings.TEMPLATE_PATH)) {
+ String resolveTemplatePath =
resolve(extract.getProperty(ExporterFactoryStrings.TEMPLATE_PATH));
StringTokenizer st = new StringTokenizer(resolveTemplatePath, ";");
//$NON-NLS-1$
String out = ""; //$NON-NLS-1$
while (st.hasMoreTokens()) {
@@ -245,15 +245,15 @@
// special handling for GenericExporter (TODO: be delegated via plugin.xml)
if (exporterId.equals("org.hibernate.tools.hbmtemplate")) { //$NON-NLS-1$
GenericExporter ge = (GenericExporter) exporter;
- ge.setFilePattern(extract.getProperty(EFS.FILE_PATTERN));
- ge.setTemplateName(extract.getProperty(EFS.TEMPLATE_NAME));
- ge.setForEach(extract.getProperty(EFS.FOR_EACH));
+ ge.setFilePattern(extract.getProperty(ExporterFactoryStrings.FILE_PATTERN));
+ ge.setTemplateName(extract.getProperty(ExporterFactoryStrings.TEMPLATE_NAME));
+ ge.setForEach(extract.getProperty(ExporterFactoryStrings.FOR_EACH));
}
// special handling for Hbm2DDLExporter
if (exporterId.equals("org.hibernate.tools.hbm2ddl")) { //$NON-NLS-1$
Hbm2DDLExporter ddlExporter = (Hbm2DDLExporter) exporter;
//avoid users to delete their databases with a single click
- ddlExporter.setExport(Boolean.getBoolean(extract.getProperty(EFS.EXPORTTODATABASE)));
+ ddlExporter.setExport(Boolean.getBoolean(extract.getProperty(ExporterFactoryStrings.EXPORTTODATABASE)));
}
return exporter;
}
@@ -268,38 +268,38 @@
*/
public static void extractExporterProperties(
String exporterId, Properties props, Properties extract) throws CoreException {
- if (props.containsKey(EFS.OUTPUTDIR)) {
- extract.put(EFS.OUTPUTDIR, resolve(props.getProperty(EFS.OUTPUTDIR)));
+ if (props.containsKey(ExporterFactoryStrings.OUTPUTDIR)) {
+ extract.put(ExporterFactoryStrings.OUTPUTDIR,
resolve(props.getProperty(ExporterFactoryStrings.OUTPUTDIR)));
// done to avoid validation check in hibernate tools templates
- props.remove(EFS.OUTPUTDIR);
+ props.remove(ExporterFactoryStrings.OUTPUTDIR);
}
- if (props.containsKey(EFS.TEMPLATE_PATH)) {
- extract.put(EFS.TEMPLATE_PATH, resolve(props.getProperty(EFS.TEMPLATE_PATH)));
+ if (props.containsKey(ExporterFactoryStrings.TEMPLATE_PATH)) {
+ extract.put(ExporterFactoryStrings.TEMPLATE_PATH,
resolve(props.getProperty(ExporterFactoryStrings.TEMPLATE_PATH)));
// done to avoid validation check in hibernate tools templates
- props.remove(EFS.TEMPLATE_PATH);
+ props.remove(ExporterFactoryStrings.TEMPLATE_PATH);
}
if (exporterId.equals("org.hibernate.tools.hbmtemplate")) { //$NON-NLS-1$
String tmp;
- if (props.containsKey(EFS.FILE_PATTERN)) {
- tmp = props.getProperty(EFS.FILE_PATTERN, ""); //$NON-NLS-1$
- extract.put(EFS.FILE_PATTERN, tmp);
- props.remove(EFS.FILE_PATTERN);
+ if (props.containsKey(ExporterFactoryStrings.FILE_PATTERN)) {
+ tmp = props.getProperty(ExporterFactoryStrings.FILE_PATTERN, "");
//$NON-NLS-1$
+ extract.put(ExporterFactoryStrings.FILE_PATTERN, tmp);
+ props.remove(ExporterFactoryStrings.FILE_PATTERN);
}
- if (props.containsKey(EFS.TEMPLATE_NAME)) {
- tmp = props.getProperty(EFS.TEMPLATE_NAME, ""); //$NON-NLS-1$
- extract.put(EFS.TEMPLATE_NAME, tmp);
- props.remove(EFS.TEMPLATE_NAME);
+ if (props.containsKey(ExporterFactoryStrings.TEMPLATE_NAME)) {
+ tmp = props.getProperty(ExporterFactoryStrings.TEMPLATE_NAME, "");
//$NON-NLS-1$
+ extract.put(ExporterFactoryStrings.TEMPLATE_NAME, tmp);
+ props.remove(ExporterFactoryStrings.TEMPLATE_NAME);
}
- if (props.containsKey(EFS.FOR_EACH)) {
- tmp = props.getProperty(EFS.FOR_EACH, ""); //$NON-NLS-1$
- extract.put(EFS.FOR_EACH, tmp);
- props.remove(EFS.FOR_EACH);
+ if (props.containsKey(ExporterFactoryStrings.FOR_EACH)) {
+ tmp = props.getProperty(ExporterFactoryStrings.FOR_EACH, "");
//$NON-NLS-1$
+ extract.put(ExporterFactoryStrings.FOR_EACH, tmp);
+ props.remove(ExporterFactoryStrings.FOR_EACH);
}
}
// special handling for Hbm2DDLExporter
if (exporterId.equals("org.hibernate.tools.hbm2ddl")) { //$NON-NLS-1$
- extract.put(EFS.EXPORTTODATABASE, props.getProperty(EFS.EXPORTTODATABASE,
Boolean.toString(false)));
- props.remove(EFS.EXPORTTODATABASE);
+ extract.put(ExporterFactoryStrings.EXPORTTODATABASE,
props.getProperty(ExporterFactoryStrings.EXPORTTODATABASE, Boolean.toString(false)));
+ props.remove(ExporterFactoryStrings.EXPORTTODATABASE);
}
}
}
Copied:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterFactoryStrings.java
(from rev 23797,
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/EFS.java)
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterFactoryStrings.java
(rev 0)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterFactoryStrings.java 2010-07-30
17:41:49 UTC (rev 23843)
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.hibernate.eclipse.console.model.impl;
+
+/**
+ * ExporterFactory strings
+ *
+ * @author vitali
+ */
+public interface ExporterFactoryStrings {
+ //
+ public static final String OUTPUTDIR = "outputdir"; //$NON-NLS-1$
+ public static final String TEMPLATE_PATH = "template_path"; //$NON-NLS-1$
+ public static final String FILE_PATTERN = "file_pattern"; //$NON-NLS-1$
+ public static final String TEMPLATE_NAME = "template_name"; //$NON-NLS-1$
+ public static final String FOR_EACH = "for_each"; //$NON-NLS-1$
+ public static final String EXPORTTODATABASE = "exportToDatabase";
//$NON-NLS-1$
+}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterProperty.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterProperty.java 2010-07-30
17:41:10 UTC (rev 23842)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterProperty.java 2010-07-30
17:41:49 UTC (rev 23843)
@@ -22,13 +22,13 @@
package org.hibernate.eclipse.console.model.impl;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
-import org.hibernate.eclipse.launch.CGS;
+import org.hibernate.eclipse.launch.CodeGenerationStrings;
public class ExporterProperty
{
private static ExporterProperty[] globalProperties = new ExporterProperty[] {
- new ExporterProperty (CGS.JDK5,
HibernateConsoleMessages.ExporterProperty_use_java5_syntax, "false", false),
//$NON-NLS-1$
- new ExporterProperty (CGS.EJB3,
HibernateConsoleMessages.ExporterProperty_generate_ejb3_annotations, "false",
false) //$NON-NLS-1$
+ new ExporterProperty (CodeGenerationStrings.JDK5,
HibernateConsoleMessages.ExporterProperty_use_java5_syntax, "false", false),
//$NON-NLS-1$
+ new ExporterProperty (CodeGenerationStrings.EJB3,
HibernateConsoleMessages.ExporterProperty_generate_ejb3_annotations, "false",
false) //$NON-NLS-1$
};
private String defaultValue;
Deleted:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CGS.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CGS.java 2010-07-30
17:41:10 UTC (rev 23842)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CGS.java 2010-07-30
17:41:49 UTC (rev 23843)
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.hibernate.eclipse.launch;
-
-/**
- * XML Ant code generation strings
- *
- * @author vitali
- */
-public class CGS {
- //
- public static final String ID = "id"; //$NON-NLS-1$
- public static final String NAME = "name"; //$NON-NLS-1$
- public static final String DEPENDS = "depends"; //$NON-NLS-1$
- public static final String KEY = "key"; //$NON-NLS-1$
- public static final String VALUE = "value"; //$NON-NLS-1$
- public static final String LOCATION = "location"; //$NON-NLS-1$
- public static final String DEFAULT = "default"; //$NON-NLS-1$
- public static final String PATH = "path"; //$NON-NLS-1$
- public static final String PATHELEMENT = "pathelement"; //$NON-NLS-1$
- public static final String PROPERTY = "property"; //$NON-NLS-1$
- public static final String PROJECT = "project"; //$NON-NLS-1$
- public static final String TARGET = "target"; //$NON-NLS-1$
- public static final String TASKDEF = "taskdef"; //$NON-NLS-1$
- public static final String CLASSNAME = "classname"; //$NON-NLS-1$
- public static final String CLASSPATH = "classpath"; //$NON-NLS-1$
- public static final String CLASSPATHREF = "classpathref"; //$NON-NLS-1$
- public static final String DESTDIR = "destdir"; //$NON-NLS-1$
- public static final String TEMPLATEPATH = "templatepath"; //$NON-NLS-1$
- public static final String EJB3 = "ejb3"; //$NON-NLS-1$
- public static final String JDK5 = "jdk5"; //$NON-NLS-1$
- public static final String HIBERNATETOOL = "hibernatetool"; //$NON-NLS-1$
- public static final String ECHO = "echo"; //$NON-NLS-1$
- public static final String FILE = "file"; //$NON-NLS-1$
-}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenXMLFactory.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenXMLFactory.java 2010-07-30
17:41:10 UTC (rev 23842)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenXMLFactory.java 2010-07-30
17:41:49 UTC (rev 23843)
@@ -28,7 +28,7 @@
import org.eclipse.datatools.connectivity.drivers.DriverInstance;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.hibernate.cfg.Environment;
-import org.hibernate.console.CFS;
+import org.hibernate.console.ConfigurationXMLStrings;
import org.hibernate.console.ConfigurationXMLFactory;
import org.hibernate.console.ConnectionProfileUtil;
import org.hibernate.console.ConsoleConfiguration;
@@ -72,32 +72,32 @@
}
Properties props = new Properties();
if (attributes.isReverseEngineer()) {
- props.setProperty(CFS.ISREVENG, Boolean.toString(attributes.isReverseEngineer()));
- props.setProperty(CFS.PACKAGENAME, attributes.getPackageName());
- props.setProperty(CFS.PREFERBASICCOMPOSITEIDS,
Boolean.toString(attributes.isPreferBasicCompositeIds()));
- props.setProperty(CFS.DETECTMANYTOMANY,
Boolean.toString(attributes.detectManyToMany()));
- props.setProperty(CFS.DETECTONTTOONE, Boolean.toString(attributes.detectOneToOne()));
- props.setProperty(CFS.DETECTOPTIMISTICLOCK,
Boolean.toString(attributes.detectOptimisticLock()));
- props.setProperty(CFS.REVERSESTRATEGY, attributes.getRevengStrategy());
+ props.setProperty(ConfigurationXMLStrings.ISREVENG,
Boolean.toString(attributes.isReverseEngineer()));
+ props.setProperty(ConfigurationXMLStrings.PACKAGENAME, attributes.getPackageName());
+ props.setProperty(ConfigurationXMLStrings.PREFERBASICCOMPOSITEIDS,
Boolean.toString(attributes.isPreferBasicCompositeIds()));
+ props.setProperty(ConfigurationXMLStrings.DETECTMANYTOMANY,
Boolean.toString(attributes.detectManyToMany()));
+ props.setProperty(ConfigurationXMLStrings.DETECTONTTOONE,
Boolean.toString(attributes.detectOneToOne()));
+ props.setProperty(ConfigurationXMLStrings.DETECTOPTIMISTICLOCK,
Boolean.toString(attributes.detectOptimisticLock()));
+ props.setProperty(ConfigurationXMLStrings.REVERSESTRATEGY,
attributes.getRevengStrategy());
String revEngFile = getResLocation(attributes.getRevengSettings());
- props.setProperty(CFS.REVENGFILE, revEngFile);
+ props.setProperty(ConfigurationXMLStrings.REVENGFILE, revEngFile);
}
String consoleConfigName = attributes.getConsoleConfigurationName();
ConsoleConfigurationPreferences consoleConfigPrefs =
getConsoleConfigPreferences(consoleConfigName);
- ConfigurationXMLFactory csfXML = new ConfigurationXMLFactory(
+ final ConfigurationXMLFactory configurationXMLFactory = new ConfigurationXMLFactory(
consoleConfigPrefs, props);
- Element rootConsoleConfig = csfXML.createRoot();
+ Element rootConsoleConfig = configurationXMLFactory.createRoot();
//
- String defaultTargetName = "JdbcCodeGen"; //$NON-NLS-1$
- Element root = DocumentFactory.getInstance().createElement(CGS.PROJECT);
- root.addAttribute(CGS.NAME, "CodeGen"); //$NON-NLS-1$
- root.addAttribute(CGS.DEFAULT, defaultTargetName);
+ String defaultTargetName = "hibernateAntCodeGeneration"; //$NON-NLS-1$
+ Element root =
DocumentFactory.getInstance().createElement(CodeGenerationStrings.PROJECT);
+ root.addAttribute(CodeGenerationStrings.NAME, "CodeGen"); //$NON-NLS-1$
+ root.addAttribute(CodeGenerationStrings.DEFAULT, defaultTargetName);
//
String location = getResLocation(attributes.getOutputPath());
- Element el = root.addElement(CGS.PROPERTY);
- el.addAttribute(CGS.NAME, "build.dir"); //$NON-NLS-1$
- el.addAttribute(CGS.LOCATION, location);
+ Element el = root.addElement(CodeGenerationStrings.PROPERTY);
+ el.addAttribute(CodeGenerationStrings.NAME, "build.dir"); //$NON-NLS-1$
+ el.addAttribute(CodeGenerationStrings.LOCATION, location);
//
String hibernatePropFile = null;
String generateHibernatePropeties = null;
@@ -117,49 +117,49 @@
/**/
//
String driverClass =
driverInstance.getProperty("org.eclipse.datatools.connectivity.db.driverClass");
//$NON-NLS-1$
- el = root.addElement(CGS.PROPERTY);
- el.addAttribute(CGS.NAME, Environment.DRIVER);
- el.addAttribute(CGS.VALUE, driverClass);
+ el = root.addElement(CodeGenerationStrings.PROPERTY);
+ el.addAttribute(CodeGenerationStrings.NAME, Environment.DRIVER);
+ el.addAttribute(CodeGenerationStrings.VALUE, driverClass);
addIntoPropFileContent(propFileContent, Environment.DRIVER);
//
String url =
cpProperties.getProperty("org.eclipse.datatools.connectivity.db.URL");
//$NON-NLS-1$
- el = root.addElement(CGS.PROPERTY);
- el.addAttribute(CGS.NAME, Environment.URL);
- el.addAttribute(CGS.VALUE, url);
+ el = root.addElement(CodeGenerationStrings.PROPERTY);
+ el.addAttribute(CodeGenerationStrings.NAME, Environment.URL);
+ el.addAttribute(CodeGenerationStrings.VALUE, url);
addIntoPropFileContent(propFileContent, Environment.URL);
//
String user =
cpProperties.getProperty("org.eclipse.datatools.connectivity.db.username");
//$NON-NLS-1$
- el = root.addElement(CGS.PROPERTY);
- el.addAttribute(CGS.NAME, Environment.USER);
- el.addAttribute(CGS.VALUE, user);
+ el = root.addElement(CodeGenerationStrings.PROPERTY);
+ el.addAttribute(CodeGenerationStrings.NAME, Environment.USER);
+ el.addAttribute(CodeGenerationStrings.VALUE, user);
addIntoPropFileContent(propFileContent, Environment.USER);
//
String pass =
cpProperties.getProperty("org.eclipse.datatools.connectivity.db.password");
//$NON-NLS-1$
- el = root.addElement(CGS.PROPERTY);
- el.addAttribute(CGS.NAME, Environment.PASS);
- el.addAttribute(CGS.VALUE, pass);
+ el = root.addElement(CodeGenerationStrings.PROPERTY);
+ el.addAttribute(CodeGenerationStrings.NAME, Environment.PASS);
+ el.addAttribute(CodeGenerationStrings.VALUE, pass);
addIntoPropFileContent(propFileContent, Environment.PASS);
//
String dialectName = consoleConfigPrefs.getDialectName();
if (StringHelper.isNotEmpty(dialectName)) {
- el = root.addElement(CGS.PROPERTY);
- el.addAttribute(CGS.NAME, Environment.DIALECT);
- el.addAttribute(CGS.VALUE, dialectName);
+ el = root.addElement(CodeGenerationStrings.PROPERTY);
+ el.addAttribute(CodeGenerationStrings.NAME, Environment.DIALECT);
+ el.addAttribute(CodeGenerationStrings.VALUE, dialectName);
addIntoPropFileContent(propFileContent, Environment.DIALECT);
}
//
hibernatePropFile = "hibernatePropFile"; //$NON-NLS-1$
- el = root.addElement(CGS.PROPERTY);
- el.addAttribute(CGS.NAME, hibernatePropFile);
- el.addAttribute(CGS.VALUE,
"${java.io.tmpdir}${ant.project.name}-hibernate.properties"); //$NON-NLS-1$
+ el = root.addElement(CodeGenerationStrings.PROPERTY);
+ el.addAttribute(CodeGenerationStrings.NAME, hibernatePropFile);
+ el.addAttribute(CodeGenerationStrings.VALUE,
"${java.io.tmpdir}${ant.project.name}-hibernate.properties"); //$NON-NLS-1$
//
generateHibernatePropeties = "generateHibernatePropeties"; //$NON-NLS-1$
- Element target = root.addElement(CGS.TARGET);
- target.addAttribute(CGS.NAME, generateHibernatePropeties);
+ Element target = root.addElement(CodeGenerationStrings.TARGET);
+ target.addAttribute(CodeGenerationStrings.NAME, generateHibernatePropeties);
//
hibernatePropFile = "${" + hibernatePropFile + "}"; //$NON-NLS-1$
//$NON-NLS-2$
- Element echo = target.addElement(CGS.ECHO);
- echo.addAttribute(CGS.FILE, hibernatePropFile);
+ Element echo = target.addElement(CodeGenerationStrings.ECHO);
+ echo.addAttribute(CodeGenerationStrings.FILE, hibernatePropFile);
echo.addText(getPropFileContentStubUID());
//echo.addText(propFileContent.toString());
propFileContentPreSave = propFileContent.toString();
@@ -167,8 +167,8 @@
}
// all jars from libraries should be here
String toolslibID = "toolslib"; //$NON-NLS-1$
- Element toolslib = root.addElement(CGS.PATH);
- toolslib.addAttribute(CGS.ID, toolslibID);
+ Element toolslib = root.addElement(CodeGenerationStrings.PATH);
+ toolslib.addAttribute(CodeGenerationStrings.ID, toolslibID);
final URL[] customClassPathURLs =
PreferencesClassPathUtils.getCustomClassPathURLs(consoleConfigPrefs);
for (int i = 0; i < customClassPathURLs.length; i++) {
if (customClassPathURLs[i] == null) {
@@ -177,7 +177,7 @@
// what is right here: CGS.PATH or CGS.PATHELEMENT?
//
http://www.redhat.com/docs/en-US/JBoss_Developer_Studio/en/hibernatetools...
// use CGS.PATH - so may be error in documentation?
- Element pathItem = toolslib.addElement(CGS.PATH);
+ Element pathItem = toolslib.addElement(CodeGenerationStrings.PATH);
//Element pathItem = toolslib.addElement(CGS.PATHELEMENT);
String strPathItem = customClassPathURLs[i].getPath();
try {
@@ -185,41 +185,41 @@
} catch (URISyntaxException e) {
// ignore
}
- pathItem.addAttribute(CGS.LOCATION, strPathItem);
+ pathItem.addAttribute(CodeGenerationStrings.LOCATION, strPathItem);
}
//
- Element target = root.addElement(CGS.TARGET);
- target.addAttribute(CGS.NAME, defaultTargetName);
+ Element target = root.addElement(CodeGenerationStrings.TARGET);
+ target.addAttribute(CodeGenerationStrings.NAME, defaultTargetName);
if (!isEmpty(generateHibernatePropeties)) {
- target.addAttribute(CGS.DEPENDS, generateHibernatePropeties);
+ target.addAttribute(CodeGenerationStrings.DEPENDS, generateHibernatePropeties);
}
//
- Element taskdef = target.addElement(CGS.TASKDEF);
- taskdef.addAttribute(CGS.NAME, CGS.HIBERNATETOOL);
- taskdef.addAttribute(CGS.CLASSNAME,
"org.hibernate.tool.ant.HibernateToolTask"); //$NON-NLS-1$
- taskdef.addAttribute(CGS.CLASSPATHREF, toolslibID);
+ Element taskdef = target.addElement(CodeGenerationStrings.TASKDEF);
+ taskdef.addAttribute(CodeGenerationStrings.NAME, CodeGenerationStrings.HIBERNATETOOL);
+ taskdef.addAttribute(CodeGenerationStrings.CLASSNAME,
"org.hibernate.tool.ant.HibernateToolTask"); //$NON-NLS-1$
+ taskdef.addAttribute(CodeGenerationStrings.CLASSPATHREF, toolslibID);
//
- Element hibernatetool = target.addElement(CGS.HIBERNATETOOL);
- hibernatetool.addAttribute(CGS.DESTDIR, "${build.dir}"); //$NON-NLS-1$
+ Element hibernatetool = target.addElement(CodeGenerationStrings.HIBERNATETOOL);
+ hibernatetool.addAttribute(CodeGenerationStrings.DESTDIR, "${build.dir}");
//$NON-NLS-1$
String templatePath = getResLocation(attributes.getTemplatePath());
if (attributes.isUseOwnTemplates()) {
- hibernatetool.addAttribute(CGS.TEMPLATEPATH, templatePath);
+ hibernatetool.addAttribute(CodeGenerationStrings.TEMPLATEPATH, templatePath);
}
//
if (StringHelper.isNotEmpty(hibernatePropFile)) {
- rootConsoleConfig.addAttribute(CFS.PROPERTYFILE, hibernatePropFile);
+ rootConsoleConfig.addAttribute(ConfigurationXMLStrings.PROPERTYFILE,
hibernatePropFile);
}
// add hibernate console configuration
hibernatetool.content().add(rootConsoleConfig);
//
// the path there are user classes
- Element classpath = hibernatetool.addElement(CGS.CLASSPATH);
- Element path = classpath.addElement(CGS.PATH);
- path.addAttribute(CGS.LOCATION, "${build.dir}"); //$NON-NLS-1$
+ Element classpath = hibernatetool.addElement(CodeGenerationStrings.CLASSPATH);
+ Element path = classpath.addElement(CodeGenerationStrings.PATH);
+ path.addAttribute(CodeGenerationStrings.LOCATION, "${build.dir}");
//$NON-NLS-1$
//
Properties globalProps = new Properties();
- globalProps.put(CGS.EJB3, "" + attributes.isEJB3Enabled()); //$NON-NLS-1$
- globalProps.put(CGS.JDK5, "" + attributes.isJDK5Enabled()); //$NON-NLS-1$
+ globalProps.put(CodeGenerationStrings.EJB3, "" + attributes.isEJB3Enabled());
//$NON-NLS-1$
+ globalProps.put(CodeGenerationStrings.JDK5, "" + attributes.isJDK5Enabled());
//$NON-NLS-1$
List<ExporterFactory> exporterFactories = attributes.getExporterFactories();
for (Iterator<ExporterFactory> iter = exporterFactories.iterator();
iter.hasNext();) {
ExporterFactory ef = iter.next();
@@ -249,14 +249,14 @@
if ("hbmtemplate".compareToIgnoreCase(expName) == 0 ) { //$NON-NLS-1$
Element property = null;
if (attributes.isJDK5Enabled()) {
- property = exporter.addElement(CGS.PROPERTY);
- property.addAttribute(CGS.KEY, CGS.JDK5);
- property.addAttribute(CGS.VALUE, "" + attributes.isJDK5Enabled());
//$NON-NLS-1$
+ property = exporter.addElement(CodeGenerationStrings.PROPERTY);
+ property.addAttribute(CodeGenerationStrings.KEY, CodeGenerationStrings.JDK5);
+ property.addAttribute(CodeGenerationStrings.VALUE, "" +
attributes.isJDK5Enabled()); //$NON-NLS-1$
}
if (attributes.isEJB3Enabled()) {
- property = exporter.addElement(CGS.PROPERTY);
- property.addAttribute(CGS.KEY, CGS.EJB3);
- property.addAttribute(CGS.VALUE, "" + attributes.isEJB3Enabled());
//$NON-NLS-1$
+ property = exporter.addElement(CodeGenerationStrings.PROPERTY);
+ property.addAttribute(CodeGenerationStrings.KEY, CodeGenerationStrings.EJB3);
+ property.addAttribute(CodeGenerationStrings.VALUE, "" +
attributes.isEJB3Enabled()); //$NON-NLS-1$
}
}
}
@@ -306,17 +306,4 @@
public String getPropFileContentPreSave() {
return propFileContentPreSave;
}
-
- public static String replaceString(String input, String repl, String with) {
- final StringBuffer tmp = new StringBuffer();
- int startIdx = 0;
- int idxOld = 0;
- while ((idxOld = input.indexOf(repl, startIdx)) >= 0) {
- tmp.append(input.substring(startIdx, idxOld));
- tmp.append(with);
- startIdx = idxOld + repl.length();
- }
- tmp.append(input.substring(startIdx));
- return tmp.toString();
- }
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationLaunchDelegate.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationLaunchDelegate.java 2010-07-30
17:41:10 UTC (rev 23842)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationLaunchDelegate.java 2010-07-30
17:41:49 UTC (rev 23843)
@@ -225,8 +225,8 @@
// Global properties
Properties props = new Properties();
- props.put(CGS.EJB3, "" + attributes.isEJB3Enabled());
//$NON-NLS-1$
- props.put(CGS.JDK5, "" + attributes.isJDK5Enabled());
//$NON-NLS-1$
+ props.put(CodeGenerationStrings.EJB3, "" +
attributes.isEJB3Enabled()); //$NON-NLS-1$
+ props.put(CodeGenerationStrings.JDK5, "" +
attributes.isJDK5Enabled()); //$NON-NLS-1$
for (int i = 0; i < exporterFactories.length; i++)
{
Copied:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationStrings.java
(from rev 23797,
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CGS.java)
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationStrings.java
(rev 0)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationStrings.java 2010-07-30
17:41:49 UTC (rev 23843)
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.hibernate.eclipse.launch;
+
+/**
+ * XML Ant code generation strings
+ *
+ * @author vitali
+ */
+public interface CodeGenerationStrings {
+ //
+ public static final String ID = "id"; //$NON-NLS-1$
+ public static final String NAME = "name"; //$NON-NLS-1$
+ public static final String DEPENDS = "depends"; //$NON-NLS-1$
+ public static final String KEY = "key"; //$NON-NLS-1$
+ public static final String VALUE = "value"; //$NON-NLS-1$
+ public static final String LOCATION = "location"; //$NON-NLS-1$
+ public static final String DEFAULT = "default"; //$NON-NLS-1$
+ public static final String PATH = "path"; //$NON-NLS-1$
+ public static final String PATHELEMENT = "pathelement"; //$NON-NLS-1$
+ public static final String PROPERTY = "property"; //$NON-NLS-1$
+ public static final String PROJECT = "project"; //$NON-NLS-1$
+ public static final String TARGET = "target"; //$NON-NLS-1$
+ public static final String TASKDEF = "taskdef"; //$NON-NLS-1$
+ public static final String CLASSNAME = "classname"; //$NON-NLS-1$
+ public static final String CLASSPATH = "classpath"; //$NON-NLS-1$
+ public static final String CLASSPATHREF = "classpathref"; //$NON-NLS-1$
+ public static final String DESTDIR = "destdir"; //$NON-NLS-1$
+ public static final String TEMPLATEPATH = "templatepath"; //$NON-NLS-1$
+ public static final String EJB3 = "ejb3"; //$NON-NLS-1$
+ public static final String JDK5 = "jdk5"; //$NON-NLS-1$
+ public static final String HIBERNATETOOL = "hibernatetool"; //$NON-NLS-1$
+ public static final String ECHO = "echo"; //$NON-NLS-1$
+ public static final String FILE = "file"; //$NON-NLS-1$
+}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ExporterSettingsTab.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ExporterSettingsTab.java 2010-07-30
17:41:10 UTC (rev 23842)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ExporterSettingsTab.java 2010-07-30
17:41:49 UTC (rev 23843)
@@ -88,7 +88,7 @@
import org.hibernate.eclipse.console.ExtensionManager;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
-import org.hibernate.eclipse.console.model.impl.EFS;
+import org.hibernate.eclipse.console.model.impl.ExporterFactoryStrings;
import org.hibernate.eclipse.console.model.impl.ExporterDefinition;
import org.hibernate.eclipse.console.model.impl.ExporterFactory;
import org.hibernate.eclipse.console.utils.EclipseImages;
@@ -799,7 +799,7 @@
// hard-coded checks: this should be delegated to extension point that knows about the
different exporters.
//Iterator iterator = observableFactoryList.getList().iterator(); // check all
exporters
for (ExporterFactory ef : selectedExporters) {// check only selected exporters
- String str = ef.getProperties().get(EFS.OUTPUTDIR);
+ String str = ef.getProperties().get(ExporterFactoryStrings.OUTPUTDIR);
String msg = null;
if(str!=null) {
msg = PathHelper.checkDirectory(str,
HibernateConsoleMessages.ExporterSettingsTab_output_directory_for + " " +
ef.getExporterDefinition().getDescription(), true); //$NON-NLS-1$
@@ -809,7 +809,7 @@
}
}
- str = ef.getProperties().get(EFS.TEMPLATE_PATH);
+ str = ef.getProperties().get(ExporterFactoryStrings.TEMPLATE_PATH);
if(str!=null) {
msg = PathHelper.checkDirectory(str,
HibernateConsoleMessages.ExporterSettingsTab_template_directory_for + " " +
ef.getExporterDefinition().getDescription(), true); //$NON-NLS-1$
if(msg!=null) {
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/HibernateLaunchConstants.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/HibernateLaunchConstants.java 2010-07-30
17:41:10 UTC (rev 23842)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/HibernateLaunchConstants.java 2010-07-30
17:41:49 UTC (rev 23843)
@@ -40,8 +40,8 @@
*/
package org.hibernate.eclipse.launch;
-import org.hibernate.console.CFS;
-import org.hibernate.eclipse.console.model.impl.EFS;
+import org.hibernate.console.ConfigurationXMLStrings;
+import org.hibernate.eclipse.console.model.impl.ExporterFactoryStrings;
public class HibernateLaunchConstants
{
@@ -51,13 +51,13 @@
public static final String ATTR_EXPORTERS = ATTR_PREFIX + "exporters";
//$NON-NLS-1$
public static final String ATTR_CONSOLE_CONFIGURATION_NAME = ATTR_PREFIX +
"configurationname"; //$NON-NLS-1$
- public static final String ATTR_OUTPUT_DIR = ATTR_PREFIX + EFS.OUTPUTDIR;
+ public static final String ATTR_OUTPUT_DIR = ATTR_PREFIX +
ExporterFactoryStrings.OUTPUTDIR;
public static final String ATTR_REVERSE_ENGINEER = ATTR_PREFIX +
"schema2hbm"; //$NON-NLS-1$
- public static final String ATTR_REVERSE_ENGINEER_SETTINGS = ATTR_PREFIX +
CFS.REVENGFILE;
+ public static final String ATTR_REVERSE_ENGINEER_SETTINGS = ATTR_PREFIX +
ConfigurationXMLStrings.REVENGFILE;
public static final String ATTR_REVERSE_ENGINEER_STRATEGY = ATTR_PREFIX +
"revengstrategy"; //$NON-NLS-1$
public static final String ATTR_USE_OWN_TEMPLATES = ATTR_PREFIX +
"useOwnTemplates"; //$NON-NLS-1$
- public static final String ATTR_ENABLE_EJB3_ANNOTATIONS = ATTR_PREFIX + CGS.EJB3;
- public static final String ATTR_ENABLE_JDK5 = ATTR_PREFIX + CGS.JDK5;
+ public static final String ATTR_ENABLE_EJB3_ANNOTATIONS = ATTR_PREFIX +
CodeGenerationStrings.EJB3;
+ public static final String ATTR_ENABLE_JDK5 = ATTR_PREFIX +
CodeGenerationStrings.JDK5;
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$
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/core/refactoring/HibernateRefactoringUtil.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/core/refactoring/HibernateRefactoringUtil.java 2010-07-30
17:41:10 UTC (rev 23842)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/core/refactoring/HibernateRefactoringUtil.java 2010-07-30
17:41:49 UTC (rev 23843)
@@ -50,7 +50,7 @@
import org.eclipse.ltk.core.refactoring.CompositeChange;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
-import org.hibernate.eclipse.console.model.impl.EFS;
+import org.hibernate.eclipse.console.model.impl.ExporterFactoryStrings;
import org.hibernate.eclipse.console.utils.LaunchHelper;
import org.hibernate.eclipse.launch.HibernateLaunchConstants;
import org.hibernate.eclipse.launch.IConsoleConfigurationLaunchConstants;
@@ -127,7 +127,7 @@
@SuppressWarnings("unchecked")
private static boolean isExportersAffected(ILaunchConfiguration config,
IPath oldPath) throws CoreException {
- String[] k = new String[]{EFS.OUTPUTDIR};
+ String[] k = new String[]{ExporterFactoryStrings.OUTPUTDIR};
List<String> exporterNames =
config.getAttribute(HibernateLaunchConstants.ATTR_EXPORTERS, Collections.EMPTY_LIST);
for (String exporterName : exporterNames) {
Map<String, String> props =
config.getAttribute(HibernateLaunchConstants.ATTR_EXPORTERS + '.' +
@@ -230,7 +230,7 @@
@SuppressWarnings("unchecked")
private static void updateExporters(IPath oldPath, IPath newPath,
ILaunchConfigurationWorkingCopy wc) throws CoreException {
- String[] keys = new String[]{EFS.OUTPUTDIR};
+ String[] keys = new String[]{ExporterFactoryStrings.OUTPUTDIR};
List<String> exporterNames =
wc.getAttribute(HibernateLaunchConstants.ATTR_EXPORTERS, Collections.EMPTY_LIST);
for (String exporterName : exporterNames) {
String exporterProp = HibernateLaunchConstants.ATTR_EXPORTERS + '.' +