summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaren Butzke2013-01-10 16:13:14 (EST)
committerKaren Butzke2013-01-10 16:13:14 (EST)
commit1583e09bb0f6def90ef454c8eda036d4331d20aa (patch)
tree916c21402a123412355a361ab5638394ea1cf9c4
parentdfa236dcc4a38ae158b0b52e92a9a80aa77f581d (diff)
downloadwebtools.dali-1583e09bb0f6def90ef454c8eda036d4331d20aa.zip
webtools.dali-1583e09bb0f6def90ef454c8eda036d4331d20aa.tar.gz
webtools.dali-1583e09bb0f6def90ef454c8eda036d4331d20aa.tar.bz2
Bug 391360 - jdt refactoring extensions load the jpa.core plug-in even when there are no referencing JPA faceted projects
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/META-INF/MANIFEST.MF4
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/plugin.xml7
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/bundleexclude/FacetedReferencingProjectsPropertyTester.java54
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/bundleexclude/IndeterminateContentDescriber.java (renamed from common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/content/IndeterminateContentDescriber.java)4
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.xml2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/plugin.xml89
6 files changed, 129 insertions, 31 deletions
diff --git a/common/plugins/org.eclipse.jpt.common.core/META-INF/MANIFEST.MF b/common/plugins/org.eclipse.jpt.common.core/META-INF/MANIFEST.MF
index d93ade8..3fd92bf 100644
--- a/common/plugins/org.eclipse.jpt.common.core/META-INF/MANIFEST.MF
+++ b/common/plugins/org.eclipse.jpt.common.core/META-INF/MANIFEST.MF
@@ -5,7 +5,7 @@ Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.jpt.common.core;singleton:=true
Bundle-Version: 1.3.0.qualifier
Bundle-Activator: org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin
-Bundle-ActivationPolicy: lazy;exclude:="org.eclipse.jpt.common.core.internal.content"
+Bundle-ActivationPolicy: lazy;exclude:="org.eclipse.jpt.common.core.internal.bundleexclude"
Bundle-ClassPath: .
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
@@ -36,7 +36,7 @@ Dali-Comment: We friend 'internal.utility' to all non-EclipseLink, non-test bund
Export-Package: org.eclipse.jpt.common.core,
org.eclipse.jpt.common.core.gen,
org.eclipse.jpt.common.core.internal;x-friends:="org.eclipse.jpt.jaxb.core,org.eclipse.jpt.jpa.core",
- org.eclipse.jpt.common.core.internal.content;x-friends:="org.eclipse.jpt.jaxb.core,org.eclipse.jpt.jpa.core",
+ org.eclipse.jpt.common.core.internal.bundleexclude;x-friends:="org.eclipse.jpt.jaxb.core,org.eclipse.jpt.jpa.core",
org.eclipse.jpt.common.core.internal.gen;x-friends:="org.eclipse.jpt.jaxb.core,org.eclipse.jpt.jpa.core",
org.eclipse.jpt.common.core.internal.libprov;x-friends:="org.eclipse.jpt.jaxb.core,org.eclipse.jpt.jpa.core",
org.eclipse.jpt.common.core.internal.libval;x-friends:="org.eclipse.jpt.jaxb.core,org.eclipse.jpt.jpa.core",
diff --git a/common/plugins/org.eclipse.jpt.common.core/plugin.xml b/common/plugins/org.eclipse.jpt.common.core/plugin.xml
index 4293622..8983236 100644
--- a/common/plugins/org.eclipse.jpt.common.core/plugin.xml
+++ b/common/plugins/org.eclipse.jpt.common.core/plugin.xml
@@ -132,6 +132,13 @@
namespace="org.eclipse.jpt.common.core"
properties="resourceTypeIsKindOf"
class="org.eclipse.jpt.common.core.internal.JptResourceTypeReferencePropertyTester"/>
+
+ <propertyTester
+ id="org.eclipse.jpt.common.core.propertyTester.FacetedReferencingProjectsPropertyTester"
+ type="org.eclipse.core.resources.IResource"
+ namespace="org.eclipse.jpt.common.core"
+ properties="anyFacetedReferencingProjects"
+ class="org.eclipse.jpt.common.core.internal.bundleexclude.FacetedReferencingProjectsPropertyTester"/>
</extension>
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/bundleexclude/FacetedReferencingProjectsPropertyTester.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/bundleexclude/FacetedReferencingProjectsPropertyTester.java
new file mode 100644
index 0000000..c2c5cba
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/bundleexclude/FacetedReferencingProjectsPropertyTester.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Oracle. All rights reserved.
+ * This program and the accompanying materials are 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.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.common.core.internal.bundleexclude;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin;
+import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
+
+public final class FacetedReferencingProjectsPropertyTester
+ extends PropertyTester
+{
+ private static final String ANY_FACETED_REFERENCING_PROJECTS_PROPERTY = "anyFacetedReferencingProjects"; //$NON-NLS-1$
+
+ //partially copied from org.eclipse.wst.common.project.facet.core.internal.FacetedProjectPropertyTester
+ public boolean test(final Object receiver, final String property, final Object[] args, final Object value) {
+ if (property.equals(ANY_FACETED_REFERENCING_PROJECTS_PROPERTY)) {
+ final String val = (String) value;
+ final int colonIndex = val.indexOf(':');
+ final String facetId;
+ final String versionExpression;
+ if (colonIndex == -1 || colonIndex == val.length() - 1) {
+ facetId = val;
+ versionExpression = null;
+ }
+ else {
+ facetId = val.substring(0, colonIndex);
+ versionExpression = val.substring(colonIndex + 1);
+ }
+ if (receiver instanceof IResource) {
+ try {
+ for (IProject project : ((IResource) receiver).getProject().getReferencingProjects()) {
+ if (FacetedProjectFramework.hasProjectFacet(project, facetId, versionExpression)) {
+ return true;
+ }
+ }
+ }
+ catch (CoreException e) {
+ JptCommonCorePlugin.instance().logError(e);
+ }
+ }
+ }
+ return false;
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/content/IndeterminateContentDescriber.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/bundleexclude/IndeterminateContentDescriber.java
index 5d2dcc3..4cea472 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/content/IndeterminateContentDescriber.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/bundleexclude/IndeterminateContentDescriber.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2012 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2013 Oracle. All rights reserved.
* This program and the accompanying materials are 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.
@@ -7,7 +7,7 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.common.core.internal.content;
+package org.eclipse.jpt.common.core.internal.bundleexclude;
import java.io.InputStream;
import java.io.Reader;
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.xml b/jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.xml
index 4934c3d..c36c6eb 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.xml
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.xml
@@ -107,7 +107,7 @@
id="org.eclipse.jpt.jaxb.core.content.jaxbXmlContent"
name="%JAXB_XML_CONTENT"
base-type="org.eclipse.core.runtime.xml"
- describer="org.eclipse.jpt.common.core.internal.content.IndeterminateContentDescriber"/>
+ describer="org.eclipse.jpt.common.core.internal.bundleexclude.IndeterminateContentDescriber"/>
<!--
we don't use this file type internally, but we register it here to help
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/plugin.xml b/jpa/plugins/org.eclipse.jpt.jpa.core/plugin.xml
index 88ed228..666ed16 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/plugin.xml
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/plugin.xml
@@ -22,7 +22,7 @@
<!-- ***** expressions ***** -->
<extension point="org.eclipse.core.expressions.definitions">
- <!-- A test for determining whether something adapts to an IProject and has the JPA facet.
+ <!-- A test for determining whether an IProject has the JPA facet.
Force activation of the wst facet plug-in containing the property tester.
Possible usage:
<adapt type="org.eclipse.core.resources.IProject">
@@ -35,7 +35,21 @@
value="jpt.jpa"
forcePluginActivation="true"/>
</definition>
-
+ <!-- A test for determining whether an IResource has any referencing projects with the JPA facet.
+ Force activation of the org.eclipse.jpt.common.core plug-in containing the property tester.
+ Though in this case the property tester class is in a package that does not cause the plug-in to load.
+ So the class will be loaded, but the plug-in will not.
+ Possible usage:
+ <adapt type="org.eclipse.core.resources.IResource">
+ <reference definitionId="org.eclipse.jpt.jpa.reference.anyJpaFacetedReferencingProjects"/>
+ </adapt>
+ -->
+ <definition id="org.eclipse.jpt.jpa.reference.anyJpaFacetedReferencingProjects">
+ <test
+ property="org.eclipse.jpt.common.core.anyFacetedReferencingProjects"
+ value="jpt.jpa"
+ forcePluginActivation="true"/>
+ </definition>
</extension>
<!-- ***** adapters ***** -->
@@ -119,7 +133,7 @@
id="org.eclipse.jpt.jpa.core.content.jpaXmlContent"
name="%JPA_XML_CONTENT"
base-type="org.eclipse.core.runtime.xml"
- describer="org.eclipse.jpt.common.core.internal.content.IndeterminateContentDescriber">
+ describer="org.eclipse.jpt.common.core.internal.bundleexclude.IndeterminateContentDescriber">
</content-type>
<!-- persistence.xml -->
@@ -646,6 +660,9 @@
<enablement>
<with variable="element">
<instanceof value="org.eclipse.jdt.core.IType"/>
+ <adapt type="org.eclipse.core.resources.IResource">
+ <reference definitionId="org.eclipse.jpt.jpa.reference.anyJpaFacetedReferencingProjects"/>
+ </adapt>
</with>
</enablement>
</deleteParticipant>
@@ -660,6 +677,9 @@
<instanceof value="org.eclipse.jdt.core.IPackageFragment"/>
<instanceof value="org.eclipse.core.resources.IFolder"/>
</or>
+ <adapt type="org.eclipse.core.resources.IResource">
+ <reference definitionId="org.eclipse.jpt.jpa.reference.anyJpaFacetedReferencingProjects"/>
+ </adapt>
</with>
</enablement>
</deleteParticipant>
@@ -670,13 +690,14 @@
name="%JPA_DELETE_MAPPING_FILE_PARTICIPANT_NAME">
<enablement>
<with variable="element">
- <and>
- <instanceof value="org.eclipse.core.resources.IFile"/>
- <test
- args="kindOf"
- property="org.eclipse.core.resources.contentTypeId"
- value="org.eclipse.jpt.jpa.core.content.mappingFile"/>
- </and>
+ <instanceof value="org.eclipse.core.resources.IFile"/>
+ <test
+ args="kindOf"
+ property="org.eclipse.core.resources.contentTypeId"
+ value="org.eclipse.jpt.jpa.core.content.mappingFile"/>
+ <adapt type="org.eclipse.core.resources.IResource">
+ <reference definitionId="org.eclipse.jpt.jpa.reference.anyJpaFacetedReferencingProjects"/>
+ </adapt>
</with>
</enablement>
</deleteParticipant>
@@ -693,8 +714,10 @@
<enablement>
<with variable="element">
<instanceof value="org.eclipse.jdt.core.IType"/>
+ <adapt type="org.eclipse.core.resources.IResource">
+ <reference definitionId="org.eclipse.jpt.jpa.reference.anyJpaFacetedReferencingProjects"/>
+ </adapt>
</with>
-
</enablement>
</moveParticipant>
</extension>
@@ -710,7 +733,10 @@
<enablement>
<with variable="element">
<instanceof value="org.eclipse.jdt.core.IType"/>
- </with>
+ <adapt type="org.eclipse.core.resources.IResource">
+ <reference definitionId="org.eclipse.jpt.jpa.reference.anyJpaFacetedReferencingProjects"/>
+ </adapt>
+ </with>
</enablement>
</renameParticipant>
@@ -721,6 +747,9 @@
<enablement>
<with variable="element">
<instanceof value="org.eclipse.jdt.core.IPackageFragment"/>
+ <adapt type="org.eclipse.core.resources.IResource">
+ <reference definitionId="org.eclipse.jpt.jpa.reference.anyJpaFacetedReferencingProjects"/>
+ </adapt>
</with>
</enablement>
</renameParticipant>
@@ -732,6 +761,9 @@
<enablement>
<with variable="element">
<instanceof value="org.eclipse.core.resources.IFolder"/>
+ <adapt type="org.eclipse.core.resources.IResource">
+ <reference definitionId="org.eclipse.jpt.jpa.reference.anyJpaFacetedReferencingProjects"/>
+ </adapt>
</with>
</enablement>
</renameParticipant>
@@ -742,13 +774,14 @@
name="%JPA_RENAME_MAPPING_FILE_PARTICIPANT_NAME">
<enablement>
<with variable="element">
- <and>
- <instanceof value="org.eclipse.core.resources.IFile"/>
- <test
- args="kindOf"
- property="org.eclipse.core.resources.contentTypeId"
- value="org.eclipse.jpt.jpa.core.content.mappingFile"/>
- </and>
+ <instanceof value="org.eclipse.core.resources.IFile"/>
+ <test
+ args="kindOf"
+ property="org.eclipse.core.resources.contentTypeId"
+ value="org.eclipse.jpt.jpa.core.content.mappingFile"/>
+ <adapt type="org.eclipse.core.resources.IResource">
+ <reference definitionId="org.eclipse.jpt.jpa.reference.anyJpaFacetedReferencingProjects"/>
+ </adapt>
</with>
</enablement>
</renameParticipant>
@@ -764,13 +797,14 @@
name="%JPA_MOVE_MAPPING_FILE_PARTICIPANT_NAME">
<enablement>
<with variable="element">
- <and>
- <instanceof value="org.eclipse.core.resources.IFile"/>
- <test
- args="kindOf"
- property="org.eclipse.core.resources.contentTypeId"
- value="org.eclipse.jpt.jpa.core.content.mappingFile"/>
- </and>
+ <instanceof value="org.eclipse.core.resources.IFile"/>
+ <test
+ args="kindOf"
+ property="org.eclipse.core.resources.contentTypeId"
+ value="org.eclipse.jpt.jpa.core.content.mappingFile"/>
+ <adapt type="org.eclipse.core.resources.IResource">
+ <reference definitionId="org.eclipse.jpt.jpa.reference.anyJpaFacetedReferencingProjects"/>
+ </adapt>
</with>
</enablement>
</moveParticipant>
@@ -782,6 +816,9 @@
<enablement>
<with variable="element">
<instanceof value="org.eclipse.core.resources.IFolder"/>
+ <adapt type="org.eclipse.core.resources.IResource">
+ <reference definitionId="org.eclipse.jpt.jpa.reference.anyJpaFacetedReferencingProjects"/>
+ </adapt>
</with>
</enablement>
</moveParticipant>