Author: max.andersen(a)jboss.com
Date: 2008-09-05 18:00:23 -0400 (Fri, 05 Sep 2008)
New Revision: 10107
Added:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/BestGuessConsoleConfigurationVisitor.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConnectionProfileCtrl.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConsoleConfigurationJavaClasspathTab.java
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/META-INF/MANIFEST.MF
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/EclipseConsoleConfigurationPreferences.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/EclipseLaunchConsoleConfigurationPreferences.java
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/actions/AddConfigurationAction.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/ConsoleConfigurationCreationWizard.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/ConsoleConfigurationWizardPage.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/NewConfigurationWizard.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/BasicWorkbenchAdapter.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/ConfigurationWorkbenchAdapter.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/ConsoleConfigurationWorkbenchAdapter.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConsoleConfigurationMainTab.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConsoleConfigurationTabGroup.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/IConsoleConfigurationLaunchConstants.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/META-INF/MANIFEST.MF
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleMessages.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleMessages.properties
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences/AbstractConsoleConfigurationPreferences.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences/ConsoleConfigurationPreferences.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences/StandAloneConsoleConfigurationPreferences.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/KnownConfigurationsTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HQLQueryValidatorTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HibernateErrorsTest2.java
Log:
JBIDE-719 Reworked the patch done by Vitali. Support for using DTP connection profile with
Hibernate Console Configuration + changes needed to have launchconfig tabs in console
wizard.
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse/META-INF/MANIFEST.MF
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse/META-INF/MANIFEST.MF 2008-09-05
18:01:24 UTC (rev 10106)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/META-INF/MANIFEST.MF 2008-09-05
22:00:23 UTC (rev 10107)
@@ -515,6 +515,7 @@
pojo
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui.console,
- org.eclipse.jface
+ org.eclipse.jface,
+ org.eclipse.datatools.connectivity
Eclipse-LazyStart: true
Eclipse-BuddyPolicy: registered
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java 2008-09-05
18:01:24 UTC (rev 10106)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java 2008-09-05
22:00:23 UTC (rev 10107)
@@ -29,6 +29,7 @@
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;
+import java.sql.DatabaseMetaData;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.SQLException;
@@ -38,11 +39,12 @@
import java.util.List;
import java.util.Map;
import java.util.Properties;
-import java.util.Map.Entry;
import org.dom4j.DocumentException;
import org.dom4j.Node;
import org.dom4j.io.DOMWriter;
+import org.eclipse.datatools.connectivity.IConnectionProfile;
+import org.eclipse.datatools.connectivity.ProfileManager;
import org.eclipse.osgi.util.NLS;
import org.hibernate.HibernateException;
import org.hibernate.MappingException;
@@ -58,6 +60,8 @@
import org.hibernate.console.execution.ExecutionContext.Command;
import org.hibernate.console.preferences.ConsoleConfigurationPreferences;
import
org.hibernate.console.preferences.ConsoleConfigurationPreferences.ConfigurationMode;
+import org.hibernate.dialect.Dialect;
+import org.hibernate.dialect.DialectFactory;
import org.hibernate.util.ConfigHelper;
import org.hibernate.util.ReflectHelper;
import org.hibernate.util.StringHelper;
@@ -142,8 +146,13 @@
method = clazz.getMethod("getHibernateConfiguration", new
Class[0]);//$NON-NLS-1$
Configuration invoke = (Configuration) method.invoke(ejb3cfg, (Object[])null);
+ invoke = configureConnectionProfile(invoke);
+
return invoke;
}
+ catch (HibernateConsoleRuntimeException he) {
+ throw he;
+ }
catch (Exception e) {
throw new
HibernateConsoleRuntimeException(ConsoleMessages.ConsoleConfiguration_could_not_create_jpa_based_configuration,e);
}
@@ -217,6 +226,7 @@
// here both setProperties and configxml have had their chance to tell which
databasedriver is needed.
registerFakeDriver(localCfg.getProperty(Environment.DRIVER) );
+ //autoConfigureDialect(localCfg); Disabled for now since it causes very looong
timeouts for non-running databases + i havent been needed until now...
// TODO: jpa configuration ?
if(includeMappings) {
@@ -234,6 +244,24 @@
return localCfg;
}
+ private void autoConfigureDialect(Configuration localCfg) {
+ if (localCfg.getProperty(Environment.DIALECT) == null){
+ String url = localCfg.getProperty(Environment.URL);
+ String user = localCfg.getProperty(Environment.USER);
+ String pass = localCfg.getProperty(Environment.PASS);
+ try {
+ DatabaseMetaData meta = DriverManager.getConnection(url, user,
pass).getMetaData();
+ String databaseName = meta.getDatabaseProductName();
+ int databaseMajorVersion = meta.getDatabaseMajorVersion();
+ //SQL Dialect:
+ Dialect dialect = DialectFactory.buildDialect( localCfg.getProperties(),
databaseName, databaseMajorVersion );
+ localCfg.setProperty(Environment.DIALECT, dialect.toString());
+ } catch (Exception e) {
+ //can't determine dialect
+ }
+ }
+ }
+
});
@@ -498,6 +526,9 @@
localCfg = buildAnnotationConfiguration();
localCfg = configureStandardConfiguration( includeMappings, localCfg, properties );
}
+ catch (HibernateConsoleRuntimeException he) {
+ throw he;
+ }
catch (Exception e) {
throw new
HibernateConsoleRuntimeException(ConsoleMessages.ConsoleConfiguration_could_not_load_annotationconfiguration,e);
}
@@ -505,6 +536,9 @@
try {
localCfg = buildJPAConfiguration( getPreferences().getPersistenceUnitName(),
properties, prefs.getEntityResolverName(), includeMappings );
}
+ catch (HibernateConsoleRuntimeException he) {
+ throw he;
+ }
catch (Exception e) {
throw new
HibernateConsoleRuntimeException(ConsoleMessages.ConsoleConfiguration_could_not_load_jpa_configuration,e);
}
@@ -539,10 +573,45 @@
}
localCfg = loadConfigurationXML( localCfg, includeMappings, entityResolver );
+ localCfg = configureConnectionProfile(localCfg);
return localCfg;
}
+ private Configuration configureConnectionProfile(Configuration localCfg) {
+ String connectionProfile = prefs.getConnectionProfileName();
+ if(connectionProfile==null) {
+ return localCfg;
+ }
+
+ IConnectionProfile profile =
ProfileManager.getInstance().getProfileByName(connectionProfile);
+ if (profile != null) {
+ final Properties invokeProperties = localCfg.getProperties();
+ // set this property to null!
+ invokeProperties.remove(Environment.DATASOURCE);
+ localCfg.setProperties(invokeProperties);
+ Properties cpProperties = profile.getProperties(profile.getProviderId());
+ // seems we should not setup dialect here
+ //String dialect =
"org.hibernate.dialect.HSQLDialect";//cpProperties.getProperty("org.eclipse.datatools.connectivity.db.driverClass");
+ //invoke.setProperty(Environment.DIALECT, dialect);
+ String driver =
cpProperties.getProperty("org.eclipse.datatools.connectivity.db.driverClass");
//$NON-NLS-1$
+ localCfg.setProperty(Environment.DRIVER, driver);
+ String url =
cpProperties.getProperty("org.eclipse.datatools.connectivity.db.URL");
//$NON-NLS-1$
+ //url += "/";// +
cpProperties.getProperty("org.eclipse.datatools.connectivity.db.databaseName");
+ localCfg.setProperty(Environment.URL, url);
+ String user =
cpProperties.getProperty("org.eclipse.datatools.connectivity.db.username");
//$NON-NLS-1$
+ if (null != user && user.length() > 0) {
+ localCfg.setProperty(Environment.USER, user);
+ }
+ String pass =
cpProperties.getProperty("org.eclipse.datatools.connectivity.db.password");
//$NON-NLS-1$
+ if (null != pass && pass.length() > 0) {
+ localCfg.setProperty(Environment.PASS, pass);
+ }
+ } else {
+ String out =
NLS.bind(ConsoleMessages.ConsoleConfiguration_connection_profile_not_found,
connectionProfile);
+ throw new HibernateConsoleRuntimeException(out);
+ }
+ return localCfg;
+ }
-
}
\ No newline at end of file
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleMessages.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleMessages.java 2008-09-05
18:01:24 UTC (rev 10106)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleMessages.java 2008-09-05
22:00:23 UTC (rev 10107)
@@ -4,6 +4,7 @@
public class ConsoleMessages extends NLS {
private static final String BUNDLE_NAME =
"org.hibernate.console.ConsoleMessages"; //$NON-NLS-1$
+ public static String ConsoleConfiguration_connection_profile_not_found;
public static String ConsoleConfiguration_could_not_access;
public static String ConsoleConfiguration_could_not_configure_entity_resolver;
public static String ConsoleConfiguration_could_not_configure_naming_strategy;
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleMessages.properties
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleMessages.properties 2008-09-05
18:01:24 UTC (rev 10106)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleMessages.properties 2008-09-05
22:00:23 UTC (rev 10107)
@@ -26,3 +26,4 @@
StandAloneConsoleConfigurationPreferences_errors_while_parsing=Errors while parsing
PluginFileAppender_missing_plugin_state_location=Missing Plugin State Location.
PluginLogAppender_missing_layout_for_appender=Missing layout for appender
+ConsoleConfiguration_connection_profile_not_found=Connection profile not found:
''{0}''.
\ No newline at end of file
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences/AbstractConsoleConfigurationPreferences.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences/AbstractConsoleConfigurationPreferences.java 2008-09-05
18:01:24 UTC (rev 10106)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences/AbstractConsoleConfigurationPreferences.java 2008-09-05
22:00:23 UTC (rev 10107)
@@ -53,8 +53,13 @@
private ConfigurationMode configurationMode;
private String persistenceUnitName;
private String namingStrategy;
+ private String connectionProfile;
+
- public AbstractConsoleConfigurationPreferences(String name, ConfigurationMode
configurationMode, String projectName, boolean useProjectclassPath, String entityResolver,
String persistenceUnitName, String namingStrategy) {
+ public AbstractConsoleConfigurationPreferences(String name, ConfigurationMode
configurationMode,
+ String projectName, boolean useProjectclassPath, String entityResolver,
+ String persistenceUnitName, String namingStrategy,
+ String connectionProfile) {
setName(name);
this.persistenceUnitName = persistenceUnitName;
this.namingStrategy = namingStrategy;
@@ -62,6 +67,7 @@
entityResolverName = entityResolver;
this.projectName = projectName;
this.useProjectClasspath = useProjectclassPath;
+ this.connectionProfile = connectionProfile;
}
protected AbstractConsoleConfigurationPreferences() {
@@ -80,6 +86,10 @@
return namingStrategy;
}
+ public String getConnectionProfileName() {
+ return connectionProfile;
+ }
+
public void setName(String name) {
if(name==null || name.trim().length()==0) {
throw new
IllegalArgumentException(ConsoleMessages.AbstractConsoleConfigurationPreferences_name_not_null_or_empty);
@@ -95,13 +105,22 @@
public final Properties getProperties() {
File propFile = getPropertyFile();
if(propFile==null) return null;
+ FileInputStream inStream = null;
try {
Properties p = new Properties();
- p.load(new FileInputStream(propFile) );
+ inStream = new FileInputStream(propFile);
+ p.load(inStream );
return p;
}
catch(IOException io) {
throw new
HibernateConsoleRuntimeException(ConsoleMessages.AbstractConsoleConfigurationPreferences_could_not_load_prop_file
+ propFile, io);
+ } finally {
+ if(inStream!=null)
+ try {
+ inStream.close();
+ } catch (IOException e) {
+ //ignore
+ }
}
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences/ConsoleConfigurationPreferences.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences/ConsoleConfigurationPreferences.java 2008-09-05
18:01:24 UTC (rev 10106)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences/ConsoleConfigurationPreferences.java 2008-09-05
22:00:23 UTC (rev 10107)
@@ -35,7 +35,7 @@
*
*/
public interface ConsoleConfigurationPreferences {
-
+
static final String PATH_TAG = "path"; //$NON-NLS-1$
static final String CLASSPATH_TAG = "classpath"; //$NON-NLS-1$
static final String MAPPING_TAG = "mapping"; //$NON-NLS-1$
@@ -48,7 +48,7 @@
static final String ANNOTATIONS_ATTRIB = "annotations"; //$NON-NLS-1$
static final String ENTITYRESOLVER_ATTRIB = "entityresolver"; //$NON-NLS-1$
static final String CONFIGURATION_MODE_ATTRIB = "configuration-factory";
//$NON-NLS-1$
-
+
// TODO: we should move this to some classhandler
static public class ConfigurationMode implements Serializable {
@@ -88,9 +88,9 @@
}
}
-
+
public abstract ConfigurationMode getConfigurationMode();
-
+
public abstract String getName();
/**
@@ -108,7 +108,7 @@
public abstract File getConfigXMLFile();
public abstract File getPropertyFile();
-
+
public abstract void writeStateTo(Element node);
public abstract void readStateFrom(Element element);
@@ -118,6 +118,8 @@
public abstract String getEntityResolverName();
public abstract String getPersistenceUnitName();
-
+
public abstract String getNamingStrategy();
+
+ public abstract String getConnectionProfileName();
}
\ No newline at end of file
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences/StandAloneConsoleConfigurationPreferences.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences/StandAloneConsoleConfigurationPreferences.java 2008-09-05
18:01:24 UTC (rev 10106)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences/StandAloneConsoleConfigurationPreferences.java 2008-09-05
22:00:23 UTC (rev 10107)
@@ -46,7 +46,7 @@
private File[] customClasspath;
public StandAloneConsoleConfigurationPreferences(String name, File xmlconfig, File
propertiesFile, File[] mappingFiles, File[] customClasspath) {
- super(name, ConfigurationMode.CORE, null, false, null, null, null);
+ super(name, ConfigurationMode.CORE, null, false, null, null, null, null);
this.cfgFile = xmlconfig;
this.propertyFilename = propertiesFile;
this.mappings = mappingFiles;
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/META-INF/MANIFEST.MF
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/META-INF/MANIFEST.MF 2008-09-05
18:01:24 UTC (rev 10106)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/META-INF/MANIFEST.MF 2008-09-05
22:00:23 UTC (rev 10107)
@@ -62,10 +62,22 @@
org.eclipse.ui.forms,
org.eclipse.wst.common.project.facet.core,
org.eclipse.wst.common.project.facet.ui,
+ org.eclipse.wst.xml.core,
+ org.eclipse.wst.sse.core,
+ org.eclipse.wst.xml.ui,
+ org.eclipse.wst.sse.ui,
org.eclipse.ui.navigator,
org.eclipse.jdt.launching,
org.eclipse.jdt.debug.ui,
org.eclipse.core.filesystem,
org.eclipse.core.variables,
- org.eclipse.ltk.core.refactoring
+ org.eclipse.datatools.connectivity.ui,
+ org.eclipse.datatools.connectivity,
+ org.eclipse.ltk.core.refactoring,
+ org.eclipse.jdt.launching,
+ org.eclipse.jdt.debug.ui,
+ org.eclipse.core.filesystem,
+ org.eclipse.core.variables,
+ org.eclipse.datatools.connectivity.ui,
+ org.eclipse.datatools.connectivity
Eclipse-LazyStart: true
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/EclipseConsoleConfigurationPreferences.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/EclipseConsoleConfigurationPreferences.java 2008-09-05
18:01:24 UTC (rev 10106)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/EclipseConsoleConfigurationPreferences.java 2008-09-05
22:00:23 UTC (rev 10107)
@@ -35,16 +35,13 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
-import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.osgi.util.NLS;
import org.hibernate.console.HibernateConsoleRuntimeException;
import org.hibernate.console.preferences.AbstractConsoleConfigurationPreferences;
-import org.hibernate.console.preferences.ConsoleConfigurationPreferences;
import org.hibernate.eclipse.console.utils.ClassLoaderHelper;
import org.hibernate.eclipse.console.utils.ProjectUtils;
-import org.hibernate.eclipse.launch.IConsoleConfigurationLaunchConstants;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
@@ -61,9 +58,12 @@
private IPath[] mappings = new IPath[0];
private IPath[] customClasspath = new IPath[0];
-
- public EclipseConsoleConfigurationPreferences(String configName, ConfigurationMode
cmode, String projectName, boolean useProjectClasspath, String entityResolver, IPath
cfgFile, IPath propertyFilename, IPath[] mappings, IPath[] classpaths, String
persistenceUnitName, String namingStrategy) {
- super(configName, cmode, projectName, useProjectClasspath, entityResolver,
persistenceUnitName, namingStrategy);
+ public EclipseConsoleConfigurationPreferences(String configName,
+ ConfigurationMode cmode, String projectName, boolean useProjectClasspath,
+ String entityResolver, IPath cfgFile, IPath propertyFilename,
+ IPath[] mappings, IPath[] classpaths, String persistenceUnitName, String
namingStrategy,
+ String connectionProfile, boolean connectionProfileFlag) {
+ super(configName, cmode, projectName, useProjectClasspath, entityResolver,
persistenceUnitName, namingStrategy, connectionProfile);
this.cfgFile = cfgFile;
this.propertyFilename = propertyFilename;
this.mappings = mappings;
@@ -135,9 +135,7 @@
public File[] getMappingFiles() {
File[] files = new File[mappings.length];
for (int i = 0; i < mappings.length; i++) {
- IPath path = mappings[i];
- files[i] = pathToFile(path);
-
+ files[i] = pathToFile(mappings[i]);
}
return files;
}
@@ -184,7 +182,6 @@
protected void setMappings(String[] mappings) {
this.mappings = new IPath[mappings.length];
for (int i = 0; i < mappings.length; i++) {
- String str = mappings[i];
this.mappings[i] = new Path(mappings[i]);
}
}
@@ -192,7 +189,6 @@
protected void setCustomClassPath(String[] mappings) {
this.customClasspath = new IPath[mappings.length];
for (int i = 0; i < mappings.length; i++) {
- //String str = mappings[i];
this.customClasspath[i] = new Path(mappings[i]);
}
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/EclipseLaunchConsoleConfigurationPreferences.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/EclipseLaunchConsoleConfigurationPreferences.java 2008-09-05
18:01:24 UTC (rev 10106)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/EclipseLaunchConsoleConfigurationPreferences.java 2008-09-05
22:00:23 UTC (rev 10107)
@@ -16,14 +16,10 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.osgi.util.NLS;
-import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.HibernateConsoleRuntimeException;
-import org.hibernate.console.KnownConfigurations;
import org.hibernate.console.preferences.ConsoleConfigurationPreferences;
import org.hibernate.eclipse.console.utils.ClassLoaderHelper;
-import org.hibernate.eclipse.launch.ICodeGenerationLaunchConstants;
import org.hibernate.eclipse.launch.IConsoleConfigurationLaunchConstants;
import org.w3c.dom.Element;
@@ -128,11 +124,15 @@
return getAttribute( IConsoleConfigurationLaunchConstants.NAMING_STRATEGY, null );
}
+ public String getConnectionProfileName() {
+ return getAttribute(IConsoleConfigurationLaunchConstants.CONNECTION_PROFILE_NAME,
null);
+ }
+
public String getPersistenceUnitName() {
return getAttribute( IConsoleConfigurationLaunchConstants.PERSISTENCE_UNIT_NAME, null
);
}
- public Properties getProperties() {
+ public Properties getProperties() {
File propFile = getPropertyFile();
if(propFile==null) return null;
try {
@@ -161,9 +161,4 @@
throw new
IllegalStateException(HibernateConsoleMessages.EclipseLaunchConsoleConfigurationPreferences_cannot_write_to_xml);
}
-
-
-
-
-
}
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 2008-09-05
18:01:24 UTC (rev 10106)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.java 2008-09-05
22:00:23 UTC (rev 10107)
@@ -512,6 +512,8 @@
public static String HibernateNature_exception_when_trying_to_locate_hibernate_nature;
public static String HibernateNature_reading_database_metadata;
public static String HibernateNature_reading_database_metadata_for;
+
+ public static String BasicWorkbenchAdapter_error_while_opening_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 2008-09-05
18:01:24 UTC (rev 10106)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.properties 2008-09-05
22:00:23 UTC (rev 10107)
@@ -1,506 +1,507 @@
-popup_copy_text=Copy
-popup_paste_text=Paste
-popup_select_all=Select All
-find_replace_action_label=Find/Replace
-find_replace_action_tooltip=Find/Replace
-find_replace_action_image=
-find_replace_action_description=Find & Replace
-AbstractQueryEditor_could_not_show_query_editor_input=Could not show query editor input
-AbstractQueryEditor_do_you_want_open_session_factory=Do you want to open the session
factory for {0} ?
-AbstractQueryEditor_max_results=Max results:
-AbstractQueryEditor_open_session_factory=Open Session factory
-AbstractQueryEditor_cannot_save=Cannot Save
-AbstractQueryEditor_the_file_has_been_deleted_or_is_not_accessible=The file has been
deleted or is not accessible.
-AbstractQueryEditor_save_as=Save As
-AbstractQueryEditor_already_exists_do_you_want_to_replace_it={0} already exists.\nDo you
want to replace it?
-AbstractQueryEditor_problems_during_save_as=Problems During Save As...
-AbstractQueryEditor_save_could_not_be_completed=Save could not be completed. {0}
-AbstractQueryEditor_the_original_file_has_been_deleted_or_is_not_accessible=The original
file ''{0}'' has been deleted or is not accessible.
-EclipseConsoleConfigurationPreferences_could_not_compute_def_classpath=Could not compute
default classpath from project
-EclipseConsoleConfigurationPreferences_could_not_resolve_to_file=Could not resolve {0} to
a file
-EclipseConsoleConfigurationPreferences_could_not_resolve_classpaths=Could not resolve
classpaths
-EclipseConsoleConfigurationPreferences_errors_while_parsing=Errors while parsing
-EclipseLaunchConsoleConfigurationPreferences_cannot_be_renamed=\ cannot be renamed
-EclipseLaunchConsoleConfigurationPreferences_cannot_read_from_xml=Cannot read from xml
-EclipseLaunchConsoleConfigurationPreferences_cannot_write_to_xml=Cannot write to xml
-EclipseLaunchConsoleConfigurationPreferences_could_not_compute_classpath=Could not
compute classpath
-EclipseLaunchConsoleConfigurationPreferences_could_not_load_property_file=Could not load
property file
-EclipseLaunchConsoleConfigurationPreferences_could_not_resolve_to_file=Could not resolve
{0} to a file
-HibernateConsolePlugin_could_not_delete_launch_config_for=Could not delete launch
configuration for:
-HibernateConsolePlugin_could_not_open_criteria_editor_for_console=Could not open Criteria
editor for console:
-HibernateConsolePlugin_could_not_open_hql_editor_for_console=Could not open HQL editor
for console:
-HibernateConsolePlugin_error_while_reading_console_config=Error while reading console
configuration
-HibernateConsolePlugin_hibernate_console=Hibernate Console
-HibernateConsolePlugin_no_message_1=: <no message>
-HibernateConsolePlugin_no_message_2=<No message>
-HibernateConsolePlugin_problem_to_get_flag=Problem to get flag
-
-AddConfigurationAction_add_config=Add Configuration...
-AddConfigurationAction_hibernate=hibernate
-AddConfigurationAction_problem_add_console_config=Problem adding a console configuration
-BuildSessionFactoryAction_build_session_factory=Build SessionFactory
-BuildSessionFactoryAction_close_sessionfactory=Close SessionFactory
-BuildSessionFactoryAction_create_sessionfactory=Create SessionFactory
-BuildSessionFactoryAction_exception_while_start_hibernate=Exception while
connecting/starting Hibernate
-BuildSessionFactoryAction_start_hibernate_resulted=Starting Hibernate resulted in a
UnsupportedClassVersionError.\nThis can occur if you are running eclipse with JDK 1.4 and
your domain classes require JDK 1.5. \n\nResolution: Run eclipse with JDK 1.5.
-ClearAction_clear_editor=Clear editor
-CloseQueryPageAction_close_query_page=Close query page
-ConsoleConfigurationBasedAction_problem_while_executing=Problem while executing {0}
({1})
-CriteriaEditorAction_hibernate_criteria_editor=Hibernate Criteria Editor
-CriteriaEditorAction_open_hibernate_criteria_editor=Open Hibernate Criteria Editor
-DeleteConfigurationAction_delete_config=Delete Configuration
-DeleteConfigurationAction_delete_console_config=Delete console configuration
-DeleteConfigurationAction_do_you_wish_del_selected_config=Do you wish to delete the
selected console configuration
-DeleteConfigurationAction_str_1=s
-DeleteConfigurationAction_str_2=s
-DeleteConfigurationAction_str_3=?
-EditConsoleConfiguration_could_not_find_launch_cfg=Could not find launch configuration
for ''{0}''
-EditConsoleConfiguration_edit_config=Edit Configuration
-EditConsoleConfiguration_exception_while_edit_config=Exception while trying to edit
configuration
-EditConsoleConfiguration_no_launch_cfg_matched=No launch configuration matched the
configuration named
-EditConsoleConfiguration_problem_adding_console_cfg=Problem adding a console
configuration
-ExecuteQueryAction_run_hql=Run HQL
-HQLScratchpadAction_hql_editor=HQL Editor
-HQLScratchpadAction_open_hql_editor=Open HQL Editor
-JTidyFormatAction_do_you_want_format_xml_files_with_jtidy=Do you want to format {0} xml
files with JTidy?
-JTidyFormatAction_error_while_running_jtidy=Error while running JTidy
-JTidyFormatAction_format_with_jtidy=Format with JTidy
-OpenFileActionUtils_problems_while_get_project_package_fragment_roots=Problems while
getting project package fragment roots
-OpenMappingAction_cannot_find_mapping_file=Can't find mapping file.
-OpenMappingAction_cannot_open_mapping_file=Can't open mapping file.
-OpenMappingAction_mapping_file_for_property_not_found=Mapping file for property
''{0}'' not found.
-OpenMappingAction_mapping_for_not_found=Mapping for {0} not found.
-OpenMappingAction_open_mapping_file=Open Mapping File
-OpenMappingAction_selection_not_found=Selection not found.
-OpenQueryEditorAction_exception_open_hql_editor=Exception while trying to open HQL
editor
-OpenSourceAction_cannot_find_source_file=Can't find source file.
-OpenSourceAction_cannot_open_source_file=Can't open source file.
-OpenSourceAction_open_source_file=Open Source File
-OpenSourceAction_source_file_for_class_not_found=Source file for class
''{0}'' not found.
-RefreshAction_refresh=Refresh
-
-ExporterDefinition_problem_creating_exporter_class=Problem while creating exporter class
-ExporterFactory_output_dir_in_does_not_exist=Output directory ''{0}'' in
{1} does not exist.
-ExporterFactory_template_dir_in_does_not_exist=Template directory ''{0}''
in {1} does not exist.
-ExporterProperty_generate_ejb3_annotations=Generate EJB3 annotations
-ExporterProperty_use_java5_syntax=Use Java 5 syntax
-
-HibernateConsolePreferencePage_choice_1=&Choice 1
-HibernateConsolePreferencePage_choice_2=C&hoice 2
-HibernateConsolePreferencePage_choice1=choice1
-HibernateConsolePreferencePage_choice2=choice2
-HibernateConsolePreferencePage_def_value=Default value
-HibernateConsolePreferencePage_demo_of_pref_page_impl=A demonstration of a preference
page implementation
-HibernateConsolePreferencePage_dir_preference=&Directory preference:
-HibernateConsolePreferencePage_example_of_bool_pref=&An example of a boolean
preference
-HibernateConsolePreferencePage_example_of_multichoise_pref=An example of a
multiple-choice preference
-HibernateConsolePreferencePage_text_pref=A &text preference:
-
-HibernatePropertyPage_default_hibernate_console_config=Default Hibernate Console
configuration:
-HibernatePropertyPage_enable_hibernate3_support=Enable Hibernate 3 support
-HibernatePropertyPage_open_url=Open URL
-HibernatePropertyPage_unable_open_webbrowser_for_url=Unable to open webbrowser for url:
-
-AutoResizeTableLayout_unknown_column_layout_data=Unknown column layout data
-ClassLoaderHelper_could_not_determine_physical_location_for=Could not determine physical
location for
-LaunchHelper_launch_cfg_type_cannot_be_null=Launch configuration type cannot be null
-ProjectUtils_could_not_activate_hibernate_nature_on_project=Could not activate Hibernate
nature on project
-ProjectUtils_could_not_save_changes_to_preferences=Could not save changes to preferences
-
-DialogSelectionHelper_used_entries_must_be_notnull=used entries must be not-null
-
-ConsoleConfigurationPropertySource_additional_mapping_files=Additional mapping files
-ConsoleConfigurationPropertySource_config_file=Configuration file
-ConsoleConfigurationPropertySource_error=Error:
-ConsoleConfigurationPropertySource_name=Name
-ConsoleConfigurationPropertySource_properties_file=Properties file
-DynamicSQLPreviewView_caused_by=\nCaused by:\n
-DynamicSQLPreviewView_empty_hql_query=Empty HQL query.
-DynamicSQLPreviewView_manipulation_of=Manipulation of
-DynamicSQLPreviewView_no_console_conf_associated=No Console configuration associated with
HQL Editor
-DynamicSQLPreviewView_no_hql_query_editor=No HQL Query editor
-DynamicSQLPreviewView_no_hql_query_editor_selected=No HQL Query editor selected
-DynamicSQLPreviewView_no_sql_generated=HQL was valid, but no SQL generated. Your
configuration most likely does not have any mappings defined.
-DynamicSQLPreviewView_session_factory_not_created=Session factory not created for
configuration:
-QueryPageViewer_error=<error:{0}>
-QueryPageViewer_exception_while_executing_hql_query=Exception while executing HQL Query
-QueryPageViewer_unknown_value=<Unknown value>
-QueryParametersPage_format=Format:
-QueryParametersPage_name=Name
-QueryParametersPage_null=null?
-QueryParametersPage_type=Type
-QueryParametersPage_value=Value
-QueryParametersView_no_hql_editor_open=No HQL editor open
-ReloadConfigurationAction_exception_while_start_hibernate=Exception while
connecting/starting Hibernate
-ReloadConfigurationAction_rebuild_configuration=Rebuild configuration
-ReloadConfigurationAction_starting_hibernate_resulted_exception=Starting Hibernate
resulted in a UnsupportedClassVersionError.\nThis can occur if you are running eclipse
with JDK 1.4 and your domain classes require JDK 1.5. \n\nResolution: Run eclipse with JDK
1.5.
-SchemaExportAction_errornum_while_performing_schemaexport=Error \# {0} while performing
SchemaExport
-SchemaExportAction_error_while_performing_schemaexport=\ error(s) while performing
SchemaExport, see Error Log for details
-SchemaExportAction_exception_running_schemaexport=Exception while running SchemaExport
-SchemaExportAction_run_schemaexport=Run SchemaExport
-SchemaExportAction_sure_run_schemaexport=Are you sure you want to run SchemaExport on
''{0}''?
-
-ClearPlaceHolderJob_removing_place_holder=Removing place holder for pending node
-PendingNode_error_getting_images=Error while getting images
-PendingNode_pending=Pending
-
-EntityPropertySource_identifier=Identifier
-EntityPropertySource_properties=Properties
-QueryPagePropertySource_console_configuration=Console configuration
-QueryPagePropertySource_millisec=\ millisec
-QueryPagePropertySource_query_run_time=Query run time
-QueryPagePropertySource_query_size=Query size
-QueryPagePropertySource_query_string=Query string
-QueryPagePropertySource_sec=\ sec
-QueryPagePropertySource_unknown=(unknown)
-
-ConsoleConfigurationCreationWizard_configuring_hibernate_console=Configuring Hibernate
Console
-ConsoleConfigurationCreationWizard_enable_hibernate_features=Enable Hibernate features
for project
-ConsoleConfigurationCreationWizard_error_finishing=Error while finishing Wizard
-ConsoleConfigurationCreationWizard_missing_classes=Probably missing classes or errors
with classloading
-ConsoleConfigurationCreationWizard_the_project=The project named ''{0}''
does not have Hibernate features enabled. Should it be updated to use {1} ?
-ConsoleConfigurationCreationWizard_the_project_named=The project named
''{0}'' does not have a default Hibernate configuration specified. Should
it be updated to use {1} ?
-ConsoleConfigurationCreationWizard_the_project_named_have=The project named
''{0}'' have the ''{1}'' specified. Should it be updated
to use {2} ?
-ConsoleConfigurationWizardPage_27=.jar
-ConsoleConfigurationWizardPage_28=.zip
-ConsoleConfigurationWizardPage_35=hbm.xml
-ConsoleConfigurationWizardPage_add_classpath_entry=Add classpath entry
-ConsoleConfigurationWizardPage_add_directory_zip_jar=Add a directory, .zip or .jar file
-ConsoleConfigurationWizardPage_add_external_jars=Add External JARS...
-ConsoleConfigurationWizardPage_add_hbmxml_file=Add hbm.xml file
-ConsoleConfigurationWizardPage_add_hibernate_mapping_file=Add a Hibernate Mapping file
-ConsoleConfigurationWizardPage_add_jar_dir=Add JAR/Dir...
-ConsoleConfigurationWizardPage_additional_classpath=Additional classpath (Hibernate jars
not necessary\!)
-ConsoleConfigurationWizardPage_additional_mapping_files=Additional mapping files (not
listed in cfg.xml)
-ConsoleConfigurationWizardPage_annotations=Annotations (jdk 1.5+)
-ConsoleConfigurationWizardPage_browse=Browse...
-ConsoleConfigurationWizardPage_choose_file_to_use=Choose file to use as
hibernate.properties
-ConsoleConfigurationWizardPage_choose_file_to_use_hibcfgxml_file=Choose file to use as
hibernate.cfg.xml
-ConsoleConfigurationWizardPage_classpath=Classpath
-ConsoleConfigurationWizardPage_config_file=&Configuration file:
-ConsoleConfigurationWizardPage_config_name_already_exist=A configuration with that name
already exists\!
-ConsoleConfigurationWizardPage_config_page=configurationPage
-ConsoleConfigurationWizardPage_configuration_file=Configuration file
-ConsoleConfigurationWizardPage_core=Core
-ConsoleConfigurationWizardPage_create_hibernate_console_config=Create Hibernate Console
Configuration
-ConsoleConfigurationWizardPage_does_not_exist=\ does not exist
-ConsoleConfigurationWizardPage_entity_resolver=&Entity resolver:
-ConsoleConfigurationWizardPage_general=General
-ConsoleConfigurationWizardPage_include_default_classpath=Include default classpath from
project
-ConsoleConfigurationWizardPage_is_not_a_file=\ is not a file
-ConsoleConfigurationWizardPage_jpa=JPA (jdk 1.5+)
-ConsoleConfigurationWizardPage_mappings=Mappings
-ConsoleConfigurationWizardPage_name=&Name:
-ConsoleConfigurationWizardPage_name_must_specified=A name must be specified
-ConsoleConfigurationWizardPage_bad_name={0} is an invalid configuration name.
-ConsoleConfigurationWizardPage_bad_char=''{0}'' is an invalid character
in a configuration name.
-ConsoleConfigurationWizardPage_naming_strategy=&Naming strategy:
-ConsoleConfigurationWizardPage_need_to_specify_classpath=Need to specify a classpath when
not using a project classpath
-ConsoleConfigurationWizardPage_both_hibernate_properties_and_hibernate_cfg_xml=If you
have both 'Property file' and 'Configuration file', the settings of
'Configuration file' will override the settings used in 'Property file'.
-ConsoleConfigurationWizardPage_need_to_specify_project=Need to specify a project or setup
a classpath
-ConsoleConfigurationWizardPage_persistence_unit=&Persistence unit:
-ConsoleConfigurationWizardPage_problem_while_initializing_cc=Problem while initializing
ConsoleConfigurationWizardPage
-ConsoleConfigurationWizardPage_problem_while_locating_jdbc_drivers=Problem while locating
jdbc drivers
-ConsoleConfigurationWizardPage_project=Pro&ject:
-ConsoleConfigurationWizardPage_property_file_1=Property file
-ConsoleConfigurationWizardPage_property_file_2=&Property file:
-ConsoleConfigurationWizardPage_select_entity_resolver_class=Select entity resolver class
-ConsoleConfigurationWizardPage_select_hibcfgxml_file=Select hibernate.cfg.xml file
-ConsoleConfigurationWizardPage_select_java_project=Select java project
-ConsoleConfigurationWizardPage_select_java_project_to_classpath=The (optional) java
project is used to determine the default classpath
-ConsoleConfigurationWizardPage_select_naming_strategy_class=Select naming strategy class
-ConsoleConfigurationWizardPage_select_property_file=Select property file
-ConsoleConfigurationWizardPage_the_java_project_does_not_exist=The Java project {0} does
not exist.
-ConsoleConfigurationWizardPage_this_wizard_allows=This wizard allows you to create a
configuration for Hibernate Console.
-ConsoleConfigurationWizardPage_type=Type:
-NewConfigurationWizard_create_hibernate_cfg_file=Create Hibernate Configuration file
(cfg.xml)
-NewConfigurationWizard_create_new_hibernate_cfg_xml=Create a new hibernate.cfg.xml.
-NewConfigurationWizard_creating=Creating
-NewConfigurationWizard_error=Error
-NewConfigurationWizard_open_file_for_editing=Opening file for editing...
-NewConfigurationWizard_problems_converting_to_utf8=Problems converting to UTF-8
-NewConfigurationWizardPage_connection_url=Connection &URL:
-NewConfigurationWizardPage_container=&Container:
-NewConfigurationWizardPage_create_console_configuration=Create a console configuration
-NewConfigurationWizardPage_database_dialect=&Database dialect:
-NewConfigurationWizardPage_default_catalog=Default Catalog:
-NewConfigurationWizardPage_default_schema=Default Schema:
-NewConfigurationWizardPage_driver_class=&Driver class:
-NewConfigurationWizardPage_file_already_exist=File already exists
-NewConfigurationWizardPage_file_container_must_be_specified=File container must be
specified
-NewConfigurationWizardPage_file_container_must_exist=File container must exist
-NewConfigurationWizardPage_file_extension_must_be_cfgxml=File extension must be
"cfg.xml"
-NewConfigurationWizardPage_file_name=&File name:
-NewConfigurationWizardPage_file_name_must_be_specified=File name must be specified
-NewConfigurationWizardPage_file_name_must_be_valid=File name must be valid
-NewConfigurationWizardPage_hibernate_config_file=Hibernate Configuration File (cfg.xml)
-NewConfigurationWizardPage_password=&Password:
-NewConfigurationWizardPage_project_must_be_writable=Project must be writable
-NewConfigurationWizardPage_session_factory_name=&Session factory name:
-NewConfigurationWizardPage_this_wizard_creates=This wizard creates a new configuration
file to use with Hibernate.
-NewConfigurationWizardPage_user_name=User&name:
-NewHibernateMappingFilePage_browse=Browse...
-NewHibernateMappingFilePage_class_to_map=Class to &map:
-NewHibernateMappingFilePage_container=&Container:
-NewHibernateMappingFilePage_file_container_must_be_specified=File container must be
specified
-NewHibernateMappingFilePage_file_container_must_exist=File container must exist
-NewHibernateMappingFilePage_file_name=&File name:
-NewHibernateMappingFilePage_file_name_must_be_specified=File name must be specified
-NewHibernateMappingFilePage_file_name_must_be_valid=File name must be valid
-NewHibernateMappingFilePage_hibernate_xml_mapping_file=Hibernate XML Mapping file
-NewHibernateMappingFilePage_project_must_be_writable=Project must be writable
-NewHibernateMappingFilePage_select_class_to_map=Select class to map
-NewHibernateMappingFilePage_select_new_file_container=Select new file container
-NewHibernateMappingFilePage_the_class_will_be_used_when=The class will be used when
generating the hbm.xml file
-NewHibernateMappingFilePage_this_wizard_creates=This wizard creates a new Hibernate XML
Mapping file
-NewHibernateMappingFileWizard_create_hibernate_xml_mapping_file=Create Hibernate XML
Mapping file (hbm.xml)
-NewHibernateMappingFileWizard_create_new_xml_mapping_file=Create a new XML Mapping file.
-NewHibernateMappingFileWizard_creating=Creating
-NewHibernateMappingFileWizard_opening_file_for_editing=Opening file for editing...
-NewReverseEngineeringFileWizard_create_hibernate_reverse_engineering_file=Create
Hibernate Reverse Engineering file (reveng.xml)
-NewReverseEngineeringFileWizard_create_new_hibernate_reveng_xml=Create a new
hibernate.reveng.xml.
-NewReverseEngineeringFileWizard_creating=Creating
-NewReverseEngineeringFileWizard_error=Error
-NewReverseEngineeringFileWizard_opening_file_for_editing=Opening file for editing...
-NewReverseEngineeringFileWizard_problems_converting_to_utf8=Problems converting to UTF-8
-TableFilterView_catalog=Catalog
-TableFilterView_do_you_want_to_remove_all_filters=Do you want to remove all filters ?
-TableFilterView_exclude=Exclude...
-TableFilterView_include=Include...
-TableFilterView_not_known_button=\ not a known button
-TableFilterView_remove_all_filters=Remove all filters
-TableFilterView_schema=Schema
-TableFilterView_sign=\!
-TableFilterView_table=Table
-TableFilterWizardPage_configure_table_filters=Configure Table filters
-TableFilterWizardPage_console_configuration=Console &configuration:
-TableFilterWizardPage_specify_which_catalog=Specify which catalog/schema/tables should be
included or excluded from the reverse engineering.
-TableFilterWizardPage_table_filters_contains_duplicates=Table filters contains
duplicates.
-TreeToTableComposite_database_schema=Database schema:
-TreeToTableComposite_down=Down
-TreeToTableComposite_exclude=Exclude...
-TreeToTableComposite_include=Include...
-TreeToTableComposite_incorrect_initial_value=incorrect initial value
-TreeToTableComposite_incorrect_state_count=incorrect state count
-TreeToTableComposite_invalid_value=invalid value
-TreeToTableComposite_refresh=Refresh
-TreeToTableComposite_remove=Remove
-TreeToTableComposite_remove_all=Remove All
-TreeToTableComposite_table_filters=Table filters:
-TreeToTableComposite_up=Up
-UpDownListComposite_add=Add...
-UpDownListComposite_down=Down
-UpDownListComposite_remove=Remove
-UpDownListComposite_test=\ test
-UpDownListComposite_up=Up
-
-BasicWorkbenchAdapter_error_while_expanding=Error while expanding
-BasicWorkbenchAdapter_hibernate_configuration_error=Hibernate Configuration error
-ConfigurationWorkbenchAdapter_configuration=Configuration
-ConsoleConfigurationWorkbenchAdapter_empty_configuration=<Empty Configuration>
-KnownConfigurationsWorkbenchAdapter_configurations=Configurations
-LazyDatabaseSchemaWorkbenchAdapter_database=Database
-LazyDatabaseSchemaWorkbenchAdapter_problem_while_reading_database_schema=Problem while
reading database schema
-LazyDatabaseSchemaWorkbenchAdapter_problems_while_reading_database_schema=Problems while
reading database schema
-LazyDatabaseSchemaWorkbenchAdapter_reading_schema_error=<Reading schema error: {0}
>
-LazyDatabaseSchemaWorkbenchAdapter_schema_not_available=<Schema not available>
-LazySessionFactoryAdapter_problems_while_creating_sessionfactory=Problems while creating
sessionfactory
-LazySessionFactoryAdapter_session_factory=Session Factory
-LazySessionFactoryAdapter_sessionfactory_error=<Sessionfactory error: {0} >
-PrimaryKeyWorkbenchAdapter_composite_primary_key=Composite primary key
-TableContainerWorkbenchAdapter_default=<default>
-ValueWorkbenchAdapter_value=value
-
-AnyAdaptableLabelProvider_unknown=Unknown: {0} ({1})
-
-CriteriaEditorInput_criteria=Criteria:
-CriteriaEditorInput_none=<None>
-CriteriaEditorStorage_criteria=Criteria:
-CriteriaEditorStorage_none=<None>
-JavaCompletionProcessor_error=Error
-JavaCompletionProcessor_error_while_performing_code_completion=Error while performing
code completion
-JavaCompletionProcessor_no_console_configuration_found=No console configuration found
-JavaCompletionProcessor_session_session=Session session;
-
-HibernateConfigurationPartFactory_not_known_by_factory=\ not known by factory
-
-ToggleLayoutAction_auto_layout=Automatic Layout
-ToggleLayoutAction_auto_layout_active=Automatic layout active
-ToggleLayoutAction_enable_auto_layout=Enable automatic layout
-ToggleLayoutAction_enable_manual_layout=Enable manual layout
-ToggleLayoutAction_manual_layout_active=Manual layout active
-
-AssociationViewAdapter_association_target_source=Association target: {0} source: {1}
-InheritanceViewAdapter_inheritance=Inheritance
-InheritanceViewAdapter_subclass_must_not_be_equal_to_superclass=subclass must not be
equal to superclass
-InheritanceViewAdapter_subclass_must_not_null=subclass must not null
-InheritanceViewAdapter_superclass_must_not_null=superclass must not null
-
-CompletionHelper_could_not_complete_java_types=Could not complete java types
-CompletionHelper_error_unknown_completion_proposal_class=ERROR: unknown
CompletionProposal class.
-HQLCompletionProcessor_could_not_get_document_contents=Could not get document contents
-HQLCompletionProcessor_error_while_performing_hql_completion=Error while performing HQL
completion
-HQLCompletionProcessor_no_hql_completions_available=No HQL completions available.
-HQLCompletionProcessor_no_start_word_found=No start word found.
-HQLEditorInput_none=<None>
-HQLEditorStorage_none=<None>
-HQLTextHover_empty_selection=Empty Selection
-LoadConsoleCFGCompletionProposal_could_not_load_configuration=Could not load
configuration
-LoadConsoleCFGCompletionProposal_load_console_cfg=Load Console Configuration
-LoadConsoleCFGCompletionProposal_no_open_console_cfg_found=No open console configuration
found.\nThis will attempt to open the console configuration\nto enable better code
completion.
-
-HQLEditorPreferencePage_colors_for_hql_editor_highlighting=Colors for HQL editor syntax
highlighting
-HQLEditorPreferencePage_default=Default:
-HQLEditorPreferencePage_identifier=Identifier:
-HQLEditorPreferencePage_keyword=Keyword:
-HQLEditorPreferencePage_string_literal=String literal:
-
-AddPropertyDialog_add_exporter_property=Add exporter property
-AddPropertyDialog_add_property_to=Add property to
-AddPropertyDialog_name=Name:
-AddPropertyDialog_the_property_is_already_set=The property {0} is already set, pressing
ok will overwrite the current value
-AddPropertyDialog_the_property_name_may_not_contain_whitespaces=The property name may not
contain whitespaces
-AddPropertyDialog_the_property_name_must_be_chosen_or_entered=The property name must be
chosen or entered
-AddPropertyDialog_the_property_value_must_be_non_empty=The property value must be
non-empty
-AddPropertyDialog_value=Value:
-CodeGenerationLaunchDelegate_console_configuration_not_found_in=Console configuration {0}
not found in {1}
-CodeGenerationLaunchDelegate_console_configuration_name_is_empty_in=Console configuration
name is empty in
-CodeGenerationLaunchDelegate_could_not_create_or_find_with_default_noarg_constructor=Could
not create or find {0} with default no-arg constructor
-CodeGenerationLaunchDelegate_could_not_create_or_find_with_one_argument_delegate_constructor=Could
not create or find {0} with one argument delegate constructor
-CodeGenerationLaunchDelegate_error_while_running=Error while running
-CodeGenerationLaunchDelegate_error_while_setting_up=Error while setting up
-CodeGenerationLaunchDelegate_exception_during_java_format=exception during java format
-CodeGenerationLaunchDelegate_formate_generated_code=Formate generated code
-CodeGenerationLaunchDelegate_generating_code_for=Generating code for
-CodeGenerationLaunchDelegate_java_format_cancelled=java format cancelled
-CodeGenerationLaunchDelegate_output_has_to_be_specified_in=Output has to be specified in
-CodeGenerationLaunchDelegate_reading_jdbc_metadata=reading jdbc metadata
-CodeGenerationLaunchDelegate_received_noclassdeffounderror=Received a
NoClassDefFoundError, probably the console configuration classpath is incomplete or
contains conflicting versions of the same class
-CodeGenerationSettingsTab_browse=&Browse...
-CodeGenerationSettingsTab_choose_dir_custom_templates=Choose directory containing custom
templates
-CodeGenerationSettingsTab_choose_dir_for_generated_files=Choose directory in which the
generated files will be stored
-CodeGenerationSettingsTab_choose_file_read_reverse_settings=Choose file from which
settings for the reverse engineering will be read
-CodeGenerationSettingsTab_choose_reverse_engineering_strategy=Choose a reverse
engineering strategy
-CodeGenerationSettingsTab_console_cfg_must_be_specified=Console configuration must be
specified
-CodeGenerationSettingsTab_console_configuration=Console &configuration:
-CodeGenerationSettingsTab_create_new=Create &new...
-CodeGenerationSettingsTab_detect_many_to_many_tables=Detect many-to-many tables
-CodeGenerationSettingsTab_detect_optimistic_lock_columns=Detect optimistic lock columns
-CodeGenerationSettingsTab_do_you_want_create_reveng_xml=Do you want to create a new
reveng.xml or use an existing file ?
-CodeGenerationSettingsTab_does_not_exist=\ does not exist
-CodeGenerationSettingsTab_filesystem=&Filesystem...
-CodeGenerationSettingsTab_generate_basic_typed_composite_ids=Generate basic typed
composite ids
-CodeGenerationSettingsTab_main=Main
-CodeGenerationSettingsTab_must_be_file=\ must be a file
-CodeGenerationSettingsTab_output_dir=Output &directory:
-CodeGenerationSettingsTab_output_directory=Output directory
-CodeGenerationSettingsTab_package=&Package:
-CodeGenerationSettingsTab_problems_when_reading=Problem when reading hibernate tools
launch configuration
-CodeGenerationSettingsTab_reveng_strategy=reveng. s&trategy:
-CodeGenerationSettingsTab_reveng_xml_1=reveng.xml
-CodeGenerationSettingsTab_reveng_xml_2=reveng.&xml:
-CodeGenerationSettingsTab_reveng_xml_3=reveng.xml
-CodeGenerationSettingsTab_reverse_engineer_from_jdbc_connection=Reverse engineer from
JDBC Connection
-CodeGenerationSettingsTab_select_output_dir=Select output directory
-CodeGenerationSettingsTab_select_reverse_engineering_settings_file=Select reverse
engineering settings file
-CodeGenerationSettingsTab_select_template_dir=Select template directory
-CodeGenerationSettingsTab_setup=&Setup...
-CodeGenerationSettingsTab_setup_reverse_engineering=Setup reverse engineering
-CodeGenerationSettingsTab_template_dir=template directory
-CodeGenerationSettingsTab_template_directory=Template &directory:
-CodeGenerationSettingsTab_use_custom_templates=Use custom templates (for custom file
generation)
-CodeGenerationSettingsTab_use_existing=Use &existing...
-CodeGenerationSettingsTab_workspace=&Workspace...
-ConsoleConfigurationLaunchDelegate_direct_launch_not_supported=Direct launch not
supported
-ConsoleConfigurationMainTab_annotations=Annotations (jdk 1.5+)
-ConsoleConfigurationMainTab_cfg_xml=cfg.xml
-ConsoleConfigurationMainTab_choose_file_to_use_as_hibernate_cfg_xml=Choose file to use as
hibernate.cfg.xml
-ConsoleConfigurationMainTab_choose_file_to_use_as_hibernate_properties=Choose file to use
as hibernate.properties
-ConsoleConfigurationMainTab_configuration_file=Configuration file:
-ConsoleConfigurationMainTab_configuration_file_2=Configuration file
-ConsoleConfigurationMainTab_both_hibernate_properties_and_hibernate_cfg_xml=If you have
both 'Property file' and 'Configuration file', the settings of
'Configuration file' will override the settings used in 'Property file'.
-ConsoleConfigurationMainTab_core=Core
-ConsoleConfigurationMainTab_create_hibernate_properties_file=Create Hibernate Properties
file (.properties)
-ConsoleConfigurationMainTab_create_new=Create &new...
-ConsoleConfigurationMainTab_create_new_properties_file=Create a new properties file
-ConsoleConfigurationMainTab_create_property_file=Create Property File
-ConsoleConfigurationMainTab_do_you_want_to_create_new_cfgxml=Do you want to create a new
*.cfg.xml or use an existing one ?
-ConsoleConfigurationMainTab_do_you_want_to_create_new_property_file=Do you want to create
a new property file or use an existing one ?
-ConsoleConfigurationMainTab_does_not_exist=\ does not exist
-ConsoleConfigurationMainTab_is_not_file=\ is not a file
-ConsoleConfigurationMainTab_java_project_to_determine_default_classpath=The (optional)
java project is used to determine the default classpath
-ConsoleConfigurationMainTab_jpa=JPA (jdk 1.5+)
-ConsoleConfigurationMainTab_main=Main
-ConsoleConfigurationMainTab_path_for_project_must_have_only_one_segment=Path for project
must have only one segment.
-ConsoleConfigurationMainTab_persistence_unit=Persistence unit:
-ConsoleConfigurationMainTab_project=Project:
-ConsoleConfigurationMainTab_properties=properties
-ConsoleConfigurationMainTab_property_file=Property file:
-ConsoleConfigurationMainTab_property_file_2=Property file
-ConsoleConfigurationMainTab_select_java_project=Select java project
-ConsoleConfigurationMainTab_select_propertyfile=Select property file
-ConsoleConfigurationMainTab_setup_configuration_file=Setup configuration file
-ConsoleConfigurationMainTab_setup_property_file=Setup property file
-ConsoleConfigurationMainTab_select_hibernate_cfg_xml_file=Select hibernate.cfg.xml file
-ConsoleConfigurationMainTab_the_java_project_does_not_exist=The Java project {0} does not
exist.
-ConsoleConfigurationMainTab_type=Type:
-ConsoleConfigurationMainTab_use_existing=Use &existing...
-ConsoleConfigurationMainTab_wizard_page=wizardPage
-ConsoleConfigurationMappingsTab_add_hbm_xml_file=Add hbm.xml file
-ConsoleConfigurationMappingsTab_add_hibernate_mapping_file=Add a Hibernate Mapping file
-ConsoleConfigurationMappingsTab_additional_mapping_files=Additonal mapping files (not
listed in cfg.xml)
-ConsoleConfigurationMappingsTab_mappings=Mappings
-ConsoleConfigurationOptionsTab_entity_resolver=Entity resolver:
-ConsoleConfigurationOptionsTab_naming_strategy=Naming strategy:
-ConsoleConfigurationOptionsTab_options=Options
-ConsoleConfigurationOptionsTab_select_entity_resolver_class=Select entity resolver class
-ConsoleConfigurationOptionsTab_select_naming_strategy_class=Select naming strategy class
-ConsoleConfigurationTab_browse=Browse...
-ConsoleConfigurationTab_create_new=Create New
-ConsoleConfigurationTab_setup=Setup...
-ConsoleConfigurationTabGroup_classpath_must_be_set_or_restored_to_default=Classpath must
be set or restored to default
-DirectoryBrowseField_filesystem=Filesystem...
-DirectoryBrowseField_workspace=Workspace..
-ExporterAttributes_could_not_locate_exporter_for_in=Could not locate exporter for
''{0}'' in {1}
-ExporterSettingsTab_add=Add...
-ExporterSettingsTab_add_exporter=Add exporter
-ExporterSettingsTab_at_least_one_exporter_option_must_be_selected=At least one exporter
option must be selected
-ExporterSettingsTab_console_configuration_must_be_specified=Console configuration must be
specified
-ExporterSettingsTab_description=Description
-ExporterSettingsTab_deselect_all=Deselect all
-ExporterSettingsTab_does_not_exist=\ does not exist
-ExporterSettingsTab_exporters=Exporters:
-ExporterSettingsTab_exporters_2=Exporters
-ExporterSettingsTab_general_settings=General settings:
-ExporterSettingsTab_generate_ejb3annotations=Generate EJB3 annotations
-ExporterSettingsTab_has_to_be_folder_or_project=\ has to be a folder or project
-ExporterSettingsTab_must_be_file=\ must be a file
-ExporterSettingsTab_output_directory_for=Output directory for
-ExporterSettingsTab_problem_when_reading_hibernate_tools_launch_configuration=Problem
when reading hibernate tools launch configuration
-ExporterSettingsTab_project_for_is_closed=Project for {0} is closed
-ExporterSettingsTab_properties=Properties:
-ExporterSettingsTab_remove=Remove...
-ExporterSettingsTab_select_all=Select all
-ExporterSettingsTab_select_exporter_you_want_to_add=Select the exporter(s) you want to
add
-ExporterSettingsTab_template_directory_for=Template directory for
-ExporterSettingsTab_use_java5_syntax=Use Java 5 syntax
-ExporterSettingsTab_select_dir=Select directory
-ExporterSettingsTab_select_path=Select path
-ExporterSettingsTab_use_java5_syntax=Use Java 5 syntax
-GeneralExceptionStatusHandler_exception_while_generating_code=Exception while generating
code
-GeneralExceptionStatusHandler_generating_code=Generating code
-PathHelper_does_not_exist={0} does not exist [{1}]
-PathHelper_has_invalid_variable_references={0} has invalid variable references [{1}]
-PathHelper_has_to_be_folder_or_project={0} has to be a folder or project [{1}]
-PathHelper_project_for_is_closed=Project for {0} is closed [{1}]
-
-HibernateRefactoringUtil_error_during_refactoring=Error during refactoring
-HibernateRefactoringUtil_error_occured_while_updating_classpath=Error occured while
updating classpath.
-LaunchConfigurationResourceNameChange_update_resource_path_in_launch_cfg=Update resource
path in launch configuration
-MoveResourceParticipant_launch_configurations_updates=Launch Configurations updates
-RenameResourceParticipant_launch_configurations_updates=Launch Configurations updates
-
-HibernateNature_error_while_performing_background_reading_of_database_schema=Error while
performing background reading of database schema
-HibernateNature_exception_when_trying_to_locate_hibernate_nature=Exception when trying to
locate Hibernate Nature
-HibernateNature_reading_database_metadata=Reading database metadata
-HibernateNature_reading_database_metadata_for=Reading database metadata for
+popup_copy_text=Copy
+popup_paste_text=Paste
+popup_select_all=Select All
+find_replace_action_label=Find/Replace
+find_replace_action_tooltip=Find/Replace
+find_replace_action_image=
+find_replace_action_description=Find & Replace
+AbstractQueryEditor_could_not_show_query_editor_input=Could not show query editor input
+AbstractQueryEditor_do_you_want_open_session_factory=Do you want to open the session
factory for {0} ?
+AbstractQueryEditor_max_results=Max results:
+AbstractQueryEditor_open_session_factory=Open Session factory
+AbstractQueryEditor_cannot_save=Cannot Save
+AbstractQueryEditor_the_file_has_been_deleted_or_is_not_accessible=The file has been
deleted or is not accessible.
+AbstractQueryEditor_save_as=Save As
+AbstractQueryEditor_already_exists_do_you_want_to_replace_it={0} already exists.\nDo you
want to replace it?
+AbstractQueryEditor_problems_during_save_as=Problems During Save As...
+AbstractQueryEditor_save_could_not_be_completed=Save could not be completed. {0}
+AbstractQueryEditor_the_original_file_has_been_deleted_or_is_not_accessible=The original
file ''{0}'' has been deleted or is not accessible.
+EclipseConsoleConfigurationPreferences_could_not_compute_def_classpath=Could not compute
default classpath from project
+EclipseConsoleConfigurationPreferences_could_not_resolve_to_file=Could not resolve {0} to
a file
+EclipseConsoleConfigurationPreferences_could_not_resolve_classpaths=Could not resolve
classpaths
+EclipseConsoleConfigurationPreferences_errors_while_parsing=Errors while parsing
+EclipseLaunchConsoleConfigurationPreferences_cannot_be_renamed=\ cannot be renamed
+EclipseLaunchConsoleConfigurationPreferences_cannot_read_from_xml=Cannot read from xml
+EclipseLaunchConsoleConfigurationPreferences_cannot_write_to_xml=Cannot write to xml
+EclipseLaunchConsoleConfigurationPreferences_could_not_compute_classpath=Could not
compute classpath
+EclipseLaunchConsoleConfigurationPreferences_could_not_load_property_file=Could not load
property file
+EclipseLaunchConsoleConfigurationPreferences_could_not_resolve_to_file=Could not resolve
{0} to a file
+HibernateConsolePlugin_could_not_delete_launch_config_for=Could not delete launch
configuration for:
+HibernateConsolePlugin_could_not_open_criteria_editor_for_console=Could not open Criteria
editor for console:
+HibernateConsolePlugin_could_not_open_hql_editor_for_console=Could not open HQL editor
for console:
+HibernateConsolePlugin_error_while_reading_console_config=Error while reading console
configuration
+HibernateConsolePlugin_hibernate_console=Hibernate Console
+HibernateConsolePlugin_no_message_1=: <no message>
+HibernateConsolePlugin_no_message_2=<No message>
+HibernateConsolePlugin_problem_to_get_flag=Problem to get flag
+
+AddConfigurationAction_add_config=Add Configuration...
+AddConfigurationAction_hibernate=hibernate
+AddConfigurationAction_problem_add_console_config=Problem adding a console configuration
+BuildSessionFactoryAction_build_session_factory=Build SessionFactory
+BuildSessionFactoryAction_close_sessionfactory=Close SessionFactory
+BuildSessionFactoryAction_create_sessionfactory=Create SessionFactory
+BuildSessionFactoryAction_exception_while_start_hibernate=Exception while
connecting/starting Hibernate
+BuildSessionFactoryAction_start_hibernate_resulted=Starting Hibernate resulted in a
UnsupportedClassVersionError.\nThis can occur if you are running eclipse with JDK 1.4 and
your domain classes require JDK 1.5. \n\nResolution: Run eclipse with JDK 1.5.
+ClearAction_clear_editor=Clear editor
+CloseQueryPageAction_close_query_page=Close query page
+ConsoleConfigurationBasedAction_problem_while_executing=Problem while executing {0}
({1})
+CriteriaEditorAction_hibernate_criteria_editor=Hibernate Criteria Editor
+CriteriaEditorAction_open_hibernate_criteria_editor=Open Hibernate Criteria Editor
+DeleteConfigurationAction_delete_config=Delete Configuration
+DeleteConfigurationAction_delete_console_config=Delete console configuration
+DeleteConfigurationAction_do_you_wish_del_selected_config=Do you wish to delete the
selected console configuration
+DeleteConfigurationAction_str_1=s
+DeleteConfigurationAction_str_2=s
+DeleteConfigurationAction_str_3=?
+EditConsoleConfiguration_could_not_find_launch_cfg=Could not find launch configuration
for ''{0}''
+EditConsoleConfiguration_edit_config=Edit Configuration
+EditConsoleConfiguration_exception_while_edit_config=Exception while trying to edit
configuration
+EditConsoleConfiguration_no_launch_cfg_matched=No launch configuration matched the
configuration named
+EditConsoleConfiguration_problem_adding_console_cfg=Problem adding a console
configuration
+ExecuteQueryAction_run_hql=Run HQL
+HQLScratchpadAction_hql_editor=HQL Editor
+HQLScratchpadAction_open_hql_editor=Open HQL Editor
+JTidyFormatAction_do_you_want_format_xml_files_with_jtidy=Do you want to format {0} xml
files with JTidy?
+JTidyFormatAction_error_while_running_jtidy=Error while running JTidy
+JTidyFormatAction_format_with_jtidy=Format with JTidy
+OpenFileActionUtils_problems_while_get_project_package_fragment_roots=Problems while
getting project package fragment roots
+OpenMappingAction_cannot_find_mapping_file=Can't find mapping file.
+OpenMappingAction_cannot_open_mapping_file=Can't open mapping file.
+OpenMappingAction_mapping_file_for_property_not_found=Mapping file for property
''{0}'' not found.
+OpenMappingAction_mapping_for_not_found=Mapping for {0} not found.
+OpenMappingAction_open_mapping_file=Open Mapping File
+OpenMappingAction_selection_not_found=Selection not found.
+OpenQueryEditorAction_exception_open_hql_editor=Exception while trying to open HQL
editor
+OpenSourceAction_cannot_find_source_file=Can't find source file.
+OpenSourceAction_cannot_open_source_file=Can't open source file.
+OpenSourceAction_open_source_file=Open Source File
+OpenSourceAction_source_file_for_class_not_found=Source file for class
''{0}'' not found.
+RefreshAction_refresh=Refresh
+
+ExporterDefinition_problem_creating_exporter_class=Problem while creating exporter class
+ExporterFactory_output_dir_in_does_not_exist=Output directory ''{0}'' in
{1} does not exist.
+ExporterFactory_template_dir_in_does_not_exist=Template directory ''{0}''
in {1} does not exist.
+ExporterProperty_generate_ejb3_annotations=Generate EJB3 annotations
+ExporterProperty_use_java5_syntax=Use Java 5 syntax
+
+HibernateConsolePreferencePage_choice_1=&Choice 1
+HibernateConsolePreferencePage_choice_2=C&hoice 2
+HibernateConsolePreferencePage_choice1=choice1
+HibernateConsolePreferencePage_choice2=choice2
+HibernateConsolePreferencePage_def_value=Default value
+HibernateConsolePreferencePage_demo_of_pref_page_impl=A demonstration of a preference
page implementation
+HibernateConsolePreferencePage_dir_preference=&Directory preference:
+HibernateConsolePreferencePage_example_of_bool_pref=&An example of a boolean
preference
+HibernateConsolePreferencePage_example_of_multichoise_pref=An example of a
multiple-choice preference
+HibernateConsolePreferencePage_text_pref=A &text preference:
+
+HibernatePropertyPage_default_hibernate_console_config=Default Hibernate Console
configuration:
+HibernatePropertyPage_enable_hibernate3_support=Enable Hibernate 3 support
+HibernatePropertyPage_open_url=Open URL
+HibernatePropertyPage_unable_open_webbrowser_for_url=Unable to open webbrowser for url:
+
+AutoResizeTableLayout_unknown_column_layout_data=Unknown column layout data
+ClassLoaderHelper_could_not_determine_physical_location_for=Could not determine physical
location for
+LaunchHelper_launch_cfg_type_cannot_be_null=Launch configuration type cannot be null
+ProjectUtils_could_not_activate_hibernate_nature_on_project=Could not activate Hibernate
nature on project
+ProjectUtils_could_not_save_changes_to_preferences=Could not save changes to preferences
+
+DialogSelectionHelper_used_entries_must_be_notnull=used entries must be not-null
+
+ConsoleConfigurationPropertySource_additional_mapping_files=Additional mapping files
+ConsoleConfigurationPropertySource_config_file=Configuration file
+ConsoleConfigurationPropertySource_error=Error:
+ConsoleConfigurationPropertySource_name=Name
+ConsoleConfigurationPropertySource_properties_file=Properties file
+DynamicSQLPreviewView_caused_by=\nCaused by:\n
+DynamicSQLPreviewView_empty_hql_query=Empty HQL query.
+DynamicSQLPreviewView_manipulation_of=Manipulation of
+DynamicSQLPreviewView_no_console_conf_associated=No Console configuration associated with
HQL Editor
+DynamicSQLPreviewView_no_hql_query_editor=No HQL Query editor
+DynamicSQLPreviewView_no_hql_query_editor_selected=No HQL Query editor selected
+DynamicSQLPreviewView_no_sql_generated=HQL was valid, but no SQL generated. Your
configuration most likely does not have any mappings defined.
+DynamicSQLPreviewView_session_factory_not_created=Session factory not created for
configuration:
+QueryPageViewer_error=<error:{0}>
+QueryPageViewer_exception_while_executing_hql_query=Exception while executing HQL Query
+QueryPageViewer_unknown_value=<Unknown value>
+QueryParametersPage_format=Format:
+QueryParametersPage_name=Name
+QueryParametersPage_null=null?
+QueryParametersPage_type=Type
+QueryParametersPage_value=Value
+QueryParametersView_no_hql_editor_open=No HQL editor open
+ReloadConfigurationAction_exception_while_start_hibernate=Exception while
connecting/starting Hibernate
+ReloadConfigurationAction_rebuild_configuration=Rebuild configuration
+ReloadConfigurationAction_starting_hibernate_resulted_exception=Starting Hibernate
resulted in a UnsupportedClassVersionError.\nThis can occur if you are running eclipse
with JDK 1.4 and your domain classes require JDK 1.5. \n\nResolution: Run eclipse with JDK
1.5.
+SchemaExportAction_errornum_while_performing_schemaexport=Error \# {0} while performing
SchemaExport
+SchemaExportAction_error_while_performing_schemaexport=\ error(s) while performing
SchemaExport, see Error Log for details
+SchemaExportAction_exception_running_schemaexport=Exception while running SchemaExport
+SchemaExportAction_run_schemaexport=Run SchemaExport
+SchemaExportAction_sure_run_schemaexport=Are you sure you want to run SchemaExport on
''{0}''?
+
+ClearPlaceHolderJob_removing_place_holder=Removing place holder for pending node
+PendingNode_error_getting_images=Error while getting images
+PendingNode_pending=Pending
+
+EntityPropertySource_identifier=Identifier
+EntityPropertySource_properties=Properties
+QueryPagePropertySource_console_configuration=Console configuration
+QueryPagePropertySource_millisec=\ millisec
+QueryPagePropertySource_query_run_time=Query run time
+QueryPagePropertySource_query_size=Query size
+QueryPagePropertySource_query_string=Query string
+QueryPagePropertySource_sec=\ sec
+QueryPagePropertySource_unknown=(unknown)
+
+ConsoleConfigurationCreationWizard_configuring_hibernate_console=Configuring Hibernate
Console
+ConsoleConfigurationCreationWizard_enable_hibernate_features=Enable Hibernate features
for project
+ConsoleConfigurationCreationWizard_error_finishing=Error while finishing Wizard
+ConsoleConfigurationCreationWizard_missing_classes=Probably missing classes or errors
with classloading
+ConsoleConfigurationCreationWizard_the_project=The project named ''{0}''
does not have Hibernate features enabled. Should it be updated to use {1} ?
+ConsoleConfigurationCreationWizard_the_project_named=The project named
''{0}'' does not have a default Hibernate configuration specified. Should
it be updated to use {1} ?
+ConsoleConfigurationCreationWizard_the_project_named_have=The project named
''{0}'' have the ''{1}'' specified. Should it be updated
to use {2} ?
+ConsoleConfigurationWizardPage_27=.jar
+ConsoleConfigurationWizardPage_28=.zip
+ConsoleConfigurationWizardPage_35=hbm.xml
+ConsoleConfigurationWizardPage_add_classpath_entry=Add classpath entry
+ConsoleConfigurationWizardPage_add_directory_zip_jar=Add a directory, .zip or .jar file
+ConsoleConfigurationWizardPage_add_external_jars=Add External JARS...
+ConsoleConfigurationWizardPage_add_hbmxml_file=Add hbm.xml file
+ConsoleConfigurationWizardPage_add_hibernate_mapping_file=Add a Hibernate Mapping file
+ConsoleConfigurationWizardPage_add_jar_dir=Add JAR/Dir...
+ConsoleConfigurationWizardPage_additional_classpath=Additional classpath (Hibernate jars
not necessary\!)
+ConsoleConfigurationWizardPage_additional_mapping_files=Additional mapping files (not
listed in cfg.xml)
+ConsoleConfigurationWizardPage_annotations=Annotations (jdk 1.5+)
+ConsoleConfigurationWizardPage_browse=Browse...
+ConsoleConfigurationWizardPage_choose_file_to_use=Choose file to use as
hibernate.properties
+ConsoleConfigurationWizardPage_choose_file_to_use_hibcfgxml_file=Choose file to use as
hibernate.cfg.xml
+ConsoleConfigurationWizardPage_classpath=Classpath
+ConsoleConfigurationWizardPage_config_file=&Configuration file:
+ConsoleConfigurationWizardPage_config_name_already_exist=A configuration with this name
already exists\!
+ConsoleConfigurationWizardPage_config_page=configurationPage
+ConsoleConfigurationWizardPage_configuration_file=Configuration file
+ConsoleConfigurationWizardPage_core=Core
+ConsoleConfigurationWizardPage_create_hibernate_console_config=Create Hibernate Console
Configuration
+ConsoleConfigurationWizardPage_does_not_exist=\ does not exist
+ConsoleConfigurationWizardPage_entity_resolver=&Entity resolver:
+ConsoleConfigurationWizardPage_general=General
+ConsoleConfigurationWizardPage_include_default_classpath=Include default classpath from
project
+ConsoleConfigurationWizardPage_is_not_a_file=\ is not a file
+ConsoleConfigurationWizardPage_jpa=JPA (jdk 1.5+)
+ConsoleConfigurationWizardPage_mappings=Mappings
+ConsoleConfigurationWizardPage_name=&Name:
+ConsoleConfigurationWizardPage_name_must_specified=A configuration name must be
specified
+ConsoleConfigurationWizardPage_bad_name={0} is an invalid configuration name.
+ConsoleConfigurationWizardPage_bad_char=''{0}'' is an invalid character
in a configuration name.
+ConsoleConfigurationWizardPage_naming_strategy=&Naming strategy:
+ConsoleConfigurationWizardPage_need_to_specify_classpath=Need to specify a classpath when
not using a project classpath
+ConsoleConfigurationWizardPage_both_hibernate_properties_and_hibernate_cfg_xml=If you
have both 'Property file' and 'Configuration file', the settings of
'Configuration file' will override the settings used in 'Property file'.
+ConsoleConfigurationWizardPage_need_to_specify_project=Need to specify a project or setup
a classpath
+ConsoleConfigurationWizardPage_persistence_unit=&Persistence unit:
+ConsoleConfigurationWizardPage_problem_while_initializing_cc=Problem while initializing
ConsoleConfigurationWizardPage
+ConsoleConfigurationWizardPage_problem_while_locating_jdbc_drivers=Problem while locating
jdbc drivers
+ConsoleConfigurationWizardPage_project=Pro&ject:
+ConsoleConfigurationWizardPage_property_file_1=Property file
+ConsoleConfigurationWizardPage_property_file_2=&Property file:
+ConsoleConfigurationWizardPage_select_entity_resolver_class=Select entity resolver class
+ConsoleConfigurationWizardPage_select_hibcfgxml_file=Select hibernate.cfg.xml file
+ConsoleConfigurationWizardPage_select_java_project=Select java project
+ConsoleConfigurationWizardPage_select_java_project_to_classpath=The (optional) java
project is used to determine the default classpath
+ConsoleConfigurationWizardPage_select_naming_strategy_class=Select naming strategy class
+ConsoleConfigurationWizardPage_select_property_file=Select property file
+ConsoleConfigurationWizardPage_the_java_project_does_not_exist=The Java project {0} does
not exist.
+ConsoleConfigurationWizardPage_this_wizard_allows=This wizard allows you to create a
configuration for Hibernate Console.
+ConsoleConfigurationWizardPage_type=Type:
+NewConfigurationWizard_create_hibernate_cfg_file=Create Hibernate Configuration file
(cfg.xml)
+NewConfigurationWizard_create_new_hibernate_cfg_xml=Create a new hibernate.cfg.xml.
+NewConfigurationWizard_creating=Creating
+NewConfigurationWizard_error=Error
+NewConfigurationWizard_open_file_for_editing=Opening file for editing...
+NewConfigurationWizard_problems_converting_to_utf8=Problems converting to UTF-8
+NewConfigurationWizardPage_connection_url=Connection &URL:
+NewConfigurationWizardPage_container=&Container:
+NewConfigurationWizardPage_create_console_configuration=Create a console configuration
+NewConfigurationWizardPage_database_dialect=&Database dialect:
+NewConfigurationWizardPage_default_catalog=Default Catalog:
+NewConfigurationWizardPage_default_schema=Default Schema:
+NewConfigurationWizardPage_driver_class=&Driver class:
+NewConfigurationWizardPage_file_already_exist=File already exists
+NewConfigurationWizardPage_file_container_must_be_specified=File container must be
specified
+NewConfigurationWizardPage_file_container_must_exist=File container must exist
+NewConfigurationWizardPage_file_extension_must_be_cfgxml=File extension must be
"cfg.xml"
+NewConfigurationWizardPage_file_name=&File name:
+NewConfigurationWizardPage_file_name_must_be_specified=File name must be specified
+NewConfigurationWizardPage_file_name_must_be_valid=File name must be valid
+NewConfigurationWizardPage_hibernate_config_file=Hibernate Configuration File (cfg.xml)
+NewConfigurationWizardPage_password=&Password:
+NewConfigurationWizardPage_project_must_be_writable=Project must be writable
+NewConfigurationWizardPage_session_factory_name=&Session factory name:
+NewConfigurationWizardPage_this_wizard_creates=This wizard creates a new configuration
file to use with Hibernate.
+NewConfigurationWizardPage_user_name=User&name:
+NewHibernateMappingFilePage_browse=Browse...
+NewHibernateMappingFilePage_class_to_map=Class to &map:
+NewHibernateMappingFilePage_container=&Container:
+NewHibernateMappingFilePage_file_container_must_be_specified=File container must be
specified
+NewHibernateMappingFilePage_file_container_must_exist=File container must exist
+NewHibernateMappingFilePage_file_name=&File name:
+NewHibernateMappingFilePage_file_name_must_be_specified=File name must be specified
+NewHibernateMappingFilePage_file_name_must_be_valid=File name must be valid
+NewHibernateMappingFilePage_hibernate_xml_mapping_file=Hibernate XML Mapping file
+NewHibernateMappingFilePage_project_must_be_writable=Project must be writable
+NewHibernateMappingFilePage_select_class_to_map=Select class to map
+NewHibernateMappingFilePage_select_new_file_container=Select new file container
+NewHibernateMappingFilePage_the_class_will_be_used_when=The class will be used when
generating the hbm.xml file
+NewHibernateMappingFilePage_this_wizard_creates=This wizard creates a new Hibernate XML
Mapping file
+NewHibernateMappingFileWizard_create_hibernate_xml_mapping_file=Create Hibernate XML
Mapping file (hbm.xml)
+NewHibernateMappingFileWizard_create_new_xml_mapping_file=Create a new XML Mapping file.
+NewHibernateMappingFileWizard_creating=Creating
+NewHibernateMappingFileWizard_opening_file_for_editing=Opening file for editing...
+NewReverseEngineeringFileWizard_create_hibernate_reverse_engineering_file=Create
Hibernate Reverse Engineering file (reveng.xml)
+NewReverseEngineeringFileWizard_create_new_hibernate_reveng_xml=Create a new
hibernate.reveng.xml.
+NewReverseEngineeringFileWizard_creating=Creating
+NewReverseEngineeringFileWizard_error=Error
+NewReverseEngineeringFileWizard_opening_file_for_editing=Opening file for editing...
+NewReverseEngineeringFileWizard_problems_converting_to_utf8=Problems converting to UTF-8
+TableFilterView_catalog=Catalog
+TableFilterView_do_you_want_to_remove_all_filters=Do you want to remove all filters ?
+TableFilterView_exclude=Exclude...
+TableFilterView_include=Include...
+TableFilterView_not_known_button=\ not a known button
+TableFilterView_remove_all_filters=Remove all filters
+TableFilterView_schema=Schema
+TableFilterView_sign=\!
+TableFilterView_table=Table
+TableFilterWizardPage_configure_table_filters=Configure Table filters
+TableFilterWizardPage_console_configuration=Console &configuration:
+TableFilterWizardPage_specify_which_catalog=Specify which catalog/schema/tables should be
included or excluded from the reverse engineering.
+TableFilterWizardPage_table_filters_contains_duplicates=Table filters contains
duplicates.
+TreeToTableComposite_database_schema=Database schema:
+TreeToTableComposite_down=Down
+TreeToTableComposite_exclude=Exclude...
+TreeToTableComposite_include=Include...
+TreeToTableComposite_incorrect_initial_value=incorrect initial value
+TreeToTableComposite_incorrect_state_count=incorrect state count
+TreeToTableComposite_invalid_value=invalid value
+TreeToTableComposite_refresh=Refresh
+TreeToTableComposite_remove=Remove
+TreeToTableComposite_remove_all=Remove All
+TreeToTableComposite_table_filters=Table filters:
+TreeToTableComposite_up=Up
+UpDownListComposite_add=Add...
+UpDownListComposite_down=Down
+UpDownListComposite_remove=Remove
+UpDownListComposite_test=\ test
+UpDownListComposite_up=Up
+
+BasicWorkbenchAdapter_error_while_expanding=Error while opening {0}
+BasicWorkbenchAdapter_error_while_opening_configuration=Error while opening console
configuration: {0}
+BasicWorkbenchAdapter_hibernate_configuration_error=Hibernate Configuration error
+ConfigurationWorkbenchAdapter_configuration=Configuration
+ConsoleConfigurationWorkbenchAdapter_empty_configuration=<Empty Configuration>
+KnownConfigurationsWorkbenchAdapter_configurations=Configurations
+LazyDatabaseSchemaWorkbenchAdapter_database=Database
+LazyDatabaseSchemaWorkbenchAdapter_problem_while_reading_database_schema=Problem while
reading database schema
+LazyDatabaseSchemaWorkbenchAdapter_problems_while_reading_database_schema=Problems while
reading database schema
+LazyDatabaseSchemaWorkbenchAdapter_reading_schema_error=<Reading schema error: {0}
>
+LazyDatabaseSchemaWorkbenchAdapter_schema_not_available=<Schema not available>
+LazySessionFactoryAdapter_problems_while_creating_sessionfactory=Problems while creating
sessionfactory
+LazySessionFactoryAdapter_session_factory=Session Factory
+LazySessionFactoryAdapter_sessionfactory_error=<Sessionfactory error: {0} >
+PrimaryKeyWorkbenchAdapter_composite_primary_key=Composite primary key
+TableContainerWorkbenchAdapter_default=<default>
+ValueWorkbenchAdapter_value=value
+
+AnyAdaptableLabelProvider_unknown=Unknown: {0} ({1})
+
+CriteriaEditorInput_criteria=Criteria:
+CriteriaEditorInput_none=<None>
+CriteriaEditorStorage_criteria=Criteria:
+CriteriaEditorStorage_none=<None>
+JavaCompletionProcessor_error=Error
+JavaCompletionProcessor_error_while_performing_code_completion=Error while performing
code completion
+JavaCompletionProcessor_no_console_configuration_found=No console configuration found
+JavaCompletionProcessor_session_session=Session session;
+
+HibernateConfigurationPartFactory_not_known_by_factory=\ not known by factory
+
+ToggleLayoutAction_auto_layout=Automatic Layout
+ToggleLayoutAction_auto_layout_active=Automatic layout active
+ToggleLayoutAction_enable_auto_layout=Enable automatic layout
+ToggleLayoutAction_enable_manual_layout=Enable manual layout
+ToggleLayoutAction_manual_layout_active=Manual layout active
+
+AssociationViewAdapter_association_target_source=Association target: {0} source: {1}
+InheritanceViewAdapter_inheritance=Inheritance
+InheritanceViewAdapter_subclass_must_not_be_equal_to_superclass=subclass must not be
equal to superclass
+InheritanceViewAdapter_subclass_must_not_null=subclass must not null
+InheritanceViewAdapter_superclass_must_not_null=superclass must not null
+
+CompletionHelper_could_not_complete_java_types=Could not complete java types
+CompletionHelper_error_unknown_completion_proposal_class=ERROR: unknown
CompletionProposal class.
+HQLCompletionProcessor_could_not_get_document_contents=Could not get document contents
+HQLCompletionProcessor_error_while_performing_hql_completion=Error while performing HQL
completion
+HQLCompletionProcessor_no_hql_completions_available=No HQL completions available.
+HQLCompletionProcessor_no_start_word_found=No start word found.
+HQLEditorInput_none=<None>
+HQLEditorStorage_none=<None>
+HQLTextHover_empty_selection=Empty Selection
+LoadConsoleCFGCompletionProposal_could_not_load_configuration=Could not load
configuration
+LoadConsoleCFGCompletionProposal_load_console_cfg=Load Console Configuration
+LoadConsoleCFGCompletionProposal_no_open_console_cfg_found=No open console configuration
found.\nThis will attempt to open the console configuration\nto enable better code
completion.
+
+HQLEditorPreferencePage_colors_for_hql_editor_highlighting=Colors for HQL editor syntax
highlighting
+HQLEditorPreferencePage_default=Default:
+HQLEditorPreferencePage_identifier=Identifier:
+HQLEditorPreferencePage_keyword=Keyword:
+HQLEditorPreferencePage_string_literal=String literal:
+
+AddPropertyDialog_add_exporter_property=Add exporter property
+AddPropertyDialog_add_property_to=Add property to
+AddPropertyDialog_name=Name:
+AddPropertyDialog_the_property_is_already_set=The property {0} is already set, pressing
ok will overwrite the current value
+AddPropertyDialog_the_property_name_may_not_contain_whitespaces=The property name may not
contain whitespaces
+AddPropertyDialog_the_property_name_must_be_chosen_or_entered=The property name must be
chosen or entered
+AddPropertyDialog_the_property_value_must_be_non_empty=The property value must be
non-empty
+AddPropertyDialog_value=Value:
+CodeGenerationLaunchDelegate_console_configuration_not_found_in=Console configuration {0}
not found in {1}
+CodeGenerationLaunchDelegate_console_configuration_name_is_empty_in=Console configuration
name is empty in
+CodeGenerationLaunchDelegate_could_not_create_or_find_with_default_noarg_constructor=Could
not create or find {0} with default no-arg constructor
+CodeGenerationLaunchDelegate_could_not_create_or_find_with_one_argument_delegate_constructor=Could
not create or find {0} with one argument delegate constructor
+CodeGenerationLaunchDelegate_error_while_running=Error while running
+CodeGenerationLaunchDelegate_error_while_setting_up=Error while setting up
+CodeGenerationLaunchDelegate_exception_during_java_format=exception during java format
+CodeGenerationLaunchDelegate_formate_generated_code=Formate generated code
+CodeGenerationLaunchDelegate_generating_code_for=Generating code for
+CodeGenerationLaunchDelegate_java_format_cancelled=java format cancelled
+CodeGenerationLaunchDelegate_output_has_to_be_specified_in=Output has to be specified in
+CodeGenerationLaunchDelegate_reading_jdbc_metadata=reading jdbc metadata
+CodeGenerationLaunchDelegate_received_noclassdeffounderror=Received a
NoClassDefFoundError, probably the console configuration classpath is incomplete or
contains conflicting versions of the same class
+CodeGenerationSettingsTab_browse=&Browse...
+CodeGenerationSettingsTab_choose_dir_custom_templates=Choose directory containing custom
templates
+CodeGenerationSettingsTab_choose_dir_for_generated_files=Choose directory in which the
generated files will be stored
+CodeGenerationSettingsTab_choose_file_read_reverse_settings=Choose file from which
settings for the reverse engineering will be read
+CodeGenerationSettingsTab_choose_reverse_engineering_strategy=Choose a reverse
engineering strategy
+CodeGenerationSettingsTab_console_cfg_must_be_specified=Console configuration must be
specified
+CodeGenerationSettingsTab_console_configuration=Console &configuration:
+CodeGenerationSettingsTab_create_new=Create &new...
+CodeGenerationSettingsTab_detect_many_to_many_tables=Detect many-to-many tables
+CodeGenerationSettingsTab_detect_optimistic_lock_columns=Detect optimistic lock columns
+CodeGenerationSettingsTab_do_you_want_create_reveng_xml=Do you want to create a new
reveng.xml or use an existing file ?
+CodeGenerationSettingsTab_does_not_exist=\ does not exist
+CodeGenerationSettingsTab_filesystem=&Filesystem...
+CodeGenerationSettingsTab_generate_basic_typed_composite_ids=Generate basic typed
composite ids
+CodeGenerationSettingsTab_main=Main
+CodeGenerationSettingsTab_must_be_file=\ must be a file
+CodeGenerationSettingsTab_output_dir=Output &directory:
+CodeGenerationSettingsTab_output_directory=Output directory
+CodeGenerationSettingsTab_package=&Package:
+CodeGenerationSettingsTab_problems_when_reading=Problem when reading hibernate tools
launch configuration
+CodeGenerationSettingsTab_reveng_strategy=reveng. s&trategy:
+CodeGenerationSettingsTab_reveng_xml_1=reveng.xml
+CodeGenerationSettingsTab_reveng_xml_2=reveng.&xml:
+CodeGenerationSettingsTab_reveng_xml_3=reveng.xml
+CodeGenerationSettingsTab_reverse_engineer_from_jdbc_connection=Reverse engineer from
JDBC Connection
+CodeGenerationSettingsTab_select_output_dir=Select output directory
+CodeGenerationSettingsTab_select_reverse_engineering_settings_file=Select reverse
engineering settings file
+CodeGenerationSettingsTab_select_template_dir=Select template directory
+CodeGenerationSettingsTab_setup=&Setup...
+CodeGenerationSettingsTab_setup_reverse_engineering=Setup reverse engineering
+CodeGenerationSettingsTab_template_dir=template directory
+CodeGenerationSettingsTab_template_directory=Template &directory:
+CodeGenerationSettingsTab_use_custom_templates=Use custom templates (for custom file
generation)
+CodeGenerationSettingsTab_use_existing=Use &existing...
+CodeGenerationSettingsTab_workspace=&Workspace...
+ConsoleConfigurationLaunchDelegate_direct_launch_not_supported=Direct launch not
supported
+ConsoleConfigurationMainTab_annotations=Annotations (jdk 1.5+)
+ConsoleConfigurationMainTab_cfg_xml=cfg.xml
+ConsoleConfigurationMainTab_choose_file_to_use_as_hibernate_cfg_xml=Choose file to use as
hibernate.cfg.xml
+ConsoleConfigurationMainTab_choose_file_to_use_as_hibernate_properties=Choose file to use
as hibernate.properties
+ConsoleConfigurationMainTab_configuration_file=Configuration file:
+ConsoleConfigurationMainTab_configuration_file_2=Configuration file
+ConsoleConfigurationMainTab_both_hibernate_properties_and_hibernate_cfg_xml=If you have
both 'Property file' and 'Configuration file', the settings of
'Configuration file' will override the settings used in 'Property file'.
+ConsoleConfigurationMainTab_core=Core
+ConsoleConfigurationMainTab_create_hibernate_properties_file=Create Hibernate Properties
file (.properties)
+ConsoleConfigurationMainTab_create_new=Create &new...
+ConsoleConfigurationMainTab_create_new_properties_file=Create a new properties file
+ConsoleConfigurationMainTab_create_property_file=Create Property File
+ConsoleConfigurationMainTab_do_you_want_to_create_new_cfgxml=Do you want to create a new
*.cfg.xml or use an existing one ?
+ConsoleConfigurationMainTab_do_you_want_to_create_new_property_file=Do you want to create
a new property file or use an existing one ?
+ConsoleConfigurationMainTab_does_not_exist=\ does not exist
+ConsoleConfigurationMainTab_is_not_file=\ is not a file
+ConsoleConfigurationMainTab_java_project_to_determine_default_classpath=The (optional)
java project is used to determine the default classpath
+ConsoleConfigurationMainTab_jpa=JPA (jdk 1.5+)
+ConsoleConfigurationMainTab_main=Main
+ConsoleConfigurationMainTab_path_for_project_must_have_only_one_segment=Path for project
must have only one segment.
+ConsoleConfigurationMainTab_persistence_unit=Persistence unit:
+ConsoleConfigurationMainTab_project=Project:
+ConsoleConfigurationMainTab_properties=properties
+ConsoleConfigurationMainTab_property_file=Property file:
+ConsoleConfigurationMainTab_property_file_2=Property file
+ConsoleConfigurationMainTab_select_java_project=Select java project
+ConsoleConfigurationMainTab_select_propertyfile=Select property file
+ConsoleConfigurationMainTab_setup_configuration_file=Setup configuration file
+ConsoleConfigurationMainTab_setup_property_file=Setup property file
+ConsoleConfigurationMainTab_select_hibernate_cfg_xml_file=Select hibernate.cfg.xml file
+ConsoleConfigurationMainTab_the_java_project_does_not_exist=The Java project {0} does not
exist.
+ConsoleConfigurationMainTab_type=Type:
+ConsoleConfigurationMainTab_use_existing=Use &existing...
+ConsoleConfigurationMainTab_wizard_page=wizardPage
+ConsoleConfigurationMappingsTab_add_hbm_xml_file=Add hbm.xml file
+ConsoleConfigurationMappingsTab_add_hibernate_mapping_file=Add a Hibernate Mapping file
+ConsoleConfigurationMappingsTab_additional_mapping_files=Additonal mapping files (not
listed in cfg.xml)
+ConsoleConfigurationMappingsTab_mappings=Mappings
+ConsoleConfigurationOptionsTab_entity_resolver=Entity resolver:
+ConsoleConfigurationOptionsTab_naming_strategy=Naming strategy:
+ConsoleConfigurationOptionsTab_options=Options
+ConsoleConfigurationOptionsTab_select_entity_resolver_class=Select entity resolver class
+ConsoleConfigurationOptionsTab_select_naming_strategy_class=Select naming strategy class
+ConsoleConfigurationTab_browse=Browse...
+ConsoleConfigurationTab_create_new=Create New
+ConsoleConfigurationTab_setup=Setup...
+ConsoleConfigurationTabGroup_classpath_must_be_set_or_restored_to_default=Classpath must
be set or restored to default
+DirectoryBrowseField_filesystem=Filesystem...
+DirectoryBrowseField_workspace=Workspace..
+ExporterAttributes_could_not_locate_exporter_for_in=Could not locate exporter for
''{0}'' in {1}
+ExporterSettingsTab_add=Add...
+ExporterSettingsTab_add_exporter=Add exporter
+ExporterSettingsTab_at_least_one_exporter_option_must_be_selected=At least one exporter
option must be selected
+ExporterSettingsTab_console_configuration_must_be_specified=Console configuration must be
specified
+ExporterSettingsTab_description=Description
+ExporterSettingsTab_deselect_all=Deselect all
+ExporterSettingsTab_does_not_exist=\ does not exist
+ExporterSettingsTab_exporters=Exporters:
+ExporterSettingsTab_exporters_2=Exporters
+ExporterSettingsTab_general_settings=General settings:
+ExporterSettingsTab_generate_ejb3annotations=Generate EJB3 annotations
+ExporterSettingsTab_has_to_be_folder_or_project=\ has to be a folder or project
+ExporterSettingsTab_must_be_file=\ must be a file
+ExporterSettingsTab_output_directory_for=Output directory for
+ExporterSettingsTab_problem_when_reading_hibernate_tools_launch_configuration=Problem
when reading hibernate tools launch configuration
+ExporterSettingsTab_project_for_is_closed=Project for {0} is closed
+ExporterSettingsTab_properties=Properties:
+ExporterSettingsTab_remove=Remove...
+ExporterSettingsTab_select_all=Select all
+ExporterSettingsTab_select_exporter_you_want_to_add=Select the exporter(s) you want to
add
+ExporterSettingsTab_template_directory_for=Template directory for
+ExporterSettingsTab_use_java5_syntax=Use Java 5 syntax
+ExporterSettingsTab_select_dir=Select directory
+ExporterSettingsTab_select_path=Select path
+ExporterSettingsTab_use_java5_syntax=Use Java 5 syntax
+GeneralExceptionStatusHandler_exception_while_generating_code=Exception while generating
code
+GeneralExceptionStatusHandler_generating_code=Generating code
+PathHelper_does_not_exist={0} does not exist [{1}]
+PathHelper_has_invalid_variable_references={0} has invalid variable references [{1}]
+PathHelper_has_to_be_folder_or_project={0} has to be a folder or project [{1}]
+PathHelper_project_for_is_closed=Project for {0} is closed [{1}]
+
+HibernateRefactoringUtil_error_during_refactoring=Error during refactoring
+HibernateRefactoringUtil_error_occured_while_updating_classpath=Error occured while
updating classpath.
+LaunchConfigurationResourceNameChange_update_resource_path_in_launch_cfg=Update resource
path in launch configuration
+MoveResourceParticipant_launch_configurations_updates=Launch Configurations updates
+RenameResourceParticipant_launch_configurations_updates=Launch Configurations updates
+
+HibernateNature_error_while_performing_background_reading_of_database_schema=Error while
performing background reading of database schema
+HibernateNature_exception_when_trying_to_locate_hibernate_nature=Exception when trying to
locate Hibernate Nature
+HibernateNature_reading_database_metadata=Reading database metadata
+HibernateNature_reading_database_metadata_for=Reading database metadata for
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/AddConfigurationAction.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/AddConfigurationAction.java 2008-09-05
18:01:24 UTC (rev 10106)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/AddConfigurationAction.java 2008-09-05
22:00:23 UTC (rev 10107)
@@ -72,33 +72,12 @@
*/
try {
- ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
-
- ILaunchConfigurationType launchConfigurationType =
launchManager.getLaunchConfigurationType(
ICodeGenerationLaunchConstants.CONSOLE_CONFIGURATION_LAUNCH_TYPE_ID );
- String launchName =
launchManager.generateUniqueLaunchConfigurationNameFrom(HibernateConsoleMessages.AddConfigurationAction_hibernate);
- //ILaunchConfiguration[] launchConfigurations = launchManager.getLaunchConfigurations(
launchConfigurationType );
- ILaunchConfigurationWorkingCopy wc = launchConfigurationType.newInstance(null,
launchName);
- wc.setAttribute(TEMPORARY_CONFIG_FLAG, true);
- ILaunchConfiguration saved = wc.doSave();
- int res = DebugUITools.openLaunchConfigurationPropertiesDialog(
part.getSite().getShell(), saved, "org.eclipse.debug.ui.launchGroup.run" );
//$NON-NLS-1$
- List<ILaunchConfiguration> listTempConfigs = new
ArrayList<ILaunchConfiguration>();
- ILaunchConfiguration[] configs =
launchManager.getLaunchConfigurations(launchConfigurationType);
- for (int i = 0; i < configs.length; i++) {
- boolean temporary =
configs[i].getAttribute(AddConfigurationAction.TEMPORARY_CONFIG_FLAG, false);
- if (temporary) {
- listTempConfigs.add(configs[i]);
- }
- }
+ ILaunchConfiguration wc = createTemporaryLaunchConfiguration();
+ int res = DebugUITools.openLaunchConfigurationPropertiesDialog(
part.getSite().getShell(), wc, "org.eclipse.debug.ui.launchGroup.run" );
//$NON-NLS-1$
if (res != Window.OK) {
- for (int i = 0; i < listTempConfigs.size(); i++) {
- listTempConfigs.get(i).delete();
- }
+ deleteTemporaryLaunchConfigurations();
} else {
- for (int i = 0; i < listTempConfigs.size(); i++) {
- wc = listTempConfigs.get(i).getWorkingCopy();
- wc.setAttribute(TEMPORARY_CONFIG_FLAG, (String)null); // Must be set to null since
it should never be in the actual saved configuration!
- wc.doSave();
- }
+ makeTemporaryLaunchConfigurationsPermanent();
}
} catch (CoreException ce) {
@@ -107,4 +86,50 @@
}
+
+ static public ILaunchConfiguration createTemporaryLaunchConfiguration()
+ throws CoreException {
+ ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
+
+ ILaunchConfigurationType launchConfigurationType =
launchManager.getLaunchConfigurationType(
ICodeGenerationLaunchConstants.CONSOLE_CONFIGURATION_LAUNCH_TYPE_ID );
+ String launchName =
launchManager.generateUniqueLaunchConfigurationNameFrom(HibernateConsoleMessages.AddConfigurationAction_hibernate);
+ //ILaunchConfiguration[] launchConfigurations = launchManager.getLaunchConfigurations(
launchConfigurationType );
+ ILaunchConfigurationWorkingCopy wc = launchConfigurationType.newInstance(null,
launchName);
+ wc.setAttribute(TEMPORARY_CONFIG_FLAG, true);
+ return wc.doSave();
+ }
+
+ static public void makeTemporaryLaunchConfigurationsPermanent() throws CoreException {
+ List<ILaunchConfiguration> listTempConfigs = getTemporaryLaunchConfigurations();
+ ILaunchConfigurationWorkingCopy wc;
+ for (int i = 0; i < listTempConfigs.size(); i++) {
+ wc = listTempConfigs.get(i).getWorkingCopy();
+ wc.setAttribute(TEMPORARY_CONFIG_FLAG, (String)null); // Must be set to null since it
should never be in the actual saved configuration!
+ wc.doSave();
+ }
+ }
+
+ static public void deleteTemporaryLaunchConfigurations() throws CoreException {
+ List<ILaunchConfiguration> listTempConfigs = getTemporaryLaunchConfigurations();
+ for (int i = 0; i < listTempConfigs.size(); i++) {
+ listTempConfigs.get(i).delete();
+ }
+ }
+
+ static private List<ILaunchConfiguration> getTemporaryLaunchConfigurations()
+ throws CoreException {
+ ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
+
+ ILaunchConfigurationType launchConfigurationType =
launchManager.getLaunchConfigurationType(
ICodeGenerationLaunchConstants.CONSOLE_CONFIGURATION_LAUNCH_TYPE_ID );
+
+ List<ILaunchConfiguration> listTempConfigs = new
ArrayList<ILaunchConfiguration>();
+ ILaunchConfiguration[] configs =
launchManager.getLaunchConfigurations(launchConfigurationType);
+ for (int i = 0; i < configs.length; i++) {
+ boolean temporary =
configs[i].getAttribute(AddConfigurationAction.TEMPORARY_CONFIG_FLAG, false);
+ if (temporary) {
+ listTempConfigs.add(configs[i]);
+ }
+ }
+ return listTempConfigs;
+ }
}
Added:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/BestGuessConsoleConfigurationVisitor.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/BestGuessConsoleConfigurationVisitor.java
(rev 0)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/BestGuessConsoleConfigurationVisitor.java 2008-09-05
22:00:23 UTC (rev 10107)
@@ -0,0 +1,98 @@
+package org.hibernate.eclipse.console.wizards;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceProxy;
+import org.eclipse.core.resources.IResourceProxyVisitor;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IJavaProject;
+
+/**
+ * A visitor class that will make a "best guess" on which files the user
+ * want for the properties and config file.
+ *
+ * @author max
+ *
+ */
+public class BestGuessConsoleConfigurationVisitor implements IResourceProxyVisitor {
+
+ private IPath propertyFile;
+ private IPath configFile;
+ private IPath persistencexml;
+ private IJavaProject javaProject;
+ private List<IPath> classpath = new ArrayList<IPath>();
+ private List<IPath> mappings = new ArrayList<IPath>();
+
+ public IPath getPropertyFile() {
+ return propertyFile;
+ }
+
+ public IPath getConfigFile() {
+ return configFile;
+ }
+
+ public IPath getPersistencexml() {
+ return persistencexml;
+ }
+
+ public IJavaProject getJavaProject() {
+ return javaProject;
+ }
+
+ public List<IPath> getClasspath() {
+ return classpath;
+ }
+
+ public List<IPath> getMappings() {
+ return mappings;
+ }
+
+ public boolean visit(IResourceProxy proxy) throws CoreException {
+ // System.out.println("visit: " + proxy.getName() );
+ IPath fullPath = proxy.requestFullPath();
+ if (proxy.getType() == IResource.FILE) {
+ if ("hibernate.properties".equals(proxy.getName())) { //$NON-NLS-1$
+ propertyFile = fullPath;
+ return false;
+ }
+
+ if ("hibernate.cfg.xml".equals(proxy.getName())) { //$NON-NLS-1$
+ configFile = fullPath;
+ mappings.clear(); // we prefer af cfg.xml over mappings
+ return false;
+ }
+
+ if ("persistence.xml".equals(proxy.getName())) { //$NON-NLS-1$
+ if (javaProject != null
+ && javaProject.isOnClasspath(proxy
+ .requestResource())) {
+ persistencexml = fullPath;
+ mappings.clear();
+ return false;
+ }
+ }
+
+ // only add mappings if we don't have a config file.
+ if ((configFile == null || persistencexml == null)
+ && proxy.getName().endsWith(".hbm.xml")) { //$NON-NLS-1$
+ mappings.add(fullPath);
+ return false;
+ }
+ } else if (proxy.getType() == IResource.FOLDER) {
+ if (javaProject != null) {
+ if (javaProject.getOutputLocation().isPrefixOf(fullPath)) {
+ // classpath.add(fullPath);
+ return false; // skip output locations
+ }
+ }
+ }
+ return true;
+ }
+
+ public void setJavaProject(IJavaProject project) {
+ javaProject = project;
+ }
+}
\ No newline at end of file
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/ConsoleConfigurationCreationWizard.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/ConsoleConfigurationCreationWizard.java 2008-09-05
18:01:24 UTC (rev 10106)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/ConsoleConfigurationCreationWizard.java 2008-09-05
22:00:23 UTC (rev 10107)
@@ -21,18 +21,13 @@
*/
package org.hibernate.eclipse.console.wizards;
-import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
@@ -41,10 +36,8 @@
import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.IWizardContainer;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Display;
@@ -52,13 +45,10 @@
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWizard;
-import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.ImageConstants;
import org.hibernate.console.KnownConfigurations;
-import org.hibernate.console.preferences.ConsoleConfigurationPreferences;
import
org.hibernate.console.preferences.ConsoleConfigurationPreferences.ConfigurationMode;
import org.hibernate.eclipse.console.EclipseConsoleConfiguration;
-import org.hibernate.eclipse.console.EclipseConsoleConfigurationPreferences;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.eclipse.console.utils.EclipseImages;
@@ -101,53 +91,24 @@
* using wizard as execution context.
*/
public boolean performFinish() {
- final ConsoleConfigurationWizardPage confPage = this.page;
- return createConsoleConfiguration( getContainer(), confPage );
- }
-
- static boolean createConsoleConfiguration(IWizardContainer container, final
ConsoleConfigurationWizardPage confPage) {
- final String configName = confPage.getConfigurationName();
- final String entityResolver = confPage.getEntityResolverClassName();
- final IPath propertyFile = confPage.getPropertyFilePath();
- final IPath fileName = confPage.getConfigurationFilePath();
- final ConfigurationMode annotations = confPage.getConfigurationMode();
- final IPath[] mappings = confPage.getMappingFiles();
- final IPath[] classpaths = confPage.getClassPath();
- final boolean useProjectClasspath = confPage.useProjectClassPath();
- final String projectName = confPage.getProjectName();
- final String namingStrategy = confPage.getNamingStrategy();
- final String persistenceUnitName = confPage.getPersistenceUnitName();
- IRunnableWithProgress op = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- try {
- createConsoleConfiguration(confPage.getShell(), confPage.getOldConfiguration(),
configName, annotations, projectName, useProjectClasspath, entityResolver, propertyFile,
fileName, mappings, classpaths, persistenceUnitName, namingStrategy, monitor);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- };
try {
- container.run(true, false, op);
- } catch (InterruptedException e) {
- return false;
- } catch (InvocationTargetException e) {
- Throwable realException = e.getTargetException();
- IStatus s = null;
- if(realException instanceof CoreException) {
- s = ( (CoreException)realException).getStatus();
- } else {
- IStatus se = HibernateConsolePlugin.throwableToStatus( e );
- s = new MultiStatus(HibernateConsolePlugin.ID, IStatus.OK, new IStatus[] { se },
HibernateConsoleMessages.ConsoleConfigurationCreationWizard_missing_classes, e);
-
- }
- HibernateConsolePlugin.getDefault().showError( container.getShell(),
HibernateConsoleMessages.ConsoleConfigurationCreationWizard_error_finishing, s );
- return false;
+ page.performFinish();
+ } catch (CoreException ce) {
+ HibernateConsolePlugin.getDefault().showError(getShell(),
HibernateConsoleMessages.AddConfigurationAction_problem_add_console_config, ce);
}
return true;
}
+ public boolean performCancel() {
+ try {
+ page.performCancel();
+ } catch (CoreException ce) {
+ HibernateConsolePlugin.getDefault().showError(getShell(),
HibernateConsoleMessages.AddConfigurationAction_problem_add_console_config, ce);
+ }
+ return true;
+ }
+
+ // Only used by tests - see JBIDE-2734
static protected void createConsoleConfiguration(
final Shell shell,
final EclipseConsoleConfiguration oldConfig,
@@ -158,8 +119,6 @@
monitor.beginTask(HibernateConsoleMessages.ConsoleConfigurationCreationWizard_configuring_hibernate_console,
IProgressMonitor.UNKNOWN);
- //ConsoleConfigurationPreferences ccp = createOldConsoleConfiguration( configName,
cmode, projectName, useProjectClasspath, entityResolver, propertyFilename, cfgFile,
mappings, classpaths, persistenceUnitName, namingStrategy );
-
if(oldConfig!=null) {
KnownConfigurations.getInstance().removeConfiguration( oldConfig, false );
}
@@ -186,7 +145,7 @@
}
if(classpaths.length>0) {
- List user = new ArrayList();
+ List<String> user = new ArrayList<String>();
for (int i = 0; i < projectEntries.length; i++) {
user.add( projectEntries[i].getMemento() );
}
@@ -202,7 +161,7 @@
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, (String)null);
}
- List mappingFiles = new ArrayList();
+ List<String> mappingFiles = new ArrayList<String>();
for (int i = 0; i < mappings.length; i++) {
mappingFiles.add(mappings[i].toPortableString());
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/ConsoleConfigurationWizardPage.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/ConsoleConfigurationWizardPage.java 2008-09-05
18:01:24 UTC (rev 10106)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/ConsoleConfigurationWizardPage.java 2008-09-05
22:00:23 UTC (rev 10107)
@@ -23,106 +23,101 @@
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
import java.util.List;
import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceProxy;
-import org.eclipse.core.resources.IResourceProxyVisitor;
import org.eclipse.core.resources.ResourcesPlugin;
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.core.runtime.Platform;
import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.ui.ILaunchConfigurationDialog;
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.search.IJavaSearchConstants;
-import org.eclipse.jdt.core.search.IJavaSearchScope;
-import org.eclipse.jdt.core.search.SearchEngine;
-import org.eclipse.jdt.core.search.SearchMatch;
-import org.eclipse.jdt.core.search.SearchParticipant;
-import org.eclipse.jdt.core.search.SearchPattern;
-import org.eclipse.jdt.ui.wizards.BuildPathDialogAccess;
+import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
import org.eclipse.jface.dialogs.IDialogPage;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.resource.ColorRegistry;
+import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CTabFolder;
+import org.eclipse.swt.custom.CTabItem;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.layout.RowLayout;
-import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.TabFolder;
-import org.eclipse.swt.widgets.TabItem;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;
-import org.hibernate.cfg.NamingStrategy;
+import org.eclipse.ui.IWorkbenchPreferenceConstants;
+import org.eclipse.ui.PlatformUI;
import
org.hibernate.console.preferences.ConsoleConfigurationPreferences.ConfigurationMode;
import org.hibernate.eclipse.console.EclipseConsoleConfiguration;
-import org.hibernate.eclipse.console.EclipseConsoleConfigurationPreferences;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
-import org.hibernate.eclipse.console.utils.DialogSelectionHelper;
-import org.hibernate.eclipse.console.utils.ProjectUtils;
+import org.hibernate.eclipse.console.actions.AddConfigurationAction;
+import org.hibernate.eclipse.launch.ConsoleConfigurationMainTab;
+import org.hibernate.eclipse.launch.ConsoleConfigurationTabGroup;
+import org.hibernate.eclipse.launch.ICodeGenerationLaunchConstants;
+import org.hibernate.eclipse.launch.IConsoleConfigurationLaunchConstants;
import org.hibernate.util.StringHelper;
-import org.xml.sax.EntityResolver;
-
/**
+ * This wizardpage wraps the LaunchConfiguration based tabs and thus mimicks the normal
launch configuration ui.
+ * Most logic should go to the launch config tabs, very little logic should need to be in
this class (besides handling the tabs and name of the configuraiton).
+ *
* @author max
- *
- *
*/
-public class ConsoleConfigurationWizardPage extends WizardPage {
+public class ConsoleConfigurationWizardPage extends WizardPage implements
+ ILaunchConfigurationDialog {
- private Text propertyFileText;
- private Text configurationFileText;
- private Text configurationNameText;
- private Text projectNameText;
- private Text persistenceUnitNameText;
+ /**
+ * Name label widget
+ */
+ protected Label nameLabel;
+ /**
+ * Name text widget
+ */
+ protected Text nameWidget;
- private EclipseConsoleConfiguration oldConfiguaration = null;
- Button coreMode;
- Button jpaMode;
- Button annotationsMode;
+ /**
+ * custom tab folder control
+ */
+ protected CTabFolder tabFolder;
- private Text entityResolverClassNameText;
- private Text namingStrategyClassNameText;
+ /**
+ * Tab controls
+ */
+ protected ConsoleConfigurationTabGroup tabGroup;
- private ISelection selection;
- private UpDownListComposite mappingFilesViewer;
- private UpDownListComposite classPathViewer;
- private boolean configurationFileWillBeCreated;
- private Button confbutton;
- private Button entbutton;
- private Button useProjectClassPath;
- private Button nambutton;
+ protected ILaunchConfigurationWorkingCopy currentLaunchConfig;
+ protected int currentTabIndex;
+
+ protected ISelection selection;
+
+ private boolean initializingTabs;
+
/**
* Constructor for SampleNewWizardPage.
+ *
* @param pageName
*/
public ConsoleConfigurationWizardPage(ISelection selection) {
@@ -136,641 +131,247 @@
* @see IDialogPage#createControl(Composite)
*/
public void createControl(Composite parent) {
- final ScrolledComposite sc = new ScrolledComposite(parent, SWT.H_SCROLL |
SWT.V_SCROLL);
+ final ScrolledComposite sc = new ScrolledComposite(parent, SWT.H_SCROLL
+ | SWT.V_SCROLL);
sc.setExpandHorizontal(true);
sc.setExpandVertical(true);
- TabFolder folder = new TabFolder(sc, SWT.TOP);
- sc.setContent(folder);
- //Composite container = new Composite(parent, SWT.NULL);
+ Composite container = new Composite(sc, SWT.NONE);
- GridLayout layout = new GridLayout();
- //container.setLayout(layout);
- layout.numColumns = 3;
- layout.verticalSpacing = 9;
+ GridLayout layout = new GridLayout(2, false);
+ layout.verticalSpacing = 10;
+ layout.horizontalSpacing = 5;
+ container.setLayout(layout);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ container.setLayoutData(gd);
- GridData gd;
+ nameLabel = new Label(container, SWT.HORIZONTAL | SWT.LEFT);
+ nameLabel.setText("Name");
+ nameLabel.setLayoutData(new GridData(
+ GridData.HORIZONTAL_ALIGN_BEGINNING));
- ModifyListener modifyListener = new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- dialogChanged();
- }
- };
+ nameWidget = new Text(container, SWT.SINGLE | SWT.BORDER);
+ nameWidget.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Composite general = createGeneral( folder, modifyListener );
- TabItem item = new TabItem(folder, SWT.NONE);
- item.setControl( general );
- item.setText( HibernateConsoleMessages.ConsoleConfigurationWizardPage_general );
-
- Composite composite = buildClassPathTable(folder);
- item = new TabItem(folder, SWT.NONE);
- item.setControl( composite );
- item.setText( HibernateConsoleMessages.ConsoleConfigurationWizardPage_classpath );
-
- composite = buildMappingFileTable(folder);
- item = new TabItem(folder, SWT.NONE);
- item.setControl( composite );
- item.setText( HibernateConsoleMessages.ConsoleConfigurationWizardPage_mappings );
-
- initialize(selection);
- dialogChanged();
- sc.setMinSize(folder.computeSize(SWT.DEFAULT, SWT.DEFAULT));
- setControl(sc);
- }
-
- private Composite createGeneral(Composite parent, ModifyListener modifyListener) {
- Composite container = new Composite(parent, SWT.NULL);
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 3;
- gridLayout.verticalSpacing = 9;
-
- container.setLayout(gridLayout);
- Label label;
- Button button;
- GridData gd;
- label = new Label(container, SWT.NULL);
- label.setText(HibernateConsoleMessages.ConsoleConfigurationWizardPage_name);
-
- configurationNameText = new Text(container, SWT.BORDER | SWT.SINGLE);
- gd = new GridData(GridData.FILL_HORIZONTAL);
+ tabFolder = new CTabFolder(container, SWT.TOP | SWT.NO_REDRAW_RESIZE
+ | SWT.NO_TRIM | SWT.FLAT);
+ gd = new GridData(GridData.FILL_BOTH);
gd.horizontalSpan = 2;
- configurationNameText.setLayoutData(gd);
- configurationNameText.addModifyListener(modifyListener);
+ ColorRegistry reg = JFaceResources.getColorRegistry();
+ Color c1 = reg.get("org.eclipse.ui.workbench.ACTIVE_TAB_BG_START"),
//$NON-NLS-1$
+ c2 = reg.get("org.eclipse.ui.workbench.ACTIVE_TAB_BG_END"); //$NON-NLS-1$
+ tabFolder.setSelectionBackground(new Color[] { c1, c2 },
+ new int[] { 100 }, true);
+ tabFolder.setSelectionForeground(reg
+ .get("org.eclipse.ui.workbench.ACTIVE_TAB_TEXT_COLOR")); //$NON-NLS-1$
+ tabFolder.setSimple(PlatformUI.getPreferenceStore().getBoolean(
+ IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS));
+ tabFolder.setLayoutData(gd);
+ tabFolder.setBorderVisible(true);
+ tabFolder.setFont(parent.getFont());
- label = new Label(container, SWT.NULL);
- label.setText(HibernateConsoleMessages.ConsoleConfigurationWizardPage_project);
+ sc.setContent(container);
- projectNameText = new Text(container, SWT.BORDER | SWT.SINGLE);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- projectNameText.setLayoutData(gd);
- projectNameText.addModifyListener(modifyListener);
+ initTabs(tabFolder);
- button = new Button(container, SWT.PUSH);
- button.setText(HibernateConsoleMessages.ConsoleConfigurationWizardPage_browse);
- button.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handleProjectBrowse();
- }
- });
+ try {
+ performStart();
+ } catch (CoreException ce) {
+ HibernateConsolePlugin
+ .getDefault().showError(getShell(),
+ HibernateConsoleMessages.AddConfigurationAction_problem_add_console_config,
+ ce);
+ }
+ try {
+ initialize(currentLaunchConfig, selection);
+ } catch (CoreException ce) {
+ HibernateConsolePlugin
+ .getDefault().logErrorMessage(
+ HibernateConsoleMessages.ConsoleConfigurationWizardPage_problem_while_initializing_cc,
+ ce);
+ }
+ performInit();
- //label = new Label(container, SWT.NULL);
- createConfigurationMode( container );
-
-
- label = new Label(container, SWT.NULL);
- label.setText(HibernateConsoleMessages.ConsoleConfigurationWizardPage_property_file_2);
-
- propertyFileText = new Text(container, SWT.BORDER | SWT.SINGLE);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- propertyFileText.setLayoutData(gd);
- propertyFileText.addModifyListener(modifyListener);
-
-
- button = new Button(container, SWT.PUSH);
- button.setText(HibernateConsoleMessages.ConsoleConfigurationWizardPage_browse);
- button.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handlePropertyFileBrowse();
- }
- });
-
- label = new Label(container, SWT.NULL);
- label.setText(HibernateConsoleMessages.ConsoleConfigurationWizardPage_config_file);
-
- configurationFileText = new Text(container, SWT.BORDER | SWT.SINGLE);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- configurationFileText.setLayoutData(gd);
- configurationFileText.addModifyListener(modifyListener);
-
- confbutton = new Button(container, SWT.PUSH);
- confbutton.setText(HibernateConsoleMessages.ConsoleConfigurationWizardPage_browse);
- confbutton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handleConfigurationFileBrowse();
- }
- });
-
- label = new Label(container, SWT.NULL);
- label.setText(HibernateConsoleMessages.ConsoleConfigurationWizardPage_persistence_unit);
-
- persistenceUnitNameText = new Text(container, SWT.BORDER | SWT.SINGLE);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 2;
- persistenceUnitNameText.setLayoutData(gd);
- persistenceUnitNameText.addModifyListener(modifyListener);
-
- label = new Label(container, SWT.NULL);
- label.setText(HibernateConsoleMessages.ConsoleConfigurationWizardPage_naming_strategy);
-
- namingStrategyClassNameText = new Text(container, SWT.BORDER | SWT.SINGLE);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 1;
- namingStrategyClassNameText.setLayoutData(gd);
- namingStrategyClassNameText.addModifyListener(modifyListener);
-
- nambutton = new Button(container, SWT.PUSH);
- nambutton.setText(HibernateConsoleMessages.ConsoleConfigurationWizardPage_browse);
- nambutton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handleNamingStrategyBrowse();
- }
- });
-
- label = new Label(container, SWT.NULL);
- label.setText(HibernateConsoleMessages.ConsoleConfigurationWizardPage_entity_resolver);
-
- entityResolverClassNameText = new Text(container, SWT.BORDER | SWT.SINGLE);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 1;
- entityResolverClassNameText.setLayoutData(gd);
- entityResolverClassNameText.addModifyListener(modifyListener);
-
- entbutton = new Button(container, SWT.PUSH);
- entbutton.setText(HibernateConsoleMessages.ConsoleConfigurationWizardPage_browse);
- entbutton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handleEntityResolverBrowse();
- }
- });
-
-
- return container;
- }
-
-
- private void createConfigurationMode(Composite container) {
- SelectionListener sl = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
+ ModifyListener modifyListener = new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
dialogChanged();
}
};
- new Label(container, SWT.NULL).setText(
HibernateConsoleMessages.ConsoleConfigurationWizardPage_type );
- Group group = new Group( container, SWT.SHADOW_IN);
- //group.setText("Choose Hibernate configuration");
- group.setLayout( new RowLayout( SWT.HORIZONTAL ) );
- coreMode = new Button(group, SWT.RADIO);
- coreMode.setText(HibernateConsoleMessages.ConsoleConfigurationWizardPage_core);
- coreMode.addSelectionListener( sl );
- coreMode.setSelection( true );
- annotationsMode = new Button(group, SWT.RADIO);
- annotationsMode.setText(HibernateConsoleMessages.ConsoleConfigurationWizardPage_annotations);
- annotationsMode.addSelectionListener( sl );
- jpaMode = new Button(group, SWT.RADIO);
- jpaMode.setText(HibernateConsoleMessages.ConsoleConfigurationWizardPage_jpa);
- jpaMode.addSelectionListener( sl );
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 2;
- group.setLayoutData( gd );
+ nameWidget.addModifyListener(modifyListener);
+
+ setActiveTab(0);
+ sc.setMinSize(tabFolder.computeSize(SWT.DEFAULT, SWT.DEFAULT));
+ setControl(sc);
+ dialogChanged();
}
- protected void handleEntityResolverBrowse() {
- String string =
DialogSelectionHelper.chooseImplementation(EntityResolver.class.getName(),
entityResolverClassNameText.getText(),
HibernateConsoleMessages.ConsoleConfigurationWizardPage_select_entity_resolver_class,
getShell());
- if(string!=null) {
- entityResolverClassNameText.setText(string);
+ protected void initTabs(CTabFolder folder) {
+
+ tabGroup = new ConsoleConfigurationTabGroup();
+ tabGroup.createTabs(this, null); // TODO: set the proper mode here
+ ILaunchConfigurationTab[] tabs = tabGroup.getTabs();
+ for (int i = 0; i < tabs.length; i++) {
+ tabs[i].setLaunchConfigurationDialog(this);
}
+ for (int i = 0; i < tabs.length; i++) {
+ CTabItem item = new CTabItem(folder, SWT.BORDER);
+ item.setText(tabs[i].getName());
+ item.setImage(tabs[i].getImage());
+ tabs[i].createControl(item.getParent());
+ Control control = tabs[i].getControl();
+ if (control != null) {
+ item.setControl(control);
+ }
+ }
}
- protected void handleNamingStrategyBrowse() {
- String string =
DialogSelectionHelper.chooseImplementation(NamingStrategy.class.getName(),
namingStrategyClassNameText.getText(),
HibernateConsoleMessages.ConsoleConfigurationWizardPage_select_naming_strategy_class,
getShell());
- if(string!=null) {
- namingStrategyClassNameText.setText(string);
- }
+ public void performStart() throws CoreException {
+ currentLaunchConfig =
AddConfigurationAction.createTemporaryLaunchConfiguration().getWorkingCopy();
}
+
+ public void performCancel() throws CoreException {
+ AddConfigurationAction.deleteTemporaryLaunchConfigurations();
+ }
-
- private Composite buildClassPathTable(Composite parent) {
- Composite c = new Composite(parent, SWT.None);
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 1;
- gridLayout.verticalSpacing = 9;
- c.setLayout( gridLayout );
-
- classPathViewer = new UpDownListComposite(c, SWT.NONE,
HibernateConsoleMessages.ConsoleConfigurationWizardPage_additional_classpath) {
- protected Object[] handleAdd(int idx) {
-
- TableItem[] items = getTable().getItems();
- IPath[] exclude = new IPath[items.length];
-
- for (int i = 0; i < items.length; i++) {
- TableItem item = items[i];
- exclude[i] = (IPath) item.getData();
- }
-
- switch (idx) {
- case 0:
- return DialogSelectionHelper.chooseFileEntries(getShell(), null, exclude,
HibernateConsoleMessages.ConsoleConfigurationWizardPage_add_classpath_entry,
HibernateConsoleMessages.ConsoleConfigurationWizardPage_add_directory_zip_jar, new
String[] { HibernateConsoleMessages.ConsoleConfigurationWizardPage_27,
HibernateConsoleMessages.ConsoleConfigurationWizardPage_28 }, true, true, true);
- case 1:
- return BuildPathDialogAccess.chooseExternalJAREntries(getShell() );
- default:
- return null;
- }
-
- }
-
- protected String[] getAddButtonLabels() {
- return new String[] {
HibernateConsoleMessages.ConsoleConfigurationWizardPage_add_jar_dir,
HibernateConsoleMessages.ConsoleConfigurationWizardPage_add_external_jars };
- }
- protected void listChanged() {
- dialogChanged();
- }
-
- };
- GridData gd = new GridData();
- gd.grabExcessHorizontalSpace = true;
- gd.grabExcessVerticalSpace = true;
- gd.verticalAlignment = GridData.FILL;
- gd.horizontalAlignment = GridData.FILL;
- classPathViewer.setLayoutData( gd );
-
- useProjectClassPath = new Button(c, SWT.CHECK);
- useProjectClassPath.setSelection( true );
- useProjectClassPath.setText(HibernateConsoleMessages.ConsoleConfigurationWizardPage_include_default_classpath);
- useProjectClassPath.addSelectionListener(new SelectionListener() {
-
- public void widgetDefaultSelected(SelectionEvent e) {
- dialogChanged();
- }
-
- public void widgetSelected(SelectionEvent e) {
- dialogChanged();
- }
- });
-
-
- return c;
+ public void performFinish() throws CoreException {
+ currentLaunchConfig.rename(nameWidget.getText().trim());
+ currentLaunchConfig.doSave();
+ AddConfigurationAction.makeTemporaryLaunchConfigurationsPermanent();
}
- private UpDownListComposite buildMappingFileTable(Composite parent) {
- mappingFilesViewer = new UpDownListComposite(parent, SWT.NONE,
HibernateConsoleMessages.ConsoleConfigurationWizardPage_additional_mapping_files) {
- protected Object[] handleAdd(int idx) {
- TableItem[] items = getTable().getItems();
- IPath[] exclude = new IPath[items.length];
-
- for (int i = 0; i < items.length; i++) {
- TableItem item = items[i];
- exclude[i] = (IPath) item.getData();
- }
-
- return DialogSelectionHelper.chooseFileEntries(getShell(), null, exclude,
HibernateConsoleMessages.ConsoleConfigurationWizardPage_add_hbmxml_file,
HibernateConsoleMessages.ConsoleConfigurationWizardPage_add_hibernate_mapping_file, new
String[] { HibernateConsoleMessages.ConsoleConfigurationWizardPage_35 }, true, false,
true);
- }
-
- protected void listChanged() {
- dialogChanged();
- }
- };
-
- GridData gd;
- gd = new GridData(GridData.FILL_BOTH);
-
- gd.horizontalSpan = 3;
- gd.verticalSpan = 1;
-
- mappingFilesViewer.setLayoutData( gd );
- return mappingFilesViewer;
+ public void performInit() {
+ initializingTabs = true;
+ nameWidget.setText(currentLaunchConfig.getName());
+ tabGroup.initializeFrom(currentLaunchConfig);
+ initializingTabs = false;
}
-
-
/**
- * A visitor class that will make a "best guess" on which files the
- * user want for the properties and config file.
- *
- * @author max
- *
+ * Ensures that both text fields are set.
*/
- static class Visitor implements IResourceProxyVisitor {
-
- public IPath propertyFile;
- public IPath configFile;
- public IPath persistencexml;
- public IJavaProject javaProject;
- public List classpath = new ArrayList();
- public List mappings = new ArrayList();
-
- public boolean visit(IResourceProxy proxy) throws CoreException {
- //System.out.println("visit: " + proxy.getName() );
- IPath fullPath = proxy.requestFullPath();
- if(proxy.getType() == IResource.FILE) {
- if("hibernate.properties".equals(proxy.getName() ) ) { //$NON-NLS-1$
- propertyFile = fullPath;
- return false;
- }
-
- if("hibernate.cfg.xml".equals(proxy.getName() ) ) { //$NON-NLS-1$
- configFile = fullPath;
- mappings.clear(); // we prefer af cfg.xml over mappings
- return false;
- }
-
- if("persistence.xml".equals( proxy.getName() )) { //$NON-NLS-1$
- if(javaProject!=null && javaProject.isOnClasspath( proxy.requestResource()
)) {
- persistencexml = fullPath;
- mappings.clear();
- return false;
+ protected void dialogChanged() {
+ if(initializingTabs) {
+ return;
+ }
+ String messageWarning = null;
+ String messageError = null;
+ if (tabGroup == null || currentLaunchConfig == null) {
+ setMessage(messageWarning);
+ updateStatus(messageError);
+ return;
+ }
+ String name = getConfigurationName();
+ if (name != null) {
+ name = name.trim();
+ }
+ messageError = verifyConfigurationName(name);
+ if (messageError != null) {
+ setMessage(messageWarning);
+ updateStatus(messageError);
+ return;
+ }
+
+ tabGroup.performApply(currentLaunchConfig);
+
+ ILaunchConfigurationTab[] tabs = tabGroup.getTabs();
+ for (int i = 0; i < tabs.length; i++) {
+ if (tabs[i].isValid(currentLaunchConfig)) {
+ if (messageWarning == null) {
+ messageWarning = tabs[i].getMessage();
+ if(messageWarning!=null) {
+ System.out.println(tabs[i].getName() + " warns: " + messageWarning);
}
}
-
- // only add mappings if we don't have a config file.
- if((configFile==null || persistencexml==null) &&
proxy.getName().endsWith(".hbm.xml") ) { //$NON-NLS-1$
- mappings.add(fullPath);
- return false;
- }
- } else if(proxy.getType() == IResource.FOLDER) {
- if(javaProject!=null) {
- if(javaProject.getOutputLocation().isPrefixOf(fullPath) ) {
- //classpath.add(fullPath);
- return false; // skip output locations
+ } else {
+ if (messageError == null) {
+ messageError = tabs[i].getErrorMessage();
+ if(messageError!=null) {
+ System.out.println(tabs[i].getName() + " errors: " + messageError);
}
}
}
- return true;
}
+ setMessage(messageWarning);
+ updateStatus(messageError);
}
-
-
- public void initialize(ISelection currentSelection) {
+ private boolean existingLaunchConfiguration(String name) {
+ ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
+ ILaunchConfigurationType launchConfigurationType = launchManager
+ .getLaunchConfigurationType(ICodeGenerationLaunchConstants.CONSOLE_CONFIGURATION_LAUNCH_TYPE_ID);
try {
- Visitor v = new Visitor();
- // use selection to build configuration from it...
- if (currentSelection!=null && currentSelection.isEmpty()==false &&
currentSelection instanceof IStructuredSelection) {
- IStructuredSelection ssel = (IStructuredSelection)currentSelection;
- if (ssel.size()>1) return;
- Object obj = ssel.getFirstElement();
-
- IContainer container = null;
- if (obj instanceof IJavaElement) {
- v.javaProject = ((IJavaElement) obj).getJavaProject();
- if(v.javaProject!=null) {
- container = v.javaProject.getProject();
- }
+ ILaunchConfiguration[] configs;
+ configs = launchManager.getLaunchConfigurations(launchConfigurationType);
+ for (int i = 0; i < configs.length; i++) {
+ if(!configs[i].getAttribute(AddConfigurationAction.TEMPORARY_CONFIG_FLAG, false)) {
+ if (name.equalsIgnoreCase(configs[i].getName())) {
+ return true;
+ }
+ }
}
- if (obj instanceof IResource) {
- IResource res = (IResource) obj;
- if (obj instanceof IContainer) {
- container = (IContainer)res;
- } else {
- container = res.getParent();
- }
-
- if(res.getProject()!=null) {
- IJavaProject project = JavaCore.create(res.getProject());
- if(project.exists()) {
- v.javaProject = project;
- }
- }
- }
-
- if(container!=null) {
- container.accept(v, IResource.NONE);
-
- if(v.javaProject==null) {
- IProject project = container.getProject();
- v.javaProject = JavaCore.create(project);
- }
-
- if(v.javaProject!=null) {
- ILaunchManager lm = DebugPlugin.getDefault().getLaunchManager();
- String uniqName =
lm.generateUniqueLaunchConfigurationNameFrom(v.javaProject.getElementName());
- configurationNameText.setText(uniqName);
- projectNameText.setText(v.javaProject.getElementName());
- }
- if (v.propertyFile!=null) {
- propertyFileText.setText(v.propertyFile.toOSString() );
- }
-
- if (v.configFile!=null) {
- configurationFileText.setText(v.configFile.toOSString() );
- }
-
- if (v.persistencexml!=null) {
- jpaMode.setSelection( true );
- coreMode.setSelection( false );
- annotationsMode.setSelection( false );
- }
- if (!v.mappings.isEmpty() && v.configFile==null &&
v.persistencexml==null) mappingFilesViewer.add(v.mappings.toArray(), false);
- if (!v.classpath.isEmpty() ) classPathViewer.add(v.classpath.toArray(), false);
- useProjectClassPath.setSelection( true );
- //if(v.javaProject!=null) {
- //classPathViewer.add(locateTypes(v.javaProject).toArray(), false);
- //}
- } else if (obj instanceof EclipseConsoleConfiguration) {
- // trying to edit an EXISTING consoleconfiguration
- EclipseConsoleConfiguration cc = (EclipseConsoleConfiguration) obj;
- EclipseConsoleConfigurationPreferences prefs =
(EclipseConsoleConfigurationPreferences) cc.getPreferences();
-
- configurationNameText.setText(prefs.getName() );
- if(prefs.getProjectName()!=null) projectNameText.setText( prefs.getProjectName() );
- useProjectClassPath.setSelection( prefs.useProjectClasspath() );
- if(prefs.getPropertyFilename()!=null)
propertyFileText.setText(prefs.getPropertyFilename().toOSString() );
- if(prefs.getCfgFile()!=null)
configurationFileText.setText(prefs.getCfgFile().toOSString() );
- if(prefs.getMappings()!=null) mappingFilesViewer.add(prefs.getMappings(),false);
- if(prefs.getCustomClasspath()!=null)
classPathViewer.add(prefs.getCustomClasspath(),false);
- if(prefs.getEntityResolverName()!=null)
entityResolverClassNameText.setText(prefs.getEntityResolverName());
- if(prefs.getNamingStrategy() !=null)
namingStrategyClassNameText.setText(prefs.getNamingStrategy());
- if(prefs.getPersistenceUnitName()!=null) persistenceUnitNameText.setText(
prefs.getPersistenceUnitName() );
- jpaMode.setSelection( prefs.getConfigurationMode().equals( ConfigurationMode.JPA )
);
- coreMode.setSelection( prefs.getConfigurationMode().equals( ConfigurationMode.CORE )
);
- annotationsMode.setSelection( prefs.getConfigurationMode().equals(
ConfigurationMode.ANNOTATIONS ) );
-
- oldConfiguaration = cc;
- }
-
-
-
-
+ } catch (CoreException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage(e.getMessage(), e);
}
- } catch (CoreException ce) {
- HibernateConsolePlugin.getDefault().logErrorMessage(HibernateConsoleMessages.ConsoleConfigurationWizardPage_problem_while_initializing_cc,
ce);
- }
-
+ return false;
}
- List locateTypes(final IJavaProject javaProject) {
-
- try {
- String typeName = "java.sql.Driver"; //$NON-NLS-1$
- final SearchPattern pattern = SearchPattern.createPattern(typeName,
IJavaSearchConstants.TYPE, IJavaSearchConstants.IMPLEMENTORS,
SearchPattern.R_EXACT_MATCH);
- final IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[]
{javaProject });
-
- final SearchEngine engine = new SearchEngine();
-
- final CollectingSearchRequestor sr = new CollectingSearchRequestor();
- final SearchParticipant[] participants = new SearchParticipant[]
{SearchEngine.getDefaultSearchParticipant()};
-
- final ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell() );
-
-
- dialog.run(true, false, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) {
- try {
- engine.search(pattern, participants, scope, sr, monitor);
- } catch (CoreException ce) {
- HibernateConsolePlugin.getDefault().logErrorMessage(
- HibernateConsoleMessages.ConsoleConfigurationWizardPage_problem_while_locating_jdbc_drivers,
ce);
- }
- }
- });
-
-
- List resources = new ArrayList();
- Iterator iter = sr.getResults().iterator();
- while (iter.hasNext() ) {
- SearchMatch match = (SearchMatch) iter.next();
- if(match.getResource() instanceof IFile) { // what happens if a actual class
implements java.sql.driver ?
- resources.add(match.getResource().getFullPath() );
- }
- }
-
- return resources;
- } catch (InvocationTargetException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage(
- HibernateConsoleMessages.ConsoleConfigurationWizardPage_problem_while_locating_jdbc_drivers,
e);
- } catch (InterruptedException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage(
- HibernateConsoleMessages.ConsoleConfigurationWizardPage_problem_while_locating_jdbc_drivers,
e);
+ /**
+ * Notification that a tab has been selected
+ *
+ * Disallow tab changing when the current tab is invalid. Update the config
+ * from the tab being left, and refresh the tab being entered.
+ */
+ protected void handleTabSelected() {
+ if(tabGroup==null) return;
+ ILaunchConfigurationTab[] tabs = tabGroup.getTabs();
+ if (currentTabIndex == tabFolder.getSelectionIndex() || tabs == null
+ || tabs.length == 0 || currentTabIndex > (tabs.length - 1)) {
+ return;
}
-
-
- return Collections.EMPTY_LIST;
- }
-
- IPath[] getMappingFiles() {
- return tableItems2File(mappingFilesViewer.getTable() );
- }
-
- IPath[] getClassPath() {
- return tableItems2File(classPathViewer.getTable() );
- }
-
- private IPath[] tableItems2File(Table table) {
- TableItem[] items = table.getItems();
- IPath[] str = new IPath[items.length];
- for (int i = 0; i < items.length; i++) {
- TableItem item = items[i];
- IPath path = (IPath) item.getData();
- str[i] = path;
+ if (currentTabIndex != -1) {
+ ILaunchConfigurationTab tab = tabs[currentTabIndex];
+ if (currentLaunchConfig != null) {
+ tab.deactivated(currentLaunchConfig);
+ getActiveTab().activated(currentLaunchConfig);
+ }
}
- return str;
+ currentTabIndex = tabFolder.getSelectionIndex();
}
- private void handlePropertyFileBrowse() {
- IPath[] paths =
org.hibernate.eclipse.console.utils.xpl.DialogSelectionHelper.chooseFileEntries(getShell(),
getPropertyFilePath(), new IPath[0],
HibernateConsoleMessages.ConsoleConfigurationWizardPage_select_property_file,
HibernateConsoleMessages.ConsoleConfigurationWizardPage_choose_file_to_use, new String[]
{"properties"}, false, false, true); //$NON-NLS-1$
- if(paths!=null && paths.length==1) {
- propertyFileText.setText( (paths[0]).toOSString() );
+
+ public void setActiveTab(int index) {
+ if(tabGroup==null) return;
+ ILaunchConfigurationTab[] tabs = tabGroup.getTabs();
+ if (tabs != null && index >= 0 && index < tabs.length) {
+ tabFolder.setSelection(index);
+ handleTabSelected();
+ dialogChanged();
}
}
- private void handleProjectBrowse() {
- IJavaProject paths = DialogSelectionHelper.chooseJavaProject( getShell(),
ProjectUtils.findJavaProject( getProjectName() ),
HibernateConsoleMessages.ConsoleConfigurationWizardPage_select_java_project,
HibernateConsoleMessages.ConsoleConfigurationWizardPage_select_java_project_to_classpath
);
- if(paths!=null) {
- projectNameText.setText( paths.getProject().getName() );
- } else {
- projectNameText.setText(""); //$NON-NLS-1$
- }
- }
-
-
- private void handleConfigurationFileBrowse() {
- IPath[] paths = DialogSelectionHelper.chooseFileEntries(getShell(),
getConfigurationFilePath(), new IPath[0],
HibernateConsoleMessages.ConsoleConfigurationWizardPage_select_hibcfgxml_file,
HibernateConsoleMessages.ConsoleConfigurationWizardPage_choose_file_to_use_hibcfgxml_file,
new String[] {"cfg.xml"}, false, false, true); //$NON-NLS-1$
- if(paths!=null && paths.length==1) {
- configurationFileText.setText( (paths[0]).toOSString() );
- }
- }
-
/**
- * Ensures that both text fields are set.
+ * Returns the currently active <code>ILaunchConfigurationTab</code> being
+ * displayed, or <code>null</code> if there is none.
+ *
+ * @return currently active <code>ILaunchConfigurationTab</code>, or
+ * <code>null</code>.
*/
-
- private void dialogChanged() {
- String propertyFilename = propertyFileText.getText();
- String configurationFilename = configurationFileText.getText();
- setMessage(null);
-
- configurationFileText.setEnabled( !configurationFileWillBeCreated &&
!getConfigurationMode().equals( ConfigurationMode.JPA ) );
- confbutton.setEnabled( !getConfigurationMode().equals( ConfigurationMode.JPA ) );
-
- persistenceUnitNameText.setEnabled( getConfigurationMode().equals(
ConfigurationMode.JPA) );
-
- String error = verifyConfigurationName();
- if (error != null){
- updateStatus(error);
- return;
- }
-
- if(getProjectName()!=null && StringHelper.isNotEmpty(getProjectName().trim()))
{
- IJavaProject findJavaProject = ProjectUtils.findJavaProject( getProjectName() );
- if(findJavaProject==null || !findJavaProject.exists()) {
- String out =
NLS.bind(HibernateConsoleMessages.ConsoleConfigurationWizardPage_the_java_project_does_not_exist,
getProjectName());
- updateStatus(out);
- return;
+ public ILaunchConfigurationTab getActiveTab() {
+ if(tabGroup==null) return null;
+ ILaunchConfigurationTab[] tabs = tabGroup.getTabs();
+ if (tabFolder != null && tabs != null) {
+ int pageIndex = tabFolder.getSelectionIndex();
+ if (pageIndex >= 0) {
+ return tabs[pageIndex];
}
}
-
- /* TODO: warn about implicit behavior of loading /hibernate.cfg.xml,
/hibernate.properties and /META-INF/persistence.xml
- * if (propertyFilename.length() == 0 && configurationFilename.trim().length()
== 0) {
- updateStatus("Property or Configuration file must be specified");
- return;
- } */
-
- if (propertyFilename.length() > 0) {
- IResource resource =
ResourcesPlugin.getWorkspace().getRoot().findMember(propertyFilename);
- String msg =
checkForFile(HibernateConsoleMessages.ConsoleConfigurationWizardPage_property_file_1,
resource);
- if(msg!=null) {
- updateStatus(msg);
- return;
- }
- }
-
- if (!configurationFileWillBeCreated && configurationFilename.length() > 0)
{
- IResource resource =
ResourcesPlugin.getWorkspace().getRoot().findMember(configurationFilename);
- String msg =
checkForFile(HibernateConsoleMessages.ConsoleConfigurationWizardPage_configuration_file,resource);
- if(msg!=null) {
- updateStatus(msg);
- return;
- }
- } else if(mappingFilesViewer.getTable().getItemCount()==0) {
- //TODO: removed to provide a way to create a non-mapping base configuration
- //updateStatus("Need to specify one or more mapping files");
- //return;
- }
-
- if((useProjectClassPath() && StringHelper.isEmpty( getProjectName() ))
&& classPathViewer.getTable().getItemCount()==0) {
- updateStatus(
HibernateConsoleMessages.ConsoleConfigurationWizardPage_need_to_specify_project );
- return;
- }
-
- if((!useProjectClassPath() && classPathViewer.getTable().getItemCount()==0)) {
- updateStatus(
HibernateConsoleMessages.ConsoleConfigurationWizardPage_need_to_specify_classpath );
- return;
- }
-
- if ((configurationFilename != null && configurationFilename.trim().length()
> 0) &&
- (propertyFilename != null && propertyFilename.trim().length() > 0)) {
- setMessage(HibernateConsoleMessages.ConsoleConfigurationWizardPage_both_hibernate_properties_and_hibernate_cfg_xml,
WARNING);
- return;
- }
-
- updateStatus(null);
+ return null;
}
-
- private String verifyConfigurationName(){
- String currentName = getConfigurationName().trim();
+ protected String verifyConfigurationName(String currentName) {
if (currentName == null || currentName.length() < 1) {
return HibernateConsoleMessages.ConsoleConfigurationWizardPage_name_must_specified;
}
-
- ILaunchManager lm = DebugPlugin.getDefault().getLaunchManager();
- try {
- if (lm.isExistingLaunchConfigurationName(currentName)) {
- return
HibernateConsoleMessages.ConsoleConfigurationWizardPage_config_name_already_exist;
- }
- } catch (CoreException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage(e.getMessage(), e);
- }
-
if (Platform.OS_WIN32.equals(Platform.getOS())) {
String[] badnames = new String[] { "aux", "clock$",
"com1", "com2", "com3", "com4", //$NON-NLS-1$
//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
"com5", "com6", "com7", "com8",
"com9", "con", "lpt1", "lpt2", //$NON-NLS-1$
//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
//$NON-NLS-8$
@@ -791,97 +392,239 @@
}
}
+ if(existingLaunchConfiguration(currentName)) {
+ return
HibernateConsoleMessages.ConsoleConfigurationWizardPage_config_name_already_exist;
+ }
return null;
}
- String getProjectName() {
- return projectNameText.getText();
+ private String getConfigurationName() {
+ return nameWidget.getText();
}
- String getConfigurationName() {
- return configurationNameText.getText();
- }
-
- private String checkForFile(String msgPrefix, IResource resource) {
- if(resource!=null) {
- if(resource instanceof IFile) {
-
- return null;
- } else {
- return msgPrefix +
HibernateConsoleMessages.ConsoleConfigurationWizardPage_is_not_a_file;
- }
- } else {
- return msgPrefix +
HibernateConsoleMessages.ConsoleConfigurationWizardPage_does_not_exist;
- }
- }
-
private void updateStatus(String message) {
setErrorMessage(message);
setPageComplete(message == null);
}
- public Path getPropertyFilePath() {
- String p = propertyFileText.getText();
- return pathOrNull(p);
+ public String generateName(String name) {
+ // empty ILaunchConfigurationDialog method stub
+ return null;
}
- private Path pathOrNull(String p) {
- if(p==null || p.trim().length()==0) {
+
+ public String getMode() {
+ // empty ILaunchConfigurationDialog method stub
+ return null;
+ }
+
+ public ILaunchConfigurationTab[] getTabs() {
+ if(tabGroup==null) {
return null;
} else {
- return new Path(p);
+ return tabGroup.getTabs();
}
}
- public Path getConfigurationFilePath() {
- return pathOrNull(configurationFileText.getText() );
+ public void setActiveTab(ILaunchConfigurationTab tab) {
+ // empty ILaunchConfigurationDialog method stub
}
- /**
- * @return
- */
- public EclipseConsoleConfiguration getOldConfiguration() {
- return oldConfiguaration;
+ public void setName(String name) {
+ nameWidget.setText(name);
}
- public void setConfigurationFilePath(IPath containerFullPath) {
- if(!configurationFileWillBeCreated) {
- initialize( new StructuredSelection(containerFullPath) );
- }
- configurationFileText.setText(containerFullPath.toPortableString());
+ public void updateButtons() {
+ // empty ILaunchConfigurationDialog method stub
+ }
- configurationFileWillBeCreated = true;
- configurationFileText.setEnabled(false);
- confbutton.setEnabled(false);
+ public void updateMessage() {
+ dialogChanged();
}
- public String getEntityResolverClassName() {
- return entityResolverClassNameText.getText();
+ public void run(boolean fork, boolean cancelable,
+ IRunnableWithProgress runnable) throws InvocationTargetException,
+ InterruptedException {
+ // empty ILaunchConfigurationDialog method stub
}
- public boolean useProjectClassPath() {
- return useProjectClassPath.getSelection();
+ static protected String nonEmptyTrimOrNull(Text t) {
+ return nonEmptyTrimOrNull( t.getText() );
}
- public ConfigurationMode getConfigurationMode() {
- if(annotationsMode.getSelection()) {
- return ConfigurationMode.ANNOTATIONS;
- } else if(jpaMode.getSelection()) {
- return ConfigurationMode.JPA;
+ static String nonEmptyTrimOrNull(String str) {
+ if(StringHelper.isEmpty( str )) {
+ return null;
} else {
- return ConfigurationMode.CORE;
+ return str.trim();
}
}
- public String getNamingStrategy() {
- return namingStrategyClassNameText.getText();
+ /////
+ // auxiliary functions to setup config parameters
+ // BEGIN
+ static protected void setPathAttribute(ILaunchConfigurationWorkingCopy
currentLaunchConfig, String attr, IPath path) {
+ if (path != null) {
+ currentLaunchConfig.setAttribute(attr, nonEmptyTrimOrNull(path.toOSString()));
+ }
+ else {
+ currentLaunchConfig.setAttribute(attr, (String)null);
+ }
}
-
- public String getPersistenceUnitName() {
- return persistenceUnitNameText.getText();
+
+ static protected void setProjAttribute(ILaunchConfigurationWorkingCopy
currentLaunchConfig, String attr, IJavaProject proj) {
+ if (proj != null) {
+ currentLaunchConfig.setAttribute(attr, nonEmptyTrimOrNull(proj.getElementName()));
+ }
+ else {
+ currentLaunchConfig.setAttribute(attr, (String)null);
+ }
}
+
+ static protected void setStrAttribute(ILaunchConfigurationWorkingCopy
currentLaunchConfig, String attr, String str) {
+ if (str != null) {
+ currentLaunchConfig.setAttribute(attr, nonEmptyTrimOrNull(str));
+ }
+ else {
+ currentLaunchConfig.setAttribute(attr, str);
+ }
+ }
+ // END
+ /////
+ /**
+ * Init launch config parameters from proper selection
+ *
+ * @param currentSelection
+ */
+ static public void initialize(ILaunchConfigurationWorkingCopy launchConfig, ISelection
currentSelection) throws CoreException {
+ BestGuessConsoleConfigurationVisitor v = new BestGuessConsoleConfigurationVisitor();
+ // use selection to build configuration from it...
+ if (currentSelection != null && currentSelection.isEmpty() == false
+ && currentSelection instanceof IStructuredSelection) {
+ IStructuredSelection ssel = (IStructuredSelection) currentSelection;
+ if (ssel.size() > 1) {
+ return;
+ }
+ Object obj = ssel.getFirstElement();
+ IContainer container = null;
+ if (obj instanceof IJavaElement) {
+ v.setJavaProject(((IJavaElement) obj).getJavaProject());
+ if (v.getJavaProject() != null) {
+ container = v.getJavaProject().getProject();
+ }
+ }
+ if (obj instanceof IResource) {
+ IResource res = (IResource) obj;
+ if (obj instanceof IContainer) {
+ container = (IContainer) res;
+ } else {
+ container = res.getParent();
+ }
+ if (res.getProject() != null) {
+ IJavaProject project = JavaCore.create(res.getProject());
+ if (project.exists()) {
+ v.setJavaProject(project);
+ }
+ }
+ }
+ if (container != null && v.getJavaProject() == null) {
+ IProject project = container.getProject();
+ v.setJavaProject(JavaCore.create(project));
+ }
+ if (container != null) {
+ container.accept(v, IResource.NONE);
+ if (v.getJavaProject() == null) {
+ IProject project = container.getProject();
+ v.setJavaProject(JavaCore.create(project));
+ }
+ setProjAttribute(launchConfig, IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME,
v.getJavaProject());
+
+ if (v.getJavaProject() != null) {
+ ILaunchManager lm = DebugPlugin.getDefault().getLaunchManager();
+ String uniqName =
lm.generateUniqueLaunchConfigurationNameFrom(v.getJavaProject().getElementName());
+ launchConfig.rename(uniqName);
+ }
+ setPathAttribute(launchConfig, IConsoleConfigurationLaunchConstants.PROPERTY_FILE,
v.getPropertyFile());
+ setPathAttribute(launchConfig, IConsoleConfigurationLaunchConstants.CFG_XML_FILE,
v.getConfigFile());
+ if (v.getPersistencexml() != null) {
+ setStrAttribute(launchConfig,
IConsoleConfigurationLaunchConstants.CONFIGURATION_FACTORY,
ConfigurationMode.JPA.toString());
+ }
+ else {
+ setStrAttribute(launchConfig,
IConsoleConfigurationLaunchConstants.CONFIGURATION_FACTORY,
ConfigurationMode.CORE.toString());
+ }
+ if (!v.getMappings().isEmpty() && v.getConfigFile() == null &&
v.getPersistencexml() == null) {
+ IPath[] mappings = v.getMappings().toArray(new IPath[]{});
+ List<String> l = new ArrayList<String>();
+ for (int i = 0; i < mappings.length; i++) {
+ IPath path = mappings[i];
+ l.add(path.toPortableString());
+ }
+
+ launchConfig.setAttribute(IConsoleConfigurationLaunchConstants.FILE_MAPPINGS, l);
+ }
+ else {
+ launchConfig.setAttribute(IConsoleConfigurationLaunchConstants.FILE_MAPPINGS,
(List<String>)null);
+ }
+ if (!v.getClasspath().isEmpty()) {
+ launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH,
false);
+ IPath[] custClasspath = v.getClasspath().toArray(new IPath[]{});
+ List<String> mementos = new ArrayList<String>(custClasspath.length);
+ for (int i = 0; i < custClasspath.length; i++) {
+ mementos.add(custClasspath[i].toOSString());
+ }
+ launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH,
mementos);
+ }
+ else {
+ launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH,
true);
+ launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH,
(List<String>)null);
+ }
+ } else if (obj instanceof EclipseConsoleConfiguration) {
+ throw new IllegalStateException("This should never happen!");
+ }
+ }
+ }
-}
+ /**
+ * Init path to cfg.xml for ConsoleConfigurationMainTab,
+ * init all tabs parameters
+ *
+ * @param configFullPath full path to cfg.xml file
+ */
+ public void setConfigurationFilePath(IPath configFullPath) {
+ boolean flagFileWillBeCreated = false;
+ try {
+ IPath path = configFullPath;
+ IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(path);
+ if (resource == null) {
+ flagFileWillBeCreated = true;
+ }
+ while (resource == null && path != null) {
+ path = path.removeLastSegments(1);
+ resource = ResourcesPlugin.getWorkspace().getRoot().findMember(path);
+ }
+ initialize(currentLaunchConfig, new StructuredSelection(resource));
+ } catch (CoreException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage(
+ HibernateConsoleMessages.ConsoleConfigurationWizardPage_problem_while_initializing_cc,
e);
+ }
+ if (flagFileWillBeCreated) {
+ setPathAttribute(currentLaunchConfig,
IConsoleConfigurationLaunchConstants.CFG_XML_FILE, configFullPath);
+ ConsoleConfigurationMainTab ccmt = null;
+ ILaunchConfigurationTab[] tabs = tabGroup.getTabs();
+ for (int i = 0; i < tabs.length; i++) {
+ if (tabs[i] instanceof ConsoleConfigurationMainTab) {
+ ccmt = (ConsoleConfigurationMainTab)tabs[i];
+ break;
+ }
+ }
+ if (ccmt != null) {
+ ccmt.markConfigurationFileWillBeCreated();
+ }
+ }
+ performInit();
+ dialogChanged();
+ }
+}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/NewConfigurationWizard.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/NewConfigurationWizard.java 2008-09-05
18:01:24 UTC (rev 10106)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/NewConfigurationWizard.java 2008-09-05
22:00:23 UTC (rev 10107)
@@ -55,7 +55,6 @@
/**
* Creates a new hibernate.cfg.xml
*/
-
public class NewConfigurationWizard extends Wizard implements INewWizard {
private NewConfigurationWizardPage connectionInfoPage;
private ISelection selection;
@@ -87,13 +86,12 @@
}
}
}
+
/**
* Adding the page to the wizard.
*/
-
public void addPages() {
- cPage =
- new ExtendedWizardNewFileCreationPage( "Ccfgxml",
(IStructuredSelection) selection ); //$NON-NLS-1$
+ cPage = new ExtendedWizardNewFileCreationPage( "Ccfgxml",
(IStructuredSelection) selection ); //$NON-NLS-1$
cPage.setTitle(
HibernateConsoleMessages.NewConfigurationWizard_create_hibernate_cfg_file );
cPage.setDescription(
HibernateConsoleMessages.NewConfigurationWizard_create_new_hibernate_cfg_xml );
cPage.setFileName("hibernate.cfg.xml"); //$NON-NLS-1$
@@ -107,15 +105,12 @@
addPage(confPage);
}
-
-
/**
* This method is called when 'Finish' button is pressed in
* the wizard. We will create an operation and run it
* using wizard as execution context.
*/
public boolean performFinish() {
-
final Properties props = new Properties();
putIfNotNull(props, Environment.SESSION_FACTORY_NAME,
connectionInfoPage.getSessionFactoryName() );
putIfNotNull(props, Environment.DIALECT, connectionInfoPage.getDialect() );
@@ -148,13 +143,25 @@
return false;
}
- if(connectionInfoPage.isCreateConsoleConfigurationEnabled()) {
- ConsoleConfigurationCreationWizard.createConsoleConfiguration(getContainer(),
confPage);
+ if (connectionInfoPage.isCreateConsoleConfigurationEnabled()) {
+ try {
+ confPage.performFinish();
+ } catch (CoreException ce) {
+ HibernateConsolePlugin.getDefault().showError(getShell(),
HibernateConsoleMessages.AddConfigurationAction_problem_add_console_config, ce);
+ }
}
-
return true;
}
+ public boolean performCancel() {
+ try {
+ confPage.performCancel();
+ } catch (CoreException ce) {
+ HibernateConsolePlugin.getDefault().showError(getShell(),
HibernateConsoleMessages.AddConfigurationAction_problem_add_console_config, ce);
+ }
+ return true;
+ }
+
/**
* @param props
* @param dialect
@@ -173,7 +180,6 @@
* @param file
* @param props
*/
-
private void createHibernateCfgXml(
final IFile file, Properties props, IProgressMonitor monitor)
throws CoreException {
@@ -208,7 +214,6 @@
* We will initialize file contents with a sample text.
* @throws UnsupportedEncodingException
*/
-
private InputStream openContentStream(Properties props) {
StringWriter stringWriter = new StringWriter();
HibernateConfigurationExporter hce = new HibernateConfigurationExporter();
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/BasicWorkbenchAdapter.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/BasicWorkbenchAdapter.java 2008-09-05
18:01:24 UTC (rev 10106)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/BasicWorkbenchAdapter.java 2008-09-05
22:00:23 UTC (rev 10107)
@@ -32,6 +32,7 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.ui.progress.IDeferredWorkbenchAdapter;
import org.eclipse.ui.progress.IElementCollector;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
@@ -116,12 +117,13 @@
HibernateConsolePlugin.openError(null, getDefaultErrorTitle(),
getDefaultErrorMessage(object), e, HibernateConsolePlugin.PERFORM_SYNC_EXEC);
}
- private String getDefaultErrorMessage(Object object) {
- return HibernateConsoleMessages.BasicWorkbenchAdapter_error_while_expanding +
getLabel(object);
+ protected String getDefaultErrorMessage(Object object) {
+
+ return NLS.bind(HibernateConsoleMessages.BasicWorkbenchAdapter_error_while_expanding,
getLabel(object));
}
- private String getDefaultErrorTitle() {
+ protected String getDefaultErrorTitle() {
return HibernateConsoleMessages.BasicWorkbenchAdapter_hibernate_configuration_error;
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/ConfigurationWorkbenchAdapter.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/ConfigurationWorkbenchAdapter.java 2008-09-05
18:01:24 UTC (rev 10106)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/ConfigurationWorkbenchAdapter.java 2008-09-05
22:00:23 UTC (rev 10107)
@@ -25,6 +25,7 @@
import java.util.Iterator;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.osgi.util.NLS;
import org.hibernate.cfg.Configuration;
import org.hibernate.console.ImageConstants;
import org.hibernate.console.KnownConfigurations;
@@ -66,6 +67,6 @@
return true;
}
+
-
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/ConsoleConfigurationWorkbenchAdapter.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/ConsoleConfigurationWorkbenchAdapter.java 2008-09-05
18:01:24 UTC (rev 10106)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/ConsoleConfigurationWorkbenchAdapter.java 2008-09-05
22:00:23 UTC (rev 10107)
@@ -22,6 +22,7 @@
package org.hibernate.eclipse.console.workbench;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.osgi.util.NLS;
import org.hibernate.cfg.Configuration;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.ImageConstants;
@@ -96,4 +97,7 @@
return KnownConfigurations.getInstance();
}
+ protected String getDefaultErrorMessage(Object object) {
+ return
NLS.bind(HibernateConsoleMessages.BasicWorkbenchAdapter_error_while_opening_configuration,
getLabel(object));
+ }
}
Added:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConnectionProfileCtrl.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConnectionProfileCtrl.java
(rev 0)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConnectionProfileCtrl.java 2008-09-05
22:00:23 UTC (rev 10107)
@@ -0,0 +1,374 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 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.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+
+import org.eclipse.datatools.connectivity.ConnectionProfileException;
+import org.eclipse.datatools.connectivity.IConnectionProfile;
+import org.eclipse.datatools.connectivity.IProfileListener;
+import org.eclipse.datatools.connectivity.ProfileManager;
+import org.eclipse.datatools.connectivity.internal.ui.wizards.NewCPWizard;
+import org.eclipse.datatools.connectivity.internal.ui.wizards.NewCPWizardCategoryFilter;
+import org.eclipse.datatools.connectivity.ui.wizards.NewConnectionProfileWizard;
+import org.eclipse.debug.internal.ui.SWTFactory;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.viewers.ComboViewer;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.internal.dialogs.PropertyDialog;
+import org.hibernate.annotations.common.util.StringHelper;
+import org.hibernate.eclipse.console.HibernateConsolePlugin;
+
+/**
+ *
+ *
+ * @author Vitali
+ */
+public class ConnectionProfileCtrl {
+
+ protected ComboViewer comboControl;
+ protected Button buttonNew;
+ protected Button buttonEdit;
+
+ static final protected ConnectionWrapper NO_CONNECTION_PLACEHOLDER = new
ConnectionWrapper("",null);
+
+ private static class ConnectionWrapper {
+
+ final private String id;
+ final private IConnectionProfile profile;
+
+ public ConnectionWrapper(String id, IConnectionProfile profile) {
+ this.id = id;
+ this.profile = profile;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public IConnectionProfile getProfile() {
+ return profile;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if(obj==null) {
+ return false;
+ }
+
+ ConnectionWrapper cw = (ConnectionWrapper) obj;
+ return this.getId().equals(cw.getId());
+ }
+ }
+
+ protected ArrayList<ModifyListener> modifyListeners = new
ArrayList<ModifyListener>();
+
+ public ConnectionProfileCtrl(Composite comp, int hspan, String defaultValue) {
+ createComboWithTwoButtons(comp, hspan, defaultValue,
+ new NewConnectionProfileAction(), new EditConnectionProfileAction());
+ }
+
+ public class ButtonPressedAction extends Action implements SelectionListener {
+
+ public ButtonPressedAction(String label) {
+ super(label);
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ run();
+ }
+ }
+
+ public class ConnectionProfileChangeListener implements IProfileListener {
+ /* (non-Javadoc)
+ * @see
org.eclipse.datatools.connectivity.IProfileListener#profileAdded(org.eclipse.datatools.connectivity.IConnectionProfile)
+ */
+ public void profileAdded(final IConnectionProfile profile) {
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ updateInput();
+ selectValue(profile.getName());
+ validate();
+ }
+ });
+ }
+
+ /* (non-Javadoc)
+ * @see
org.eclipse.datatools.connectivity.IProfileListener#profileChanged(org.eclipse.datatools.connectivity.IConnectionProfile)
+ */
+ public void profileChanged(IConnectionProfile profile) {
+ profileAdded(profile);
+ }
+
+ /* (non-Javadoc)
+ * @see
org.eclipse.datatools.connectivity.IProfileListener#profileDeleted(org.eclipse.datatools.connectivity.IConnectionProfile)
+ */
+ public void profileDeleted(IConnectionProfile profile) {
+ // this event never happens
+ }
+ }
+
+ public class NewConnectionProfileAction extends ButtonPressedAction {
+ /**
+ * @param label
+ */
+ public NewConnectionProfileAction() {
+ super("New...");
+ }
+
+ @Override
+ public void run() {
+ IProfileListener listener = new ConnectionProfileChangeListener();
+
+ ProfileManager.getInstance().addProfileListener(listener);
+ NewCPWizardCategoryFilter filter = new
NewCPWizardCategoryFilter("org.eclipse.datatools.connectivity.db.category");
//$NON-NLS-1$
+ NewCPWizard wizard = new NewCPWizard(filter, null);
+ new NewConnectionProfileWizard() {
+ public boolean performFinish() {
+ // create profile only
+ try {
+ ProfileManager.getInstance().createProfile(
+ getProfileName() == null ? "" //$NON-NLS-1$
+ : getProfileName(),
+ getProfileDescription() == null ? "" //$NON-NLS-1$
+ : getProfileDescription(),
+ mProviderID,
+ getProfileProperties(),
+ mProfilePage.getRepository() == null ? "" //$NON-NLS-1$
+ : mProfilePage.getRepository()
+ .getName(), false);
+ } catch (ConnectionProfileException e) {
+ HibernateConsolePlugin.getDefault().log(e);
+ }
+ return true;
+ }
+
+ @Override
+ public void addCustomPages() {
+ }
+
+ @Override
+ public Properties getProfileProperties() {
+ return null;
+ }
+ };
+ WizardDialog wizardDialog = new WizardDialog(Display.getCurrent()
+ .getActiveShell(), wizard);
+ wizardDialog.open();
+ ProfileManager.getInstance().removeProfileListener(listener);
+ }
+ }
+
+ /**
+ *
+ */
+ public class EditConnectionProfileAction extends ButtonPressedAction {
+
+ /**
+ * @param label
+ */
+ public EditConnectionProfileAction() {
+ super("Edit...");
+ }
+
+ /**
+ *
+ */
+ @Override
+ public void run() {
+ ConnectionWrapper currentConnection = getSelectedConnection();
+ if (null == currentConnection || currentConnection.getProfile()==null) {
+ return;
+ }
+ IConnectionProfile selectedProfile = currentConnection.getProfile();
+ PropertyDialog.createDialogOn(
+ Display.getCurrent().getActiveShell(),
+ "org.eclipse.datatools.connectivity.db.generic.profileProperties",
//$NON-NLS-1$
+ selectedProfile).open();
+
+ if (!currentConnection.getId().equals(selectedProfile.getName())) {
+ updateInput();
+ selectValue(selectedProfile.getName());
+ }
+ validate();
+ }
+ };
+
+ public Composite createComboWithTwoButtons(Composite container, int hspan,
+ String defaultValue, ButtonPressedAction action1, ButtonPressedAction action2) {
+
+ Composite comp = SWTFactory.createComposite(container, container.getFont(), 3, 1,
GridData.FILL_BOTH, 0, 0);
+ Combo combo;
+ combo = new Combo(comp, SWT.DROP_DOWN | SWT.READ_ONLY);
+ combo.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
+ comboControl = new ComboViewer(combo);
+ comboControl.setContentProvider(new IStructuredContentProvider() {
+
+ public void dispose() {
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput,
+ Object newInput) {
+ }
+
+ public Object[] getElements(Object inputElement) {
+ return getProfileNameList().toArray();
+ }
+ });
+
+ comboControl.setLabelProvider(new LabelProvider() {
+
+ @Override
+ public String getText(Object element) {
+ ConnectionWrapper cw = (ConnectionWrapper) element;
+ if(cw.getProfile()==null) {
+ return "[Hibernate configured connection]";
+ } else {
+ return cw.getProfile().getName();
+ }
+ }
+ });
+
+ comboControl.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ buttonEdit.setEnabled(getSelectedConnection().getProfile()!=null);
+ notifyModifyListeners();
+ }
+
+ });
+ combo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL |
GridData.GRAB_HORIZONTAL));
+
+ buttonNew = new Button(comp, SWT.PUSH);
+ buttonNew.setText("New...");
+ buttonNew.addSelectionListener(action1);
+
+ buttonEdit = new Button(comp, SWT.PUSH);
+ buttonEdit.setText("Edit...");
+ buttonEdit.addSelectionListener(action2);
+
+ updateInput();
+ return comp;
+ }
+
+ public void updateInput() {
+ comboControl.setInput(getProfileNameList());
+ }
+
+ //TODO: handle if the connection profile does not exist
+ // Require that we make the combobox editable
+ protected ConnectionWrapper findMatchingConnection(String name) {
+ if(StringHelper.isEmpty(name)) {
+ return NO_CONNECTION_PLACEHOLDER;
+ }
+
+ List<ConnectionWrapper> list = getProfileNameList();
+
+ for (Iterator<ConnectionWrapper> iterator = list.iterator(); iterator.hasNext();)
{
+ ConnectionWrapper object = iterator.next();
+ if(name.equals(object.getId())) {
+ return object;
+ }
+ }
+ return NO_CONNECTION_PLACEHOLDER;
+ }
+
+ public void selectValue(String name) {
+ ConnectionWrapper connection = findMatchingConnection(name);
+ comboControl.setSelection(new StructuredSelection(connection), true);
+ comboControl.refresh();
+ notifyModifyListeners();
+ }
+
+ /**
+ *
+ * @return current selected connection wrapper, will always return non-null.
+ */
+ private ConnectionWrapper getSelectedConnection() {
+ StructuredSelection selection = (StructuredSelection)comboControl.getSelection();
+ if (null == selection || selection.isEmpty()) {
+ return NO_CONNECTION_PLACEHOLDER;
+ }
+ ConnectionWrapper cw = (ConnectionWrapper) selection.getFirstElement();
+ return cw;
+ }
+
+ private String getSelectedId() {
+ ConnectionWrapper cw = getSelectedConnection();
+ if (cw == null) {
+ cw = NO_CONNECTION_PLACEHOLDER;
+ }
+ return cw.getId();
+ }
+
+ protected void validate() {
+ }
+
+ private List<ConnectionWrapper> getProfileNameList() {
+ IConnectionProfile[] profiles = ProfileManager.getInstance()
+ .getProfilesByCategory("org.eclipse.datatools.connectivity.db.category");
//$NON-NLS-1$
+ List<ConnectionWrapper> names = new ArrayList<ConnectionWrapper>();
+ names.add(NO_CONNECTION_PLACEHOLDER);
+ for (IConnectionProfile connectionProfile : profiles) {
+ names.add(new ConnectionWrapper(connectionProfile.getName(), connectionProfile));
+ }
+ return names;
+ }
+
+ public void setEnabled(boolean enabled) {
+ comboControl.getControl().setEnabled(enabled);
+ buttonNew.setEnabled(enabled);
+ buttonEdit.setEnabled(enabled);
+ }
+
+ public void notifyModifyListeners() {
+ for (int i = 0; i < modifyListeners.size(); i++) {
+ modifyListeners.get(i).modifyText(null);
+ }
+ }
+
+ public void addModifyListener(ModifyListener listener) {
+ modifyListeners.add(listener);
+ }
+
+ public void removeModifyListener(ModifyListener listener) {
+ modifyListeners.remove(listener);
+ }
+
+ public String getSelectedConnectionName() {
+ return getSelectedConnection().getId();
+ }
+
+ public boolean hasConnectionProfileSelected() {
+ return getSelectedConnection().getProfile()!=null;
+ }
+}
Added:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConsoleConfigurationJavaClasspathTab.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConsoleConfigurationJavaClasspathTab.java
(rev 0)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConsoleConfigurationJavaClasspathTab.java 2008-09-05
22:00:23 UTC (rev 10107)
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 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 org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.jdt.debug.ui.launchConfigurations.JavaClasspathTab;
+import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.hibernate.eclipse.console.HibernateConsoleMessages;
+import org.hibernate.eclipse.console.HibernateConsolePlugin;
+
+/**
+ *
+ * @author Vitali
+ */
+public class ConsoleConfigurationJavaClasspathTab extends JavaClasspathTab {
+
+ public boolean isShowBootpath() {
+ return false;
+ }
+
+ public boolean isValid(ILaunchConfiguration launchConfig) {
+ if(super.isValid( launchConfig )) {
+ setErrorMessage( null );
+ setMessage( null );
+ IRuntimeClasspathEntry[] entries;
+ try {
+ entries = JavaRuntime.computeUnresolvedRuntimeClasspath(launchConfig);
+ for (int i = 0; i < entries.length; i++) {
+ IRuntimeClasspathEntry entry = entries[i];
+ if(entry.getClasspathProperty()==IRuntimeClasspathEntry.USER_CLASSES) {
+ return true;
+ }
+ }
+
+ }
+ catch (CoreException e) {
+ HibernateConsolePlugin.getDefault().log( e );
+ }
+ setErrorMessage(
HibernateConsoleMessages.ConsoleConfigurationTabGroup_classpath_must_be_set_or_restored_to_default
);
+ return false;
+ }
+ return false;
+ }
+
+ public void initializeFrom(ILaunchConfiguration configuration) {
+
+ super.initializeFrom( configuration );
+ }
+
+ public boolean canSave() {
+ return super.canSave();
+ }
+}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConsoleConfigurationMainTab.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConsoleConfigurationMainTab.java 2008-09-05
18:01:24 UTC (rev 10106)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConsoleConfigurationMainTab.java 2008-09-05
22:00:23 UTC (rev 10107)
@@ -11,6 +11,7 @@
import org.eclipse.core.runtime.Path;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.internal.ui.SWTFactory;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
import org.eclipse.jface.dialogs.IDialogConstants;
@@ -40,6 +41,7 @@
import
org.hibernate.console.preferences.ConsoleConfigurationPreferences.ConfigurationMode;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
+import org.hibernate.eclipse.console.actions.AddConfigurationAction;
import org.hibernate.eclipse.console.utils.DialogSelectionHelper;
import org.hibernate.eclipse.console.utils.EclipseImages;
import org.hibernate.eclipse.console.utils.ProjectUtils;
@@ -49,8 +51,8 @@
public class ConsoleConfigurationMainTab extends ConsoleConfigurationTab {
+ protected boolean configurationFileWillBeCreated = false;
-
private Button coreMode;
private Button jpaMode;
private Button annotationsMode;
@@ -60,7 +62,9 @@
private Text configurationFileText;
private Text projectNameText;
private Text persistenceUnitNameText;
-
+
+ private ConnectionProfileCtrl connectionProfileCtrl;
+
public String getName() {
return HibernateConsoleMessages.ConsoleConfigurationMainTab_main;
}
@@ -78,14 +82,25 @@
createProjectEditor( comp );
+ createDBConnectConfig(comp);
+
createPropertyFileEditor(comp);
createConfigurationFileEditor(comp);
createPersistenceUnitEditor( comp );
+
}
+ private void createDBConnectConfig(Composite container) {
+ Group group = SWTFactory.createGroup(container, "Database connection:", 3, 2,
GridData.FILL_HORIZONTAL);
+
+ connectionProfileCtrl = new ConnectionProfileCtrl(group, 1, "");
//$NON-NLS-1$//$NON-NLS-2$
+ connectionProfileCtrl.addModifyListener(getChangeListener());
+
+ }
+
private void createConfigurationMode(Composite container) {
Group group = createGroup( container,
HibernateConsoleMessages.ConsoleConfigurationMainTab_type);
group.setLayout( new RowLayout( SWT.HORIZONTAL ) );
@@ -148,14 +163,14 @@
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
- configuration.setAttribute( IConsoleConfigurationLaunchConstants.CONFIGURATION_FACTORY,
getConfigurationMode().toString());
+ configuration.setAttribute(IConsoleConfigurationLaunchConstants.CONFIGURATION_FACTORY,
getConfigurationMode().toString());
configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME,
nonEmptyTrimOrNull( projectNameText ));
configuration.setAttribute(IConsoleConfigurationLaunchConstants.PROPERTY_FILE,
nonEmptyTrimOrNull(propertyFileText));
configuration.setAttribute(IConsoleConfigurationLaunchConstants.CFG_XML_FILE,
nonEmptyTrimOrNull(configurationFileText));
- configuration.setAttribute( IConsoleConfigurationLaunchConstants.PERSISTENCE_UNIT_NAME,
nonEmptyTrimOrNull(persistenceUnitNameText));
-
+ configuration.setAttribute(IConsoleConfigurationLaunchConstants.PERSISTENCE_UNIT_NAME,
nonEmptyTrimOrNull(persistenceUnitNameText));
+ configuration.setAttribute(IConsoleConfigurationLaunchConstants.CONNECTION_PROFILE_NAME,
nonEmptyTrimOrNull(connectionProfileCtrl.getSelectedConnectionName()));
}
-
+
public void initializeFrom(ILaunchConfiguration configuration) {
try {
@@ -168,10 +183,12 @@
propertyFileText.setText( configuration.getAttribute(
IConsoleConfigurationLaunchConstants.PROPERTY_FILE, "" ) ); //$NON-NLS-1$
configurationFileText.setText( configuration.getAttribute(
IConsoleConfigurationLaunchConstants.CFG_XML_FILE, "" )); //$NON-NLS-1$
persistenceUnitNameText.setText( configuration.getAttribute(
IConsoleConfigurationLaunchConstants.PERSISTENCE_UNIT_NAME, "" ));
//$NON-NLS-1$
+
+ connectionProfileCtrl.selectValue(configuration.getAttribute(IConsoleConfigurationLaunchConstants.CONNECTION_PROFILE_NAME,
"")); //$NON-NLS-1$
}
catch (CoreException e) {
HibernateConsolePlugin.getDefault().log( e );
- }
+ }
}
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {}
@@ -336,16 +353,18 @@
}
public boolean isValid(ILaunchConfiguration launchConfig) {
+
setErrorMessage( null );
setMessage( null );
String propertyFilename = propertyFileText.getText();
String configurationFilename = configurationFileText.getText();
- configurationFileText.setEnabled( /* TODO !configurationFileWillBeCreated && */
!getConfigurationMode().equals( ConfigurationMode.JPA ) );
- confbutton.setEnabled( !getConfigurationMode().equals( ConfigurationMode.JPA ) );
+ boolean modeJPA = getConfigurationMode().equals(ConfigurationMode.JPA);
+ configurationFileText.setEnabled(!configurationFileWillBeCreated && !modeJPA
);
+ confbutton.setEnabled(!configurationFileWillBeCreated && !modeJPA);
- persistenceUnitNameText.setEnabled( getConfigurationMode().equals(
ConfigurationMode.JPA) );
-
+ persistenceUnitNameText.setEnabled(modeJPA);
+
if(getProjectName()!=null && StringHelper.isNotEmpty(getProjectName().trim()))
{
Path projectPath = new Path(getProjectName());
if (projectPath.segmentCount() > 1){
@@ -375,7 +394,7 @@
}
}
- if (/*!configurationFileWillBeCreated &&*/ configurationFilename.length() >
0) {
+ if (!configurationFileWillBeCreated && configurationFilename.length() > 0)
{
IResource resource =
ResourcesPlugin.getWorkspace().getRoot().findMember(configurationFilename);
String msg =
checkForFile(HibernateConsoleMessages.ConsoleConfigurationMainTab_configuration_file_2,resource);
if(msg!=null) {
@@ -384,11 +403,13 @@
}
}
- if ((configurationFilename != null && configurationFilename.trim().length()
> 0) &&
+ /* This check is not true! The properties in console configuration is used to override
things in cfg.xml/persistence.xml.
+ * Having a /hibernate.properties is not the same as this!
+ if ((configurationFilename != null && configurationFilename.trim().length()
> 0) &&
(propertyFilename != null && propertyFilename.trim().length() > 0)) {
setMessage(HibernateConsoleMessages.ConsoleConfigurationMainTab_both_hibernate_properties_and_hibernate_cfg_xml);
return true;
- }
+ }*/
/*if((useProjectClassPath() && StringHelper.isEmpty( getProjectName() ))
&& classPathViewer.getTable().getItemCount()==0) {
setErrorMessage( "Need to specify a project or setup a classpath" );
@@ -433,5 +454,10 @@
return EclipseImages.getImage(ImageConstants.MINI_HIBERNATE);
}
+ public void markConfigurationFileWillBeCreated() {
+ configurationFileWillBeCreated = true;
+ confbutton.setEnabled(false);
+ configurationFileText.setEnabled(false);
+ }
}
\ No newline at end of file
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConsoleConfigurationTabGroup.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConsoleConfigurationTabGroup.java 2008-09-05
18:01:24 UTC (rev 10106)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConsoleConfigurationTabGroup.java 2008-09-05
22:00:23 UTC (rev 10107)
@@ -1,76 +1,26 @@
package org.hibernate.eclipse.launch;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
import org.eclipse.debug.ui.CommonTab;
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
import org.eclipse.debug.ui.ILaunchConfigurationTab;
-import org.eclipse.jdt.debug.ui.launchConfigurations.JavaClasspathTab;
-import org.eclipse.jdt.internal.debug.ui.classpath.ClasspathModel;
-import org.eclipse.jdt.internal.debug.ui.classpath.IClasspathEntry;
-import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
-import org.eclipse.jdt.launching.JavaRuntime;
-import org.hibernate.eclipse.console.HibernateConsoleMessages;
-import org.hibernate.eclipse.console.HibernateConsolePlugin;
public class ConsoleConfigurationTabGroup extends
AbstractLaunchConfigurationTabGroup {
public ConsoleConfigurationTabGroup() {
-
}
-
public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] {
new ConsoleConfigurationMainTab(),
new ConsoleConfigurationOptionsTab(),
- new JavaClasspathTab() {
-
- public boolean isShowBootpath() {
- return false;
- }
-
- public boolean isValid(ILaunchConfiguration launchConfig) {
- if(super.isValid( launchConfig )) {
- setErrorMessage( null );
- setMessage( null );
- IRuntimeClasspathEntry[] entries;
- try {
- entries = JavaRuntime.computeUnresolvedRuntimeClasspath(launchConfig);
- for (int i = 0; i < entries.length; i++) {
- IRuntimeClasspathEntry entry = entries[i];
- if(entry.getClasspathProperty()==IRuntimeClasspathEntry.USER_CLASSES) {
- return true;
- }
- }
-
- }
- catch (CoreException e) {
- HibernateConsolePlugin.getDefault().log( e );
- }
- setErrorMessage(
HibernateConsoleMessages.ConsoleConfigurationTabGroup_classpath_must_be_set_or_restored_to_default
);
- return false;
- }
- return false;
- }
-
- public void initializeFrom(ILaunchConfiguration configuration) {
-
- super.initializeFrom( configuration );
- }
-
- public boolean canSave() {
- return super.canSave();
- }
- },
+ new ConsoleConfigurationJavaClasspathTab(),
new ConsoleConfigurationMappingsTab(),
new CommonTab(),
-
- };
-
- this.setTabs(tabs);
+ };
+ setTabs(tabs);
}
-
+
+
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/IConsoleConfigurationLaunchConstants.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/IConsoleConfigurationLaunchConstants.java 2008-09-05
18:01:24 UTC (rev 10106)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/IConsoleConfigurationLaunchConstants.java 2008-09-05
22:00:23 UTC (rev 10107)
@@ -11,6 +11,7 @@
public static final String CFG_XML_FILE = ID + ".CFG_XML_FILE"; //$NON-NLS-1$
public static final String PERSISTENCE_UNIT_NAME = ID +
".PERSISTENCE_UNIT_NAME"; //$NON-NLS-1$
public static final String CONFIGURATION_FACTORY = ID +
".CONFIGURATION_FACTORY"; //$NON-NLS-1$
+ public static final String CONNECTION_PROFILE_NAME = ID +
".CONNECTION_PROFILE_NAME"; //$NON-NLS-1$
public static final String FILE_MAPPINGS = ID + ".FILE_MAPPINGS";
//$NON-NLS-1$
public static final String PROJECT_NAME =
IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME;
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 2008-09-05
18:01:24 UTC (rev 10106)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsoleConfigurationTest.java 2008-09-05
22:00:23 UTC (rev 10107)
@@ -106,6 +106,11 @@
return null;
}
+ public String getConnectionProfileName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/KnownConfigurationsTest.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/KnownConfigurationsTest.java 2008-09-05
18:01:24 UTC (rev 10106)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/KnownConfigurationsTest.java 2008-09-05
22:00:23 UTC (rev 10107)
@@ -129,6 +129,11 @@
return null;
}
+ public String getConnectionProfileName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
};
ConsoleConfigurationPreferences preferences2 = new ConsoleConfigurationPreferences() {
@@ -203,6 +208,11 @@
return null;
}
+ public String getConnectionProfileName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
};
ConsoleConfiguration configuration = new ConsoleConfiguration(preferences);
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HQLQueryValidatorTest.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HQLQueryValidatorTest.java 2008-09-05
18:01:24 UTC (rev 10106)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HQLQueryValidatorTest.java 2008-09-05
22:00:23 UTC (rev 10107)
@@ -112,7 +112,7 @@
String prjName = getProject().getIProject().getName();
EclipseConsoleConfigurationPreferences preferences = new
EclipseConsoleConfigurationPreferences(prjName,
- ConfigurationMode.JPA, prjName, true, null, null, null, new IPath[0], new IPath[0],
null, null);
+ ConfigurationMode.JPA, prjName, true, null, null, null, new IPath[0], new IPath[0],
null, null, null, false);
ccfg = KnownConfigurations.getInstance().addConfiguration(new
EclipseConsoleConfiguration(preferences), false);
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HibernateErrorsTest2.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HibernateErrorsTest2.java 2008-09-05
18:01:24 UTC (rev 10106)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HibernateErrorsTest2.java 2008-09-05
22:00:23 UTC (rev 10107)
@@ -1,192 +1,192 @@
-package org.hibernate.eclipse.jdt.ui.test;
-
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.IOException;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IncrementalProjectBuilder;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.dom.AST;
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.ASTParser;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.launching.JavaRuntime;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.PlatformUI;
-import org.hibernate.HibernateException;
-import org.hibernate.console.ConsoleConfiguration;
-import org.hibernate.console.KnownConfigurations;
-import
org.hibernate.console.preferences.ConsoleConfigurationPreferences.ConfigurationMode;
-import org.hibernate.eclipse.console.EclipseConsoleConfiguration;
-import org.hibernate.eclipse.console.EclipseConsoleConfigurationPreferences;
-import org.hibernate.eclipse.console.test.HibernateConsoleTest;
-import org.hibernate.eclipse.console.test.SimpleTestProject;
-import org.hibernate.eclipse.console.test.xpl.JavaProjectHelper;
-import org.hibernate.eclipse.console.utils.ProjectUtils;
-import org.hibernate.eclipse.jdt.ui.internal.HQLDetector;
-import org.hibernate.eclipse.jdt.ui.internal.HQLProblem;
-
-public class HibernateErrorsTest2 extends HibernateConsoleTest {
-
- private SimpleTestProject project;
-
- private ConsoleConfiguration ccfg;
-
- public HibernateErrorsTest2(String name) {
- super(name);
- }
-
- @Override
- protected SimpleTestProject createTestProject() {
- return new SimpleTestProject("hqlquerytest-" + System.currentTimeMillis()) {
// the currentTime Millis can be removed once the classloader stop hanging on to the jars.
see JBIDE-1012
-
- @Override
- protected void buildSimpleTestProject() throws JavaModelException,
- CoreException, IOException {
- super.buildSimpleTestProject();
-
-
- //set up project #3: file system structure with project as source folder
- //add an internal jar
- File ejb3lib= HibernateJDTuiTestPlugin.getDefault().getFileInPlugin(new
Path("testresources/ejb3-persistence.jar")); //$NON-NLS-1$
- assertTrue("ejb3 lib not found", ejb3lib != null &&
ejb3lib.exists()); //$NON-NLS-1$
-
- JavaProjectHelper.addToClasspath(getIJavaProject(),
JavaRuntime.getDefaultJREContainerEntry());
-
- IPackageFragmentRoot addLibraryWithImport =
JavaProjectHelper.addLibraryWithImport(getIJavaProject(),
Path.fromOSString(ejb3lib.getPath()), null, null);
-
- assertEquals(3,getIJavaProject().getRawClasspath().length);
-
- getIProject().getFolder("src/META-INF").create(true, true, new
NullProgressMonitor());
- getIProject().getFile("src/META-INF/persistence.xml").create(
- new ByteArrayInputStream(("<persistence>\n" +
- " <persistence-unit name=\"manager1\"
transaction-type=\"RESOURCE_LOCAL\">\n" +
- " <class>test.TestClass</class>\n" +
- " <properties>\n" +
- " <property name=\"hibernate.dialect\"
value=\"org.hibernate.dialect.HSQLDialect\"/>\n" +
- " <property
name=\"hibernate.connection.driver_class\"
value=\"org.hsqldb.jdbcDriver\"/>\n" +
- " <property
name=\"hibernate.connection.username\" value=\"sa\"/>\n" +
- " <property
name=\"hibernate.connection.password\" value=\"\"/>\n" +
- " <property
name=\"hibernate.connection.url\" value=\"jdbc:hsqldb:.\"/>\n"
+
- " <property
name=\"hibernate.query.startup_check\" value=\"false\"/>\n"
+
- " </properties>\n" +
- " </persistence-unit>\n" +
- "</persistence>").getBytes()),
- false /* force */, new NullProgressMonitor());
-
- getIProject().findMember("src/META-INF/persistence.xml");
- getIProject().build(IncrementalProjectBuilder.FULL_BUILD, new
NullProgressMonitor());
- }
-
- @Override
- protected IType buildType(IPackageFragment pack, String cuName)
- throws JavaModelException {
- ICompilationUnit cu = pack.createCompilationUnit(cuName,
- "", false, null);
-
- cu.createPackageDeclaration(pack.getElementName(),null);
- IType type = cu.createType(
- "(a)javax.persistence.NamedQuery(name=\"fromUnknown\",
query=\"from Unknown\")\n" +
- "(a)javax.persistence.Entity\n" +
- "public class " + TYPE_NAME + " {}",null,false,null);
- type.createField("(a)javax.persistence.Id private int id;",null,false,null);
- type.createField("private String testField;",null,false,null);
- type.createMethod("public String getTestField() {return
this.testField;}",null,false,null);
- type.createMethod("public void setTestField(String testField) {this.testField =
testField;}",null,false,null);
- return type;
- }
- };
- }
-
- @Override
- protected void setUp() throws Exception {
-
- this.project = createTestProject();
- waitForJobs();
-
- String prjName = getProject().getIProject().getName();
-
- EclipseConsoleConfigurationPreferences preferences = new
EclipseConsoleConfigurationPreferences(prjName,
- ConfigurationMode.JPA, prjName, true, null, null, null, new IPath[0], new IPath[0],
null, null);
-
- ccfg = KnownConfigurations.getInstance().addConfiguration(new
EclipseConsoleConfiguration(preferences), false);
-
- assertTrue(ProjectUtils.toggleHibernateOnProject(getProject().getIProject(), true,
prjName));
-
- ccfg.build();
- ccfg.buildSessionFactory();
-
- }
-
- @Override
- protected void tearDown() throws Exception {
- ccfg.reset();
- KnownConfigurations.getInstance().removeAllConfigurations();
- //super.tearDown();
- waitForJobs();
-
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
- .closeAllEditors( false);
-
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
- .setPerspective(
- PlatformUI.getWorkbench().getPerspectiveRegistry()
- .findPerspectiveWithId(
- "org.eclipse.ui.resourcePerspective"));
-
- waitForJobs();
- // getProject().deleteIProject();
-
- // super.tearDown();
-
- IProject proj = getProject().getIProject();
- String projRoot = proj.getLocation().toFile().getAbsolutePath();
- File file = new File(projRoot);
-
- getProject().getIProject().delete(false, true, null);
- waitForJobs();
- delete(file);
- }
- public void testDummy() throws JavaModelException {
-
- }
-
- private void delete(File path) {
- if (path.exists()) {
- File[] files = path.listFiles();
- for (int i = 0; i < files.length; i++) {
- if (files[i].isDirectory()) {
- delete(files[i]);
- } else {
- deleteFile(files[i]);
- }
- }
- }
- deleteFile(path);
-
- }
-
- private void deleteFile(File file) {
- try {
- if (!file.delete())
- throw new RuntimeException("Cannot remove the " + file.getAbsolutePath() +
" file. (" + Platform.getOS() + ")");
- } catch (Throwable e) {
- throw new RuntimeException("Cannot remove the " + file.getAbsolutePath() +
" file. (" + Platform.getOS() + ")",e);
- }
- }
-
- protected SimpleTestProject getProject() {
- return this.project;
- }
-}
+package org.hibernate.eclipse.jdt.ui.test;
+
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOException;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.ASTParser;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PlatformUI;
+import org.hibernate.HibernateException;
+import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.console.KnownConfigurations;
+import
org.hibernate.console.preferences.ConsoleConfigurationPreferences.ConfigurationMode;
+import org.hibernate.eclipse.console.EclipseConsoleConfiguration;
+import org.hibernate.eclipse.console.EclipseConsoleConfigurationPreferences;
+import org.hibernate.eclipse.console.test.HibernateConsoleTest;
+import org.hibernate.eclipse.console.test.SimpleTestProject;
+import org.hibernate.eclipse.console.test.xpl.JavaProjectHelper;
+import org.hibernate.eclipse.console.utils.ProjectUtils;
+import org.hibernate.eclipse.jdt.ui.internal.HQLDetector;
+import org.hibernate.eclipse.jdt.ui.internal.HQLProblem;
+
+public class HibernateErrorsTest2 extends HibernateConsoleTest {
+
+ private SimpleTestProject project;
+
+ private ConsoleConfiguration ccfg;
+
+ public HibernateErrorsTest2(String name) {
+ super(name);
+ }
+
+ @Override
+ protected SimpleTestProject createTestProject() {
+ return new SimpleTestProject("hqlquerytest-" + System.currentTimeMillis()) {
// the currentTime Millis can be removed once the classloader stop hanging on to the jars.
see JBIDE-1012
+
+ @Override
+ protected void buildSimpleTestProject() throws JavaModelException,
+ CoreException, IOException {
+ super.buildSimpleTestProject();
+
+
+ //set up project #3: file system structure with project as source folder
+ //add an internal jar
+ File ejb3lib= HibernateJDTuiTestPlugin.getDefault().getFileInPlugin(new
Path("testresources/ejb3-persistence.jar")); //$NON-NLS-1$
+ assertTrue("ejb3 lib not found", ejb3lib != null &&
ejb3lib.exists()); //$NON-NLS-1$
+
+ JavaProjectHelper.addToClasspath(getIJavaProject(),
JavaRuntime.getDefaultJREContainerEntry());
+
+ IPackageFragmentRoot addLibraryWithImport =
JavaProjectHelper.addLibraryWithImport(getIJavaProject(),
Path.fromOSString(ejb3lib.getPath()), null, null);
+
+ assertEquals(3,getIJavaProject().getRawClasspath().length);
+
+ getIProject().getFolder("src/META-INF").create(true, true, new
NullProgressMonitor());
+ getIProject().getFile("src/META-INF/persistence.xml").create(
+ new ByteArrayInputStream(("<persistence>\n" +
+ " <persistence-unit name=\"manager1\"
transaction-type=\"RESOURCE_LOCAL\">\n" +
+ " <class>test.TestClass</class>\n" +
+ " <properties>\n" +
+ " <property name=\"hibernate.dialect\"
value=\"org.hibernate.dialect.HSQLDialect\"/>\n" +
+ " <property
name=\"hibernate.connection.driver_class\"
value=\"org.hsqldb.jdbcDriver\"/>\n" +
+ " <property
name=\"hibernate.connection.username\" value=\"sa\"/>\n" +
+ " <property
name=\"hibernate.connection.password\" value=\"\"/>\n" +
+ " <property
name=\"hibernate.connection.url\" value=\"jdbc:hsqldb:.\"/>\n"
+
+ " <property
name=\"hibernate.query.startup_check\" value=\"false\"/>\n"
+
+ " </properties>\n" +
+ " </persistence-unit>\n" +
+ "</persistence>").getBytes()),
+ false /* force */, new NullProgressMonitor());
+
+ getIProject().findMember("src/META-INF/persistence.xml");
+ getIProject().build(IncrementalProjectBuilder.FULL_BUILD, new
NullProgressMonitor());
+ }
+
+ @Override
+ protected IType buildType(IPackageFragment pack, String cuName)
+ throws JavaModelException {
+ ICompilationUnit cu = pack.createCompilationUnit(cuName,
+ "", false, null);
+
+ cu.createPackageDeclaration(pack.getElementName(),null);
+ IType type = cu.createType(
+ "(a)javax.persistence.NamedQuery(name=\"fromUnknown\",
query=\"from Unknown\")\n" +
+ "(a)javax.persistence.Entity\n" +
+ "public class " + TYPE_NAME + " {}",null,false,null);
+ type.createField("(a)javax.persistence.Id private int id;",null,false,null);
+ type.createField("private String testField;",null,false,null);
+ type.createMethod("public String getTestField() {return
this.testField;}",null,false,null);
+ type.createMethod("public void setTestField(String testField) {this.testField =
testField;}",null,false,null);
+ return type;
+ }
+ };
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+
+ this.project = createTestProject();
+ waitForJobs();
+
+ String prjName = getProject().getIProject().getName();
+
+ EclipseConsoleConfigurationPreferences preferences = new
EclipseConsoleConfigurationPreferences(prjName,
+ ConfigurationMode.JPA, prjName, true, null, null, null, new IPath[0], new IPath[0],
null, null, null, false);
+
+ ccfg = KnownConfigurations.getInstance().addConfiguration(new
EclipseConsoleConfiguration(preferences), false);
+
+ assertTrue(ProjectUtils.toggleHibernateOnProject(getProject().getIProject(), true,
prjName));
+
+ ccfg.build();
+ ccfg.buildSessionFactory();
+
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ ccfg.reset();
+ KnownConfigurations.getInstance().removeAllConfigurations();
+ //super.tearDown();
+ waitForJobs();
+
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+ .closeAllEditors( false);
+
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+ .setPerspective(
+ PlatformUI.getWorkbench().getPerspectiveRegistry()
+ .findPerspectiveWithId(
+ "org.eclipse.ui.resourcePerspective"));
+
+ waitForJobs();
+ // getProject().deleteIProject();
+
+ // super.tearDown();
+
+ IProject proj = getProject().getIProject();
+ String projRoot = proj.getLocation().toFile().getAbsolutePath();
+ File file = new File(projRoot);
+
+ getProject().getIProject().delete(false, true, null);
+ waitForJobs();
+ delete(file);
+ }
+ public void testDummy() throws JavaModelException {
+
+ }
+
+ private void delete(File path) {
+ if (path.exists()) {
+ File[] files = path.listFiles();
+ for (int i = 0; i < files.length; i++) {
+ if (files[i].isDirectory()) {
+ delete(files[i]);
+ } else {
+ deleteFile(files[i]);
+ }
+ }
+ }
+ deleteFile(path);
+
+ }
+
+ private void deleteFile(File file) {
+ try {
+ if (!file.delete())
+ throw new RuntimeException("Cannot remove the " + file.getAbsolutePath() +
" file. (" + Platform.getOS() + ")");
+ } catch (Throwable e) {
+ throw new RuntimeException("Cannot remove the " + file.getAbsolutePath() +
" file. (" + Platform.getOS() + ")",e);
+ }
+ }
+
+ protected SimpleTestProject getProject() {
+ return this.project;
+ }
+}