[jbosstools-commits] JBoss Tools SVN: r23272 - in trunk/hibernatetools: plugins/org.hibernate.eclipse/src/org/hibernate/console and 12 other directories.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Wed Jul 7 08:53:59 EDT 2010
Author: vyemialyanchyk
Date: 2010-07-07 08:53:56 -0400 (Wed, 07 Jul 2010)
New Revision: 23272
Added:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/icons/images/ant_codegen_export.gif
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/codegen/
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/codegen/ExportAntCodeGenWizard.java
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/launch/CodeGenXMLFactory.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationXMLFactory.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/AntCodeGenReveng_test1.xml
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/AntCodeGenReveng_test2.xml
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/AntCodeGen_test1.xml
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/AntCodeGen_test2.xml
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/CodeGenXMLFactoryTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/launchcfg/
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/launchcfg/TestConsoleConfigurationPreferences.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/launchcfg/TestLaunchConfig.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/launchcfg/TestWorkingCopy.java
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/plugin.properties
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/plugin.xml
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.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/ExporterDefinition.java
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/launch/ExporterAttributes.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/.classpath
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/eclipse/HibernatePlugin.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsoleConfigurationTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/QueryParametersTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/RefactoringTest.java
Log:
https://jira.jboss.org/browse/JBIDE-6518 - initial implementation Ant codegen export
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse/.classpath
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse/.classpath 2010-07-07 08:43:22 UTC (rev 23271)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/.classpath 2010-07-07 12:53:56 UTC (rev 23272)
@@ -6,7 +6,7 @@
<classpathentry exported="true" kind="lib" path="lib/hibernate/asm.jar"/>
<classpathentry exported="true" kind="lib" path="lib/hibernate/asm-attrs.jar"/>
<classpathentry exported="true" kind="lib" path="lib/hibernate/dom4j-1.6.1.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/hibernate/hibernate3.jar" sourcepath="C:/Temp/_hibernate/hibernate-core-3.3.2.GA-sources.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/hibernate/hibernate3.jar"/>
<classpathentry exported="true" kind="lib" path="lib/hibernate/jboss-cache.jar"/>
<classpathentry exported="true" kind="lib" path="lib/hibernate/jboss-common.jar"/>
<classpathentry exported="true" kind="lib" path="lib/hibernate/jboss-jmx.jar"/>
@@ -21,13 +21,13 @@
<classpathentry exported="true" kind="lib" path="lib/annotations/hibernate-annotations.jar"/>
<classpathentry exported="true" kind="lib" path="lib/hibernate/jgroups-2.2.8.jar"/>
<classpathentry exported="true" kind="lib" path="lib/hibernate/antlr-2.7.6.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/annotations/hibernate-entitymanager.jar" sourcepath="C:/Temp/_hibernate/hibernate-entitymanager-3.4.0.GA-sources.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/annotations/hibernate-entitymanager.jar"/>
<classpathentry exported="true" kind="lib" path="lib/hibernate/javassist.jar"/>
<classpathentry exported="true" kind="lib" path="lib/annotations/hibernate-validator.jar"/>
<classpathentry exported="true" kind="lib" path="lib/hibernate/log4j-1.2.15.jar"/>
<classpathentry exported="true" kind="lib" path="lib/hibernate/hibernate-jmx.jar"/>
<classpathentry exported="true" kind="lib" path="lib/hibernate/commons-collections-3.1.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/hibernate/slf4j-api-1.5.8.jar" sourcepath="D:/Temp/_hibernate/slf4j-api-1.5.8-sources.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/hibernate/slf4j-api-1.5.8.jar"/>
<classpathentry exported="true" kind="lib" path="lib/hibernate/cglib-2.2.jar"/>
<classpathentry exported="true" kind="lib" path="lib/annotations/hibernate-commons-annotations.jar"/>
<classpathentry exported="true" kind="lib" path="lib/annotations/ejb3-persistence.jar"/>
Added: trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationXMLFactory.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationXMLFactory.java (rev 0)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationXMLFactory.java 2010-07-07 12:53:56 UTC (rev 23272)
@@ -0,0 +1,143 @@
+/*******************************************************************************
+ * 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.console;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Properties;
+
+import org.dom4j.Document;
+import org.dom4j.DocumentFactory;
+import org.dom4j.Element;
+import org.dom4j.io.OutputFormat;
+import org.dom4j.io.XMLWriter;
+import org.hibernate.console.preferences.ConsoleConfigurationPreferences;
+import org.hibernate.console.preferences.ConsoleConfigurationPreferences.ConfigurationMode;
+import org.hibernate.util.StringHelper;
+
+/**
+ * XML document part creation factory,
+ * responsible for creation Hibernate Configuration part for
+ * Hibernate Tools core Ant code generation.
+ *
+ * @author Vitali Yemialyanchyk
+ */
+public class ConfigurationXMLFactory {
+ protected ConsoleConfigurationPreferences prefs;
+ protected Properties additional;
+
+ public ConfigurationXMLFactory(ConsoleConfigurationPreferences prefs, Properties additional) {
+ this.prefs = prefs;
+ this.additional = additional;
+ }
+
+ public ConsoleConfigurationPreferences getPreferences() {
+ return prefs;
+ }
+
+ public Document createXML(boolean includeMappings) {
+ Document res = DocumentFactory.getInstance().createDocument();
+ Element root = createRoot(includeMappings);
+ res.setRootElement(root);
+ return res;
+ }
+
+ public Element createRoot(boolean includeMappings) {
+ Properties properties = prefs.getProperties();
+ Element root = createRoot(properties, includeMappings);
+ return root;
+ }
+
+ protected Element createRoot(Properties properties, boolean includeMappings) {
+ String rootName = null;
+ Boolean jdbcConfig = Boolean.valueOf(additional.getProperty("isRevEng", "false")); //$NON-NLS-1$ //$NON-NLS-2$
+ if (jdbcConfig) {
+ rootName = "jdbcconfiguration"; //$NON-NLS-1$
+ } else if (prefs.getConfigurationMode().equals(ConfigurationMode.ANNOTATIONS)) {
+ rootName = "annotationconfiguration"; //$NON-NLS-1$
+ } else if (prefs.getConfigurationMode().equals(ConfigurationMode.JPA)) {
+ rootName = "jpaconfiguration"; //$NON-NLS-1$
+ } else if (prefs.getConfigurationMode().equals(ConfigurationMode.CORE)) {
+ rootName = "configuration"; //$NON-NLS-1$
+ } else {
+ rootName = "undef"; //$NON-NLS-1$
+ }
+ Element root = DocumentFactory.getInstance().createElement(rootName);
+ final String configurationFile = getPreferences().getConfigXMLFile() == null ? null :
+ getPreferences().getConfigXMLFile().toString();
+ if (!StringHelper.isEmpty(configurationFile)) {
+ root.addAttribute("configurationFile", configurationFile); //$NON-NLS-1$
+ }
+ final String propertyFile = getPreferences().getPropertyFile() == null ? null :
+ getPreferences().getPropertyFile().toString();
+ if (!StringHelper.isEmpty(propertyFile)) {
+ root.addAttribute("propertyFile", propertyFile); //$NON-NLS-1$
+ }
+ final String entityResolver = getPreferences().getEntityResolverName();
+ if (!StringHelper.isEmpty(entityResolver)) {
+ root.addAttribute("entityResolver", entityResolver); //$NON-NLS-1$
+ }
+ final String persistenceUnit = getPreferences().getPersistenceUnitName();
+ if (!StringHelper.isEmpty(persistenceUnit)) {
+ root.addAttribute("persistenceUnit", persistenceUnit); //$NON-NLS-1$
+ }
+ final String detectManyToMany = additional.getProperty("detectManyToMany", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ if (!StringHelper.isEmpty(detectManyToMany)) {
+ root.addAttribute("detectManyToMany", detectManyToMany); //$NON-NLS-1$
+ }
+ final String detectOneToOne = additional.getProperty("detectOneToOne", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ if (!StringHelper.isEmpty(detectOneToOne)) {
+ root.addAttribute("detectOneToOne", detectOneToOne); //$NON-NLS-1$
+ }
+ final String detectOptimisticLock = additional.getProperty("detectOptimisticLock", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ if (!StringHelper.isEmpty(detectOptimisticLock)) {
+ root.addAttribute("detectOptimisticLock", detectOptimisticLock); //$NON-NLS-1$
+ }
+ final String packageName = additional.getProperty("packageName", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ if (!StringHelper.isEmpty(packageName)) {
+ root.addAttribute("packageName", packageName); //$NON-NLS-1$
+ }
+ final String revEngFile = additional.getProperty("revEngFile", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ if (!StringHelper.isEmpty(revEngFile)) {
+ root.addAttribute("revEngFile", revEngFile); //$NON-NLS-1$
+ }
+ final String reverseStrategy = additional.getProperty("reverseStrategy", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ if (!StringHelper.isEmpty(reverseStrategy)) {
+ root.addAttribute("reverseStrategy", reverseStrategy); //$NON-NLS-1$
+ }
+ if (includeMappings) {
+ Element fileset = root.addElement("fileset"); //$NON-NLS-1$
+ fileset.addAttribute("dir", "./src"); //$NON-NLS-1$ //$NON-NLS-2$
+ fileset.addAttribute("id", "id"); //$NON-NLS-1$ //$NON-NLS-2$
+ Element include = fileset.addElement("include"); //$NON-NLS-1$
+ include.addAttribute("name", "**/*"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ return root;
+ }
+
+ public static void dump(OutputStream os, Element element) {
+ try {
+ // try to "pretty print" it
+ OutputFormat outformat = OutputFormat.createPrettyPrint();
+ XMLWriter writer = new XMLWriter(os, outformat);
+ writer.write(element);
+ writer.flush();
+ } catch (Throwable t) {
+ // otherwise, just dump it
+ try {
+ os.write(element.asXML().getBytes());
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+
+ }
+}
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/eclipse/HibernatePlugin.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/eclipse/HibernatePlugin.java 2010-07-07 08:43:22 UTC (rev 23271)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/eclipse/HibernatePlugin.java 2010-07-07 12:53:56 UTC (rev 23272)
@@ -21,10 +21,15 @@
*/
package org.hibernate.eclipse;
+import java.io.File;
+import java.io.IOException;
import java.net.URL;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Plugin;
import org.hibernate.eclipse.logging.LoggingHelper;
import org.hibernate.eclipse.logging.PluginLogManager;
@@ -32,37 +37,65 @@
/**
* @author max
- *
*/
public class HibernatePlugin extends Plugin {
+ // The shared instance.
+ private static HibernatePlugin plugin;
+
+ /**
+ * The constructor.
+ */
+ public HibernatePlugin() {
+ super();
+ setPlugin(this);
+ }
+
public void start(BundleContext context) throws Exception {
super.start(context);
configureLog4jHooks();
Log log = LogFactory.getLog(HibernatePlugin.class);
- log.info("HibernatePlugin Started"); //$NON-NLS-1$
+ log.info("HibernatePlugin Started"); //$NON-NLS-1$
}
-
+
private void configureLog4jHooks() {
URL entry = getBundle().getEntry("hibernate-log4j.xml"); //$NON-NLS-1$
- if(entry==null) {
- entry = getBundle().getEntry("hibernate-log4j.properties"); //$NON-NLS-1$
+ if (entry == null) {
+ entry = getBundle().getEntry("hibernate-log4j.properties"); //$NON-NLS-1$
}
-
- if(entry==null) {
+
+ if (entry == null) {
// should log this!
} else {
LoggingHelper helper = LoggingHelper.getDefault();
- PluginLogManager manager = new PluginLogManager(this, helper, entry);
+ PluginLogManager manager = new PluginLogManager(this, helper, entry);
}
-
-
-
-
}
public void stop(BundleContext context) throws Exception {
LoggingHelper.getDefault().stop(context);
- super.stop( context );
+ super.stop(context);
+ setPlugin(null);
}
+
+ /**
+ * Returns the shared instance.
+ */
+ public static HibernatePlugin getDefault() {
+ return plugin;
+ }
+
+ private static void setPlugin(HibernatePlugin plugin) {
+ HibernatePlugin.plugin = plugin;
+ }
+
+ public static File getResourceItem(String strResPath) throws IOException {
+ IPath resourcePath = new Path(strResPath);
+ File resourceFolder = resourcePath.toFile();
+ URL entry = getDefault().getBundle().getEntry(strResPath);
+ URL resProject = FileLocator.resolve(entry);
+ String tplPrjLcStr = FileLocator.resolve(resProject).getFile();
+ resourceFolder = new File(tplPrjLcStr);
+ return resourceFolder;
+ }
}
Added: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/icons/images/ant_codegen_export.gif
===================================================================
(Binary files differ)
Property changes on: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/icons/images/ant_codegen_export.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/plugin.properties
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/plugin.properties 2010-07-07 08:43:22 UTC (rev 23271)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/plugin.properties 2010-07-07 12:53:56 UTC (rev 23272)
@@ -9,3 +9,5 @@
Bundle-Vendor.0 = JBoss by Red Hat
Bundle-Name.0 = Hibernate Console
#NavigatorContent_HibernateKnownConfigs=Hibernate Known Configurations
+exportHibernateAntCodeGenerationWizardName=Ant Code Generation
+exportHibernateAntCodeGenerationWizardDescription=Export Hibernate Code Generation Configuration to Ant Code Generation script
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/plugin.xml
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/plugin.xml 2010-07-07 08:43:22 UTC (rev 23271)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/plugin.xml 2010-07-07 12:53:56 UTC (rev 23272)
@@ -749,6 +749,23 @@
label="%GenerateEntities">
</action>-->
</extension>
+ <extension
+ point="org.eclipse.ui.exportWizards">
+ <wizard
+ category="org.hibernate.eclipse.console.HibernateToolsExport"
+ class="org.hibernate.eclipse.codegen.ExportAntCodeGenWizard"
+ icon="icons/images/ant_codegen_export.gif"
+ id="org.hibernate.eclipse.codegen.ExportAntCodeGenWizard"
+ name="%exportHibernateAntCodeGenerationWizardName">
+ <description>
+ %exportHibernateAntCodeGenerationWizardDescription
+ </description>
+ </wizard>
+ <category
+ id="org.hibernate.eclipse.console.HibernateToolsExport"
+ name="Hibernate">
+ </category>
+ </extension>
<!-- <extension
point="org.eclipse.ui.themes">
<themeElementCategory
Added: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/codegen/ExportAntCodeGenWizard.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/codegen/ExportAntCodeGenWizard.java (rev 0)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/codegen/ExportAntCodeGenWizard.java 2010-07-07 12:53:56 UTC (rev 23272)
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * 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.codegen;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.IExportWizard;
+import org.eclipse.ui.IWorkbench;
+import org.hibernate.eclipse.console.HibernateConsoleMessages;
+import org.hibernate.eclipse.console.HibernateConsolePlugin;
+
+/**
+ * Export wizard responsible to generate Ant code generation script
+ * from existing Hibernate Tools code generation launch configuration.
+ *
+ * @author Vitali Yemialyanchyk
+ */
+public class ExportAntCodeGenWizard extends Wizard implements IExportWizard {
+
+ protected ExportAntCodeGenWizardPage exportAntCodeGenWizardPage = null;
+ /**
+ * The workbench.
+ */
+ private IWorkbench workbench;
+ /**
+ * The current selection.
+ */
+ protected IStructuredSelection selection;
+
+ /**
+ * Creates a wizard for creating a new file resource in the workspace.
+ */
+ public ExportAntCodeGenWizard() {
+ setWindowTitle(HibernateConsoleMessages.ExportAntCodeGenWizard_title);
+ ImageDescriptor descriptor = HibernateConsolePlugin.getImageDescriptor("icons/images/newhibernate_wiz.gif"); //$NON-NLS-1$
+ setDefaultPageImageDescriptor(descriptor);
+ }
+
+ /* (non-Javadoc)
+ * Method declared on IWizard.
+ */
+ public boolean performFinish() {
+ IFile file = exportAntCodeGenWizardPage.createNewFile();
+ if (file == null || file.getParent() == null) {
+ return false;
+ }
+ try {
+ file.getParent().refreshLocal(IResource.DEPTH_ZERO, null);
+ } catch (CoreException e) {
+ HibernateConsolePlugin.getDefault()
+ .logErrorMessage("Refresh parent: ", e); //$NON-NLS-1$
+ }
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * Method declared on IWizard.
+ */
+ public void addPages() {
+ exportAntCodeGenWizardPage = new ExportAntCodeGenWizardPage(
+ HibernateConsoleMessages.ExportAntCodeGenWizard_page_name, getSelection());
+ exportAntCodeGenWizardPage.setTitle(HibernateConsoleMessages.ExportAntCodeGenWizard_title);
+ exportAntCodeGenWizardPage.setDescription(HibernateConsoleMessages.ExportAntCodeGenWizard_description);
+ exportAntCodeGenWizardPage.setFileExtension("xml"); //$NON-NLS-1$
+ addPage(exportAntCodeGenWizardPage);
+ }
+
+ /* (non-Javadoc)
+ * Method declared on IWorkbenchWizard.
+ */
+ public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
+ this.workbench = workbench;
+ this.selection = currentSelection;
+ setWindowTitle(HibernateConsoleMessages.ExportAntCodeGenWizard_title);
+ ImageDescriptor descriptor = HibernateConsolePlugin.getImageDescriptor("icons/images/newhibernate_wiz.gif"); //$NON-NLS-1$
+ setDefaultPageImageDescriptor(descriptor);
+ }
+
+ /**
+ * Returns the selection which was passed to <code>init</code>.
+ *
+ * @return the selection
+ */
+ public IStructuredSelection getSelection() {
+ return selection;
+ }
+
+ /**
+ * Returns the workbench which was passed to <code>init</code>.
+ *
+ * @return the workbench
+ */
+ public IWorkbench getWorkbench() {
+ return workbench;
+ }
+}
Added: 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 (rev 0)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/codegen/ExportAntCodeGenWizardPage.java 2010-07-07 12:53:56 UTC (rev 23272)
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ * 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.codegen;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+
+import org.dom4j.Element;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+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;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
+import org.hibernate.console.ConfigurationXMLFactory;
+import org.hibernate.eclipse.console.HibernateConsoleMessages;
+import org.hibernate.eclipse.console.HibernateConsolePlugin;
+import org.hibernate.eclipse.console.utils.LaunchHelper;
+import org.hibernate.eclipse.launch.CodeGenXMLFactory;
+
+/**
+ * @author Vitali Yemialyanchyk
+ */
+ at SuppressWarnings("restriction")
+public class ExportAntCodeGenWizardPage extends WizardNewFileCreationPage implements Listener {
+
+ protected ComboDialogField consoleConfigurationName;
+
+ /**
+ * Creates a new file creation (Ant code generation) wizard page.
+ * If the initial resource selection contains exactly one
+ * container resource then it will be used as
+ * the default container resource.
+ *
+ * @param pageName
+ * the name of the page
+ * @param selection
+ * the current resource selection
+ */
+ public ExportAntCodeGenWizardPage(String pageName,
+ IStructuredSelection selection) {
+ super(pageName, selection);
+ setPageComplete(false);
+ }
+
+ /**
+ * @see #setControl(Control)
+ */
+ protected void setControl(Control newControl) {
+ newControl.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL
+ | GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
+ super.setControl(newControl);
+ }
+
+ /**
+ * @see #createControl(Composite)
+ */
+ public void createControl(Composite parent) {
+ initializeDialogUnits(parent);
+ Composite topLevel = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ layout.marginWidth = 0;
+ topLevel.setLayout(layout);
+ topLevel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL
+ | GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
+ topLevel.setFont(parent.getFont());
+ setControlCombo(topLevel);
+ super.createControl(topLevel);
+ setControl(topLevel);
+ }
+
+ protected void setControlCombo(Control newControl) {
+ consoleConfigurationName = new ComboDialogField(SWT.READ_ONLY);
+ consoleConfigurationName.setLabelText(
+ HibernateConsoleMessages.ExportAntCodeGenWizardPage_hibernate_code_generation_configurations);
+ ILaunchConfiguration[] launchCfgs;
+ try {
+ launchCfgs = LaunchHelper.findFilteredCodeGenerationConfigs();
+ } catch (CoreException e) {
+ launchCfgs = new ILaunchConfiguration[0];
+ }
+ String[] names = new String[launchCfgs.length];
+ for (int i = 0; i < launchCfgs.length; i++) {
+ ILaunchConfiguration launchCfg = launchCfgs[i];
+ names[i] = launchCfg.getName();
+ }
+ consoleConfigurationName.setItems(names);
+ IDialogFieldListener fieldlistener = new IDialogFieldListener() {
+ public void dialogFieldChanged(DialogField field) {
+ setPageComplete(validatePage());
+ }
+ };
+ consoleConfigurationName.setDialogFieldListener(fieldlistener);
+ consoleConfigurationName.doFillIntoGrid((Composite)newControl, 2);
+ }
+
+ /**
+ * @see #validatePage()
+ */
+ protected boolean validatePage() {
+ boolean res = super.validatePage();
+ if (res) {
+ if (consoleConfigurationName.getSelectionIndex() == -1) {
+ setErrorMessage(HibernateConsoleMessages.ExportAntCodeGenWizardPage_empty_hibernate_code_generation_configuration);
+ res = false;
+ }
+ }
+ return res;
+ }
+
+ public ILaunchConfiguration getSelectedLaunchConfig() {
+ ILaunchConfiguration[] launchCfgs;
+ try {
+ launchCfgs = LaunchHelper.findFilteredCodeGenerationConfigs();
+ } catch (CoreException e) {
+ launchCfgs = new ILaunchConfiguration[0];
+ }
+ int n = consoleConfigurationName.getSelectionIndex();
+ if (0 <= n && n < launchCfgs.length) {
+ return launchCfgs[n];
+ }
+ return null;
+ }
+
+ protected InputStream getInitialContents() {
+ ILaunchConfiguration lc = getSelectedLaunchConfig();
+ if (lc == null) {
+ return null;
+ }
+ CodeGenXMLFactory cgfXML = new CodeGenXMLFactory(lc);
+ Element rootBuildXml = cgfXML.createRoot();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ConfigurationXMLFactory.dump(baos, rootBuildXml);
+ //
+ ByteArrayInputStream bais = null;
+ try {
+ bais = new ByteArrayInputStream(baos.toString().getBytes("UTF-8")); //$NON-NLS-1$
+ } catch (UnsupportedEncodingException uec) {
+ HibernateConsolePlugin.getDefault()
+ .logErrorMessage("Problems converting to UTF-8", uec); //$NON-NLS-1$
+ bais = new ByteArrayInputStream(baos.toString().getBytes());
+ }
+ return bais;
+ }
+}
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.java 2010-07-07 08:43:22 UTC (rev 23271)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.java 2010-07-07 12:53:56 UTC (rev 23272)
@@ -515,6 +515,12 @@
public static String AddRemoveTableComposite_no_dependencies;
public static String AddRemoveTableComposite_control_depth_level;
+
+ public static String ExportAntCodeGenWizard_title;
+ public static String ExportAntCodeGenWizard_description;
+ public static String ExportAntCodeGenWizard_page_name;
+ public static String ExportAntCodeGenWizardPage_hibernate_code_generation_configurations;
+ public static String ExportAntCodeGenWizardPage_empty_hibernate_code_generation_configuration;
//
static {
// initialize resource bundle
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-07 08:43:22 UTC (rev 23271)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.properties 2010-07-07 12:53:56 UTC (rev 23272)
@@ -515,3 +515,9 @@
AddRemoveTableComposite_no_dependencies=no dependencies
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_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
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterDefinition.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterDefinition.java 2010-07-07 08:43:22 UTC (rev 23271)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterDefinition.java 2010-07-07 12:53:56 UTC (rev 23272)
@@ -167,5 +167,7 @@
return id;
}
-
+ public String getExporterTag() {
+ return getId().substring(getId().lastIndexOf(".") + 1); //$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-07 08:43:22 UTC (rev 23271)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterFactory.java 2010-07-07 12:53:56 UTC (rev 23272)
@@ -18,6 +18,7 @@
import org.hibernate.cfg.Configuration;
import org.hibernate.console.HibernateConsoleRuntimeException;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
+import org.hibernate.eclipse.launch.ExporterAttributes;
import org.hibernate.eclipse.launch.HibernateLaunchConstants;
import org.hibernate.eclipse.launch.PathHelper;
import org.hibernate.tool.hbm2x.ArtifactCollector;
@@ -84,11 +85,6 @@
return definition;
}
- // todo: move to ExporterAttributes together with isEnabled functionallity...
- String getLaunchAttributePrefix(String exporterId) {
- return HibernateLaunchConstants.ATTR_EXPORTERS + "." + exporterId; //$NON-NLS-1$
- }
-
public boolean isEnabled(ILaunchConfiguration configuration) {
boolean enabled = false;
@@ -96,7 +92,7 @@
if(configuration.getAttribute(HibernateLaunchConstants.ATTR_EXPORTERS, (List<String>)null)==null) {
enabled = configuration.getAttribute( getId(), false );
} else {
- enabled = configuration.getAttribute( getLaunchAttributePrefix( getId() ), false );
+ enabled = configuration.getAttribute(ExporterAttributes.getLaunchAttributePrefix(getId()), false);
}
} catch(CoreException ce) {
// ignore; assume false
@@ -112,7 +108,7 @@
if(oldSettings) {
configuration.setAttribute( getId(), isEnabled() );
} else {
- configuration.setAttribute( getLaunchAttributePrefix( getId() ), isEnabled());
+ configuration.setAttribute(ExporterAttributes.getLaunchAttributePrefix(getId()), isEnabled());
}
}
@@ -140,6 +136,10 @@
return exporterId;
}
+ public String getExporterTag() {
+ return definition.getExporterTag();
+ }
+
public void setProperties(Map<String, String> props) {
inputProperties.clear();
inputProperties.putAll( props );
Added: 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 (rev 0)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenXMLFactory.java 2010-07-07 12:53:56 UTC (rev 23272)
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ * 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;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.dom4j.DocumentFactory;
+import org.dom4j.Element;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.hibernate.console.ConfigurationXMLFactory;
+import org.hibernate.console.ConnectionProfileUtil;
+import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.console.KnownConfigurations;
+import org.hibernate.console.preferences.ConsoleConfigurationPreferences;
+import org.hibernate.eclipse.console.model.impl.ExporterFactory;
+import org.hibernate.eclipse.console.model.impl.ExporterProperty;
+
+/**
+ * XML document part creation factory,
+ * responsible for creation whole Ant code generation script for
+ * Hibernate Tools.
+ *
+ * @author Vitali Yemialyanchyk
+ */
+public class CodeGenXMLFactory {
+ protected ILaunchConfiguration lc = null;
+
+ public CodeGenXMLFactory(ILaunchConfiguration lc) {
+ this.lc = lc;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Element createRoot() {
+ ExporterAttributes attributes = null;
+ try {
+ attributes = new ExporterAttributes(lc);
+ } catch (CoreException e) {
+ // ignore
+ }
+ if (attributes == null) {
+ return null;
+ }
+ Properties props = new Properties();
+ if (attributes.isReverseEngineer()) {
+ props.setProperty("isRevEng", Boolean.toString(attributes.isReverseEngineer())); //$NON-NLS-1$
+ props.setProperty("packageName", attributes.getPackageName()); //$NON-NLS-1$
+ props.setProperty("detectManyToMany", Boolean.toString(attributes.detectManyToMany())); //$NON-NLS-1$
+ props.setProperty("detectOneToOne", Boolean.toString(attributes.detectOneToOne())); //$NON-NLS-1$
+ props.setProperty("detectOptimisticLock", Boolean.toString(attributes.detectOptimisticLock())); //$NON-NLS-1$
+ props.setProperty("reverseStrategy", attributes.getRevengStrategy()); //$NON-NLS-1$
+ String revEngFile = getResLocation(attributes.getRevengSettings());
+ props.setProperty("revEngFile", revEngFile); //$NON-NLS-1$
+ }
+ String consoleConfigName = attributes.getConsoleConfigurationName();
+ ConsoleConfigurationPreferences consoleConfigPrefs =
+ getConsoleConfigPreferences(consoleConfigName);
+ ConfigurationXMLFactory csfXML = new ConfigurationXMLFactory(
+ consoleConfigPrefs, props);
+ Element rootConsoleConfig = csfXML.createRoot(false);
+ //
+ Element root = DocumentFactory.getInstance().createElement("project"); //$NON-NLS-1$
+ root.addAttribute("name", "CodeGen"); //$NON-NLS-1$ //$NON-NLS-2$
+ String defaultTargetName = "JdbcCodeGen"; //$NON-NLS-1$
+ root.addAttribute("default", defaultTargetName); //$NON-NLS-1$
+ Element el = root.addElement("property"); //$NON-NLS-1$
+ el.addAttribute("name", "build.dir"); //$NON-NLS-1$ //$NON-NLS-2$
+ String location = getResLocation(attributes.getOutputPath());
+ el.addAttribute("location", location); //$NON-NLS-1$
+ el = root.addElement("property"); //$NON-NLS-1$
+ el.addAttribute("name", "jdbc.driver"); //$NON-NLS-1$ //$NON-NLS-2$
+ String driverURL = getConnectionProfileDriverURL(consoleConfigPrefs.getConnectionProfileName());
+ el.addAttribute("location", driverURL); //$NON-NLS-1$
+ //
+ Element target = root.addElement("target"); //$NON-NLS-1$
+ target.addAttribute("name", defaultTargetName); //$NON-NLS-1$
+ //
+ Element taskdef = target.addElement("taskdef"); //$NON-NLS-1$
+ taskdef.addAttribute("name", "hibernatetool"); //$NON-NLS-1$ //$NON-NLS-2$
+ taskdef.addAttribute("classname", "org.hibernate.tool.ant.HibernateToolTask"); //$NON-NLS-1$ //$NON-NLS-2$
+ //
+ Element hibernatetool = target.addElement("hibernatetool"); //$NON-NLS-1$
+ hibernatetool.addAttribute("destdir", "${build.dir}"); //$NON-NLS-1$ //$NON-NLS-2$
+ hibernatetool.content().add(rootConsoleConfig);
+ //
+ Properties globalProps = new Properties();
+ globalProps.put("ejb3", "" + attributes.isEJB3Enabled()); //$NON-NLS-1$ //$NON-NLS-2$
+ globalProps.put("jdk5", "" + attributes.isJDK5Enabled()); //$NON-NLS-1$//$NON-NLS-2$
+ List<ExporterFactory> exporterFactories = attributes.getExporterFactories();
+ for (Iterator<ExporterFactory> iter = exporterFactories.iterator(); iter.hasNext();) {
+ ExporterFactory ef = iter.next();
+ if (!ef.isEnabled(lc)) {
+ continue;
+ }
+ Map<String, ExporterProperty> defExpProps = ef.getDefaultExporterProperties();
+ String expName = ef.getExporterTag();
+ Element exporter = hibernatetool.addElement(expName);
+ Properties expProps = new Properties();
+ expProps.putAll(globalProps);
+ expProps.putAll(ef.getProperties());
+ for (Map.Entry<String, ExporterProperty> name2prop : defExpProps.entrySet()) {
+ Object val = expProps.get(name2prop.getKey());
+ if (val == null || 0 == val.toString().compareTo(name2prop.getValue().getDefaultValue())) {
+ continue;
+ }
+ exporter.addAttribute(name2prop.getKey(), val.toString());
+ }
+ if ("hbmtemplate".compareToIgnoreCase(expName) == 0 ) { //$NON-NLS-1$
+ Element property = null;
+ if (attributes.isJDK5Enabled()) {
+ property = exporter.addElement("property"); //$NON-NLS-1$
+ property.addAttribute("key", "jdk5"); //$NON-NLS-1$ //$NON-NLS-2$
+ property.addAttribute("value", "" + attributes.isJDK5Enabled()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ if (attributes.isEJB3Enabled()) {
+ property = exporter.addElement("property"); //$NON-NLS-1$
+ property.addAttribute("key", "ejb3"); //$NON-NLS-1$ //$NON-NLS-2$
+ property.addAttribute("value", "" + attributes.isEJB3Enabled()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ }
+ return root;
+ }
+
+ public ConsoleConfigurationPreferences getConsoleConfigPreferences(String consoleConfigName) {
+ ConsoleConfiguration consoleConfig = KnownConfigurations.getInstance().find(consoleConfigName);
+ return consoleConfig.getPreferences();
+ }
+
+ public IResource findResource(String path) {
+ final IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
+ final IResource res = PathHelper.findMember(wsRoot, path);
+ return res;
+ }
+
+ public String getResLocation(String path) {
+ final IResource outputPathRes = findResource(path);
+ String location = ""; //$NON-NLS-1$
+ if (outputPathRes != null) {
+ location = outputPathRes.getLocation().toString();
+ }
+ return location;
+ }
+
+ public String getConnectionProfileDriverURL(String connectionProfile) {
+ String driverURL = ConnectionProfileUtil.getConnectionProfileDriverURL(connectionProfile);
+ return driverURL;
+ }
+}
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ExporterAttributes.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ExporterAttributes.java 2010-07-07 08:43:22 UTC (rev 23271)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ExporterAttributes.java 2010-07-07 12:53:56 UTC (rev 23272)
@@ -113,12 +113,12 @@
}
}
- static String getLaunchAttributePrefix(String exporterId) {
- return HibernateLaunchConstants.ATTR_EXPORTERS + "." + exporterId; //$NON-NLS-1$
- }
+ public static String getLaunchAttributePrefix(String exporterId) {
+ return HibernateLaunchConstants.ATTR_EXPORTERS + "." + exporterId; //$NON-NLS-1$
+ }
- @SuppressWarnings("unchecked")
-private List<ExporterFactory> readExporterFactories(ILaunchConfiguration configuration) throws CoreException {
+ @SuppressWarnings("unchecked")
+ private List<ExporterFactory> readExporterFactories(ILaunchConfiguration configuration) throws CoreException {
List<String> exporterNames = configuration.getAttribute(HibernateLaunchConstants.ATTR_EXPORTERS, (List<String>)null);
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/AntCodeGenReveng_test1.xml
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/AntCodeGenReveng_test1.xml (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/AntCodeGenReveng_test1.xml 2010-07-07 12:53:56 UTC (rev 23272)
@@ -0,0 +1,17 @@
+<project name="CodeGen" default="JdbcCodeGen">
+ <property name="build.dir" location="ResLocation/test"/>
+ <property name="jdbc.driver" location="TestDriverPath.jar"/>
+ <target name="JdbcCodeGen">
+ <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask"/>
+ <hibernatetool destdir="${build.dir}">
+ <jdbcconfiguration configurationFile="project\src\hibernate.cfg.xml" detectManyToMany="true" detectOneToOne="true" detectOptimisticLock="true" revEngFile="ResLocation/test"/>
+ <hbm2doc/>
+ <hbm2cfgxml/>
+ <hbm2hbmxml/>
+ <hbmtemplate/>
+ <hbm2java/>
+ <hbm2ddl/>
+ <hbm2dao/>
+ </hibernatetool>
+ </target>
+</project>
\ No newline at end of file
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/AntCodeGenReveng_test2.xml
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/AntCodeGenReveng_test2.xml (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/AntCodeGenReveng_test2.xml 2010-07-07 12:53:56 UTC (rev 23272)
@@ -0,0 +1,11 @@
+<project name="CodeGen" default="JdbcCodeGen">
+ <property name="build.dir" location="ResLocation/test"/>
+ <property name="jdbc.driver" location="TestDriverPath.jar"/>
+ <target name="JdbcCodeGen">
+ <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask"/>
+ <hibernatetool destdir="${build.dir}">
+ <jdbcconfiguration configurationFile="project\src\hibernate.cfg.xml" detectManyToMany="true" detectOneToOne="true" detectOptimisticLock="true" revEngFile="ResLocation/test"/>
+ <hbm2java/>
+ </hibernatetool>
+ </target>
+</project>
\ No newline at end of file
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/AntCodeGen_test1.xml
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/AntCodeGen_test1.xml (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/AntCodeGen_test1.xml 2010-07-07 12:53:56 UTC (rev 23272)
@@ -0,0 +1,17 @@
+<project name="CodeGen" default="JdbcCodeGen">
+ <property name="build.dir" location="ResLocation/test"/>
+ <property name="jdbc.driver" location="TestDriverPath.jar"/>
+ <target name="JdbcCodeGen">
+ <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask"/>
+ <hibernatetool destdir="${build.dir}">
+ <configuration configurationFile="project\src\hibernate.cfg.xml"/>
+ <hbm2doc/>
+ <hbm2cfgxml/>
+ <hbm2hbmxml/>
+ <hbmtemplate/>
+ <hbm2java/>
+ <hbm2ddl/>
+ <hbm2dao/>
+ </hibernatetool>
+ </target>
+</project>
\ No newline at end of file
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/AntCodeGen_test2.xml
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/AntCodeGen_test2.xml (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/AntCodeGen_test2.xml 2010-07-07 12:53:56 UTC (rev 23272)
@@ -0,0 +1,11 @@
+<project name="CodeGen" default="JdbcCodeGen">
+ <property name="build.dir" location="ResLocation/test"/>
+ <property name="jdbc.driver" location="TestDriverPath.jar"/>
+ <target name="JdbcCodeGen">
+ <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask"/>
+ <hibernatetool destdir="${build.dir}">
+ <configuration configurationFile="project\src\hibernate.cfg.xml"/>
+ <hbm2java/>
+ </hibernatetool>
+ </target>
+</project>
\ No newline at end of file
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/CodeGenXMLFactoryTest.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/CodeGenXMLFactoryTest.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/CodeGenXMLFactoryTest.java 2010-07-07 12:53:56 UTC (rev 23272)
@@ -0,0 +1,174 @@
+/*******************************************************************************
+ * 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.test;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.dom4j.Element;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.hibernate.console.ConfigurationXMLFactory;
+import org.hibernate.console.preferences.ConsoleConfigurationPreferences;
+import org.hibernate.eclipse.console.ExtensionManager;
+import org.hibernate.eclipse.console.model.impl.ExporterDefinition;
+import org.hibernate.eclipse.console.test.launchcfg.TestConsoleConfigurationPreferences;
+import org.hibernate.eclipse.console.test.launchcfg.TestLaunchConfig;
+import org.hibernate.eclipse.launch.CodeGenXMLFactory;
+import org.hibernate.eclipse.launch.ExporterAttributes;
+import org.hibernate.eclipse.launch.HibernateLaunchConstants;
+
+import junit.framework.TestCase;
+
+/**
+ * @author Vitali Yemialyanchyk
+ */
+public class CodeGenXMLFactoryTest extends TestCase {
+
+ public static final String SPECIMEN_PATH = "res/specimen/".replaceAll("//", File.separator); //$NON-NLS-1$ //$NON-NLS-2$
+
+ public static final String HBMTEMPLATE0 = "hbm2java"; //$NON-NLS-1$
+ public static final String HBMTEMPLATE0_PROPERTIES = HibernateLaunchConstants.ATTR_EXPORTERS
+ + '.' + HBMTEMPLATE0 + ".properties"; //$NON-NLS-1$
+ public static final String OUTDIR_PATH = "outputdir/test"; //$NON-NLS-1$
+
+ public class TestConsoleConfigPref extends TestConsoleConfigurationPreferences {
+ public File getConfigXMLFile() {
+ final File xmlConfig = new File("project/src/hibernate.cfg.xml"); //$NON-NLS-1$
+ return xmlConfig;
+ }
+ }
+
+ public class CodeGenXMLFactory4Test extends CodeGenXMLFactory {
+
+ public CodeGenXMLFactory4Test(ILaunchConfiguration lc) {
+ super(lc);
+ }
+
+ public ConsoleConfigurationPreferences getConsoleConfigPreferences(String consoleConfigName) {
+ ConsoleConfigurationPreferences pref = new TestConsoleConfigPref();
+ return pref;
+ }
+
+ public String getConnectionProfileDriverURL(String connectionProfile) {
+ return "TestDriverPath.jar"; //$NON-NLS-1$
+ }
+
+ public String getResLocation(String path) {
+ return "ResLocation/test"; //$NON-NLS-1$
+ }
+ }
+
+ public void testCodeGenXMLFactoryRevengAll() {
+ String codeGen = codeGenXMLFactory(true, true);
+ String specimen = getSpecimen("AntCodeGenReveng_test1.xml"); //$NON-NLS-1$
+ assertEquals(specimen.trim(), codeGen.trim().replaceAll("\n", "\r\n")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ public void testCodeGenXMLFactoryRevengOne() {
+ String codeGen = codeGenXMLFactory(true, false);
+ String specimen = getSpecimen("AntCodeGenReveng_test2.xml"); //$NON-NLS-1$
+ assertEquals(specimen.trim(), codeGen.trim().replaceAll("\n", "\r\n")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ public void testCodeGenXMLFactoryAll() {
+ String codeGen = codeGenXMLFactory(false, true);
+ String specimen = getSpecimen("AntCodeGen_test1.xml"); //$NON-NLS-1$
+ assertEquals(specimen.trim(), codeGen.trim().replaceAll("\n", "\r\n")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ public void testCodeGenXMLFactoryOne() {
+ String codeGen = codeGenXMLFactory(false, false);
+ String specimen = getSpecimen("AntCodeGen_test2.xml"); //$NON-NLS-1$
+ assertEquals(specimen.trim(), codeGen.trim().replaceAll("\n", "\r\n")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ public String codeGenXMLFactory(boolean reveng, boolean exportersAll) {
+ Map<String, ExporterDefinition> exDefinitions = ExtensionManager.findExporterDefinitionsAsMap();
+ Map<String, Object> testLCAttr = new HashMap<String, Object>();
+ String tmp = "12345678901234567890"; //$NON-NLS-1$
+ testLCAttr.put(HibernateLaunchConstants.ATTR_TEMPLATE_DIR, tmp);
+ testLCAttr.put(HibernateLaunchConstants.ATTR_OUTPUT_DIR, tmp);
+ testLCAttr.put(HibernateLaunchConstants.ATTR_REVERSE_ENGINEER_SETTINGS, tmp);
+ List<String> exportersList = new ArrayList<String>();
+ if (exportersAll) {
+ exportersList.clear();
+ } else {
+ exportersList.add(HBMTEMPLATE0);
+ }
+ for (Map.Entry<String, ExporterDefinition> exDef : exDefinitions.entrySet()) {
+ String tmp0 = exDef.getValue().getExporterTag();
+ String tmp1 = ExporterAttributes.getLaunchAttributePrefix(tmp0);
+ testLCAttr.put(tmp1 + ".extension_id", //$NON-NLS-1$
+ HibernateLaunchConstants.ATTR_PREFIX + tmp0);
+ testLCAttr.put(tmp1, Boolean.TRUE);
+ if (exportersAll) {
+ exportersList.add(tmp0);
+ }
+ }
+ testLCAttr.put(HibernateLaunchConstants.ATTR_EXPORTERS, exportersList);
+ Map<String, String> expProps2 = new HashMap<String, String>();
+ expProps2.put(HibernateLaunchConstants.ATTR_OUTPUT_DIR, OUTDIR_PATH);
+ testLCAttr.put(HBMTEMPLATE0_PROPERTIES, expProps2);
+ testLCAttr.put(HibernateLaunchConstants.ATTR_REVERSE_ENGINEER, reveng);
+ TestLaunchConfig testLC = new TestLaunchConfig(testLCAttr);
+ CodeGenXMLFactory cgfXML = new CodeGenXMLFactory4Test(testLC);
+ Element rootBuildXml = cgfXML.createRoot();
+ ConfigurationXMLFactory.dump(System.out, rootBuildXml);
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ConfigurationXMLFactory.dump(baos, rootBuildXml);
+ return baos.toString();
+ }
+
+ public String getSpecimen(String fileName) {
+ File resourceFile = null;
+ try {
+ resourceFile = getResourceItem(SPECIMEN_PATH + fileName);
+ } catch (IOException e1) {
+ }
+ if (resourceFile == null || !resourceFile.exists()) {
+ return null;
+ }
+ StringBuffer cbuf = new StringBuffer((int) resourceFile.length());
+ try {
+ String ls = System.getProperties().getProperty("line.separator", "\n"); //$NON-NLS-1$//$NON-NLS-2$
+ BufferedReader in = new BufferedReader(new FileReader(resourceFile));
+ String str;
+ while ((str = in.readLine()) != null) {
+ cbuf.append(str + ls);
+ }
+ in.close();
+ } catch (IOException e) {
+ }
+ return cbuf.toString();
+ }
+
+ protected File getResourceItem(String strResPath) throws IOException {
+ IPath resourcePath = new Path(strResPath);
+ File resourceFolder = resourcePath.toFile();
+ URL entry = HibernateConsoleTestPlugin.getDefault().getBundle().getEntry(
+ strResPath);
+ URL resProject = FileLocator.resolve(entry);
+ String tplPrjLcStr = FileLocator.resolve(resProject).getFile();
+ resourceFolder = new File(tplPrjLcStr);
+ return resourceFolder;
+ }
+}
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsoleConfigurationTest.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsoleConfigurationTest.java 2010-07-07 08:43:22 UTC (rev 23271)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsoleConfigurationTest.java 2010-07-07 12:53:56 UTC (rev 23272)
@@ -1,27 +1,17 @@
package org.hibernate.eclipse.console.test;
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-import java.util.Properties;
-
import junit.framework.TestCase;
-import org.eclipse.core.runtime.FileLocator;
import org.hibernate.SessionFactory;
import org.hibernate.console.ConcoleConfigurationAdapter;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.HibernateConsoleRuntimeException;
import org.hibernate.console.KnownConfigurations;
import org.hibernate.console.QueryPage;
-import org.hibernate.console.preferences.ConsoleConfigurationPreferences;
-import org.osgi.framework.Bundle;
-import org.w3c.dom.Element;
+import org.hibernate.eclipse.console.test.launchcfg.TestConsoleConfigurationPreferences;
public class ConsoleConfigurationTest extends TestCase {
- public static final String HIBERNATE_CFG_XML_PATH = "/res/project/src/hibernate.cfg.xml".replaceAll("//", File.separator); //$NON-NLS-1$ //$NON-NLS-2$
-
private ConsoleConfiguration consoleCfg;
public ConsoleConfigurationTest(String name) {
@@ -41,90 +31,6 @@
consoleCfg = null;
}
- static class TestConsoleConfigurationPreferences implements ConsoleConfigurationPreferences {
-
- public void setName(String name) {
- fail();
- }
-
- public void readStateFrom(Element element) {
- fail();
- }
-
- public void writeStateTo(Element node) {
- fail();
- }
-
- public File getPropertyFile() {
- return null;
- }
-
- public File getConfigXMLFile() {
- File xmlConfig = null;
- Bundle bundle = HibernateConsoleTestPlugin.getDefault().getBundle();
- try {
- URL url = FileLocator.resolve(bundle.getEntry(HIBERNATE_CFG_XML_PATH));
- xmlConfig = new File(url.getFile());
- } catch (IOException e) {
- fail("Cannot find file: " + HIBERNATE_CFG_XML_PATH); //$NON-NLS-1$
- }
- return xmlConfig;
- }
-
- public Properties getProperties() {
- Properties p = new Properties();
- p.setProperty("hibernate.dialect", "org.hibernate.dialect.HSQLDialect"); //$NON-NLS-1$ //$NON-NLS-2$
- return p;
- }
-
- public File[] getMappingFiles() {
- return new File[0];
- }
-
- public URL[] getCustomClassPathURLS() {
- return new URL[0];
- }
-
- public String getName() {
- return ConsoleTestMessages.ConsoleConfigurationTest_fake_prefs;
- }
-
-
-
- public String getEntityResolverName() {
- return ""; //$NON-NLS-1$
- }
-
- public ConfigurationMode getConfigurationMode() {
- return ConfigurationMode.CORE;
- }
-
- public String getNamingStrategy() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getPersistenceUnitName() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getConnectionProfileName() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.hibernate.console.preferences.ConsoleConfigurationPreferences#getDialectName()
- */
- public String getDialectName() {
- // TODO Auto-generated method stub
- return null;
- }
-
- }
-
-
static class MockCCListener extends ConcoleConfigurationAdapter {
int factoryBuilt = 0;
int factoryClosing = 0;
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/QueryParametersTest.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/QueryParametersTest.java 2010-07-07 08:43:22 UTC (rev 23271)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/QueryParametersTest.java 2010-07-07 12:53:56 UTC (rev 23272)
@@ -9,7 +9,7 @@
import org.hibernate.console.ConsoleQueryParameter;
import org.hibernate.console.KnownConfigurations;
import org.hibernate.console.QueryInputModel;
-import org.hibernate.eclipse.console.test.ConsoleConfigurationTest.TestConsoleConfigurationPreferences;
+import org.hibernate.eclipse.console.test.launchcfg.TestConsoleConfigurationPreferences;
public class QueryParametersTest extends TestCase {
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/RefactoringTest.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/RefactoringTest.java 2010-07-07 08:43:22 UTC (rev 23271)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/RefactoringTest.java 2010-07-07 12:53:56 UTC (rev 23272)
@@ -16,27 +16,18 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import junit.framework.TestCase;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationType;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.core.ILaunchDelegate;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.internal.launching.DefaultProjectClasspathEntry;
import org.eclipse.jdt.internal.launching.RuntimeClasspathEntry;
import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
+import org.hibernate.eclipse.console.test.launchcfg.TestLaunchConfig;
import org.hibernate.eclipse.console.test.project.SimpleTestProject;
import org.hibernate.eclipse.launch.HibernateLaunchConstants;
import org.hibernate.eclipse.launch.IConsoleConfigurationLaunchConstants;
@@ -49,10 +40,11 @@
@SuppressWarnings("restriction")
public class RefactoringTest extends TestCase {
- private static final String HBMTEMPLATE0 = "hbmtemplate0";
- private static final String HBMTEMPLATE0_PROPERTIES = HibernateLaunchConstants.ATTR_EXPORTERS + '.' + HBMTEMPLATE0 + ".properties";
+ private static final String HBMTEMPLATE0 = "hbmtemplate0"; //$NON-NLS-1$
+ private static final String HBMTEMPLATE0_PROPERTIES = HibernateLaunchConstants.ATTR_EXPORTERS + '.' + HBMTEMPLATE0 + ".properties"; //$NON-NLS-1$
private final String[] oldPathElements = new String[]{"oldPrj","oldSrc", "oldPack", "oldHibernate.cfg.xml"}; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
private final String[] newPathElements = new String[]{"newPrj","newSrc", "newPack", "newHibernate.cfg.xml"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ private static final String OUTDIR = "outputdir"; //$NON-NLS-1$
SimpleTestProject project = null;
@@ -94,7 +86,7 @@
testCodeGenerationAttr.put(HibernateLaunchConstants.ATTR_REVERSE_ENGINEER_SETTINGS, oldPathStr.toString());
testCodeGenerationAttr.put(HibernateLaunchConstants.ATTR_EXPORTERS, Collections.singletonList(HBMTEMPLATE0));
Map<String, String> expProps = new HashMap<String, String>();
- expProps.put("outputdir", generateOldPathForSegment(2).toString());
+ expProps.put(OUTDIR, generateOldPathForSegment(2).toString());
testCodeGenerationAttr.put(HBMTEMPLATE0_PROPERTIES, expProps);
testNotChangedCodeGenerationAttr.put(HibernateLaunchConstants.ATTR_TEMPLATE_DIR, notChangedPathStr.toString());
@@ -102,7 +94,7 @@
testNotChangedCodeGenerationAttr.put(HibernateLaunchConstants.ATTR_REVERSE_ENGINEER_SETTINGS, notChangedPathStr.toString());
testCodeGenerationAttr.put(HibernateLaunchConstants.ATTR_EXPORTERS, Collections.singletonList(HBMTEMPLATE0));
Map<String, String> expProps2 = new HashMap<String, String>();
- expProps2.put("outputdir", generateOldPathForSegment(2).toString());
+ expProps2.put(OUTDIR, generateOldPathForSegment(2).toString());
testNotChangedCodeGenerationAttr.put(HBMTEMPLATE0_PROPERTIES, expProps2);
@@ -294,7 +286,7 @@
assertEquals(truePath.removeLastSegments(1).makeAbsolute(), new Path(newPath).makeAbsolute());
Map<String, String> props = testCodeGenerationConfig.getAttribute(HBMTEMPLATE0_PROPERTIES,
new HashMap<String, String>());
- assertEquals(truePath.removeLastSegments(1).makeAbsolute(), new Path(props.get("outputdir")).makeAbsolute());
+ assertEquals(truePath.removeLastSegments(1).makeAbsolute(), new Path(props.get(OUTDIR)).makeAbsolute());
}
private Path generateNewPathForSegment(int segmentNum){
@@ -328,399 +320,6 @@
return new Path(newPath);
}
-//====================================================================================
- static class TestWorkingCopy implements ILaunchConfigurationWorkingCopy{
-
- private TestLaunchConfig parent;
-
- private Map<String, Object> attributes = new HashMap<String, Object>();
-
- TestWorkingCopy(TestLaunchConfig parent){
- this.parent = parent;
- }
-
- public void addModes(Set modes) {}
-
- public ILaunchConfiguration doSave() throws CoreException {
- parent.updatedAttributes.putAll(attributes);
- return parent;
- }
-
- public boolean hasAttribute(String attributeName)
- throws CoreException {
- fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
- return false;
- }
-
- public Object removeAttribute(String attributeName) {
- fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
- return null;
- }
- public ILaunchConfiguration getOriginal() {
- return parent;
- }
-
- public ILaunchConfigurationWorkingCopy getParent() {
- return null;
- }
-
- public boolean isDirty() {
- return true;
- }
-
-
- public void removeModes(Set modes) {}
-
- public void rename(String name) {}
-
- public void setAttribute(String attributeName, int value) { }
-
- public void setAttribute(String attributeName, String value) {
- attributes.put(attributeName, value);
- }
-
- public void setAttribute(String attributeName, List value) {
- attributes.put(attributeName, value);
- }
-
- public void setAttribute(String attributeName, Map value) {
- attributes.put(attributeName, value);
- }
-
- public void setAttribute(String attributeName, boolean value) {fail(ConsoleTestMessages.RefactoringTest_method_not_tested);}
-
- public void setAttributes(Map attributes) { fail(ConsoleTestMessages.RefactoringTest_method_not_tested);}
-
- public void setContainer(IContainer container) {fail(ConsoleTestMessages.RefactoringTest_method_not_tested);}
-
- public void setMappedResources(IResource[] resources) {fail(ConsoleTestMessages.RefactoringTest_method_not_tested);}
-
- public void setModes(Set modes) {fail(ConsoleTestMessages.RefactoringTest_method_not_tested);}
-
- public void setPreferredLaunchDelegate(Set modes, String delegateId) {fail(ConsoleTestMessages.RefactoringTest_method_not_tested);}
-
- public boolean contentsEqual(ILaunchConfiguration configuration) {
- return false;
- }
-
- public ILaunchConfigurationWorkingCopy copy(String name)
- throws CoreException {
- fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
- return null;
- }
-
- public void delete() throws CoreException {}
-
- public boolean exists() {
- return false;
- }
-
- public boolean getAttribute(String attributeName, boolean defaultValue)
- throws CoreException {
- return parent.getAttribute(attributeName, defaultValue);
- }
-
- public int getAttribute(String attributeName, int defaultValue)
- throws CoreException {
- fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
- return 0;
- }
-
- public List getAttribute(String attributeName, List defaultValue)
- throws CoreException {
- return parent.getAttribute(attributeName, defaultValue);
- }
-
- public Set getAttribute(String attributeName, Set defaultValue)
- throws CoreException {
- fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
- return null;
- }
-
- public Map getAttribute(String attributeName, Map defaultValue)
- throws CoreException {
- return parent.getAttribute(attributeName, defaultValue);
- }
-
- public String getAttribute(String attributeName, String defaultValue)
- throws CoreException {
- return parent.getAttribute(attributeName, defaultValue);
- }
-
- public Map getAttributes() throws CoreException {
- return attributes;
- }
-
- public String getCategory() throws CoreException {
- return parent.getCategory();
- }
-
- public IFile getFile() {
- return null;
- }
-
- public IPath getLocation() {
- return null;
- }
-
- public IResource[] getMappedResources() throws CoreException {
- return null;
- }
-
- public String getMemento() throws CoreException {
- return null;
- }
-
- public Set getModes() throws CoreException {
- return null;
- }
-
- public String getName() {
- return null;
- }
-
- public ILaunchDelegate getPreferredDelegate(Set modes)
- throws CoreException {
- return null;
- }
-
- public ILaunchConfigurationType getType() throws CoreException {
- return null;
- }
-
- public ILaunchConfigurationWorkingCopy getWorkingCopy()
- throws CoreException {
- return null;
- }
-
- public boolean isLocal() {
- return false;
- }
-
- public boolean isMigrationCandidate() throws CoreException {
- return false;
- }
-
- public boolean isReadOnly() {
- return false;
- }
-
- public boolean isWorkingCopy() {
- return false;
- }
-
- public ILaunch launch(String mode, IProgressMonitor monitor)
- throws CoreException {
- return null;
- }
-
- public ILaunch launch(String mode, IProgressMonitor monitor,
- boolean build) throws CoreException {
- return null;
- }
-
- public ILaunch launch(String mode, IProgressMonitor monitor,
- boolean build, boolean register) throws CoreException {
- return null;
- }
-
- public void migrate() throws CoreException {}
-
- public boolean supportsMode(String mode) throws CoreException {
- return false;
- }
-
- public Object getAdapter(Class adapter) {
- return null;
- }
-
- public void setAttribute(String attributeName, Set value) {
- attributes.put(attributeName, value);
- }
-
- }
-
- @SuppressWarnings("unchecked")
- static class TestLaunchConfig implements ILaunchConfiguration{
-
- private Map<String, Object> attributes = new HashMap<String, Object>();
-
- public Map<String, Object> updatedAttributes = new HashMap<String, Object>();
-
- // returns updated attribute
- public Object getNewAttribute(String attributeName){
- return updatedAttributes.get(attributeName);
- }
-
- TestLaunchConfig(Map<String, Object> attributes){
- if (attributes != null){
- this.attributes = attributes;
- }
- }
-
- public boolean contentsEqual(ILaunchConfiguration configuration) {
- return false;
- }
-
- public ILaunchConfigurationWorkingCopy copy(String name)
- throws CoreException {
- return null;
- }
-
- public void delete() throws CoreException {
-
- }
-
- public boolean exists() {
- return false;
- }
-
- public boolean getAttribute(String attributeName, boolean defaultValue)
- throws CoreException {
- if (attributes.containsKey(attributeName)){
- return (Boolean) attributes.get(attributeName);
- } else {
- return defaultValue;
- }
- }
-
- public boolean hasAttribute(String attributeName)
- throws CoreException {
- return attributes.containsKey(attributeName);
- }
-
- public int getAttribute(String attributeName, int defaultValue)
- throws CoreException {
- if (attributes.containsKey(attributeName)){
- return (Integer) attributes.get(attributeName);
- } else {
- return defaultValue;
- }
- }
-
- public List getAttribute(String attributeName, List defaultValue)
- throws CoreException {
- if (attributes.containsKey(attributeName)){
- return (List) attributes.get(attributeName);
- } else {
- return defaultValue;
- }
- }
-
- public Set getAttribute(String attributeName, Set defaultValue)
- throws CoreException {
- return null;
- }
-
- public Map getAttribute(String attributeName, Map defaultValue)
- throws CoreException {
- if (attributes.containsKey(attributeName)){
- return (Map) attributes.get(attributeName);
- } else {
- return defaultValue;
- }
- }
-
- public String getAttribute(String attributeName, String defaultValue)
- throws CoreException {
- if (attributes.containsKey(attributeName)){
- return (String) attributes.get(attributeName);
- } else {
- return defaultValue;
- }
- }
-
- public Map getAttributes() throws CoreException {
- return null;
- }
-
- public String getCategory() throws CoreException {
- return ConsoleTestMessages.RefactoringTest_category;
- }
-
- public IFile getFile() {
- return null;
- }
-
- public IPath getLocation() {
- return null;
- }
-
- public IResource[] getMappedResources() throws CoreException {
- return null;
- }
-
- public String getMemento() throws CoreException {
- return null;
- }
-
- public Set getModes() throws CoreException {
- return null;
- }
-
- public String getName() {
- return ConsoleTestMessages.RefactoringTest_test_launch_config;
- }
-
- public ILaunchDelegate getPreferredDelegate(Set modes)
- throws CoreException {
- return null;
- }
-
- public ILaunchConfigurationType getType() throws CoreException {
- return null;
- }
-
- public ILaunchConfigurationWorkingCopy getWorkingCopy()
- throws CoreException {
- return new TestWorkingCopy(this);
- }
-
- public boolean isLocal() {
- return false;
- }
-
- public boolean isMigrationCandidate() throws CoreException {
- return false;
- }
-
- public boolean isReadOnly() {
- return false;
- }
-
- public boolean isWorkingCopy() {
- return false;
- }
-
- public ILaunch launch(String mode, IProgressMonitor monitor)
- throws CoreException {
- return null;
- }
-
- public ILaunch launch(String mode, IProgressMonitor monitor,
- boolean build) throws CoreException {
- return null;
- }
-
- public ILaunch launch(String mode, IProgressMonitor monitor,
- boolean build, boolean register) throws CoreException {
- return null;
- }
-
- public void migrate() throws CoreException {
-
- }
-
- public boolean supportsMode(String mode) throws CoreException {
- return false;
- }
-
- public Object getAdapter(Class adapter) {
- return null;
- }
-
-
- };
}
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/launchcfg/TestConsoleConfigurationPreferences.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/launchcfg/TestConsoleConfigurationPreferences.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/launchcfg/TestConsoleConfigurationPreferences.java 2010-07-07 12:53:56 UTC (rev 23272)
@@ -0,0 +1,99 @@
+package org.hibernate.eclipse.console.test.launchcfg;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.util.Properties;
+
+import junit.framework.Assert;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.hibernate.console.preferences.ConsoleConfigurationPreferences;
+import org.hibernate.eclipse.console.test.ConsoleTestMessages;
+import org.hibernate.eclipse.console.test.HibernateConsoleTestPlugin;
+import org.osgi.framework.Bundle;
+import org.w3c.dom.Element;
+
+public class TestConsoleConfigurationPreferences implements ConsoleConfigurationPreferences {
+
+ public static final String HIBERNATE_CFG_XML_PATH = "/res/project/src/hibernate.cfg.xml".replaceAll("//", File.separator); //$NON-NLS-1$ //$NON-NLS-2$
+
+ public void setName(String name) {
+ Assert.fail();
+ }
+
+ public void readStateFrom(Element element) {
+ Assert.fail();
+ }
+
+ public void writeStateTo(Element node) {
+ Assert.fail();
+ }
+
+ public File getPropertyFile() {
+ return null;
+ }
+
+ public File getConfigXMLFile() {
+ File xmlConfig = null;
+ Bundle bundle = HibernateConsoleTestPlugin.getDefault().getBundle();
+ try {
+ URL url = FileLocator.resolve(bundle.getEntry(HIBERNATE_CFG_XML_PATH));
+ xmlConfig = new File(url.getFile());
+ } catch (IOException e) {
+ Assert.fail("Cannot find file: " + HIBERNATE_CFG_XML_PATH); //$NON-NLS-1$
+ }
+ return xmlConfig;
+ }
+
+ public Properties getProperties() {
+ Properties p = new Properties();
+ p.setProperty("hibernate.dialect", "org.hibernate.dialect.HSQLDialect"); //$NON-NLS-1$ //$NON-NLS-2$
+ return p;
+ }
+
+ public File[] getMappingFiles() {
+ return new File[0];
+ }
+
+ public URL[] getCustomClassPathURLS() {
+ return new URL[0];
+ }
+
+ public String getName() {
+ return ConsoleTestMessages.ConsoleConfigurationTest_fake_prefs;
+ }
+
+ public String getEntityResolverName() {
+ return ""; //$NON-NLS-1$
+ }
+
+ public ConfigurationMode getConfigurationMode() {
+ return ConfigurationMode.CORE;
+ }
+
+ public String getNamingStrategy() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getPersistenceUnitName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getConnectionProfileName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.hibernate.console.preferences.ConsoleConfigurationPreferences#getDialectName()
+ */
+ public String getDialectName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/launchcfg/TestLaunchConfig.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/launchcfg/TestLaunchConfig.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/launchcfg/TestLaunchConfig.java 2010-07-07 12:53:56 UTC (rev 23272)
@@ -0,0 +1,198 @@
+/*******************************************************************************
+ * 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.test.launchcfg;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchDelegate;
+import org.hibernate.eclipse.console.test.ConsoleTestMessages;
+
+ at SuppressWarnings("rawtypes")
+public class TestLaunchConfig implements ILaunchConfiguration {
+
+ private Map<String, Object> attributes = new HashMap<String, Object>();
+
+ public Map<String, Object> updatedAttributes = new HashMap<String, Object>();
+
+ // returns updated attribute
+ public Object getNewAttribute(final String attributeName) {
+ return updatedAttributes.get(attributeName);
+ }
+
+ public TestLaunchConfig(final Map<String, Object> attributes) {
+ if (attributes != null) {
+ this.attributes = attributes;
+ }
+ }
+
+ public boolean contentsEqual(final ILaunchConfiguration configuration) {
+ return false;
+ }
+
+ public ILaunchConfigurationWorkingCopy copy(final String name) throws CoreException {
+ return null;
+ }
+
+ public void delete() throws CoreException {
+
+ }
+
+ public boolean exists() {
+ return false;
+ }
+
+ public boolean getAttribute(final String attributeName, final boolean defaultValue) throws CoreException {
+ if (attributes.containsKey(attributeName)) {
+ return (Boolean) attributes.get(attributeName);
+ } else {
+ return defaultValue;
+ }
+ }
+
+ public boolean hasAttribute(final String attributeName) throws CoreException {
+ return attributes.containsKey(attributeName);
+ }
+
+ public int getAttribute(final String attributeName, final int defaultValue) throws CoreException {
+ if (attributes.containsKey(attributeName)) {
+ return (Integer) attributes.get(attributeName);
+ } else {
+ return defaultValue;
+ }
+ }
+
+ public List getAttribute(final String attributeName, final List defaultValue) throws CoreException {
+ if (attributes.containsKey(attributeName)) {
+ return (List) attributes.get(attributeName);
+ } else {
+ return defaultValue;
+ }
+ }
+
+ public Set getAttribute(final String attributeName, final Set defaultValue) throws CoreException {
+ return null;
+ }
+
+ public Map getAttribute(final String attributeName, final Map defaultValue) throws CoreException {
+ if (attributes.containsKey(attributeName)) {
+ return (Map) attributes.get(attributeName);
+ } else {
+ return defaultValue;
+ }
+ }
+
+ public String getAttribute(final String attributeName, final String defaultValue) throws CoreException {
+ if (attributes.containsKey(attributeName)) {
+ return (String) attributes.get(attributeName);
+ } else {
+ return defaultValue;
+ }
+ }
+
+ public Map getAttributes() throws CoreException {
+ return null;
+ }
+
+ public String getCategory() throws CoreException {
+ return ConsoleTestMessages.RefactoringTest_category;
+ }
+
+ public IFile getFile() {
+ return null;
+ }
+
+ public IPath getLocation() {
+ return null;
+ }
+
+ public IResource[] getMappedResources() throws CoreException {
+ return null;
+ }
+
+ public String getMemento() throws CoreException {
+ return null;
+ }
+
+ public Set getModes() throws CoreException {
+ return null;
+ }
+
+ public String getName() {
+ return ConsoleTestMessages.RefactoringTest_test_launch_config;
+ }
+
+ public ILaunchDelegate getPreferredDelegate(final Set modes) throws CoreException {
+ return null;
+ }
+
+ public ILaunchConfigurationType getType() throws CoreException {
+ return null;
+ }
+
+ public ILaunchConfigurationWorkingCopy getWorkingCopy() throws CoreException {
+ return new TestWorkingCopy(this);
+ }
+
+ public boolean isLocal() {
+ return false;
+ }
+
+ public boolean isMigrationCandidate() throws CoreException {
+ return false;
+ }
+
+ public boolean isReadOnly() {
+ return false;
+ }
+
+ public boolean isWorkingCopy() {
+ return false;
+ }
+
+ public ILaunch launch(final String mode, final IProgressMonitor monitor) throws CoreException {
+ return null;
+ }
+
+ public ILaunch launch(final String mode, final IProgressMonitor monitor, final boolean build)
+ throws CoreException {
+ return null;
+ }
+
+ public ILaunch launch(final String mode, final IProgressMonitor monitor, final boolean build, final boolean register)
+ throws CoreException {
+ return null;
+ }
+
+ public void migrate() throws CoreException {
+
+ }
+
+ public boolean supportsMode(final String mode) throws CoreException {
+ return false;
+ }
+
+ public Object getAdapter(final Class adapter) {
+ return null;
+ }
+
+};
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/launchcfg/TestWorkingCopy.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/launchcfg/TestWorkingCopy.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/launchcfg/TestWorkingCopy.java 2010-07-07 12:53:56 UTC (rev 23272)
@@ -0,0 +1,250 @@
+/*******************************************************************************
+ * 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.test.launchcfg;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import junit.framework.Assert;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchDelegate;
+import org.hibernate.eclipse.console.test.ConsoleTestMessages;
+
+ at SuppressWarnings("rawtypes")
+public class TestWorkingCopy implements ILaunchConfigurationWorkingCopy {
+
+ private TestLaunchConfig parent;
+
+ private Map<String, Object> attributes = new HashMap<String, Object>();
+
+ public TestWorkingCopy(TestLaunchConfig parent) {
+ this.parent = parent;
+ }
+
+ public void addModes(Set modes) {
+ }
+
+ public ILaunchConfiguration doSave() throws CoreException {
+ parent.updatedAttributes.putAll(attributes);
+ return parent;
+ }
+
+ public boolean hasAttribute(String attributeName) throws CoreException {
+ Assert.fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
+ return false;
+ }
+
+ public Object removeAttribute(String attributeName) {
+ Assert.fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
+ return null;
+ }
+
+ public ILaunchConfiguration getOriginal() {
+ return parent;
+ }
+
+ public ILaunchConfigurationWorkingCopy getParent() {
+ return null;
+ }
+
+ public boolean isDirty() {
+ return true;
+ }
+
+ public void removeModes(Set modes) {
+ }
+
+ public void rename(String name) {
+ }
+
+ public void setAttribute(String attributeName, int value) {
+ }
+
+ public void setAttribute(String attributeName, String value) {
+ attributes.put(attributeName, value);
+ }
+
+ public void setAttribute(String attributeName, List value) {
+ attributes.put(attributeName, value);
+ }
+
+ public void setAttribute(String attributeName, Map value) {
+ attributes.put(attributeName, value);
+ }
+
+ public void setAttribute(String attributeName, boolean value) {
+ Assert.fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
+ }
+
+ public void setAttributes(Map attributes) {
+ Assert.fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
+ }
+
+ public void setContainer(IContainer container) {
+ Assert.fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
+ }
+
+ public void setMappedResources(IResource[] resources) {
+ Assert.fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
+ }
+
+ public void setModes(Set modes) {
+ Assert.fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
+ }
+
+ public void setPreferredLaunchDelegate(Set modes, String delegateId) {
+ Assert.fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
+ }
+
+ public boolean contentsEqual(ILaunchConfiguration configuration) {
+ return false;
+ }
+
+ public ILaunchConfigurationWorkingCopy copy(String name) throws CoreException {
+ Assert.fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
+ return null;
+ }
+
+ public void delete() throws CoreException {
+ }
+
+ public boolean exists() {
+ return false;
+ }
+
+ public boolean getAttribute(String attributeName, boolean defaultValue) throws CoreException {
+ return parent.getAttribute(attributeName, defaultValue);
+ }
+
+ public int getAttribute(String attributeName, int defaultValue) throws CoreException {
+ Assert.fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
+ return 0;
+ }
+
+ public List getAttribute(String attributeName, List defaultValue) throws CoreException {
+ return parent.getAttribute(attributeName, defaultValue);
+ }
+
+ public Set getAttribute(String attributeName, Set defaultValue) throws CoreException {
+ Assert.fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
+ return null;
+ }
+
+ public Map getAttribute(String attributeName, Map defaultValue) throws CoreException {
+ return parent.getAttribute(attributeName, defaultValue);
+ }
+
+ public String getAttribute(String attributeName, String defaultValue) throws CoreException {
+ return parent.getAttribute(attributeName, defaultValue);
+ }
+
+ public Map getAttributes() throws CoreException {
+ return attributes;
+ }
+
+ public String getCategory() throws CoreException {
+ return parent.getCategory();
+ }
+
+ public IFile getFile() {
+ return null;
+ }
+
+ public IPath getLocation() {
+ return null;
+ }
+
+ public IResource[] getMappedResources() throws CoreException {
+ return null;
+ }
+
+ public String getMemento() throws CoreException {
+ return null;
+ }
+
+ public Set getModes() throws CoreException {
+ return null;
+ }
+
+ public String getName() {
+ return null;
+ }
+
+ public ILaunchDelegate getPreferredDelegate(Set modes) throws CoreException {
+ return null;
+ }
+
+ public ILaunchConfigurationType getType() throws CoreException {
+ return null;
+ }
+
+ public ILaunchConfigurationWorkingCopy getWorkingCopy() throws CoreException {
+ return null;
+ }
+
+ public boolean isLocal() {
+ return false;
+ }
+
+ public boolean isMigrationCandidate() throws CoreException {
+ return false;
+ }
+
+ public boolean isReadOnly() {
+ return false;
+ }
+
+ public boolean isWorkingCopy() {
+ return false;
+ }
+
+ public ILaunch launch(String mode, IProgressMonitor monitor) throws CoreException {
+ return null;
+ }
+
+ public ILaunch launch(String mode, IProgressMonitor monitor, boolean build)
+ throws CoreException {
+ return null;
+ }
+
+ public ILaunch launch(String mode, IProgressMonitor monitor, boolean build, boolean register)
+ throws CoreException {
+ return null;
+ }
+
+ public void migrate() throws CoreException {
+ }
+
+ public boolean supportsMode(String mode) throws CoreException {
+ return false;
+ }
+
+ public Object getAdapter(Class adapter) {
+ return null;
+ }
+
+ public void setAttribute(String attributeName, Set value) {
+ attributes.put(attributeName, value);
+ }
+
+}
More information about the jbosstools-commits
mailing list