Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpfullbright2007-08-21 22:29:26 +0000
committerpfullbright2007-08-21 22:29:26 +0000
commit6a6041af5b713af17247005c86759a353d1a4739 (patch)
tree7e4230f189c596661cee09641ad7dd0d0cc8b116 /jpa/plugins/org.eclipse.jpt.core
parent01072c04e409a78ccc353b6af9740613ac55a19f (diff)
downloadwebtools.dali-6a6041af5b713af17247005c86759a353d1a4739.tar.gz
webtools.dali-6a6041af5b713af17247005c86759a353d1a4739.tar.xz
webtools.dali-6a6041af5b713af17247005c86759a353d1a4739.zip
bug 192675
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.core')
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/property_files/jpa_core.properties1
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaProject.java19
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JptCoreMessages.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidator.java23
4 files changed, 38 insertions, 7 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/property_files/jpa_core.properties b/jpa/plugins/org.eclipse.jpt.core/property_files/jpa_core.properties
index f1e4174b06..8e0a958a77 100644
--- a/jpa/plugins/org.eclipse.jpt.core/property_files/jpa_core.properties
+++ b/jpa/plugins/org.eclipse.jpt.core/property_files/jpa_core.properties
@@ -18,4 +18,5 @@ VALIDATE_LIBRARY_NOT_SPECIFIED=No JPA implementation library specified
SYNCHRONIZE_CLASSES_JOB=Synchronizing classes
SYNCHRONIZING_CLASSES_TASK=Synchronizing classes ...
INVALID_PERSISTENCE_XML_CONTENT=Invalid persistence.xml content
+ERROR_SYNCHRONIZING_CLASSES_COULD_NOT_VALIDATE=Error synchronizing classes. Could not validate.
ERROR_WRITING_FILE=Could not write to persistence.xml \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaProject.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaProject.java
index 8a14e5c8b0..fe8dc77734 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaProject.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaProject.java
@@ -142,7 +142,7 @@ public class JpaProject extends JpaEObject implements IJpaProject
* This is set to false when that job is completed
*/
boolean resynching = false;
-
+
/**
* Flag to indicate that the disposing job has been scheduled or is running
* (or has been run, in some cases)
@@ -515,6 +515,10 @@ public class JpaProject extends JpaEObject implements IJpaProject
resynch();
filled = true;
}
+
+ public boolean isFilled() {
+ return filled;
+ }
/**
* @see IJpaProject#getJpaFile(IFile)
@@ -577,9 +581,10 @@ public class JpaProject extends JpaEObject implements IJpaProject
* Dispose and remove project
*/
void dispose() {
- if (disposing)
- return;
+ if (disposing) return;
+
disposing = true;
+
Job job = new Job("Disposing JPA project ...") {
@Override
protected IStatus run(IProgressMonitor monitor) {
@@ -590,7 +595,7 @@ public class JpaProject extends JpaEObject implements IJpaProject
job.setRule(project);
job.schedule();
}
-
+
private void dispose_() {
Job.getJobManager().removeJobChangeListener(resynchJobListener);
for (IJpaFile jpaFile : new ArrayList<IJpaFile>(getFiles())) {
@@ -677,9 +682,9 @@ public class JpaProject extends JpaEObject implements IJpaProject
//passing it on to the JpaModel. We don't currently support
//multiple projects having cross-references
public void resynch() {
- if (disposing)
- return;
- if (!resynching) {
+ if (disposing) return;
+
+ if (! resynching) {
this.resynching = true;
this.needsToResynch = false;
this.resynchJob.schedule();
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JptCoreMessages.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JptCoreMessages.java
index fa75d97b34..8121ca9847 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JptCoreMessages.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JptCoreMessages.java
@@ -38,6 +38,8 @@ public class JptCoreMessages extends NLS
public static String INVALID_PERSISTENCE_XML_CONTENT;
+ public static String ERROR_SYNCHRONIZING_CLASSES_COULD_NOT_VALIDATE;
+
public static String ERROR_WRITING_FILE;
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidator.java
index 4f5b65a735..c079b69955 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidator.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidator.java
@@ -10,11 +10,18 @@
package org.eclipse.jpt.core.internal.validation;
import java.util.Iterator;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.jpt.core.internal.IJpaProject;
+import org.eclipse.jpt.core.internal.JpaModelManager;
+import org.eclipse.jpt.core.internal.JpaProject;
+import org.eclipse.jpt.core.internal.JptCoreMessages;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
import org.eclipse.wst.validation.internal.core.Message;
import org.eclipse.wst.validation.internal.core.ValidationException;
+import org.eclipse.wst.validation.internal.core.ValidatorLauncher;
import org.eclipse.wst.validation.internal.operations.IWorkbenchContext;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
@@ -34,6 +41,22 @@ public class JpaValidator implements IValidatorJob
JpaHelper jpaHelper = (JpaHelper) helper;
IJpaProject jpaProject = jpaHelper.getJpaProject();
+ if (! ((JpaProject) jpaProject).isFilled()) {
+ try {
+ JpaModelManager.instance().fillJpaProject(jpaProject.getProject());
+ }
+ catch (CoreException ce) {
+ return new Status(Status.ERROR, JptCorePlugin.PLUGIN_ID, JptCoreMessages.ERROR_SYNCHRONIZING_CLASSES_COULD_NOT_VALIDATE, ce);
+ }
+
+ JpaHelper newJpaHelper = new JpaHelper();
+ newJpaHelper.setProject(jpaHelper.getProject());
+ newJpaHelper.setValidationFileURIs(jpaHelper.getValidationFileURIs());
+ ValidatorLauncher.getLauncher().start(newJpaHelper, this, reporter);
+
+ return OK_STATUS;
+ }
+
reporter.removeAllMessages(this);
for (Iterator stream = jpaProject.validationMessages(); stream.hasNext(); ) {

Back to the top