[jbosstools-commits] JBoss Tools SVN: r23765 - in trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal: context and 1 other directory.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Wed Jul 28 04:36:04 EDT 2010
Author: dgeraskov
Date: 2010-07-28 04:36:03 -0400 (Wed, 28 Jul 2010)
New Revision: 23765
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaProject.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/Messages.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/Messages.properties
Log:
https://jira.jboss.org/browse/JBIDE-6727
Check that associated console configuration exists.
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaProject.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaProject.java 2010-07-28 08:18:12 UTC (rev 23764)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaProject.java 2010-07-28 08:36:03 UTC (rev 23765)
@@ -11,15 +11,21 @@
package org.jboss.tools.hibernate.jpt.core.internal;
+import java.util.List;
+
import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.jpt.core.JpaProject;
import org.eclipse.jpt.core.internal.AbstractJpaProject;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.NamingStrategy;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.KnownConfigurations;
import org.hibernate.eclipse.console.properties.HibernatePropertiesConstants;
+import org.jboss.tools.hibernate.jpt.core.internal.context.HibernatePersistenceUnit.LocalMessage;
+import org.jboss.tools.hibernate.jpt.core.internal.context.Messages;
import org.osgi.service.prefs.Preferences;
/**
@@ -71,5 +77,22 @@
}
return cachedNamingStrategyEnable;
}
+
+ @Override
+ protected void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+ this.validateConsoleConfiguration(messages);
+ }
+ /**
+ * @param messages
+ */
+ protected void validateConsoleConfiguration(List<IMessage> messages) {
+ if (KnownConfigurations.getInstance().find(getDefaultConsoleConfigurationName()) == null){
+ IMessage message = new LocalMessage(IMessage.HIGH_SEVERITY,
+ Messages.CC_NOT_EXISTS, new String[]{getDefaultConsoleConfigurationName()}, getResource());
+ messages.add(message);
+ }
+ }
+
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/Messages.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/Messages.java 2010-07-28 08:18:12 UTC (rev 23764)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/Messages.java 2010-07-28 08:36:03 UTC (rev 23765)
@@ -29,5 +29,7 @@
String NAMING_STRATEGY_EXCEPTION = "NAMING_STRATEGY_EXCEPTION"; //$NON-NLS-1$
String UNRESOLVED_FOREIGN_KEY_NAME = "UNRESOLVED_FOREIGN_KEY_NAME"; //$NON-NLS-1$
+
+ String CC_NOT_EXISTS = "CC_NOT_EXISTS"; //$NON-NLS-1$
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/Messages.properties
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/Messages.properties 2010-07-28 08:18:12 UTC (rev 23764)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/Messages.properties 2010-07-28 08:36:03 UTC (rev 23765)
@@ -4,4 +4,5 @@
STRATEGY_CANT_BE_EMPTY = Strategy could not be empty.
STRATEGY_INTERFACE = Strategy class \"{0}\" should implement interface \"org.hibernate.id.IdentifierGenerator\".
NAMING_STRATEGY_EXCEPTION = Exception occurred when calling NamingStrategy:
-UNRESOLVED_FOREIGN_KEY_NAME = Foreign key \"{0}\" not found in the table \"{1}\".
\ No newline at end of file
+UNRESOLVED_FOREIGN_KEY_NAME = Foreign key \"{0}\" not found in the table \"{1}\".
+CC_NOT_EXISTS= Console configuration \"{0}\" does not exist.
\ No newline at end of file
More information about the jbosstools-commits
mailing list