Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpfullbright2010-07-23 14:44:09 -0400
committerpfullbright2010-07-23 14:44:09 -0400
commit8d006966485a72109ad2c2a5267885e748fe2fd6 (patch)
tree14654f9d8d15cebf9f9311add60ffc33469a7148
parent6da58ba828920dcf7995654aa7e115c9a910f3d0 (diff)
downloadwebtools.dali-R2_3_1.tar.gz
webtools.dali-R2_3_1.tar.xz
webtools.dali-R2_3_1.zip
backing out patch for 309030R2_3_1
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/META-INF/MANIFEST.MF1
-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/AbstractJpaProject.java76
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JptCoreMessages.java1
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/AbstractJpaFileCreationDataModelProvider.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/orm/MappingFileWizardPage.java5
6 files changed, 38 insertions, 81 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.core/META-INF/MANIFEST.MF
index 5680244f70..0f45878634 100644
--- a/jpa/plugins/org.eclipse.jpt.core/META-INF/MANIFEST.MF
+++ b/jpa/plugins/org.eclipse.jpt.core/META-INF/MANIFEST.MF
@@ -22,7 +22,6 @@ Require-Bundle: org.eclipse.core.commands;bundle-version="[3.4.0,4.0.0)",
org.eclipse.jst.common.project.facet.core;bundle-version="[1.3.100,2.0.0)",
org.eclipse.jst.j2ee;bundle-version="[1.1.200,1.2.0)",
org.eclipse.jst.j2ee.core;bundle-version="[1.1.200,1.3.0)",
- org.eclipse.pde.core;bundle-version="[3.6.0,4.0.0)";resolution:=optional,
org.eclipse.wst.common.emf;bundle-version="[1.1.200,2.0.0)",
org.eclipse.wst.common.emfworkbench.integration;bundle-version="[1.1.200,2.0.0)",
org.eclipse.wst.common.frameworks;bundle-version="[1.1.200,1.3.0)",
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 923fca3bfa..9eeede567a 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
@@ -15,6 +15,7 @@ VALIDATE_SOURCE_FOLDER_NOT_SPECIFIED=Source folder must be specified
VALIDATE_SOURCE_FOLDER_ILLEGAL=Source folder path is illegal
VALIDATE_SOURCE_FOLDER_DOES_NOT_EXIST=Source folder ''{0}'' does not exist
VALIDATE_SOURCE_FOLDER_NOT_IN_PROJECT=Source folder ''{0}'' is not in project ''{1}''
+VALIDATE_SOURCE_FOLDER_NOT_SOURCE_FOLDER=Source folder ''{0}'' is not an actual source folder
VALIDATE_FILE_PATH_NOT_SPECIFIED=File path must be specified
VALIDATE_FILE_ALREADY_EXISTS=File already exists at this location
VALIDATE_FILE_VERSION_NOT_SUPPORTED=File version not supported
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaProject.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaProject.java
index c298021783..e33e50703a 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaProject.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaProject.java
@@ -24,7 +24,6 @@ import org.eclipse.core.resources.IResourceDeltaVisitor;
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.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -79,13 +78,9 @@ import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
import org.eclipse.jpt.utility.internal.iterables.SubIterableWrapper;
import org.eclipse.jpt.utility.internal.iterables.TransformationIterable;
import org.eclipse.jst.j2ee.model.internal.validation.ValidationCancelledException;
-import org.eclipse.pde.core.project.IBundleProjectDescription;
-import org.eclipse.pde.core.project.IBundleProjectService;
import org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
/**
* JPA project. Holds all the JPA stuff.
@@ -194,8 +189,8 @@ public abstract class AbstractJpaProject
* generated.
*/
protected String metamodelSourceFolderName;
-
-
+
+
// ********** constructor/initialization **********
protected AbstractJpaProject(JpaProject.Config config) {
@@ -520,8 +515,8 @@ public abstract class AbstractJpaProject
* Return the new JPA file, null if it was not created.
*/
protected JpaFile addJpaFile_(IFile file) {
- if (! getJavaProject().isOnClasspath(file) && ! isInBundleRoot(file)) {
- return null; // the file must be on the Java classpath or in the bundle root
+ if ( ! this.getJavaProject().isOnClasspath(file)) {
+ return null; // the file must be on the Java classpath
}
JpaFile jpaFile = null;
@@ -540,64 +535,7 @@ public abstract class AbstractJpaProject
this.jpaFiles.add(jpaFile);
return jpaFile;
}
-
- /**
- * Returns <code>true</code> if the given resource is within the PDE bundle root folder,
- * and <code>false</code> otherwise.
- *
- * @param resource a resource
- * @return <code>true</code> if the given resource is within the bundle root, and
- * <code>false</code> otherwise
- */
- private boolean isInBundleRoot(IResource resource) {
- IFolder folder = getBundleRoot(project);
- if (folder != null) {
- return folder.getFullPath().isPrefixOf(resource.getFullPath());
- }
- return false;
- }
-
- /**
- * Returns <code>true</code> if the given resource is within the PDE bundle root folder,
- * and <code>false</code> otherwise.
- *
- * @param resource a resource
- * @return <code>true</code> if the given resource is within the bundle root, and
- * <code>false</code> otherwise
- */
- public static IFolder getBundleRoot(IProject project) {
- try {
- if (project.hasNature("org.eclipse.pde.PluginNature")) {
- IBundleProjectService service = getBundleProjectService();
- if (service != null) {
- IBundleProjectDescription description = service.getDescription(project);
- if (description != null) {
- IPath path = description.getBundleRoot();
- if (path != null) {
- return project.getFolder(path);
- }
- }
- }
- }
- }
- catch (CoreException ce) {
- // ignore, PDE bundle root not set
- }
- return null;
- }
-
- private static IBundleProjectService getBundleProjectService() {
- BundleContext context = JptCorePlugin.instance().getBundle().getBundleContext();
- ServiceReference reference = context.getServiceReference(IBundleProjectService.class.getName());
- if (reference == null)
- return null;
- IBundleProjectService service = (IBundleProjectService) context.getService(reference);
- if (service != null)
- context.ungetService(reference);
-
- return service;
- }
-
+
/**
* Remove the JPA file corresponding to the specified IFile, if it exists.
* Return true if a JPA File was removed, false otherwise
@@ -1268,7 +1206,7 @@ public abstract class AbstractJpaProject
*/
protected boolean jpaFileIsAlive(JpaFile jpaFile) {
IFile file = jpaFile.getFile();
- return (this.getJavaProject().isOnClasspath(file) || isInBundleRoot(file)) &&
+ return this.getJavaProject().isOnClasspath(file) &&
file.exists();
}
@@ -1525,7 +1463,7 @@ public abstract class AbstractJpaProject
}
protected void externalProjectChanged(IResourceDelta delta) {
- if (this.getJavaProject().isOnClasspath(delta.getResource()) || isInBundleRoot(delta.getResource())) {
+ if (this.getJavaProject().isOnClasspath(delta.getResource())) {
ResourceDeltaVisitor resourceDeltaVisitor = this.buildExternalResourceDeltaVisitor();
resourceDeltaVisitor.visitDelta(delta);
// force an "update" here since adding and/or removing an external Java type
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 3f2de58caf..ec15ff5a9c 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
@@ -23,6 +23,7 @@ public class JptCoreMessages {
public static String VALIDATE_SOURCE_FOLDER_ILLEGAL;
public static String VALIDATE_SOURCE_FOLDER_DOES_NOT_EXIST;
public static String VALIDATE_SOURCE_FOLDER_NOT_IN_PROJECT;
+ public static String VALIDATE_SOURCE_FOLDER_NOT_SOURCE_FOLDER;
public static String VALIDATE_FILE_PATH_NOT_SPECIFIED;
public static String VALIDATE_FILE_ALREADY_EXISTS;
public static String VALIDATE_FILE_VERSION_NOT_SUPPORTED;
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/AbstractJpaFileCreationDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/AbstractJpaFileCreationDataModelProvider.java
index dada8fad7a..3600851036 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/AbstractJpaFileCreationDataModelProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/AbstractJpaFileCreationDataModelProvider.java
@@ -18,11 +18,12 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
import org.eclipse.jpt.core.JpaProject;
import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.internal.AbstractJpaProject;
import org.eclipse.jpt.core.internal.JptCoreMessages;
import org.eclipse.jpt.utility.Filter;
import org.eclipse.jpt.utility.internal.ArrayTools;
@@ -168,6 +169,11 @@ public abstract class AbstractJpaFileCreationDataModelProvider
IStatus.ERROR, JptCorePlugin.PLUGIN_ID,
NLS.bind(JptCoreMessages.VALIDATE_SOURCE_FOLDER_DOES_NOT_EXIST, sourceFolderPath));
}
+ if (getVerifiedJavaSourceFolder() == null) {
+ return new Status(
+ IStatus.ERROR, JptCorePlugin.PLUGIN_ID,
+ NLS.bind(JptCoreMessages.VALIDATE_SOURCE_FOLDER_NOT_SOURCE_FOLDER, sourceFolderPath));
+ }
String filePath = getStringProperty(FILE_PATH);
if (StringTools.stringIsEmpty(filePath)) {
return new Status(
@@ -229,17 +235,14 @@ public abstract class AbstractJpaFileCreationDataModelProvider
}
/**
- * Return a best guess source folder for the specified project
+ * Return a best guess java source folder for the specified project
*/
+ // Copied from NewJavaClassDataModelProvider
protected IFolder getDefaultSourceFolder() {
IProject project = getProject();
if (project == null) {
return null;
}
- IFolder folder = AbstractJpaProject.getBundleRoot(project);
- if (folder != null) {
- return folder;
- }
IPackageFragmentRoot[] sources = J2EEProjectUtilities.getSourceContainers(project);
// Try and return the first source folder
if (sources.length > 0) {
@@ -310,6 +313,26 @@ public abstract class AbstractJpaFileCreationDataModelProvider
return folder;
}
+ /**
+ * Return the source folder, provided it is verified to be an actual java
+ * source folder
+ */
+ protected IFolder getVerifiedJavaSourceFolder() {
+ IFolder folder = getVerifiedSourceFolder();
+ if (folder == null) {
+ return null;
+ }
+ IJavaProject jProject = JavaCore.create(getProject());
+ if (jProject == null) {
+ return null;
+ }
+ IPackageFragmentRoot packageFragmentRoot = jProject.getPackageFragmentRoot(folder);
+ if (packageFragmentRoot == null || ! packageFragmentRoot.exists()) {
+ return null;
+ }
+ return folder;
+ }
+
protected IFile getExistingFile() {
IFolder folder = getVerifiedSourceFolder();
if (folder == null) {
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/orm/MappingFileWizardPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/orm/MappingFileWizardPage.java
index 090223a148..7ad77b4cd3 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/orm/MappingFileWizardPage.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/orm/MappingFileWizardPage.java
@@ -26,7 +26,6 @@ import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.window.Window;
-import org.eclipse.jpt.core.internal.AbstractJpaProject;
import org.eclipse.jpt.core.internal.operations.OrmFileCreationDataModelProperties;
import org.eclipse.jpt.core.internal.utility.jdt.JDTTools;
import org.eclipse.jpt.ui.JptUiPlugin;
@@ -272,10 +271,6 @@ public class MappingFileWizardPage extends DataModelWizardPage
if (JDTTools.packageFragmentRootIsSourceFolder(javaProject.getPackageFragmentRoot(folder))) {
return true;
}
- // add bundle root, if it exists
- if (element.equals(AbstractJpaProject.getBundleRoot(project))) {
- return true;
- }
}
return false;
}

Back to the top